mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
PixelShaderGen: Add support for dithering.
This commit is contained in:
parent
b958457e51
commit
9bc466a443
@ -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);
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user