diff options
| author | Stenzek <stenzek@gmail.com> | 2016-12-11 21:54:21 +1000 |
|---|---|---|
| committer | Stenzek <stenzek@gmail.com> | 2016-12-19 20:17:44 +1000 |
| commit | 344f2e57f608f6a4621514bddd5c1fff7d8e3764 (patch) | |
| tree | 66b4c91415ce080fc803f244b29e6bc29a75e6f4 /Source/Core/VideoCommon/TextureDecoder_Generic.cpp | |
| parent | 989cdc09293130eaf6e99296c870b2edc4035f19 (diff) | |
VideoCommon: Use avg(color1, color2) for color3 in CMPR textures
Diffstat (limited to 'Source/Core/VideoCommon/TextureDecoder_Generic.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/TextureDecoder_Generic.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Source/Core/VideoCommon/TextureDecoder_Generic.cpp b/Source/Core/VideoCommon/TextureDecoder_Generic.cpp index fe0f53c845..bb48d1aca8 100644 --- a/Source/Core/VideoCommon/TextureDecoder_Generic.cpp +++ b/Source/Core/VideoCommon/TextureDecoder_Generic.cpp @@ -169,6 +169,7 @@ static void DecodeDXTBlock(u32* dst, const DXTBlock* src, int pitch) colors[1] = MakeRGBA(red2, green2, blue2, 255); if (c1 > c2) { + // Approximation of x/3: 3/8 (1/2 - 1/8) int blue3 = ((blue2 - blue1) >> 1) - ((blue2 - blue1) >> 3); int green3 = ((green2 - green1) >> 1) - ((green2 - green1) >> 3); int red3 = ((red2 - red1) >> 1) - ((red2 - red1) >> 3); @@ -177,9 +178,12 @@ static void DecodeDXTBlock(u32* dst, const DXTBlock* src, int pitch) } else { - colors[2] = MakeRGBA((red1 + red2 + 1) / 2, // Average - (green1 + green2 + 1) / 2, (blue1 + blue2 + 1) / 2, 255); - colors[3] = MakeRGBA(red2, green2, blue2, 0); // Color2 but transparent + // color[3] is the same as color[2] (average of both colors), but transparent. + // This differs from DXT1 where color[3] is transparent black. + colors[2] = + MakeRGBA((red1 + red2 + 1) / 2, (green1 + green2 + 1) / 2, (blue1 + blue2 + 1) / 2, 255); + colors[3] = + MakeRGBA((red1 + red2 + 1) / 2, (green1 + green2 + 1) / 2, (blue1 + blue2 + 1) / 2, 0); } for (int y = 0; y < 4; y++) |
