diff options
author | Bill Hollings <bill.hollings@brenwill.com> | 2021-08-16 18:23:15 +0300 |
---|---|---|
committer | Bill Hollings <bill.hollings@brenwill.com> | 2021-08-16 18:23:15 +0300 |
commit | 3105e82b2e14832b5d4027467e5894e2d70cb0d1 (patch) | |
tree | ae684f5f845316e8b932f45d0d79cbe468cec643 /reference/opt/shaders-msl | |
parent | bab4e5911b1bfa5a86bc80006b7301ae48363844 (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 'reference/opt/shaders-msl')
-rw-r--r-- | reference/opt/shaders-msl/vert/unused-position.vert | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/reference/opt/shaders-msl/vert/unused-position.vert b/reference/opt/shaders-msl/vert/unused-position.vert new file mode 100644 index 00000000..7dc46721 --- /dev/null +++ b/reference/opt/shaders-msl/vert/unused-position.vert @@ -0,0 +1,18 @@ +#include <metal_stdlib> +#include <simd/simd.h> + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; + float gl_PointSize [[point_size]]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + out.gl_PointSize = 1.0; + return out; +} + |