Skip to content

Commit

Permalink
Testing a workaround on D3D11/9 only for now: since we don't know how…
Browse files Browse the repository at this point in the history
… the clipper works when Z is out of range, let's only cull when Z is in range.
  • Loading branch information
hrydgard committed Mar 12, 2018
1 parent e4c6f43 commit e248845
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions GPU/Directx9/VertexShaderGeneratorDX9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ enum DoLightComputation {
#ifdef COLORGUARDBAND
// Coloring debug version
static void WriteGuardBand(char *&p) {
WRITE(p, " float3 projPos = outPos.xyz / outPos.w; \n");
WRITE(p, " if (outPos.w >= u_guardband.z) {\n");
WRITE(p, " if (abs(projPos.x) > u_guardband.x || projPos.y > u_guardband.y) colorOverride.g = 0.0;\n");//outPos.w = u_guardband.w;\n");
WRITE(p, " if (outPos.w >= 0.0) {\n");
WRITE(p, " float3 projPos = outPos.xyz / outPos.w; \n");
WRITE(p, " if (projPos.z >= 0.0 && projPos.z <= 1.0 && (abs(projPos.x) > u_guardband.x || projPos.y > u_guardband.y)) colorOverride.g = 0.0;\n");//outPos.w = u_guardband.w;\n");
WRITE(p, " } else { colorOverride.b = 0.0; } \n");
}
#else
// NOTE: We are skipping the bottom check. This fixes TOCA but I am dubious about it...
static void WriteGuardBand(char *&p) {
WRITE(p, " float3 projPos = outPos.xyz / outPos.w; \n");
WRITE(p, " if (outPos.w >= u_guardband.z) {\n");
WRITE(p, " if (abs(projPos.x) > u_guardband.x || projPos.y > u_guardband.y) outPos.w = u_guardband.w;\n");
WRITE(p, " if (outPos.w >= 0.0) {\n");
WRITE(p, " float3 projPos = outPos.xyz / outPos.w; \n");
WRITE(p, " if (projPos.z >= 0.0 && projPos.z <= 1.0 && (abs(projPos.x) > u_guardband.x || abs(projPos.y) > u_guardband.y)) outPos.w = u_guardband.w;\n");
WRITE(p, " }\n");
}
#endif
Expand Down

0 comments on commit e248845

Please sign in to comment.