Remove depthOverride pixel state bit
This can be queried directly from the shader
Bug: b/124177079
Change-Id: I08aac7f77fb59f005295de3d417d24bf61fb3906
Reviewed-on: https://swiftshader-review.googlesource.com/c/24595
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
diff --git a/src/Device/PixelProcessor.cpp b/src/Device/PixelProcessor.cpp
index 5ccc70a..c74e2f8 100644
--- a/src/Device/PixelProcessor.cpp
+++ b/src/Device/PixelProcessor.cpp
@@ -633,8 +633,6 @@
state.shaderID = 0;
}
- state.depthOverride = context->pixelShader ? context->pixelShader->getModes().DepthReplacing : false;
-
if(context->alphaTestActive())
{
state.alphaCompareMode = context->alphaCompareMode;
diff --git a/src/Device/PixelProcessor.hpp b/src/Device/PixelProcessor.hpp
index 268e127..a0c2df2 100644
--- a/src/Device/PixelProcessor.hpp
+++ b/src/Device/PixelProcessor.hpp
@@ -34,8 +34,6 @@
int shaderID;
- bool depthOverride : 1; // TODO: Eliminate by querying shader.
-
VkCompareOp depthCompareMode : BITS(VK_COMPARE_OP_END_RANGE);
VkCompareOp alphaCompareMode : BITS(VK_COMPARE_OP_END_RANGE);
bool depthWriteEnable : 1;
diff --git a/src/Device/QuadRasterizer.cpp b/src/Device/QuadRasterizer.cpp
index bfd87e1..1d24bbc 100644
--- a/src/Device/QuadRasterizer.cpp
+++ b/src/Device/QuadRasterizer.cpp
@@ -159,7 +159,7 @@
}
}
- if(veryEarlyDepthTest && state.multiSample == 1 && !state.depthOverride)
+ if(veryEarlyDepthTest && state.multiSample == 1 && !spirvShader->getModes().DepthReplacing)
{
if(!state.stencilActive && state.depthTestActive && (state.depthCompareMode == VK_COMPARE_OP_LESS_OR_EQUAL || state.depthCompareMode == VK_COMPARE_OP_LESS)) // FIXME: Both modes ok?
{
diff --git a/src/Pipeline/PixelProgram.cpp b/src/Pipeline/PixelProgram.cpp
index 34e0311..6d4b3e5 100644
--- a/src/Pipeline/PixelProgram.cpp
+++ b/src/Pipeline/PixelProgram.cpp
@@ -50,7 +50,7 @@
clampColor(c);
- if(state.depthOverride)
+ if(spirvShader->getModes().DepthReplacing)
{
oDepth = Min(Max(oDepth, Float4(0.0f)), Float4(1.0f));
}
diff --git a/src/Pipeline/PixelRoutine.cpp b/src/Pipeline/PixelRoutine.cpp
index 9d9e445..fd40455 100644
--- a/src/Pipeline/PixelRoutine.cpp
+++ b/src/Pipeline/PixelRoutine.cpp
@@ -53,7 +53,7 @@
Long pipeTime = Ticks();
#endif
- const bool earlyDepthTest = !state.depthOverride && !state.alphaTestActive();
+ const bool earlyDepthTest = !spirvShader->getModes().DepthReplacing && !state.alphaTestActive();
Int zMask[4]; // Depth mask
Int sMask[4]; // Stencil mask