diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp index 45ac231544..a0ef76546d 100644 --- a/Source/Core/VideoCommon/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/PixelShaderGen.cpp @@ -170,6 +170,7 @@ PixelShaderUid GetPixelShaderUid(DSTALPHA_MODE dstAlphaMode) uid_data->bounding_box = g_ActiveConfig.backend_info.bSupportsBBox && g_ActiveConfig.bBBoxEnable && BoundingBox::active; uid_data->rgba6_format = bpmem.zcontrol.pixel_format == PEControl::RGBA6_Z24; + uid_data->dither = bpmem.blendmode.dither; u32 numStages = uid_data->genMode_numtevstages + 1; @@ -779,6 +780,12 @@ ShaderCode GeneratePixelShaderCode(APIType ApiType, const pixel_shader_uid_data* out.Write("\tdepth = float(zCoord) / 16777216.0;\n"); } + if (uid_data->dither && uid_data->rgba6_format) + { + 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"); + } + if (uid_data->dstAlphaMode == DSTALPHA_ALPHA_PASS) { out.SetConstantsUsed(C_ALPHA, C_ALPHA); diff --git a/Source/Core/VideoCommon/PixelShaderGen.h b/Source/Core/VideoCommon/PixelShaderGen.h index 86806cf877..d141fd57f8 100644 --- a/Source/Core/VideoCommon/PixelShaderGen.h +++ b/Source/Core/VideoCommon/PixelShaderGen.h @@ -54,7 +54,8 @@ struct pixel_shader_uid_data u32 ssaa : 1; u32 numColorChans : 2; u32 rgba6_format : 1; - u32 pad : 13; + u32 dither : 1; + u32 pad : 12; u32 texMtxInfo_n_projection : 8; // 8x1 bit u32 tevindref_bi0 : 3;