mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-05-12 16:25:46 +00:00
@@ -480,6 +480,7 @@ namespace Ryujinx.Graphics.Texture.Astc
|
||||
{
|
||||
Debug.Assert(colorEndpointMode[i] < 16);
|
||||
}
|
||||
|
||||
Debug.Assert(bitStream.BitsLeft == texelParams.GetPackedBitSize());
|
||||
|
||||
// Decode both color data and texel weight data
|
||||
@@ -1032,7 +1033,6 @@ namespace Ryujinx.Graphics.Texture.Astc
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case 1:
|
||||
{
|
||||
Span<uint> val = ReadUintColorValues(2, colorValues, ref colorValuesPosition);
|
||||
@@ -1295,7 +1295,6 @@ namespace Ryujinx.Graphics.Texture.Astc
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case 4:
|
||||
{
|
||||
c = 22;
|
||||
@@ -1389,6 +1388,7 @@ namespace Ryujinx.Graphics.Texture.Astc
|
||||
default:
|
||||
throw new AstcDecoderException("Unsupported quint encoding for color values.");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1574,7 +1574,7 @@ namespace Ryujinx.Graphics.Texture.Astc
|
||||
r |= (modeBits & 0xC) >> 1;
|
||||
}
|
||||
|
||||
Debug.Assert(2 <= r && r <= 7);
|
||||
Debug.Assert(r is >= 2 and <= 7);
|
||||
|
||||
// Determine width & height
|
||||
switch (layout)
|
||||
|
||||
@@ -52,6 +52,7 @@ namespace Ryujinx.Graphics.Texture.Astc
|
||||
comp = numberBits - newShift;
|
||||
numberBits = newShift;
|
||||
}
|
||||
|
||||
retValue <<= numberBits;
|
||||
retValue |= tempValue >> comp;
|
||||
resLength += numberBits;
|
||||
|
||||
@@ -52,6 +52,7 @@ namespace Ryujinx.Graphics.Texture.Astc
|
||||
{
|
||||
totalBits += (numberVals * 7 + 2) / 3;
|
||||
}
|
||||
|
||||
return totalBits;
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace Ryujinx.Graphics.Texture.Encoders
|
||||
|
||||
int selectedPartition = 0;
|
||||
|
||||
if (selectedMode == 1 || selectedMode == 7)
|
||||
if (selectedMode is 1 or 7)
|
||||
{
|
||||
int partitionSelectionLowestError = int.MaxValue;
|
||||
|
||||
@@ -180,7 +180,7 @@ namespace Ryujinx.Graphics.Texture.Encoders
|
||||
|
||||
for (int m = 0; m < 8; m++)
|
||||
{
|
||||
for (int r = 0; r < (m == 4 || m == 5 ? 4 : 1); r++)
|
||||
for (int r = 0; r < (m is 4 or 5 ? 4 : 1); r++)
|
||||
{
|
||||
for (int im = 0; im < (m == 4 ? 2 : 1); im++)
|
||||
{
|
||||
|
||||
@@ -79,6 +79,7 @@ namespace Ryujinx.Graphics.Texture
|
||||
outPtr += outStrideGap;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -229,8 +230,10 @@ namespace Ryujinx.Graphics.Texture
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
outOffs += stride * h * d * layers;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -245,6 +248,7 @@ namespace Ryujinx.Graphics.Texture
|
||||
_ => throw new NotSupportedException($"Unable to convert ${bytesPerPixel} bpp pixel format."),
|
||||
};
|
||||
}
|
||||
|
||||
return outputOwner;
|
||||
}
|
||||
|
||||
@@ -350,6 +354,7 @@ namespace Ryujinx.Graphics.Texture
|
||||
inPtr += inStrideGap;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -493,8 +498,10 @@ namespace Ryujinx.Graphics.Texture
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inOffs += stride * h * d * layers;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -115,7 +115,6 @@ namespace Ryujinx.Graphics.Texture
|
||||
_stride == other._stride &&
|
||||
_bytesPerPixel == other._bytesPerPixel;
|
||||
|
||||
|
||||
return !other._isLinear && _layoutConverter.LayoutMatches(other._layoutConverter);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1172,7 +1172,7 @@ namespace Ryujinx.Graphics.Texture.Utils
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static RgbaColor32 Interpolate(RgbaColor32 color1, RgbaColor32 color2, int weightIndex, int indexBitCount)
|
||||
{
|
||||
Debug.Assert(indexBitCount >= 2 && indexBitCount <= 4);
|
||||
Debug.Assert(indexBitCount is >= 2 and <= 4);
|
||||
|
||||
int weight = (((weightIndex << 7) / ((1 << indexBitCount) - 1)) + 1) >> 1;
|
||||
|
||||
@@ -1191,8 +1191,8 @@ namespace Ryujinx.Graphics.Texture.Utils
|
||||
int colorIndexBitCount,
|
||||
int alphaIndexBitCount)
|
||||
{
|
||||
Debug.Assert(colorIndexBitCount >= 2 && colorIndexBitCount <= 4);
|
||||
Debug.Assert(alphaIndexBitCount >= 2 && alphaIndexBitCount <= 4);
|
||||
Debug.Assert(colorIndexBitCount is >= 2 and <= 4);
|
||||
Debug.Assert(alphaIndexBitCount is >= 2 and <= 4);
|
||||
|
||||
int colorWeight = BC67Tables.Weights[colorIndexBitCount - 2][colorWeightIndex];
|
||||
int alphaWeight = BC67Tables.Weights[alphaIndexBitCount - 2][alphaWeightIndex];
|
||||
|
||||
Reference in New Issue
Block a user