From 1e51b235aff0e68fe80c3370d46af7f20839b340 Mon Sep 17 00:00:00 2001 From: Chip Davis Date: Thu, 6 Sep 2018 12:22:55 -0500 Subject: [PATCH] Add tests showing we don't emit interpolation qualifiers in vertex shaders. In MSL, these only have an effect on fragment `[[stage_in]]` members. They have no effect in vertex shaders. The Khronos front end doesn't even emit the SPIR-V decorations for them. --- .../vert/interpolation-qualifiers.vert | 36 +++++++++++++++++++ .../vert/interpolation-qualifiers.vert | 36 +++++++++++++++++++ .../vert/interpolation-qualifiers.vert | 22 ++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 reference/opt/shaders-msl/vert/interpolation-qualifiers.vert create mode 100644 reference/shaders-msl/vert/interpolation-qualifiers.vert create mode 100644 shaders-msl/vert/interpolation-qualifiers.vert diff --git a/reference/opt/shaders-msl/vert/interpolation-qualifiers.vert b/reference/opt/shaders-msl/vert/interpolation-qualifiers.vert new file mode 100644 index 00000000..ba2c4fbd --- /dev/null +++ b/reference/opt/shaders-msl/vert/interpolation-qualifiers.vert @@ -0,0 +1,36 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float2 v0 [[user(locn0)]]; + float2 v1 [[user(locn1)]]; + float3 v2 [[user(locn2)]]; + float4 v3 [[user(locn3)]]; + float v4 [[user(locn4)]]; + float v5 [[user(locn5)]]; + float v6 [[user(locn6)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 Position [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.v0 = in.Position.xy; + out.v1 = in.Position.zw; + out.v2 = float3(in.Position.x, in.Position.z * in.Position.y, in.Position.x); + out.v3 = in.Position.xxyy; + out.v4 = in.Position.w; + out.v5 = in.Position.y; + out.v6 = in.Position.x * in.Position.w; + out.gl_Position = in.Position; + return out; +} + diff --git a/reference/shaders-msl/vert/interpolation-qualifiers.vert b/reference/shaders-msl/vert/interpolation-qualifiers.vert new file mode 100644 index 00000000..ba2c4fbd --- /dev/null +++ b/reference/shaders-msl/vert/interpolation-qualifiers.vert @@ -0,0 +1,36 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float2 v0 [[user(locn0)]]; + float2 v1 [[user(locn1)]]; + float3 v2 [[user(locn2)]]; + float4 v3 [[user(locn3)]]; + float v4 [[user(locn4)]]; + float v5 [[user(locn5)]]; + float v6 [[user(locn6)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 Position [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.v0 = in.Position.xy; + out.v1 = in.Position.zw; + out.v2 = float3(in.Position.x, in.Position.z * in.Position.y, in.Position.x); + out.v3 = in.Position.xxyy; + out.v4 = in.Position.w; + out.v5 = in.Position.y; + out.v6 = in.Position.x * in.Position.w; + out.gl_Position = in.Position; + return out; +} + diff --git a/shaders-msl/vert/interpolation-qualifiers.vert b/shaders-msl/vert/interpolation-qualifiers.vert new file mode 100644 index 00000000..541285f2 --- /dev/null +++ b/shaders-msl/vert/interpolation-qualifiers.vert @@ -0,0 +1,22 @@ +#version 450 + +layout(location=0) in vec4 Position; + +layout(location=0) out vec2 v0; +layout(location=1) out noperspective vec2 v1; +layout(location=2) out centroid vec3 v2; +layout(location=3) out centroid noperspective vec4 v3; +layout(location=4) out sample float v4; +layout(location=5) out sample noperspective float v5; +layout(location=6) out flat float v6; + +void main() { + v0 = Position.xy; + v1 = Position.zw; + v2 = vec3(Position.x, Position.z * Position.y, Position.x); + v3 = Position.xxyy; + v4 = Position.w; + v5 = Position.y; + v6 = Position.x * Position.w; + gl_Position = Position; +}