diff --git a/Source/Core/VideoBackends/Software/EfbInterface.cpp b/Source/Core/VideoBackends/Software/EfbInterface.cpp index 943ce78b06..9d8af4f88b 100644 --- a/Source/Core/VideoBackends/Software/EfbInterface.cpp +++ b/Source/Core/VideoBackends/Software/EfbInterface.cpp @@ -391,6 +391,20 @@ namespace EfbInterface } } + static void Dither(u16 x, u16 y, u8 *color) + { + // No blending for RGB8 mode + if (!bpmem.blendmode.dither || bpmem.zcontrol.pixel_format != PEControl::PixelFormat::RGBA6_Z24) + return; + + // Flipper uses a standard 2x2 Bayer Matrix for 6 bit dithering + static const u8 dither[2][2] = {{0, 2}, {3, 1}}; + + // Only the color channels are dithered? + for (int i = BLU_C; i <= RED_C; i++) + color[i] = ((color[i] - (color[i] >> 6)) + dither[y & 1][x & 1]) & 0xfc; + } + void BlendTev(u16 x, u16 y, u8 *color) { u32 dstClr; @@ -421,6 +435,7 @@ namespace EfbInterface if (bpmem.blendmode.colorupdate) { + Dither(x, y, dstClrPtr); if (bpmem.blendmode.alphaupdate) SetPixelAlphaColor(offset, dstClrPtr); else