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-08-16 18:23:15 +0300
committerBill Hollings <bill.hollings@brenwill.com>2021-08-16 18:23:15 +0300
commit3105e82b2e14832b5d4027467e5894e2d70cb0d1 (patch)
treeae684f5f845316e8b932f45d0d79cbe468cec643 /shaders-msl
parentbab4e5911b1bfa5a86bc80006b7301ae48363844 (diff)
MSL: Fix duplicate gl_Position outputs when gl_Position defined but unused.
When gl_Position is defined by SPIR-V, but neither used nor initialized, it appeared twice in the MSL output, as gl_Position and glPosition_1. The existing tests for whether an output is active check only that it is used by an op, or initialized. Adding the implicit gl_Position also marked the existing gl_Position as active, duplicating the output variable. Fix is that when checking for the need to add an implicit gl_Position output, also check if the var is already defined in the shader, and just needs to be marked as active. Add test shader.
Diffstat (limited to 'shaders-msl')
-rw-r--r--shaders-msl/vert/unused-position.vert13
1 files changed, 13 insertions, 0 deletions
diff --git a/shaders-msl/vert/unused-position.vert b/shaders-msl/vert/unused-position.vert
new file mode 100644
index 00000000..61e30b43
--- /dev/null
+++ b/shaders-msl/vert/unused-position.vert
@@ -0,0 +1,13 @@
+#version 450
+
+out gl_PerVertex
+{
+ vec4 gl_Position;
+ float gl_PointSize;
+ float gl_ClipDistance[1];
+};
+
+void main()
+{
+ gl_PointSize = 1.0;
+}