MSL: Don't emit weird reference type for spvUnsafeArray types.

This commit is contained in:
Hans-Kristian Arntzen 2021-04-06 13:27:56 +02:00
parent e7824c8b6e
commit 65b5ff7ece
8 changed files with 24 additions and 15 deletions

View File

@ -72,7 +72,7 @@ void fork0_epilogue(thread const float4& _87, thread const float4& _88, thread c
}
static inline __attribute__((always_inline))
void fork0(uint vForkInstanceId, device half (&gl_TessLevelOuter)[3], thread spvUnsafeArray<float4, 4> (&opc), constant cb1_struct& cb0_0, thread float4& v_48, thread float4& v_49, thread float4& v_50)
void fork0(uint vForkInstanceId, device half (&gl_TessLevelOuter)[3], thread spvUnsafeArray<float4, 4>& opc, constant cb1_struct& cb0_0, thread float4& v_48, thread float4& v_49, thread float4& v_50)
{
float4 r0;
r0.x = as_type<float>(vForkInstanceId);
@ -90,7 +90,7 @@ void fork1_epilogue(thread const float4& _109, device half &gl_TessLevelInner)
}
static inline __attribute__((always_inline))
void fork1(device half &gl_TessLevelInner, thread spvUnsafeArray<float4, 4> (&opc), constant cb1_struct& cb0_0, thread float4& v_56)
void fork1(device half &gl_TessLevelInner, thread spvUnsafeArray<float4, 4>& opc, constant cb1_struct& cb0_0, thread float4& v_56)
{
opc[3u].x = cb0_0._m0[0u].x;
v_56 = opc[3u];

View File

@ -85,7 +85,7 @@ struct main0_in
};
static inline __attribute__((always_inline))
HSOut _hs_main(thread const spvUnsafeArray<VertexOutput, 3> (&p), thread const uint& i)
HSOut _hs_main(thread const spvUnsafeArray<VertexOutput, 3>& p, thread const uint& i)
{
HSOut _output;
_output.pos = p[i].pos;
@ -94,7 +94,7 @@ HSOut _hs_main(thread const spvUnsafeArray<VertexOutput, 3> (&p), thread const u
}
static inline __attribute__((always_inline))
HSConstantOut PatchHS(thread const spvUnsafeArray<VertexOutput, 3> (&_patch))
HSConstantOut PatchHS(thread const spvUnsafeArray<VertexOutput, 3>& _patch)
{
HSConstantOut _output;
_output.EdgeTess[0] = (float2(1.0) + _patch[0].uv).x;

View File

@ -86,7 +86,7 @@ struct main0_in
};
static inline __attribute__((always_inline))
HSOut _hs_main(thread const spvUnsafeArray<VertexOutput, 3> (&p), thread const uint& i)
HSOut _hs_main(thread const spvUnsafeArray<VertexOutput, 3>& p, thread const uint& i)
{
HSOut _output;
_output.pos = p[i].pos;
@ -95,7 +95,7 @@ HSOut _hs_main(thread const spvUnsafeArray<VertexOutput, 3> (&p), thread const u
}
static inline __attribute__((always_inline))
HSConstantOut PatchHS(thread const spvUnsafeArray<VertexOutput, 3> (&_patch))
HSConstantOut PatchHS(thread const spvUnsafeArray<VertexOutput, 3>& _patch)
{
HSConstantOut _output;
_output.EdgeTess[0] = (float2(1.0) + _patch[0].uv).x;

View File

@ -84,7 +84,7 @@ struct main0_in
};
static inline __attribute__((always_inline))
void func(thread float4& FragColor, thread float2 baz, thread spvUnsafeArray<float2, 2> (&a), thread _13& s, thread main0_in& in)
void func(thread float4& FragColor, thread float2 baz, thread spvUnsafeArray<float2, 2>& a, thread _13& s, thread main0_in& in)
{
float2 _237 = FragColor.xy + baz;
FragColor = float4(_237.x, _237.y, FragColor.z, FragColor.w);

View File

@ -58,7 +58,7 @@ struct main0_in
};
static inline __attribute__((always_inline))
void set_globals(thread spvUnsafeArray<float, 2> (&FragColors), thread float3& vColor, thread float2& FragColor2, thread float3& FragColor3)
void set_globals(thread spvUnsafeArray<float, 2>& FragColors, thread float3& vColor, thread float2& FragColor2, thread float3& FragColor3)
{
FragColors[0] = vColor.x;
FragColors[1] = vColor.y;

View File

@ -66,13 +66,13 @@ inline Tx mod(Tx x, Ty y)
}
static inline __attribute__((always_inline))
void write_deeper_in_function(thread spvUnsafeArray<float4, 4> (&FragColor), thread float4& vA, thread float4& vB)
void write_deeper_in_function(thread spvUnsafeArray<float4, 4>& FragColor, thread float4& vA, thread float4& vB)
{
FragColor[3] = vA * vB;
}
static inline __attribute__((always_inline))
void write_in_function(thread spvUnsafeArray<float4, 4> (&FragColor), thread float4& vA, thread float4& vB)
void write_in_function(thread spvUnsafeArray<float4, 4>& FragColor, thread float4& vA, thread float4& vB)
{
FragColor[2] = vA - vB;
write_deeper_in_function(FragColor, vA, vB);

View File

@ -78,14 +78,14 @@ struct main0_in
};
static inline __attribute__((always_inline))
void write_deeper_in_function(thread float4x4& outTransModel, constant UBO& ubo, thread float4& color, thread spvUnsafeArray<float4, 3> (&colors))
void write_deeper_in_function(thread float4x4& outTransModel, constant UBO& ubo, thread float4& color, thread spvUnsafeArray<float4, 3>& colors)
{
outTransModel[1].y = ubo.lodBias;
color = colors[2];
}
static inline __attribute__((always_inline))
void write_in_function(thread float4x4& outTransModel, constant UBO& ubo, thread float4& color, thread spvUnsafeArray<float4, 3> (&colors), thread float3& inNormal)
void write_in_function(thread float4x4& outTransModel, constant UBO& ubo, thread float4& color, thread spvUnsafeArray<float4, 3>& colors, thread float3& inNormal)
{
outTransModel[2] = float4(inNormal, 1.0);
write_deeper_in_function(outTransModel, ubo, color, colors);

View File

@ -12325,7 +12325,12 @@ string CompilerMSL::argument_decl(const SPIRFunction::Parameter &arg)
}
else
{
decl += " (&";
auto array_size_decl = type_to_array_glsl(type);
if (array_size_decl.empty())
decl += "& ";
else
decl += " (&";
const char *restrict_kw = to_restrict(name_id);
if (*restrict_kw)
{
@ -12333,8 +12338,12 @@ string CompilerMSL::argument_decl(const SPIRFunction::Parameter &arg)
decl += restrict_kw;
}
decl += to_expression(name_id);
decl += ")";
decl += type_to_array_glsl(type);
if (!array_size_decl.empty())
{
decl += ")";
decl += array_size_decl;
}
}
}
else if (!opaque_handle && (!pull_model_inputs.count(var.basevariable) || type.basetype == SPIRType::Struct))