Handle interpolation qualifiers on the entire struct, too.
This commit is contained in:
parent
1e51b235af
commit
674f97a40e
@ -0,0 +1,39 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct Input
|
||||
{
|
||||
float2 v0;
|
||||
float2 v1;
|
||||
float3 v2;
|
||||
float4 v3;
|
||||
float v4;
|
||||
float v5;
|
||||
float v6;
|
||||
};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 FragColor [[color(0)]];
|
||||
};
|
||||
|
||||
struct main0_in
|
||||
{
|
||||
float2 Input_v0 [[user(locn0), centroid_no_perspective]];
|
||||
float2 Input_v1 [[user(locn1), centroid_no_perspective]];
|
||||
float3 Input_v2 [[user(locn2), centroid_no_perspective]];
|
||||
float4 Input_v3 [[user(locn3), centroid_no_perspective]];
|
||||
float Input_v4 [[user(locn4), centroid_no_perspective]];
|
||||
float Input_v5 [[user(locn5), centroid_no_perspective]];
|
||||
float Input_v6 [[user(locn6), centroid_no_perspective]];
|
||||
};
|
||||
|
||||
fragment main0_out main0(main0_in in [[stage_in]])
|
||||
{
|
||||
main0_out out = {};
|
||||
out.FragColor = float4(in.Input_v0.x + in.Input_v1.y, in.Input_v2.xy, ((in.Input_v3.w * in.Input_v4) + in.Input_v5) - in.Input_v6);
|
||||
return out;
|
||||
}
|
||||
|
@ -0,0 +1,47 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct Output
|
||||
{
|
||||
float2 v0;
|
||||
float2 v1;
|
||||
float3 v2;
|
||||
float4 v3;
|
||||
float v4;
|
||||
float v5;
|
||||
float v6;
|
||||
};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float2 Output_v0 [[user(locn0)]];
|
||||
float2 Output_v1 [[user(locn1)]];
|
||||
float3 Output_v2 [[user(locn2)]];
|
||||
float4 Output_v3 [[user(locn3)]];
|
||||
float Output_v4 [[user(locn4)]];
|
||||
float Output_v5 [[user(locn5)]];
|
||||
float Output_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.Output_v0 = in.Position.xy;
|
||||
out.Output_v1 = in.Position.zw;
|
||||
out.Output_v2 = float3(in.Position.x, in.Position.z * in.Position.y, in.Position.x);
|
||||
out.Output_v3 = in.Position.xxyy;
|
||||
out.Output_v4 = in.Position.w;
|
||||
out.Output_v5 = in.Position.y;
|
||||
out.Output_v6 = in.Position.x * in.Position.w;
|
||||
out.gl_Position = in.Position;
|
||||
return out;
|
||||
}
|
||||
|
@ -0,0 +1,39 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct Input
|
||||
{
|
||||
float2 v0;
|
||||
float2 v1;
|
||||
float3 v2;
|
||||
float4 v3;
|
||||
float v4;
|
||||
float v5;
|
||||
float v6;
|
||||
};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 FragColor [[color(0)]];
|
||||
};
|
||||
|
||||
struct main0_in
|
||||
{
|
||||
float2 Input_v0 [[user(locn0), centroid_no_perspective]];
|
||||
float2 Input_v1 [[user(locn1), centroid_no_perspective]];
|
||||
float3 Input_v2 [[user(locn2), centroid_no_perspective]];
|
||||
float4 Input_v3 [[user(locn3), centroid_no_perspective]];
|
||||
float Input_v4 [[user(locn4), centroid_no_perspective]];
|
||||
float Input_v5 [[user(locn5), centroid_no_perspective]];
|
||||
float Input_v6 [[user(locn6), centroid_no_perspective]];
|
||||
};
|
||||
|
||||
fragment main0_out main0(main0_in in [[stage_in]])
|
||||
{
|
||||
main0_out out = {};
|
||||
out.FragColor = float4(in.Input_v0.x + in.Input_v1.y, in.Input_v2.xy, ((in.Input_v3.w * in.Input_v4) + in.Input_v5) - in.Input_v6);
|
||||
return out;
|
||||
}
|
||||
|
@ -0,0 +1,47 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct Output
|
||||
{
|
||||
float2 v0;
|
||||
float2 v1;
|
||||
float3 v2;
|
||||
float4 v3;
|
||||
float v4;
|
||||
float v5;
|
||||
float v6;
|
||||
};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float2 Output_v0 [[user(locn0)]];
|
||||
float2 Output_v1 [[user(locn1)]];
|
||||
float3 Output_v2 [[user(locn2)]];
|
||||
float4 Output_v3 [[user(locn3)]];
|
||||
float Output_v4 [[user(locn4)]];
|
||||
float Output_v5 [[user(locn5)]];
|
||||
float Output_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.Output_v0 = in.Position.xy;
|
||||
out.Output_v1 = in.Position.zw;
|
||||
out.Output_v2 = float3(in.Position.x, in.Position.z * in.Position.y, in.Position.x);
|
||||
out.Output_v3 = in.Position.xxyy;
|
||||
out.Output_v4 = in.Position.w;
|
||||
out.Output_v5 = in.Position.y;
|
||||
out.Output_v6 = in.Position.x * in.Position.w;
|
||||
out.gl_Position = in.Position;
|
||||
return out;
|
||||
}
|
||||
|
19
shaders-msl/frag/interpolation-qualifiers-block.frag
Normal file
19
shaders-msl/frag/interpolation-qualifiers-block.frag
Normal file
@ -0,0 +1,19 @@
|
||||
#version 450
|
||||
|
||||
struct Input {
|
||||
vec2 v0;
|
||||
vec2 v1;
|
||||
vec3 v2;
|
||||
vec4 v3;
|
||||
float v4;
|
||||
float v5;
|
||||
float v6;
|
||||
};
|
||||
|
||||
layout(location=0) in centroid noperspective Input inp;
|
||||
|
||||
layout(location=0) out vec4 FragColor;
|
||||
|
||||
void main() {
|
||||
FragColor = vec4(inp.v0.x + inp.v1.y, inp.v2.xy, inp.v3.w * inp.v4 + inp.v5 - inp.v6);
|
||||
}
|
26
shaders-msl/vert/interpolation-qualifiers-block.vert
Normal file
26
shaders-msl/vert/interpolation-qualifiers-block.vert
Normal file
@ -0,0 +1,26 @@
|
||||
#version 450
|
||||
|
||||
layout(location=0) in vec4 Position;
|
||||
|
||||
struct Output {
|
||||
vec2 v0;
|
||||
vec2 v1;
|
||||
vec3 v2;
|
||||
vec4 v3;
|
||||
float v4;
|
||||
float v5;
|
||||
float v6;
|
||||
};
|
||||
|
||||
layout(location=0) out centroid noperspective Output outp;
|
||||
|
||||
void main() {
|
||||
outp.v0 = Position.xy;
|
||||
outp.v1 = Position.zw;
|
||||
outp.v2 = vec3(Position.x, Position.z * Position.y, Position.x);
|
||||
outp.v3 = Position.xxyy;
|
||||
outp.v4 = Position.w;
|
||||
outp.v5 = Position.y;
|
||||
outp.v6 = Position.x * Position.w;
|
||||
gl_Position = Position;
|
||||
}
|
@ -753,10 +753,14 @@ uint32_t CompilerMSL::add_interface_block(StorageClass storage)
|
||||
{
|
||||
BuiltIn builtin;
|
||||
bool is_builtin = is_member_builtin(type, mbr_idx, &builtin);
|
||||
bool is_flat = has_member_decoration(type.self, mbr_idx, DecorationFlat);
|
||||
bool is_noperspective = has_member_decoration(type.self, mbr_idx, DecorationNoPerspective);
|
||||
bool is_centroid = has_member_decoration(type.self, mbr_idx, DecorationCentroid);
|
||||
bool is_sample = has_member_decoration(type.self, mbr_idx, DecorationSample);
|
||||
bool is_flat = has_member_decoration(type.self, mbr_idx, DecorationFlat) ||
|
||||
has_decoration(p_var->self, DecorationFlat);
|
||||
bool is_noperspective = has_member_decoration(type.self, mbr_idx, DecorationNoPerspective) ||
|
||||
has_decoration(p_var->self, DecorationNoPerspective);
|
||||
bool is_centroid = has_member_decoration(type.self, mbr_idx, DecorationCentroid) ||
|
||||
has_decoration(p_var->self, DecorationCentroid);
|
||||
bool is_sample = has_member_decoration(type.self, mbr_idx, DecorationSample) ||
|
||||
has_decoration(p_var->self, DecorationSample);
|
||||
|
||||
if (!is_builtin || has_active_builtin(builtin, storage))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user