summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-07-18 05:12:16 +0200
committerLioncash <mathew1800@gmail.com>2018-07-18 05:58:14 +0200
commitc5803e30d35f9ca5a4c08dc51ee15885a7814b74 (patch)
tree60d5459bc7ab07342c87048c374f73959795d0b0 /src/video_core
parentastc: Delete Bits' copy contstructor and assignment operator (diff)
downloadyuzu-c5803e30d35f9ca5a4c08dc51ee15885a7814b74.tar
yuzu-c5803e30d35f9ca5a4c08dc51ee15885a7814b74.tar.gz
yuzu-c5803e30d35f9ca5a4c08dc51ee15885a7814b74.tar.bz2
yuzu-c5803e30d35f9ca5a4c08dc51ee15885a7814b74.tar.lz
yuzu-c5803e30d35f9ca5a4c08dc51ee15885a7814b74.tar.xz
yuzu-c5803e30d35f9ca5a4c08dc51ee15885a7814b74.tar.zst
yuzu-c5803e30d35f9ca5a4c08dc51ee15885a7814b74.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/textures/astc.cpp27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/video_core/textures/astc.cpp b/src/video_core/textures/astc.cpp
index bafd137d5..1f2eca787 100644
--- a/src/video_core/textures/astc.cpp
+++ b/src/video_core/textures/astc.cpp
@@ -106,16 +106,16 @@ private:
template <typename IntType>
class Bits {
public:
- explicit Bits(IntType& v) : m_Bits(v) {}
+ explicit Bits(const IntType& v) : m_Bits(v) {}
Bits(const Bits&) = delete;
Bits& operator=(const Bits&) = delete;
- uint8_t operator[](uint32_t bitPos) {
+ uint8_t operator[](uint32_t bitPos) const {
return static_cast<uint8_t>((m_Bits >> bitPos) & 1);
}
- IntType operator()(uint32_t start, uint32_t end) {
+ IntType operator()(uint32_t start, uint32_t end) const {
if (start == end) {
return (*this)[start];
} else if (start > end) {
@@ -183,12 +183,12 @@ public:
m_QuintValue = val;
}
- bool MatchesEncoding(const IntegerEncodedValue& other) {
+ bool MatchesEncoding(const IntegerEncodedValue& other) const {
return m_Encoding == other.m_Encoding && m_NumBits == other.m_NumBits;
}
// Returns the number of bits required to encode nVals values.
- uint32_t GetBitLength(uint32_t nVals) {
+ uint32_t GetBitLength(uint32_t nVals) const {
uint32_t totalBits = m_NumBits * nVals;
if (m_Encoding == eIntegerEncoding_Trit) {
totalBits += (nVals * 8 + 4) / 5;
@@ -387,7 +387,7 @@ struct TexelWeightParams {
bool m_bVoidExtentLDR = false;
bool m_bVoidExtentHDR = false;
- uint32_t GetPackedBitSize() {
+ uint32_t GetPackedBitSize() const {
// How many indices do we have?
uint32_t nIdxs = m_Height * m_Width;
if (m_bDualPlane) {
@@ -788,8 +788,8 @@ public:
}
};
-void DecodeColorValues(uint32_t* out, uint8_t* data, uint32_t* modes, const uint32_t nPartitions,
- const uint32_t nBitsForColorData) {
+void DecodeColorValues(uint32_t* out, uint8_t* data, const uint32_t* modes,
+ const uint32_t nPartitions, const uint32_t nBitsForColorData) {
// First figure out how many color values we have
uint32_t nValues = 0;
for (uint32_t i = 0; i < nPartitions; i++) {
@@ -825,8 +825,7 @@ void DecodeColorValues(uint32_t* out, uint8_t* data, uint32_t* modes, const uint
// Once we have the decoded values, we need to dequantize them to the 0-255 range
// This procedure is outlined in ASTC spec C.2.13
uint32_t outIdx = 0;
- std::vector<IntegerEncodedValue>::const_iterator itr;
- for (itr = decodedColorValues.begin(); itr != decodedColorValues.end(); itr++) {
+ for (auto itr = decodedColorValues.begin(); itr != decodedColorValues.end(); ++itr) {
// Have we already decoded all that we need?
if (outIdx >= nValues) {
break;
@@ -1048,17 +1047,17 @@ uint32_t UnquantizeTexelWeight(const IntegerEncodedValue& val) {
return result;
}
-void UnquantizeTexelWeights(uint32_t out[2][144], std::vector<IntegerEncodedValue>& weights,
+void UnquantizeTexelWeights(uint32_t out[2][144], const std::vector<IntegerEncodedValue>& weights,
const TexelWeightParams& params, const uint32_t blockWidth,
const uint32_t blockHeight) {
uint32_t weightIdx = 0;
uint32_t unquantized[2][144];
- std::vector<IntegerEncodedValue>::const_iterator itr;
- for (itr = weights.begin(); itr != weights.end(); itr++) {
+
+ for (auto itr = weights.begin(); itr != weights.end(); ++itr) {
unquantized[0][weightIdx] = UnquantizeTexelWeight(*itr);
if (params.m_bDualPlane) {
- itr++;
+ ++itr;
unquantized[1][weightIdx] = UnquantizeTexelWeight(*itr);
if (itr == weights.end()) {
break;