Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/KhronosGroup/SPIRV-Cross.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Hollings <bill.hollings@brenwill.com>2021-11-12 22:17:00 +0300
committerBill Hollings <bill.hollings@brenwill.com>2021-11-12 22:17:00 +0300
commit248e9ae9ed583f37b2bc5205535a9530fd2ac90b (patch)
tree52d1343dea5321239257467ac59b0e05bc5c7b75 /reference/opt/shaders-msl
parent401296d3b8fc60193e99ccabb81eb3e4fe2dd802 (diff)
MSL: Don't output depth and stencil values with explicit early fragment tests.
Fragment shaders that require explicit early fragment tests are incompatible with specifying depth and stencil values within the shader. If explicit early fragment tests is specified, remove the depth and stencil outputs from the output structure, and replace them with dummy local variables. Add CompilerMSL:uses_explicit_early_fragment_test() function to consolidate testing for whether early fragment tests are required. Add two unit tests for depth-out with, and without, early fragment tests.
Diffstat (limited to 'reference/opt/shaders-msl')
-rw-r--r--reference/opt/shaders-msl/frag/depth-out-early-frag-tests.frag19
-rw-r--r--reference/opt/shaders-msl/frag/depth-out-no-early-frag-tests.frag19
2 files changed, 38 insertions, 0 deletions
diff --git a/reference/opt/shaders-msl/frag/depth-out-early-frag-tests.frag b/reference/opt/shaders-msl/frag/depth-out-early-frag-tests.frag
new file mode 100644
index 00000000..21884d81
--- /dev/null
+++ b/reference/opt/shaders-msl/frag/depth-out-early-frag-tests.frag
@@ -0,0 +1,19 @@
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+struct main0_out
+{
+ float4 color_out [[color(0)]];
+};
+
+[[ early_fragment_tests ]] fragment main0_out main0()
+{
+ float gl_FragDepth;
+ main0_out out = {};
+ out.color_out = float4(1.0, 0.0, 0.0, 1.0);
+ gl_FragDepth = 0.699999988079071044921875;
+ return out;
+}
+
diff --git a/reference/opt/shaders-msl/frag/depth-out-no-early-frag-tests.frag b/reference/opt/shaders-msl/frag/depth-out-no-early-frag-tests.frag
new file mode 100644
index 00000000..57d810fa
--- /dev/null
+++ b/reference/opt/shaders-msl/frag/depth-out-no-early-frag-tests.frag
@@ -0,0 +1,19 @@
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+struct main0_out
+{
+ float4 color_out [[color(0)]];
+ float gl_FragDepth [[depth(less)]];
+};
+
+fragment main0_out main0()
+{
+ main0_out out = {};
+ out.color_out = float4(1.0, 0.0, 0.0, 1.0);
+ out.gl_FragDepth = 0.699999988079071044921875;
+ return out;
+}
+