diff options
| author | Tillmann Karras <tilkax@gmail.com> | 2025-02-11 17:32:25 +0000 |
|---|---|---|
| committer | Tillmann Karras <tilkax@gmail.com> | 2025-02-11 19:23:37 +0000 |
| commit | 5db6bd6054c6d535142102a3f54d8fa239f33b1c (patch) | |
| tree | 1e7b1158ff62ac71545b15c2bca107f923ea6d1b /Source/Core/VideoCommon/PixelShaderGen.cpp | |
| parent | c770e7c2766155799095d1a1df19f898a2db7bc5 (diff) | |
VideoCommon: simplify dither calculation
This saves three instructions on AMD GPUs. Dunno about Nvidia.
Diffstat (limited to 'Source/Core/VideoCommon/PixelShaderGen.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/PixelShaderGen.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp index a76681634f..0b027b2496 100644 --- a/Source/Core/VideoCommon/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/PixelShaderGen.cpp @@ -1308,9 +1308,9 @@ ShaderCode GeneratePixelShaderCode(APIType api_type, const ShaderHostConfig& hos if (uid_data->dither) { // Flipper uses a standard 2x2 Bayer Matrix for 6 bit dithering - // Here the matrix is encoded into the two factor constants out.Write("\tint2 dither = int2(rawpos.xy) & 1;\n"); - out.Write("\tprev.rgb = (prev.rgb - (prev.rgb >> 6)) + abs(dither.y * 3 - dither.x * 2);\n"); + out.Write( + "\tprev.rgb = (prev.rgb - (prev.rgb >> 6)) + (dither.x ^ dither.y) * 2 + dither.y;\n"); } WriteFog(out, uid_data); |
