Make shadow compare available in high precision path always
Previously this would only be applied if the format were directly
handled in this path. However, we have to support D16_UNORM, which
takes the other branch here.
Bug: b/129523279
Test: dEQP-VK.texture.shadow.*
Change-Id: I96e71c5b13391c0c6829c8c28a5bbd81e52ca79a
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/30648
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
diff --git a/src/Pipeline/SamplerCore.cpp b/src/Pipeline/SamplerCore.cpp
index a74c43e..9e2c952 100644
--- a/src/Pipeline/SamplerCore.cpp
+++ b/src/Pipeline/SamplerCore.cpp
@@ -1957,36 +1957,6 @@
default:
UNIMPLEMENTED("Format %d", VkFormat(state.textureFormat));
}
-
- if(state.compare != COMPARE_BYPASS)
- {
- Float4 ref = z;
-
- if(!hasFloatTexture())
- {
- ref = Min(Max(ref, Float4(0.0f)), Float4(1.0f));
- }
-
- Int4 boolean;
-
- switch(state.compare)
- {
- case COMPARE_LESSEQUAL: boolean = CmpLE(ref, c.x); break;
- case COMPARE_GREATEREQUAL: boolean = CmpNLT(ref, c.x); break;
- case COMPARE_LESS: boolean = CmpLT(ref, c.x); break;
- case COMPARE_GREATER: boolean = CmpNLE(ref, c.x); break;
- case COMPARE_EQUAL: boolean = CmpEQ(ref, c.x); break;
- case COMPARE_NOTEQUAL: boolean = CmpNEQ(ref, c.x); break;
- case COMPARE_ALWAYS: boolean = Int4(-1); break;
- case COMPARE_NEVER: boolean = Int4(0); break;
- default: ASSERT(false);
- }
-
- c.x = As<Float4>(boolean & As<Int4>(Float4(1.0f)));
- c.y = Float4(0.0f);
- c.z = Float4(0.0f);
- c.w = Float4(1.0f);
- }
}
else
{
@@ -2023,6 +1993,36 @@
}
}
+ if(state.compare != COMPARE_BYPASS)
+ {
+ Float4 ref = z;
+
+ if(!hasFloatTexture())
+ {
+ ref = Min(Max(ref, Float4(0.0f)), Float4(1.0f));
+ }
+
+ Int4 boolean;
+
+ switch(state.compare)
+ {
+ case COMPARE_LESSEQUAL: boolean = CmpLE(ref, c.x); break;
+ case COMPARE_GREATEREQUAL: boolean = CmpNLT(ref, c.x); break;
+ case COMPARE_LESS: boolean = CmpLT(ref, c.x); break;
+ case COMPARE_GREATER: boolean = CmpNLE(ref, c.x); break;
+ case COMPARE_EQUAL: boolean = CmpEQ(ref, c.x); break;
+ case COMPARE_NOTEQUAL: boolean = CmpNEQ(ref, c.x); break;
+ case COMPARE_ALWAYS: boolean = Int4(-1); break;
+ case COMPARE_NEVER: boolean = Int4(0); break;
+ default: ASSERT(false);
+ }
+
+ c.x = As<Float4>(boolean & As<Int4>(Float4(1.0f)));
+ c.y = Float4(0.0f);
+ c.z = Float4(0.0f);
+ c.w = Float4(1.0f);
+ }
+
return c;
}