mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-05-04 10:18:36 +00:00
Fixes Mario Tennis Gimmick Courts and adds support for FastDepthCalc
- Calculate ZSlope every flush but only set PixelShader Constant on Reset Buffer when zfreeze - Fixed another Pixel Shader bug in D3D that was giving me grief
This commit is contained in:
parent
6d5065c58d
commit
add59b3bea
7 changed files with 52 additions and 26 deletions
|
@ -271,7 +271,11 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
|
|||
GenerateVSOutputMembers<T>(out, ApiType);
|
||||
out.Write("};\n");
|
||||
|
||||
const bool forced_early_z = g_ActiveConfig.backend_info.bSupportsEarlyZ && bpmem.UseEarlyDepthTest() && (g_ActiveConfig.bFastDepthCalc || bpmem.alpha_test.TestResult() == AlphaTest::UNDETERMINED);
|
||||
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.
|
||||
&& !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)
|
||||
|
@ -365,7 +369,7 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
|
|||
out.Write("void main(\n");
|
||||
out.Write(" out float4 ocol0 : SV_Target0,%s%s\n in float4 rawpos : SV_Position,\n",
|
||||
dstAlphaMode == DSTALPHA_DUAL_SOURCE_BLEND ? "\n out float4 ocol1 : SV_Target1," : "",
|
||||
per_pixel_depth ? "\n out float depth : SV_Depth," : "");
|
||||
(per_pixel_depth && bpmem.zmode.testenable) ? "\n out float depth : SV_Depth," : "");
|
||||
|
||||
out.Write(" in centroid float4 colors_0 : COLOR0,\n");
|
||||
out.Write(" in centroid float4 colors_1 : COLOR1\n");
|
||||
|
@ -1023,7 +1027,11 @@ static inline void WriteAlphaTest(T& out, pixel_shader_uid_data* uid_data, API_T
|
|||
// Tests seem to have proven that writing depth even when the alpha test fails is more
|
||||
// important that a reliable alpha test, so we just force the alpha test to always succeed.
|
||||
// At least this seems to be less buggy.
|
||||
uid_data->alpha_test_use_zcomploc_hack = bpmem.UseEarlyDepthTest() && bpmem.zmode.updateenable && !g_ActiveConfig.backend_info.bSupportsEarlyZ;
|
||||
uid_data->alpha_test_use_zcomploc_hack = bpmem.UseEarlyDepthTest()
|
||||
&& bpmem.zmode.updateenable
|
||||
&& !g_ActiveConfig.backend_info.bSupportsEarlyZ
|
||||
&& !bpmem.genMode.zfreeze; // Might not be neccessary
|
||||
|
||||
if (!uid_data->alpha_test_use_zcomploc_hack)
|
||||
{
|
||||
out.Write("\t\tdiscard;\n");
|
||||
|
@ -1114,10 +1122,10 @@ static inline void WritePerPixelDepth(T& out, pixel_shader_uid_data* uid_data, A
|
|||
out.Write("\tfloat2 screenpos = rawpos.xy * " I_EFBSCALE".xy;\n");
|
||||
|
||||
// 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("\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");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue