A few small cleanups based on code review.

This commit is contained in:
Scott Mansell 2015-01-23 04:38:36 +13:00
parent e88c02dece
commit daf760b202
3 changed files with 12 additions and 9 deletions

View File

@ -273,8 +273,8 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
const bool forced_early_z = g_ActiveConfig.backend_info.bSupportsEarlyZ && bpmem.UseEarlyDepthTest()
&& (g_ActiveConfig.bFastDepthCalc || bpmem.alpha_test.TestResult() == AlphaTest::UNDETERMINED)
// We can't allow early_ztest for zfreeze because a reference poly is used
// to control the depth and we need a depth test after the alpha test.
// We can't allow early_ztest for zfreeze because depth is overridden per-pixel.
// This means it's impossible for zcomploc to be emulated on a zfrozen polygon.
&& !bpmem.genMode.zfreeze;
const bool per_pixel_depth = (bpmem.ztex2.op != ZTEXTURE_DISABLE && bpmem.UseLateDepthTest()) || (!g_ActiveConfig.bFastDepthCalc && bpmem.zmode.testenable && !forced_early_z) || bpmem.genMode.zfreeze;
@ -1030,7 +1030,7 @@ static inline void WriteAlphaTest(T& out, pixel_shader_uid_data* uid_data, API_T
uid_data->alpha_test_use_zcomploc_hack = bpmem.UseEarlyDepthTest()
&& bpmem.zmode.updateenable
&& !g_ActiveConfig.backend_info.bSupportsEarlyZ
&& !bpmem.genMode.zfreeze; // Might not be neccessary
&& !bpmem.genMode.zfreeze;
if (!uid_data->alpha_test_use_zcomploc_hack)
{
@ -1123,7 +1123,7 @@ static inline void WritePerPixelDepth(T& out, pixel_shader_uid_data* uid_data, A
// Opengl has reversed vertical screenspace coordiantes
if (ApiType == API_OPENGL)
out.Write("\tscreenpos.y = %i - screenpos.y - 1;\n", EFB_HEIGHT);
out.Write("\tscreenpos.y = %i - screenpos.y;\n", EFB_HEIGHT);
out.Write("\tdepth = float(" I_ZSLOPE".z + " I_ZSLOPE".x * screenpos.x + " I_ZSLOPE".y * screenpos.y) / float(0xFFFFFF);\n");
}

View File

@ -64,7 +64,10 @@ struct pixel_shader_uid_data
u32 forced_early_z : 1;
u32 early_ztest : 1;
u32 bounding_box : 1;
// TODO: 31 bits of padding is a waste. Can we free up some bits elseware?
u32 zfreeze : 1;
u32 pad : 31;
u32 texMtxInfo_n_projection : 8; // 8x1 bit
u32 tevindref_bi0 : 3;