A few small cleanups based on code review.
This commit is contained in:
parent
e88c02dece
commit
daf760b202
|
@ -272,10 +272,10 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
|
||||||
out.Write("};\n");
|
out.Write("};\n");
|
||||||
|
|
||||||
const bool forced_early_z = g_ActiveConfig.backend_info.bSupportsEarlyZ && bpmem.UseEarlyDepthTest()
|
const bool forced_early_z = g_ActiveConfig.backend_info.bSupportsEarlyZ && bpmem.UseEarlyDepthTest()
|
||||||
&& (g_ActiveConfig.bFastDepthCalc || bpmem.alpha_test.TestResult() == AlphaTest::UNDETERMINED)
|
&& (g_ActiveConfig.bFastDepthCalc || bpmem.alpha_test.TestResult() == AlphaTest::UNDETERMINED)
|
||||||
// We can't allow early_ztest for zfreeze because a reference poly is used
|
// We can't allow early_ztest for zfreeze because depth is overridden per-pixel.
|
||||||
// to control the depth and we need a depth test after the alpha test.
|
// This means it's impossible for zcomploc to be emulated on a zfrozen polygon.
|
||||||
&& !bpmem.genMode.zfreeze;
|
&& !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;
|
const bool per_pixel_depth = (bpmem.ztex2.op != ZTEXTURE_DISABLE && bpmem.UseLateDepthTest()) || (!g_ActiveConfig.bFastDepthCalc && bpmem.zmode.testenable && !forced_early_z) || bpmem.genMode.zfreeze;
|
||||||
|
|
||||||
if (forced_early_z)
|
if (forced_early_z)
|
||||||
|
@ -1028,9 +1028,9 @@ static inline void WriteAlphaTest(T& out, pixel_shader_uid_data* uid_data, API_T
|
||||||
// important that a reliable alpha test, so we just force the alpha test to always succeed.
|
// important that a reliable alpha test, so we just force the alpha test to always succeed.
|
||||||
// At least this seems to be less buggy.
|
// At least this seems to be less buggy.
|
||||||
uid_data->alpha_test_use_zcomploc_hack = bpmem.UseEarlyDepthTest()
|
uid_data->alpha_test_use_zcomploc_hack = bpmem.UseEarlyDepthTest()
|
||||||
&& bpmem.zmode.updateenable
|
&& bpmem.zmode.updateenable
|
||||||
&& !g_ActiveConfig.backend_info.bSupportsEarlyZ
|
&& !g_ActiveConfig.backend_info.bSupportsEarlyZ
|
||||||
&& !bpmem.genMode.zfreeze; // Might not be neccessary
|
&& !bpmem.genMode.zfreeze;
|
||||||
|
|
||||||
if (!uid_data->alpha_test_use_zcomploc_hack)
|
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
|
// Opengl has reversed vertical screenspace coordiantes
|
||||||
if (ApiType == API_OPENGL)
|
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");
|
out.Write("\tdepth = float(" I_ZSLOPE".z + " I_ZSLOPE".x * screenpos.x + " I_ZSLOPE".y * screenpos.y) / float(0xFFFFFF);\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,10 @@ struct pixel_shader_uid_data
|
||||||
u32 forced_early_z : 1;
|
u32 forced_early_z : 1;
|
||||||
u32 early_ztest : 1;
|
u32 early_ztest : 1;
|
||||||
u32 bounding_box : 1;
|
u32 bounding_box : 1;
|
||||||
|
|
||||||
|
// TODO: 31 bits of padding is a waste. Can we free up some bits elseware?
|
||||||
u32 zfreeze : 1;
|
u32 zfreeze : 1;
|
||||||
|
u32 pad : 31;
|
||||||
|
|
||||||
u32 texMtxInfo_n_projection : 8; // 8x1 bit
|
u32 texMtxInfo_n_projection : 8; // 8x1 bit
|
||||||
u32 tevindref_bi0 : 3;
|
u32 tevindref_bi0 : 3;
|
||||||
|
|
|
@ -250,7 +250,7 @@ void VertexManager::CalculateZSlope(u32 stride)
|
||||||
float vtx[9];
|
float vtx[9];
|
||||||
float out[12];
|
float out[12];
|
||||||
float viewOffset[2] = { xfmem.viewport.xOrig - bpmem.scissorOffset.x * 2,
|
float viewOffset[2] = { xfmem.viewport.xOrig - bpmem.scissorOffset.x * 2,
|
||||||
xfmem.viewport.yOrig - bpmem.scissorOffset.y * 2};
|
xfmem.viewport.yOrig - bpmem.scissorOffset.y * 2};
|
||||||
|
|
||||||
// Lookup vertices of the last rendered triangle and software-transform them
|
// Lookup vertices of the last rendered triangle and software-transform them
|
||||||
// This allows us to determine the depth slope, which will be used if zfreeze
|
// This allows us to determine the depth slope, which will be used if zfreeze
|
||||||
|
|
Loading…
Reference in New Issue