From bbcd8de9a3aba416c47efd415ac195d5be3a6796 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Tue, 6 Jun 2023 15:05:56 +0200 Subject: [PATCH] MSL: Handle more complex array copy scenarios with bool <-> short. --- .../comp/composite-array-initialization.comp | 3 +- .../shaders-msl/comp/composite-construct.comp | 3 +- .../hs-incorrect-base-type.invalid.asm.tesc | 3 +- .../hs-input-array-access.invalid.asm.tesc | 3 +- .../tesc/hs-texcoord-array.invalid.asm.tesc | 3 +- ...actor-must-be-threadgroup.invalid.asm.tesc | 3 +- .../block-like-array-type-construct.asm.comp | 3 +- .../asm/frag/scalar-select.spv14.asm.frag | 3 +- .../asm/tesc/copy-tess-level-tri.asm.tesc | 6 ++-- ...input-array-builtin-array.invalid.asm.tesc | 6 ++-- ...builtin-array.invalid.multi-patch.asm.tesc | 6 ++-- .../tesc/copy-tess-level.tesc | 6 ++-- .../vert/pass-array-by-value.vert | 6 ++-- .../comp/composite-array-initialization.comp | 3 +- .../shaders-msl/comp/composite-construct.comp | 3 +- .../comp/copy-array-of-arrays.comp | 9 ++--- ...rol-point-array-of-matrix.multi-patch.tesc | 3 +- .../load-control-point-array-of-matrix.tesc | 3 +- ...rol-point-array-of-struct.multi-patch.tesc | 3 +- .../load-control-point-array-of-struct.tesc | 3 +- .../load-control-point-array.multi-patch.tesc | 3 +- .../tesc/load-control-point-array.tesc | 3 +- .../load-control-point-array-of-matrix.tese | 3 +- .../tese/load-control-point-array.tese | 3 +- .../asm/tese/ds-texcoord-array.asm.tese | 12 +++---- .../hs-incorrect-base-type.invalid.asm.tesc | 3 +- .../hs-input-array-access.invalid.asm.tesc | 3 +- .../tesc/hs-texcoord-array.invalid.asm.tesc | 3 +- ...actor-must-be-threadgroup.invalid.asm.tesc | 3 +- spirv_glsl.cpp | 17 +++++++-- spirv_glsl.hpp | 2 +- spirv_msl.cpp | 36 +++++++++++++------ spirv_msl.hpp | 2 +- 33 files changed, 82 insertions(+), 92 deletions(-) diff --git a/reference/opt/shaders-msl/comp/composite-array-initialization.comp b/reference/opt/shaders-msl/comp/composite-array-initialization.comp index 6181ae69..b5469b98 100644 --- a/reference/opt/shaders-msl/comp/composite-array-initialization.comp +++ b/reference/opt/shaders-msl/comp/composite-array-initialization.comp @@ -71,8 +71,7 @@ kernel void main0(device SSBO& _53 [[buffer(0)]], uint3 gl_WorkGroupID [[threadg spvUnsafeArray _25 = spvUnsafeArray({ Data{ 1.0, 2.0 }, Data{ 3.0, 4.0 } }); spvUnsafeArray _31 = spvUnsafeArray({ Data{ X, 2.0 }, Data{ 3.0, 5.0 } }); - spvUnsafeArray data2; - data2 = _31; + spvUnsafeArray data2 = _31; _53.outdata[gl_WorkGroupID.x].a = _25[gl_LocalInvocationID.x].a + data2[gl_LocalInvocationID.x].a; _53.outdata[gl_WorkGroupID.x].b = _25[gl_LocalInvocationID.x].b + data2[gl_LocalInvocationID.x].b; } diff --git a/reference/opt/shaders-msl/comp/composite-construct.comp b/reference/opt/shaders-msl/comp/composite-construct.comp index 09e6fc7d..ea5aa495 100644 --- a/reference/opt/shaders-msl/comp/composite-construct.comp +++ b/reference/opt/shaders-msl/comp/composite-construct.comp @@ -59,8 +59,7 @@ constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); kernel void main0(device SSBO0& _16 [[buffer(0)]], device SSBO1& _32 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) { spvUnsafeArray _37 = spvUnsafeArray({ _16.as[gl_GlobalInvocationID.x], _32.bs[gl_GlobalInvocationID.x] }); - spvUnsafeArray values; - values = _37; + spvUnsafeArray values = _37; _16.as[0] = values[gl_LocalInvocationIndex]; _32.bs[1] = float4(40.0); } diff --git a/reference/opt/shaders-ue4/asm/tesc/hs-incorrect-base-type.invalid.asm.tesc b/reference/opt/shaders-ue4/asm/tesc/hs-incorrect-base-type.invalid.asm.tesc index 1d021259..84540d35 100644 --- a/reference/opt/shaders-ue4/asm/tesc/hs-incorrect-base-type.invalid.asm.tesc +++ b/reference/opt/shaders-ue4/asm/tesc/hs-incorrect-base-type.invalid.asm.tesc @@ -317,8 +317,7 @@ kernel void main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0) spvUnsafeArray _150 = spvUnsafeArray({ gl_in[0].in_var_LIGHTMAP_ID, gl_in[1].in_var_LIGHTMAP_ID, gl_in[2].in_var_LIGHTMAP_ID, gl_in[3].in_var_LIGHTMAP_ID, gl_in[4].in_var_LIGHTMAP_ID, gl_in[5].in_var_LIGHTMAP_ID, gl_in[6].in_var_LIGHTMAP_ID, gl_in[7].in_var_LIGHTMAP_ID, gl_in[8].in_var_LIGHTMAP_ID, gl_in[9].in_var_LIGHTMAP_ID, gl_in[10].in_var_LIGHTMAP_ID, gl_in[11].in_var_LIGHTMAP_ID }); spvUnsafeArray _259 = spvUnsafeArray({ gl_in[0].in_var_VS_To_DS_Position, gl_in[1].in_var_VS_To_DS_Position, gl_in[2].in_var_VS_To_DS_Position, gl_in[3].in_var_VS_To_DS_Position, gl_in[4].in_var_VS_To_DS_Position, gl_in[5].in_var_VS_To_DS_Position, gl_in[6].in_var_VS_To_DS_Position, gl_in[7].in_var_VS_To_DS_Position, gl_in[8].in_var_VS_To_DS_Position, gl_in[9].in_var_VS_To_DS_Position, gl_in[10].in_var_VS_To_DS_Position, gl_in[11].in_var_VS_To_DS_Position }); spvUnsafeArray _284 = spvUnsafeArray({ FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[0], _145[0], _146[0], _147[0], _148[0], _149[0], _150[0] } }, FBasePassInterpolantsVSToDS{ { } }, _259[0] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[1], _145[1], _146[1], _147[1], _148[1], _149[1], _150[1] } }, FBasePassInterpolantsVSToDS{ { } }, _259[1] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[2], _145[2], _146[2], _147[2], _148[2], _149[2], _150[2] } }, FBasePassInterpolantsVSToDS{ { } }, _259[2] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[3], _145[3], _146[3], _147[3], _148[3], _149[3], _150[3] } }, FBasePassInterpolantsVSToDS{ { } }, _259[3] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[4], _145[4], _146[4], _147[4], _148[4], _149[4], _150[4] } }, FBasePassInterpolantsVSToDS{ { } }, _259[4] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[5], _145[5], _146[5], _147[5], _148[5], _149[5], _150[5] } }, FBasePassInterpolantsVSToDS{ { } }, _259[5] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[6], _145[6], _146[6], _147[6], _148[6], _149[6], _150[6] } }, FBasePassInterpolantsVSToDS{ { } }, _259[6] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[7], _145[7], _146[7], _147[7], _148[7], _149[7], _150[7] } }, FBasePassInterpolantsVSToDS{ { } }, _259[7] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[8], _145[8], _146[8], _147[8], _148[8], _149[8], _150[8] } }, FBasePassInterpolantsVSToDS{ { } }, _259[8] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[9], _145[9], _146[9], _147[9], _148[9], _149[9], _150[9] } }, FBasePassInterpolantsVSToDS{ { } }, _259[9] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[10], _145[10], _146[10], _147[10], _148[10], _149[10], _150[10] } }, FBasePassInterpolantsVSToDS{ { } }, _259[10] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[11], _145[11], _146[11], _147[11], _148[11], _149[11], _150[11] } }, FBasePassInterpolantsVSToDS{ { } }, _259[11] } }); - spvUnsafeArray param_var_I; - param_var_I = _284; + spvUnsafeArray param_var_I = _284; float4 _301 = float4(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); float3 _310 = View_PrimitiveSceneData._m0[(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.PrimitiveId * 26u) + 22u].xyz * float3x3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz, cross(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz) * float3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.w), param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz); uint _313 = (gl_InvocationID < 2u) ? (gl_InvocationID + 1u) : 0u; diff --git a/reference/opt/shaders-ue4/asm/tesc/hs-input-array-access.invalid.asm.tesc b/reference/opt/shaders-ue4/asm/tesc/hs-input-array-access.invalid.asm.tesc index f72e5d3b..3bfbb69c 100644 --- a/reference/opt/shaders-ue4/asm/tesc/hs-input-array-access.invalid.asm.tesc +++ b/reference/opt/shaders-ue4/asm/tesc/hs-input-array-access.invalid.asm.tesc @@ -355,8 +355,7 @@ kernel void main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0) spvUnsafeArray _192 = spvUnsafeArray({ gl_in[0].in_var_VS_To_DS_Position, gl_in[1].in_var_VS_To_DS_Position, gl_in[2].in_var_VS_To_DS_Position, gl_in[3].in_var_VS_To_DS_Position, gl_in[4].in_var_VS_To_DS_Position, gl_in[5].in_var_VS_To_DS_Position, gl_in[6].in_var_VS_To_DS_Position, gl_in[7].in_var_VS_To_DS_Position, gl_in[8].in_var_VS_To_DS_Position, gl_in[9].in_var_VS_To_DS_Position, gl_in[10].in_var_VS_To_DS_Position, gl_in[11].in_var_VS_To_DS_Position }); spvUnsafeArray _193 = spvUnsafeArray({ gl_in[0].in_var_VS_To_DS_VertexID, gl_in[1].in_var_VS_To_DS_VertexID, gl_in[2].in_var_VS_To_DS_VertexID, gl_in[3].in_var_VS_To_DS_VertexID, gl_in[4].in_var_VS_To_DS_VertexID, gl_in[5].in_var_VS_To_DS_VertexID, gl_in[6].in_var_VS_To_DS_VertexID, gl_in[7].in_var_VS_To_DS_VertexID, gl_in[8].in_var_VS_To_DS_VertexID, gl_in[9].in_var_VS_To_DS_VertexID, gl_in[10].in_var_VS_To_DS_VertexID, gl_in[11].in_var_VS_To_DS_VertexID }); spvUnsafeArray _230 = spvUnsafeArray({ FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[0], _143[0] } }, _192[0], _193[0] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[1], _143[1] } }, _192[1], _193[1] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[2], _143[2] } }, _192[2], _193[2] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[3], _143[3] } }, _192[3], _193[3] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[4], _143[4] } }, _192[4], _193[4] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[5], _143[5] } }, _192[5], _193[5] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[6], _143[6] } }, _192[6], _193[6] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[7], _143[7] } }, _192[7], _193[7] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[8], _143[8] } }, _192[8], _193[8] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[9], _143[9] } }, _192[9], _193[9] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[10], _143[10] } }, _192[10], _193[10] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[11], _143[11] } }, _192[11], _193[11] } }); - spvUnsafeArray param_var_I; - param_var_I = _230; + spvUnsafeArray param_var_I = _230; float4 _247 = float4(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); float3 _251 = Primitive.Primitive_NonUniformScale.xyz * float3x3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz, cross(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz) * float3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.w), param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz); uint _254 = (gl_InvocationID < 2u) ? (gl_InvocationID + 1u) : 0u; diff --git a/reference/opt/shaders-ue4/asm/tesc/hs-texcoord-array.invalid.asm.tesc b/reference/opt/shaders-ue4/asm/tesc/hs-texcoord-array.invalid.asm.tesc index 5d4e320b..23859bc5 100644 --- a/reference/opt/shaders-ue4/asm/tesc/hs-texcoord-array.invalid.asm.tesc +++ b/reference/opt/shaders-ue4/asm/tesc/hs-texcoord-array.invalid.asm.tesc @@ -332,8 +332,7 @@ kernel void main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0) spvUnsafeArray, 12> _132 = spvUnsafeArray, 12>({ spvUnsafeArray({ gl_in[0].in_var_TEXCOORD0_0, gl_in[0].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[1].in_var_TEXCOORD0_0, gl_in[1].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[2].in_var_TEXCOORD0_0, gl_in[2].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[3].in_var_TEXCOORD0_0, gl_in[3].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[4].in_var_TEXCOORD0_0, gl_in[4].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[5].in_var_TEXCOORD0_0, gl_in[5].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[6].in_var_TEXCOORD0_0, gl_in[6].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[7].in_var_TEXCOORD0_0, gl_in[7].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[8].in_var_TEXCOORD0_0, gl_in[8].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[9].in_var_TEXCOORD0_0, gl_in[9].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[10].in_var_TEXCOORD0_0, gl_in[10].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[11].in_var_TEXCOORD0_0, gl_in[11].in_var_TEXCOORD0_1 }) }); spvUnsafeArray _205 = spvUnsafeArray({ gl_in[0].in_var_VS_To_DS_Position, gl_in[1].in_var_VS_To_DS_Position, gl_in[2].in_var_VS_To_DS_Position, gl_in[3].in_var_VS_To_DS_Position, gl_in[4].in_var_VS_To_DS_Position, gl_in[5].in_var_VS_To_DS_Position, gl_in[6].in_var_VS_To_DS_Position, gl_in[7].in_var_VS_To_DS_Position, gl_in[8].in_var_VS_To_DS_Position, gl_in[9].in_var_VS_To_DS_Position, gl_in[10].in_var_VS_To_DS_Position, gl_in[11].in_var_VS_To_DS_Position }); spvUnsafeArray _230 = spvUnsafeArray({ FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[0], _130[0], _131[0], _132[0] } }, _205[0] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[1], _130[1], _131[1], _132[1] } }, _205[1] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[2], _130[2], _131[2], _132[2] } }, _205[2] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[3], _130[3], _131[3], _132[3] } }, _205[3] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[4], _130[4], _131[4], _132[4] } }, _205[4] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[5], _130[5], _131[5], _132[5] } }, _205[5] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[6], _130[6], _131[6], _132[6] } }, _205[6] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[7], _130[7], _131[7], _132[7] } }, _205[7] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[8], _130[8], _131[8], _132[8] } }, _205[8] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[9], _130[9], _131[9], _132[9] } }, _205[9] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[10], _130[10], _131[10], _132[10] } }, _205[10] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[11], _130[11], _131[11], _132[11] } }, _205[11] } }); - spvUnsafeArray param_var_I; - param_var_I = _230; + spvUnsafeArray param_var_I = _230; float4 _247 = float4(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); float3 _251 = Primitive.Primitive_NonUniformScale.xyz * float3x3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz, cross(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz) * float3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.w), param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz); uint _254 = (gl_InvocationID < 2u) ? (gl_InvocationID + 1u) : 0u; diff --git a/reference/opt/shaders-ue4/asm/tesc/tess-factor-must-be-threadgroup.invalid.asm.tesc b/reference/opt/shaders-ue4/asm/tesc/tess-factor-must-be-threadgroup.invalid.asm.tesc index 9ae81e40..cab75e39 100644 --- a/reference/opt/shaders-ue4/asm/tesc/tess-factor-must-be-threadgroup.invalid.asm.tesc +++ b/reference/opt/shaders-ue4/asm/tesc/tess-factor-must-be-threadgroup.invalid.asm.tesc @@ -147,8 +147,7 @@ kernel void main0(main0_in in [[stage_in]], constant type_Primitive& Primitive [ spvUnsafeArray _91 = spvUnsafeArray({ gl_in[0].in_var_TEXCOORD11_centroid, gl_in[1].in_var_TEXCOORD11_centroid, gl_in[2].in_var_TEXCOORD11_centroid }); spvUnsafeArray _104 = spvUnsafeArray({ gl_in[0].in_var_VS_To_DS_Position, gl_in[1].in_var_VS_To_DS_Position, gl_in[2].in_var_VS_To_DS_Position }); spvUnsafeArray _111 = spvUnsafeArray({ FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _90[0], _91[0] } }, FBasePassInterpolantsVSToDS{ { } }, _104[0] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _90[1], _91[1] } }, FBasePassInterpolantsVSToDS{ { } }, _104[1] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _90[2], _91[2] } }, FBasePassInterpolantsVSToDS{ { } }, _104[2] } }); - spvUnsafeArray param_var_I; - param_var_I = _111; + spvUnsafeArray param_var_I = _111; float3 _128 = Primitive.Primitive_NonUniformScale.xyz * float3x3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz, cross(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz) * float3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.w), param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz); gl_out[gl_InvocationID].out_var_TEXCOORD10_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0; gl_out[gl_InvocationID].out_var_TEXCOORD11_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2; diff --git a/reference/shaders-msl-no-opt/asm/comp/block-like-array-type-construct.asm.comp b/reference/shaders-msl-no-opt/asm/comp/block-like-array-type-construct.asm.comp index 66550535..f3f73fbd 100644 --- a/reference/shaders-msl-no-opt/asm/comp/block-like-array-type-construct.asm.comp +++ b/reference/shaders-msl-no-opt/asm/comp/block-like-array-type-construct.asm.comp @@ -70,8 +70,7 @@ kernel void main0() foo[1] = 2.0; foo[2] = 3.0; foo[3] = 4.0; - spvUnsafeArray foo2; - foo2 = foo; + spvUnsafeArray foo2 = foo; _10 _37 = _10{ { foo[0], foo[1], foo[2], foo[3] }, { foo2[0], foo2[1], foo2[2], foo2[3] } }; } diff --git a/reference/shaders-msl-no-opt/asm/frag/scalar-select.spv14.asm.frag b/reference/shaders-msl-no-opt/asm/frag/scalar-select.spv14.asm.frag index e5b8fc5b..7fa8233d 100644 --- a/reference/shaders-msl-no-opt/asm/frag/scalar-select.spv14.asm.frag +++ b/reference/shaders-msl-no-opt/asm/frag/scalar-select.spv14.asm.frag @@ -65,8 +65,7 @@ fragment main0_out main0() out.FragColor = select(float4(0.0, 0.0, 0.0, 1.0), float4(1.0, 1.0, 0.0, 1.0), bool4(false, true, false, true)); out.FragColor = float4(bool4(false, true, false, true)); _15 _32 = false ? (_15{ 0.0 }) : (_15{ 1.0 }); - spvUnsafeArray _33; - _33 = true ? _29 : _30; + spvUnsafeArray _33 = true ? _29 : _30; return out; } diff --git a/reference/shaders-msl-no-opt/asm/tesc/copy-tess-level-tri.asm.tesc b/reference/shaders-msl-no-opt/asm/tesc/copy-tess-level-tri.asm.tesc index a492cb82..6585e772 100644 --- a/reference/shaders-msl-no-opt/asm/tesc/copy-tess-level-tri.asm.tesc +++ b/reference/shaders-msl-no-opt/asm/tesc/copy-tess-level-tri.asm.tesc @@ -59,10 +59,8 @@ kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_ spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(_25[0]); spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(_25[1]); spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(_25[2]); - spvUnsafeArray inner; - inner = spvUnsafeArray({ float(spvTessLevel[gl_PrimitiveID].insideTessellationFactor), 0.0 }); - spvUnsafeArray outer; - outer = spvUnsafeArray({ float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0]), float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1]), float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2]), 0.0 }); + spvUnsafeArray inner = spvUnsafeArray({ float(spvTessLevel[gl_PrimitiveID].insideTessellationFactor), 0.0 }); + spvUnsafeArray outer = spvUnsafeArray({ float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0]), float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1]), float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2]), 0.0 }); gl_out[gl_InvocationID].gl_Position = float4(1.0); } diff --git a/reference/shaders-msl-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc b/reference/shaders-msl-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc index bdbd4bef..e1357064 100644 --- a/reference/shaders-msl-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc +++ b/reference/shaders-msl-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc @@ -120,8 +120,7 @@ kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_ p[2].pos = gl_in[2].gl_Position; p[2].uv = gl_in[2].p_uv; uint i = gl_InvocationID; - spvUnsafeArray param; - param = p; + spvUnsafeArray param = p; uint param_1 = i; HSOut flattenTemp = _hs_main(param, param_1); gl_out[gl_InvocationID].gl_Position = flattenTemp.pos; @@ -129,8 +128,7 @@ kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_ threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup); if (int(gl_InvocationID) == 0) { - spvUnsafeArray param_2; - param_2 = p; + spvUnsafeArray param_2 = p; HSConstantOut _patchConstantResult = PatchHS(param_2); spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(_patchConstantResult.EdgeTess[0]); spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(_patchConstantResult.EdgeTess[1]); diff --git a/reference/shaders-msl-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.multi-patch.asm.tesc b/reference/shaders-msl-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.multi-patch.asm.tesc index dabe1b38..c3ace1b9 100644 --- a/reference/shaders-msl-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.multi-patch.asm.tesc +++ b/reference/shaders-msl-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.multi-patch.asm.tesc @@ -119,8 +119,7 @@ kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], devic p[2].pos = gl_in[2].gl_Position; p[2].uv = gl_in[2].p.uv; uint i = gl_InvocationID; - spvUnsafeArray param; - param = p; + spvUnsafeArray param = p; uint param_1 = i; HSOut flattenTemp = _hs_main(param, param_1); gl_out[gl_InvocationID].gl_Position = flattenTemp.pos; @@ -128,8 +127,7 @@ kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], devic threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup); if (int(gl_InvocationID) == 0) { - spvUnsafeArray param_2; - param_2 = p; + spvUnsafeArray param_2 = p; HSConstantOut _patchConstantResult = PatchHS(param_2); spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(_patchConstantResult.EdgeTess[0]); spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(_patchConstantResult.EdgeTess[1]); diff --git a/reference/shaders-msl-no-opt/tesc/copy-tess-level.tesc b/reference/shaders-msl-no-opt/tesc/copy-tess-level.tesc index 3bb54197..aa1e46c3 100644 --- a/reference/shaders-msl-no-opt/tesc/copy-tess-level.tesc +++ b/reference/shaders-msl-no-opt/tesc/copy-tess-level.tesc @@ -61,10 +61,8 @@ kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_ spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(_21[1]); spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(_21[2]); spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(_21[3]); - spvUnsafeArray inner; - inner = spvUnsafeArray({ float(spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0]), float(spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1]) }); - spvUnsafeArray outer; - outer = spvUnsafeArray({ float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0]), float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1]), float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2]), float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3]) }); + spvUnsafeArray inner = spvUnsafeArray({ float(spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0]), float(spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1]) }); + spvUnsafeArray outer = spvUnsafeArray({ float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0]), float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1]), float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2]), float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3]) }); gl_out[gl_InvocationID].gl_Position = float4(1.0); } diff --git a/reference/shaders-msl-no-opt/vert/pass-array-by-value.vert b/reference/shaders-msl-no-opt/vert/pass-array-by-value.vert index f6e3efbe..f7d0453a 100644 --- a/reference/shaders-msl-no-opt/vert/pass-array-by-value.vert +++ b/reference/shaders-msl-no-opt/vert/pass-array-by-value.vert @@ -60,10 +60,8 @@ struct main0_in static inline __attribute__((always_inline)) float4 consume_constant_arrays2(spvUnsafeArray positions, spvUnsafeArray positions2, thread int& Index1, thread int& Index2) { - spvUnsafeArray indexable; - indexable = positions; - spvUnsafeArray indexable_1; - indexable_1 = positions2; + spvUnsafeArray indexable = positions; + spvUnsafeArray indexable_1 = positions2; return indexable[Index1] + indexable_1[Index2]; } diff --git a/reference/shaders-msl/comp/composite-array-initialization.comp b/reference/shaders-msl/comp/composite-array-initialization.comp index c6c17b1f..0010718d 100644 --- a/reference/shaders-msl/comp/composite-array-initialization.comp +++ b/reference/shaders-msl/comp/composite-array-initialization.comp @@ -78,8 +78,7 @@ kernel void main0(device SSBO& _53 [[buffer(0)]], uint3 gl_WorkGroupID [[threadg { spvUnsafeArray data = spvUnsafeArray({ Data{ 1.0, 2.0 }, Data{ 3.0, 4.0 } }); spvUnsafeArray _31 = spvUnsafeArray({ Data{ X, 2.0 }, Data{ 3.0, 5.0 } }); - spvUnsafeArray data2; - data2 = _31; + spvUnsafeArray data2 = _31; Data param = data[gl_LocalInvocationID.x]; Data param_1 = data2[gl_LocalInvocationID.x]; Data _73 = combine(param, param_1); diff --git a/reference/shaders-msl/comp/composite-construct.comp b/reference/shaders-msl/comp/composite-construct.comp index aada82fc..808ef790 100644 --- a/reference/shaders-msl/comp/composite-construct.comp +++ b/reference/shaders-msl/comp/composite-construct.comp @@ -67,8 +67,7 @@ constant spvUnsafeArray _43 = spvUnsafeArray({ float4(20.0 kernel void main0(device SSBO0& _16 [[buffer(0)]], device SSBO1& _32 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) { spvUnsafeArray _37 = spvUnsafeArray({ _16.as[gl_GlobalInvocationID.x], _32.bs[gl_GlobalInvocationID.x] }); - spvUnsafeArray values; - values = _37; + spvUnsafeArray values = _37; Composite c = Composite{ values[0], _43[1] }; _16.as[0] = values[gl_LocalInvocationIndex]; _32.bs[1] = c.b; diff --git a/reference/shaders-msl/comp/copy-array-of-arrays.comp b/reference/shaders-msl/comp/copy-array-of-arrays.comp index 21fb9b36..904f96ab 100644 --- a/reference/shaders-msl/comp/copy-array-of-arrays.comp +++ b/reference/shaders-msl/comp/copy-array-of-arrays.comp @@ -60,8 +60,7 @@ constant spvUnsafeArray, 2>, 2> _21 = sp kernel void main0(device BUF& o [[buffer(0)]]) { - spvUnsafeArray, 2>, 2> c; - c = _21; + spvUnsafeArray, 2>, 2> c = _21; o.a = int(c[1][1][1]); spvUnsafeArray _43 = spvUnsafeArray({ o.b, o.c }); spvUnsafeArray _48 = spvUnsafeArray({ o.b, o.b }); @@ -70,10 +69,8 @@ kernel void main0(device BUF& o [[buffer(0)]]) spvUnsafeArray _59 = spvUnsafeArray({ o.c, o.b }); spvUnsafeArray, 2> _60 = spvUnsafeArray, 2>({ _54, _59 }); spvUnsafeArray, 2>, 2> _61 = spvUnsafeArray, 2>, 2>({ _49, _60 }); - spvUnsafeArray, 2>, 2> d; - d = _61; - spvUnsafeArray, 2>, 2> e; - e = d; + spvUnsafeArray, 2>, 2> d = _61; + spvUnsafeArray, 2>, 2> e = d; o.b = e[1][0][1]; } diff --git a/reference/shaders-msl/tesc/load-control-point-array-of-matrix.multi-patch.tesc b/reference/shaders-msl/tesc/load-control-point-array-of-matrix.multi-patch.tesc index 28effad2..cd452b74 100644 --- a/reference/shaders-msl/tesc/load-control-point-array-of-matrix.multi-patch.tesc +++ b/reference/shaders-msl/tesc/load-control-point-array-of-matrix.multi-patch.tesc @@ -61,8 +61,7 @@ kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], devic uint gl_InvocationID = gl_GlobalInvocationID.x % 4; uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); spvUnsafeArray _16 = spvUnsafeArray({ gl_in[0].vInputs, gl_in[1].vInputs, gl_in[2].vInputs, gl_in[3].vInputs, gl_in[4].vInputs, gl_in[5].vInputs, gl_in[6].vInputs, gl_in[7].vInputs, gl_in[8].vInputs, gl_in[9].vInputs, gl_in[10].vInputs, gl_in[11].vInputs, gl_in[12].vInputs, gl_in[13].vInputs, gl_in[14].vInputs, gl_in[15].vInputs, gl_in[16].vInputs, gl_in[17].vInputs, gl_in[18].vInputs, gl_in[19].vInputs, gl_in[20].vInputs, gl_in[21].vInputs, gl_in[22].vInputs, gl_in[23].vInputs, gl_in[24].vInputs, gl_in[25].vInputs, gl_in[26].vInputs, gl_in[27].vInputs, gl_in[28].vInputs, gl_in[29].vInputs, gl_in[30].vInputs, gl_in[31].vInputs }); - spvUnsafeArray tmp; - tmp = _16; + spvUnsafeArray tmp = _16; gl_out[gl_InvocationID].vOutputs = tmp[gl_InvocationID]; } diff --git a/reference/shaders-msl/tesc/load-control-point-array-of-matrix.tesc b/reference/shaders-msl/tesc/load-control-point-array-of-matrix.tesc index 46d4b4ad..67b97a51 100644 --- a/reference/shaders-msl/tesc/load-control-point-array-of-matrix.tesc +++ b/reference/shaders-msl/tesc/load-control-point-array-of-matrix.tesc @@ -66,8 +66,7 @@ kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_ if (gl_InvocationID >= 4) return; spvUnsafeArray _16 = spvUnsafeArray({ float4x4(gl_in[0].vInputs_0, gl_in[0].vInputs_1, gl_in[0].vInputs_2, gl_in[0].vInputs_3), float4x4(gl_in[1].vInputs_0, gl_in[1].vInputs_1, gl_in[1].vInputs_2, gl_in[1].vInputs_3), float4x4(gl_in[2].vInputs_0, gl_in[2].vInputs_1, gl_in[2].vInputs_2, gl_in[2].vInputs_3), float4x4(gl_in[3].vInputs_0, gl_in[3].vInputs_1, gl_in[3].vInputs_2, gl_in[3].vInputs_3), float4x4(gl_in[4].vInputs_0, gl_in[4].vInputs_1, gl_in[4].vInputs_2, gl_in[4].vInputs_3), float4x4(gl_in[5].vInputs_0, gl_in[5].vInputs_1, gl_in[5].vInputs_2, gl_in[5].vInputs_3), float4x4(gl_in[6].vInputs_0, gl_in[6].vInputs_1, gl_in[6].vInputs_2, gl_in[6].vInputs_3), float4x4(gl_in[7].vInputs_0, gl_in[7].vInputs_1, gl_in[7].vInputs_2, gl_in[7].vInputs_3), float4x4(gl_in[8].vInputs_0, gl_in[8].vInputs_1, gl_in[8].vInputs_2, gl_in[8].vInputs_3), float4x4(gl_in[9].vInputs_0, gl_in[9].vInputs_1, gl_in[9].vInputs_2, gl_in[9].vInputs_3), float4x4(gl_in[10].vInputs_0, gl_in[10].vInputs_1, gl_in[10].vInputs_2, gl_in[10].vInputs_3), float4x4(gl_in[11].vInputs_0, gl_in[11].vInputs_1, gl_in[11].vInputs_2, gl_in[11].vInputs_3), float4x4(gl_in[12].vInputs_0, gl_in[12].vInputs_1, gl_in[12].vInputs_2, gl_in[12].vInputs_3), float4x4(gl_in[13].vInputs_0, gl_in[13].vInputs_1, gl_in[13].vInputs_2, gl_in[13].vInputs_3), float4x4(gl_in[14].vInputs_0, gl_in[14].vInputs_1, gl_in[14].vInputs_2, gl_in[14].vInputs_3), float4x4(gl_in[15].vInputs_0, gl_in[15].vInputs_1, gl_in[15].vInputs_2, gl_in[15].vInputs_3), float4x4(gl_in[16].vInputs_0, gl_in[16].vInputs_1, gl_in[16].vInputs_2, gl_in[16].vInputs_3), float4x4(gl_in[17].vInputs_0, gl_in[17].vInputs_1, gl_in[17].vInputs_2, gl_in[17].vInputs_3), float4x4(gl_in[18].vInputs_0, gl_in[18].vInputs_1, gl_in[18].vInputs_2, gl_in[18].vInputs_3), float4x4(gl_in[19].vInputs_0, gl_in[19].vInputs_1, gl_in[19].vInputs_2, gl_in[19].vInputs_3), float4x4(gl_in[20].vInputs_0, gl_in[20].vInputs_1, gl_in[20].vInputs_2, gl_in[20].vInputs_3), float4x4(gl_in[21].vInputs_0, gl_in[21].vInputs_1, gl_in[21].vInputs_2, gl_in[21].vInputs_3), float4x4(gl_in[22].vInputs_0, gl_in[22].vInputs_1, gl_in[22].vInputs_2, gl_in[22].vInputs_3), float4x4(gl_in[23].vInputs_0, gl_in[23].vInputs_1, gl_in[23].vInputs_2, gl_in[23].vInputs_3), float4x4(gl_in[24].vInputs_0, gl_in[24].vInputs_1, gl_in[24].vInputs_2, gl_in[24].vInputs_3), float4x4(gl_in[25].vInputs_0, gl_in[25].vInputs_1, gl_in[25].vInputs_2, gl_in[25].vInputs_3), float4x4(gl_in[26].vInputs_0, gl_in[26].vInputs_1, gl_in[26].vInputs_2, gl_in[26].vInputs_3), float4x4(gl_in[27].vInputs_0, gl_in[27].vInputs_1, gl_in[27].vInputs_2, gl_in[27].vInputs_3), float4x4(gl_in[28].vInputs_0, gl_in[28].vInputs_1, gl_in[28].vInputs_2, gl_in[28].vInputs_3), float4x4(gl_in[29].vInputs_0, gl_in[29].vInputs_1, gl_in[29].vInputs_2, gl_in[29].vInputs_3), float4x4(gl_in[30].vInputs_0, gl_in[30].vInputs_1, gl_in[30].vInputs_2, gl_in[30].vInputs_3), float4x4(gl_in[31].vInputs_0, gl_in[31].vInputs_1, gl_in[31].vInputs_2, gl_in[31].vInputs_3) }); - spvUnsafeArray tmp; - tmp = _16; + spvUnsafeArray tmp = _16; gl_out[gl_InvocationID].vOutputs = tmp[gl_InvocationID]; } diff --git a/reference/shaders-msl/tesc/load-control-point-array-of-struct.multi-patch.tesc b/reference/shaders-msl/tesc/load-control-point-array-of-struct.multi-patch.tesc index d24c271d..621721f8 100644 --- a/reference/shaders-msl/tesc/load-control-point-array-of-struct.multi-patch.tesc +++ b/reference/shaders-msl/tesc/load-control-point-array-of-struct.multi-patch.tesc @@ -68,8 +68,7 @@ kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], devic uint gl_InvocationID = gl_GlobalInvocationID.x % 4; uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); spvUnsafeArray _19 = spvUnsafeArray({ gl_in[0].vInputs, gl_in[1].vInputs, gl_in[2].vInputs, gl_in[3].vInputs, gl_in[4].vInputs, gl_in[5].vInputs, gl_in[6].vInputs, gl_in[7].vInputs, gl_in[8].vInputs, gl_in[9].vInputs, gl_in[10].vInputs, gl_in[11].vInputs, gl_in[12].vInputs, gl_in[13].vInputs, gl_in[14].vInputs, gl_in[15].vInputs, gl_in[16].vInputs, gl_in[17].vInputs, gl_in[18].vInputs, gl_in[19].vInputs, gl_in[20].vInputs, gl_in[21].vInputs, gl_in[22].vInputs, gl_in[23].vInputs, gl_in[24].vInputs, gl_in[25].vInputs, gl_in[26].vInputs, gl_in[27].vInputs, gl_in[28].vInputs, gl_in[29].vInputs, gl_in[30].vInputs, gl_in[31].vInputs }); - spvUnsafeArray tmp; - tmp = _19; + spvUnsafeArray tmp = _19; VertexData tmp_single = gl_in[gl_InvocationID ^ 1].vInputs; gl_out[gl_InvocationID].vOutputs = ((tmp[gl_InvocationID].a[1] + tmp[gl_InvocationID].b[1]) + tmp[gl_InvocationID].c) + tmp_single.c; } diff --git a/reference/shaders-msl/tesc/load-control-point-array-of-struct.tesc b/reference/shaders-msl/tesc/load-control-point-array-of-struct.tesc index 08392cab..8438f49f 100644 --- a/reference/shaders-msl/tesc/load-control-point-array-of-struct.tesc +++ b/reference/shaders-msl/tesc/load-control-point-array-of-struct.tesc @@ -76,8 +76,7 @@ kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_ if (gl_InvocationID >= 4) return; spvUnsafeArray _19 = spvUnsafeArray({ VertexData{ float4x4(gl_in[0].vInputs_a_0, gl_in[0].vInputs_a_1, gl_in[0].vInputs_a_2, gl_in[0].vInputs_a_3), spvUnsafeArray({ gl_in[0].vInputs_b_0, gl_in[0].vInputs_b_1 }), gl_in[0].vInputs_c }, VertexData{ float4x4(gl_in[1].vInputs_a_0, gl_in[1].vInputs_a_1, gl_in[1].vInputs_a_2, gl_in[1].vInputs_a_3), spvUnsafeArray({ gl_in[1].vInputs_b_0, gl_in[1].vInputs_b_1 }), gl_in[1].vInputs_c }, VertexData{ float4x4(gl_in[2].vInputs_a_0, gl_in[2].vInputs_a_1, gl_in[2].vInputs_a_2, gl_in[2].vInputs_a_3), spvUnsafeArray({ gl_in[2].vInputs_b_0, gl_in[2].vInputs_b_1 }), gl_in[2].vInputs_c }, VertexData{ float4x4(gl_in[3].vInputs_a_0, gl_in[3].vInputs_a_1, gl_in[3].vInputs_a_2, gl_in[3].vInputs_a_3), spvUnsafeArray({ gl_in[3].vInputs_b_0, gl_in[3].vInputs_b_1 }), gl_in[3].vInputs_c }, VertexData{ float4x4(gl_in[4].vInputs_a_0, gl_in[4].vInputs_a_1, gl_in[4].vInputs_a_2, gl_in[4].vInputs_a_3), spvUnsafeArray({ gl_in[4].vInputs_b_0, gl_in[4].vInputs_b_1 }), gl_in[4].vInputs_c }, VertexData{ float4x4(gl_in[5].vInputs_a_0, gl_in[5].vInputs_a_1, gl_in[5].vInputs_a_2, gl_in[5].vInputs_a_3), spvUnsafeArray({ gl_in[5].vInputs_b_0, gl_in[5].vInputs_b_1 }), gl_in[5].vInputs_c }, VertexData{ float4x4(gl_in[6].vInputs_a_0, gl_in[6].vInputs_a_1, gl_in[6].vInputs_a_2, gl_in[6].vInputs_a_3), spvUnsafeArray({ gl_in[6].vInputs_b_0, gl_in[6].vInputs_b_1 }), gl_in[6].vInputs_c }, VertexData{ float4x4(gl_in[7].vInputs_a_0, gl_in[7].vInputs_a_1, gl_in[7].vInputs_a_2, gl_in[7].vInputs_a_3), spvUnsafeArray({ gl_in[7].vInputs_b_0, gl_in[7].vInputs_b_1 }), gl_in[7].vInputs_c }, VertexData{ float4x4(gl_in[8].vInputs_a_0, gl_in[8].vInputs_a_1, gl_in[8].vInputs_a_2, gl_in[8].vInputs_a_3), spvUnsafeArray({ gl_in[8].vInputs_b_0, gl_in[8].vInputs_b_1 }), gl_in[8].vInputs_c }, VertexData{ float4x4(gl_in[9].vInputs_a_0, gl_in[9].vInputs_a_1, gl_in[9].vInputs_a_2, gl_in[9].vInputs_a_3), spvUnsafeArray({ gl_in[9].vInputs_b_0, gl_in[9].vInputs_b_1 }), gl_in[9].vInputs_c }, VertexData{ float4x4(gl_in[10].vInputs_a_0, gl_in[10].vInputs_a_1, gl_in[10].vInputs_a_2, gl_in[10].vInputs_a_3), spvUnsafeArray({ gl_in[10].vInputs_b_0, gl_in[10].vInputs_b_1 }), gl_in[10].vInputs_c }, VertexData{ float4x4(gl_in[11].vInputs_a_0, gl_in[11].vInputs_a_1, gl_in[11].vInputs_a_2, gl_in[11].vInputs_a_3), spvUnsafeArray({ gl_in[11].vInputs_b_0, gl_in[11].vInputs_b_1 }), gl_in[11].vInputs_c }, VertexData{ float4x4(gl_in[12].vInputs_a_0, gl_in[12].vInputs_a_1, gl_in[12].vInputs_a_2, gl_in[12].vInputs_a_3), spvUnsafeArray({ gl_in[12].vInputs_b_0, gl_in[12].vInputs_b_1 }), gl_in[12].vInputs_c }, VertexData{ float4x4(gl_in[13].vInputs_a_0, gl_in[13].vInputs_a_1, gl_in[13].vInputs_a_2, gl_in[13].vInputs_a_3), spvUnsafeArray({ gl_in[13].vInputs_b_0, gl_in[13].vInputs_b_1 }), gl_in[13].vInputs_c }, VertexData{ float4x4(gl_in[14].vInputs_a_0, gl_in[14].vInputs_a_1, gl_in[14].vInputs_a_2, gl_in[14].vInputs_a_3), spvUnsafeArray({ gl_in[14].vInputs_b_0, gl_in[14].vInputs_b_1 }), gl_in[14].vInputs_c }, VertexData{ float4x4(gl_in[15].vInputs_a_0, gl_in[15].vInputs_a_1, gl_in[15].vInputs_a_2, gl_in[15].vInputs_a_3), spvUnsafeArray({ gl_in[15].vInputs_b_0, gl_in[15].vInputs_b_1 }), gl_in[15].vInputs_c }, VertexData{ float4x4(gl_in[16].vInputs_a_0, gl_in[16].vInputs_a_1, gl_in[16].vInputs_a_2, gl_in[16].vInputs_a_3), spvUnsafeArray({ gl_in[16].vInputs_b_0, gl_in[16].vInputs_b_1 }), gl_in[16].vInputs_c }, VertexData{ float4x4(gl_in[17].vInputs_a_0, gl_in[17].vInputs_a_1, gl_in[17].vInputs_a_2, gl_in[17].vInputs_a_3), spvUnsafeArray({ gl_in[17].vInputs_b_0, gl_in[17].vInputs_b_1 }), gl_in[17].vInputs_c }, VertexData{ float4x4(gl_in[18].vInputs_a_0, gl_in[18].vInputs_a_1, gl_in[18].vInputs_a_2, gl_in[18].vInputs_a_3), spvUnsafeArray({ gl_in[18].vInputs_b_0, gl_in[18].vInputs_b_1 }), gl_in[18].vInputs_c }, VertexData{ float4x4(gl_in[19].vInputs_a_0, gl_in[19].vInputs_a_1, gl_in[19].vInputs_a_2, gl_in[19].vInputs_a_3), spvUnsafeArray({ gl_in[19].vInputs_b_0, gl_in[19].vInputs_b_1 }), gl_in[19].vInputs_c }, VertexData{ float4x4(gl_in[20].vInputs_a_0, gl_in[20].vInputs_a_1, gl_in[20].vInputs_a_2, gl_in[20].vInputs_a_3), spvUnsafeArray({ gl_in[20].vInputs_b_0, gl_in[20].vInputs_b_1 }), gl_in[20].vInputs_c }, VertexData{ float4x4(gl_in[21].vInputs_a_0, gl_in[21].vInputs_a_1, gl_in[21].vInputs_a_2, gl_in[21].vInputs_a_3), spvUnsafeArray({ gl_in[21].vInputs_b_0, gl_in[21].vInputs_b_1 }), gl_in[21].vInputs_c }, VertexData{ float4x4(gl_in[22].vInputs_a_0, gl_in[22].vInputs_a_1, gl_in[22].vInputs_a_2, gl_in[22].vInputs_a_3), spvUnsafeArray({ gl_in[22].vInputs_b_0, gl_in[22].vInputs_b_1 }), gl_in[22].vInputs_c }, VertexData{ float4x4(gl_in[23].vInputs_a_0, gl_in[23].vInputs_a_1, gl_in[23].vInputs_a_2, gl_in[23].vInputs_a_3), spvUnsafeArray({ gl_in[23].vInputs_b_0, gl_in[23].vInputs_b_1 }), gl_in[23].vInputs_c }, VertexData{ float4x4(gl_in[24].vInputs_a_0, gl_in[24].vInputs_a_1, gl_in[24].vInputs_a_2, gl_in[24].vInputs_a_3), spvUnsafeArray({ gl_in[24].vInputs_b_0, gl_in[24].vInputs_b_1 }), gl_in[24].vInputs_c }, VertexData{ float4x4(gl_in[25].vInputs_a_0, gl_in[25].vInputs_a_1, gl_in[25].vInputs_a_2, gl_in[25].vInputs_a_3), spvUnsafeArray({ gl_in[25].vInputs_b_0, gl_in[25].vInputs_b_1 }), gl_in[25].vInputs_c }, VertexData{ float4x4(gl_in[26].vInputs_a_0, gl_in[26].vInputs_a_1, gl_in[26].vInputs_a_2, gl_in[26].vInputs_a_3), spvUnsafeArray({ gl_in[26].vInputs_b_0, gl_in[26].vInputs_b_1 }), gl_in[26].vInputs_c }, VertexData{ float4x4(gl_in[27].vInputs_a_0, gl_in[27].vInputs_a_1, gl_in[27].vInputs_a_2, gl_in[27].vInputs_a_3), spvUnsafeArray({ gl_in[27].vInputs_b_0, gl_in[27].vInputs_b_1 }), gl_in[27].vInputs_c }, VertexData{ float4x4(gl_in[28].vInputs_a_0, gl_in[28].vInputs_a_1, gl_in[28].vInputs_a_2, gl_in[28].vInputs_a_3), spvUnsafeArray({ gl_in[28].vInputs_b_0, gl_in[28].vInputs_b_1 }), gl_in[28].vInputs_c }, VertexData{ float4x4(gl_in[29].vInputs_a_0, gl_in[29].vInputs_a_1, gl_in[29].vInputs_a_2, gl_in[29].vInputs_a_3), spvUnsafeArray({ gl_in[29].vInputs_b_0, gl_in[29].vInputs_b_1 }), gl_in[29].vInputs_c }, VertexData{ float4x4(gl_in[30].vInputs_a_0, gl_in[30].vInputs_a_1, gl_in[30].vInputs_a_2, gl_in[30].vInputs_a_3), spvUnsafeArray({ gl_in[30].vInputs_b_0, gl_in[30].vInputs_b_1 }), gl_in[30].vInputs_c }, VertexData{ float4x4(gl_in[31].vInputs_a_0, gl_in[31].vInputs_a_1, gl_in[31].vInputs_a_2, gl_in[31].vInputs_a_3), spvUnsafeArray({ gl_in[31].vInputs_b_0, gl_in[31].vInputs_b_1 }), gl_in[31].vInputs_c } }); - spvUnsafeArray tmp; - tmp = _19; + spvUnsafeArray tmp = _19; int _27 = gl_InvocationID ^ 1; VertexData _30 = VertexData{ float4x4(gl_in[_27].vInputs_a_0, gl_in[_27].vInputs_a_1, gl_in[_27].vInputs_a_2, gl_in[_27].vInputs_a_3), spvUnsafeArray({ gl_in[_27].vInputs_b_0, gl_in[_27].vInputs_b_1 }), gl_in[_27].vInputs_c }; VertexData tmp_single = _30; diff --git a/reference/shaders-msl/tesc/load-control-point-array.multi-patch.tesc b/reference/shaders-msl/tesc/load-control-point-array.multi-patch.tesc index 45baadb6..b993c997 100644 --- a/reference/shaders-msl/tesc/load-control-point-array.multi-patch.tesc +++ b/reference/shaders-msl/tesc/load-control-point-array.multi-patch.tesc @@ -62,8 +62,7 @@ kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], devic uint gl_InvocationID = gl_GlobalInvocationID.x % 4; uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); spvUnsafeArray _15 = spvUnsafeArray({ gl_in[0].vInputs, gl_in[1].vInputs, gl_in[2].vInputs, gl_in[3].vInputs, gl_in[4].vInputs, gl_in[5].vInputs, gl_in[6].vInputs, gl_in[7].vInputs, gl_in[8].vInputs, gl_in[9].vInputs, gl_in[10].vInputs, gl_in[11].vInputs, gl_in[12].vInputs, gl_in[13].vInputs, gl_in[14].vInputs, gl_in[15].vInputs, gl_in[16].vInputs, gl_in[17].vInputs, gl_in[18].vInputs, gl_in[19].vInputs, gl_in[20].vInputs, gl_in[21].vInputs, gl_in[22].vInputs, gl_in[23].vInputs, gl_in[24].vInputs, gl_in[25].vInputs, gl_in[26].vInputs, gl_in[27].vInputs, gl_in[28].vInputs, gl_in[29].vInputs, gl_in[30].vInputs, gl_in[31].vInputs }); - spvUnsafeArray tmp; - tmp = _15; + spvUnsafeArray tmp = _15; gl_out[gl_InvocationID].vOutputs = tmp[gl_InvocationID]; } diff --git a/reference/shaders-msl/tesc/load-control-point-array.tesc b/reference/shaders-msl/tesc/load-control-point-array.tesc index d04571ae..5c188572 100644 --- a/reference/shaders-msl/tesc/load-control-point-array.tesc +++ b/reference/shaders-msl/tesc/load-control-point-array.tesc @@ -63,8 +63,7 @@ kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_ if (gl_InvocationID >= 4) return; spvUnsafeArray _15 = spvUnsafeArray({ gl_in[0].vInputs, gl_in[1].vInputs, gl_in[2].vInputs, gl_in[3].vInputs, gl_in[4].vInputs, gl_in[5].vInputs, gl_in[6].vInputs, gl_in[7].vInputs, gl_in[8].vInputs, gl_in[9].vInputs, gl_in[10].vInputs, gl_in[11].vInputs, gl_in[12].vInputs, gl_in[13].vInputs, gl_in[14].vInputs, gl_in[15].vInputs, gl_in[16].vInputs, gl_in[17].vInputs, gl_in[18].vInputs, gl_in[19].vInputs, gl_in[20].vInputs, gl_in[21].vInputs, gl_in[22].vInputs, gl_in[23].vInputs, gl_in[24].vInputs, gl_in[25].vInputs, gl_in[26].vInputs, gl_in[27].vInputs, gl_in[28].vInputs, gl_in[29].vInputs, gl_in[30].vInputs, gl_in[31].vInputs }); - spvUnsafeArray tmp; - tmp = _15; + spvUnsafeArray tmp = _15; gl_out[gl_InvocationID].vOutputs = tmp[gl_InvocationID]; } diff --git a/reference/shaders-msl/tese/load-control-point-array-of-matrix.tese b/reference/shaders-msl/tese/load-control-point-array-of-matrix.tese index 162874ab..b3024a9b 100644 --- a/reference/shaders-msl/tese/load-control-point-array-of-matrix.tese +++ b/reference/shaders-msl/tese/load-control-point-array-of-matrix.tese @@ -76,8 +76,7 @@ struct main0_patchIn vBoo[2] = patchIn.vBoo_2; vBoo[3] = patchIn.vBoo_3; spvUnsafeArray _16 = spvUnsafeArray({ float4x4(patchIn.gl_in[0].vInputs_0, patchIn.gl_in[0].vInputs_1, patchIn.gl_in[0].vInputs_2, patchIn.gl_in[0].vInputs_3), float4x4(patchIn.gl_in[1].vInputs_0, patchIn.gl_in[1].vInputs_1, patchIn.gl_in[1].vInputs_2, patchIn.gl_in[1].vInputs_3), float4x4(patchIn.gl_in[2].vInputs_0, patchIn.gl_in[2].vInputs_1, patchIn.gl_in[2].vInputs_2, patchIn.gl_in[2].vInputs_3), float4x4(patchIn.gl_in[3].vInputs_0, patchIn.gl_in[3].vInputs_1, patchIn.gl_in[3].vInputs_2, patchIn.gl_in[3].vInputs_3), float4x4(patchIn.gl_in[4].vInputs_0, patchIn.gl_in[4].vInputs_1, patchIn.gl_in[4].vInputs_2, patchIn.gl_in[4].vInputs_3), float4x4(patchIn.gl_in[5].vInputs_0, patchIn.gl_in[5].vInputs_1, patchIn.gl_in[5].vInputs_2, patchIn.gl_in[5].vInputs_3), float4x4(patchIn.gl_in[6].vInputs_0, patchIn.gl_in[6].vInputs_1, patchIn.gl_in[6].vInputs_2, patchIn.gl_in[6].vInputs_3), float4x4(patchIn.gl_in[7].vInputs_0, patchIn.gl_in[7].vInputs_1, patchIn.gl_in[7].vInputs_2, patchIn.gl_in[7].vInputs_3), float4x4(patchIn.gl_in[8].vInputs_0, patchIn.gl_in[8].vInputs_1, patchIn.gl_in[8].vInputs_2, patchIn.gl_in[8].vInputs_3), float4x4(patchIn.gl_in[9].vInputs_0, patchIn.gl_in[9].vInputs_1, patchIn.gl_in[9].vInputs_2, patchIn.gl_in[9].vInputs_3), float4x4(patchIn.gl_in[10].vInputs_0, patchIn.gl_in[10].vInputs_1, patchIn.gl_in[10].vInputs_2, patchIn.gl_in[10].vInputs_3), float4x4(patchIn.gl_in[11].vInputs_0, patchIn.gl_in[11].vInputs_1, patchIn.gl_in[11].vInputs_2, patchIn.gl_in[11].vInputs_3), float4x4(patchIn.gl_in[12].vInputs_0, patchIn.gl_in[12].vInputs_1, patchIn.gl_in[12].vInputs_2, patchIn.gl_in[12].vInputs_3), float4x4(patchIn.gl_in[13].vInputs_0, patchIn.gl_in[13].vInputs_1, patchIn.gl_in[13].vInputs_2, patchIn.gl_in[13].vInputs_3), float4x4(patchIn.gl_in[14].vInputs_0, patchIn.gl_in[14].vInputs_1, patchIn.gl_in[14].vInputs_2, patchIn.gl_in[14].vInputs_3), float4x4(patchIn.gl_in[15].vInputs_0, patchIn.gl_in[15].vInputs_1, patchIn.gl_in[15].vInputs_2, patchIn.gl_in[15].vInputs_3), float4x4(patchIn.gl_in[16].vInputs_0, patchIn.gl_in[16].vInputs_1, patchIn.gl_in[16].vInputs_2, patchIn.gl_in[16].vInputs_3), float4x4(patchIn.gl_in[17].vInputs_0, patchIn.gl_in[17].vInputs_1, patchIn.gl_in[17].vInputs_2, patchIn.gl_in[17].vInputs_3), float4x4(patchIn.gl_in[18].vInputs_0, patchIn.gl_in[18].vInputs_1, patchIn.gl_in[18].vInputs_2, patchIn.gl_in[18].vInputs_3), float4x4(patchIn.gl_in[19].vInputs_0, patchIn.gl_in[19].vInputs_1, patchIn.gl_in[19].vInputs_2, patchIn.gl_in[19].vInputs_3), float4x4(patchIn.gl_in[20].vInputs_0, patchIn.gl_in[20].vInputs_1, patchIn.gl_in[20].vInputs_2, patchIn.gl_in[20].vInputs_3), float4x4(patchIn.gl_in[21].vInputs_0, patchIn.gl_in[21].vInputs_1, patchIn.gl_in[21].vInputs_2, patchIn.gl_in[21].vInputs_3), float4x4(patchIn.gl_in[22].vInputs_0, patchIn.gl_in[22].vInputs_1, patchIn.gl_in[22].vInputs_2, patchIn.gl_in[22].vInputs_3), float4x4(patchIn.gl_in[23].vInputs_0, patchIn.gl_in[23].vInputs_1, patchIn.gl_in[23].vInputs_2, patchIn.gl_in[23].vInputs_3), float4x4(patchIn.gl_in[24].vInputs_0, patchIn.gl_in[24].vInputs_1, patchIn.gl_in[24].vInputs_2, patchIn.gl_in[24].vInputs_3), float4x4(patchIn.gl_in[25].vInputs_0, patchIn.gl_in[25].vInputs_1, patchIn.gl_in[25].vInputs_2, patchIn.gl_in[25].vInputs_3), float4x4(patchIn.gl_in[26].vInputs_0, patchIn.gl_in[26].vInputs_1, patchIn.gl_in[26].vInputs_2, patchIn.gl_in[26].vInputs_3), float4x4(patchIn.gl_in[27].vInputs_0, patchIn.gl_in[27].vInputs_1, patchIn.gl_in[27].vInputs_2, patchIn.gl_in[27].vInputs_3), float4x4(patchIn.gl_in[28].vInputs_0, patchIn.gl_in[28].vInputs_1, patchIn.gl_in[28].vInputs_2, patchIn.gl_in[28].vInputs_3), float4x4(patchIn.gl_in[29].vInputs_0, patchIn.gl_in[29].vInputs_1, patchIn.gl_in[29].vInputs_2, patchIn.gl_in[29].vInputs_3), float4x4(patchIn.gl_in[30].vInputs_0, patchIn.gl_in[30].vInputs_1, patchIn.gl_in[30].vInputs_2, patchIn.gl_in[30].vInputs_3), float4x4(patchIn.gl_in[31].vInputs_0, patchIn.gl_in[31].vInputs_1, patchIn.gl_in[31].vInputs_2, patchIn.gl_in[31].vInputs_3) }); - spvUnsafeArray tmp; - tmp = _16; + spvUnsafeArray tmp = _16; out.gl_Position = (tmp[0][patchIn.vIndex] + tmp[1][patchIn.vIndex]) + vBoo[patchIn.vIndex]; return out; } diff --git a/reference/shaders-msl/tese/load-control-point-array.tese b/reference/shaders-msl/tese/load-control-point-array.tese index 09c19cb4..5b008c63 100644 --- a/reference/shaders-msl/tese/load-control-point-array.tese +++ b/reference/shaders-msl/tese/load-control-point-array.tese @@ -73,8 +73,7 @@ struct main0_patchIn vBoo[2] = patchIn.vBoo_2; vBoo[3] = patchIn.vBoo_3; spvUnsafeArray _15 = spvUnsafeArray({ patchIn.gl_in[0].vInputs, patchIn.gl_in[1].vInputs, patchIn.gl_in[2].vInputs, patchIn.gl_in[3].vInputs, patchIn.gl_in[4].vInputs, patchIn.gl_in[5].vInputs, patchIn.gl_in[6].vInputs, patchIn.gl_in[7].vInputs, patchIn.gl_in[8].vInputs, patchIn.gl_in[9].vInputs, patchIn.gl_in[10].vInputs, patchIn.gl_in[11].vInputs, patchIn.gl_in[12].vInputs, patchIn.gl_in[13].vInputs, patchIn.gl_in[14].vInputs, patchIn.gl_in[15].vInputs, patchIn.gl_in[16].vInputs, patchIn.gl_in[17].vInputs, patchIn.gl_in[18].vInputs, patchIn.gl_in[19].vInputs, patchIn.gl_in[20].vInputs, patchIn.gl_in[21].vInputs, patchIn.gl_in[22].vInputs, patchIn.gl_in[23].vInputs, patchIn.gl_in[24].vInputs, patchIn.gl_in[25].vInputs, patchIn.gl_in[26].vInputs, patchIn.gl_in[27].vInputs, patchIn.gl_in[28].vInputs, patchIn.gl_in[29].vInputs, patchIn.gl_in[30].vInputs, patchIn.gl_in[31].vInputs }); - spvUnsafeArray tmp; - tmp = _15; + spvUnsafeArray tmp = _15; out.gl_Position = (tmp[0] + tmp[1]) + vBoo[patchIn.vIndex]; return out; } diff --git a/reference/shaders-ue4-no-opt/asm/tese/ds-texcoord-array.asm.tese b/reference/shaders-ue4-no-opt/asm/tese/ds-texcoord-array.asm.tese index 346d7e3f..9e45e37c 100644 --- a/reference/shaders-ue4-no-opt/asm/tese/ds-texcoord-array.asm.tese +++ b/reference/shaders-ue4-no-opt/asm/tese/ds-texcoord-array.asm.tese @@ -277,10 +277,8 @@ struct main0_patchIn float4 _113 = float4(gl_TessCoord.y); float4 _116 = float4(gl_TessCoord.z); float4 _118 = ((_97[0] * _111) + (_97[1] * _113)) + (_97[2] * _116); - spvUnsafeArray _72; - _72 = _79[0]; - spvUnsafeArray _71; - _71 = _79[1]; + spvUnsafeArray _72 = _79[0]; + spvUnsafeArray _71 = _79[1]; float3 _120 = float3(gl_TessCoord.x); float3 _123 = float3(gl_TessCoord.y); spvUnsafeArray _73; @@ -290,10 +288,8 @@ struct main0_patchIn _133++; continue; } - spvUnsafeArray _75; - _75 = _73; - spvUnsafeArray _74; - _74 = _79[2]; + spvUnsafeArray _75 = _73; + spvUnsafeArray _74 = _79[2]; float3 _155 = float3(gl_TessCoord.z); float3 _157 = ((_77[0].xyz * _120) + (_77[1].xyz * _123)).xyz + (_77[2].xyz * _155); spvUnsafeArray _76; diff --git a/reference/shaders-ue4/asm/tesc/hs-incorrect-base-type.invalid.asm.tesc b/reference/shaders-ue4/asm/tesc/hs-incorrect-base-type.invalid.asm.tesc index 1d021259..84540d35 100644 --- a/reference/shaders-ue4/asm/tesc/hs-incorrect-base-type.invalid.asm.tesc +++ b/reference/shaders-ue4/asm/tesc/hs-incorrect-base-type.invalid.asm.tesc @@ -317,8 +317,7 @@ kernel void main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0) spvUnsafeArray _150 = spvUnsafeArray({ gl_in[0].in_var_LIGHTMAP_ID, gl_in[1].in_var_LIGHTMAP_ID, gl_in[2].in_var_LIGHTMAP_ID, gl_in[3].in_var_LIGHTMAP_ID, gl_in[4].in_var_LIGHTMAP_ID, gl_in[5].in_var_LIGHTMAP_ID, gl_in[6].in_var_LIGHTMAP_ID, gl_in[7].in_var_LIGHTMAP_ID, gl_in[8].in_var_LIGHTMAP_ID, gl_in[9].in_var_LIGHTMAP_ID, gl_in[10].in_var_LIGHTMAP_ID, gl_in[11].in_var_LIGHTMAP_ID }); spvUnsafeArray _259 = spvUnsafeArray({ gl_in[0].in_var_VS_To_DS_Position, gl_in[1].in_var_VS_To_DS_Position, gl_in[2].in_var_VS_To_DS_Position, gl_in[3].in_var_VS_To_DS_Position, gl_in[4].in_var_VS_To_DS_Position, gl_in[5].in_var_VS_To_DS_Position, gl_in[6].in_var_VS_To_DS_Position, gl_in[7].in_var_VS_To_DS_Position, gl_in[8].in_var_VS_To_DS_Position, gl_in[9].in_var_VS_To_DS_Position, gl_in[10].in_var_VS_To_DS_Position, gl_in[11].in_var_VS_To_DS_Position }); spvUnsafeArray _284 = spvUnsafeArray({ FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[0], _145[0], _146[0], _147[0], _148[0], _149[0], _150[0] } }, FBasePassInterpolantsVSToDS{ { } }, _259[0] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[1], _145[1], _146[1], _147[1], _148[1], _149[1], _150[1] } }, FBasePassInterpolantsVSToDS{ { } }, _259[1] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[2], _145[2], _146[2], _147[2], _148[2], _149[2], _150[2] } }, FBasePassInterpolantsVSToDS{ { } }, _259[2] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[3], _145[3], _146[3], _147[3], _148[3], _149[3], _150[3] } }, FBasePassInterpolantsVSToDS{ { } }, _259[3] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[4], _145[4], _146[4], _147[4], _148[4], _149[4], _150[4] } }, FBasePassInterpolantsVSToDS{ { } }, _259[4] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[5], _145[5], _146[5], _147[5], _148[5], _149[5], _150[5] } }, FBasePassInterpolantsVSToDS{ { } }, _259[5] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[6], _145[6], _146[6], _147[6], _148[6], _149[6], _150[6] } }, FBasePassInterpolantsVSToDS{ { } }, _259[6] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[7], _145[7], _146[7], _147[7], _148[7], _149[7], _150[7] } }, FBasePassInterpolantsVSToDS{ { } }, _259[7] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[8], _145[8], _146[8], _147[8], _148[8], _149[8], _150[8] } }, FBasePassInterpolantsVSToDS{ { } }, _259[8] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[9], _145[9], _146[9], _147[9], _148[9], _149[9], _150[9] } }, FBasePassInterpolantsVSToDS{ { } }, _259[9] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[10], _145[10], _146[10], _147[10], _148[10], _149[10], _150[10] } }, FBasePassInterpolantsVSToDS{ { } }, _259[10] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[11], _145[11], _146[11], _147[11], _148[11], _149[11], _150[11] } }, FBasePassInterpolantsVSToDS{ { } }, _259[11] } }); - spvUnsafeArray param_var_I; - param_var_I = _284; + spvUnsafeArray param_var_I = _284; float4 _301 = float4(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); float3 _310 = View_PrimitiveSceneData._m0[(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.PrimitiveId * 26u) + 22u].xyz * float3x3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz, cross(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz) * float3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.w), param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz); uint _313 = (gl_InvocationID < 2u) ? (gl_InvocationID + 1u) : 0u; diff --git a/reference/shaders-ue4/asm/tesc/hs-input-array-access.invalid.asm.tesc b/reference/shaders-ue4/asm/tesc/hs-input-array-access.invalid.asm.tesc index f72e5d3b..3bfbb69c 100644 --- a/reference/shaders-ue4/asm/tesc/hs-input-array-access.invalid.asm.tesc +++ b/reference/shaders-ue4/asm/tesc/hs-input-array-access.invalid.asm.tesc @@ -355,8 +355,7 @@ kernel void main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0) spvUnsafeArray _192 = spvUnsafeArray({ gl_in[0].in_var_VS_To_DS_Position, gl_in[1].in_var_VS_To_DS_Position, gl_in[2].in_var_VS_To_DS_Position, gl_in[3].in_var_VS_To_DS_Position, gl_in[4].in_var_VS_To_DS_Position, gl_in[5].in_var_VS_To_DS_Position, gl_in[6].in_var_VS_To_DS_Position, gl_in[7].in_var_VS_To_DS_Position, gl_in[8].in_var_VS_To_DS_Position, gl_in[9].in_var_VS_To_DS_Position, gl_in[10].in_var_VS_To_DS_Position, gl_in[11].in_var_VS_To_DS_Position }); spvUnsafeArray _193 = spvUnsafeArray({ gl_in[0].in_var_VS_To_DS_VertexID, gl_in[1].in_var_VS_To_DS_VertexID, gl_in[2].in_var_VS_To_DS_VertexID, gl_in[3].in_var_VS_To_DS_VertexID, gl_in[4].in_var_VS_To_DS_VertexID, gl_in[5].in_var_VS_To_DS_VertexID, gl_in[6].in_var_VS_To_DS_VertexID, gl_in[7].in_var_VS_To_DS_VertexID, gl_in[8].in_var_VS_To_DS_VertexID, gl_in[9].in_var_VS_To_DS_VertexID, gl_in[10].in_var_VS_To_DS_VertexID, gl_in[11].in_var_VS_To_DS_VertexID }); spvUnsafeArray _230 = spvUnsafeArray({ FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[0], _143[0] } }, _192[0], _193[0] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[1], _143[1] } }, _192[1], _193[1] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[2], _143[2] } }, _192[2], _193[2] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[3], _143[3] } }, _192[3], _193[3] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[4], _143[4] } }, _192[4], _193[4] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[5], _143[5] } }, _192[5], _193[5] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[6], _143[6] } }, _192[6], _193[6] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[7], _143[7] } }, _192[7], _193[7] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[8], _143[8] } }, _192[8], _193[8] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[9], _143[9] } }, _192[9], _193[9] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[10], _143[10] } }, _192[10], _193[10] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[11], _143[11] } }, _192[11], _193[11] } }); - spvUnsafeArray param_var_I; - param_var_I = _230; + spvUnsafeArray param_var_I = _230; float4 _247 = float4(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); float3 _251 = Primitive.Primitive_NonUniformScale.xyz * float3x3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz, cross(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz) * float3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.w), param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz); uint _254 = (gl_InvocationID < 2u) ? (gl_InvocationID + 1u) : 0u; diff --git a/reference/shaders-ue4/asm/tesc/hs-texcoord-array.invalid.asm.tesc b/reference/shaders-ue4/asm/tesc/hs-texcoord-array.invalid.asm.tesc index 5d4e320b..23859bc5 100644 --- a/reference/shaders-ue4/asm/tesc/hs-texcoord-array.invalid.asm.tesc +++ b/reference/shaders-ue4/asm/tesc/hs-texcoord-array.invalid.asm.tesc @@ -332,8 +332,7 @@ kernel void main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0) spvUnsafeArray, 12> _132 = spvUnsafeArray, 12>({ spvUnsafeArray({ gl_in[0].in_var_TEXCOORD0_0, gl_in[0].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[1].in_var_TEXCOORD0_0, gl_in[1].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[2].in_var_TEXCOORD0_0, gl_in[2].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[3].in_var_TEXCOORD0_0, gl_in[3].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[4].in_var_TEXCOORD0_0, gl_in[4].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[5].in_var_TEXCOORD0_0, gl_in[5].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[6].in_var_TEXCOORD0_0, gl_in[6].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[7].in_var_TEXCOORD0_0, gl_in[7].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[8].in_var_TEXCOORD0_0, gl_in[8].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[9].in_var_TEXCOORD0_0, gl_in[9].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[10].in_var_TEXCOORD0_0, gl_in[10].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[11].in_var_TEXCOORD0_0, gl_in[11].in_var_TEXCOORD0_1 }) }); spvUnsafeArray _205 = spvUnsafeArray({ gl_in[0].in_var_VS_To_DS_Position, gl_in[1].in_var_VS_To_DS_Position, gl_in[2].in_var_VS_To_DS_Position, gl_in[3].in_var_VS_To_DS_Position, gl_in[4].in_var_VS_To_DS_Position, gl_in[5].in_var_VS_To_DS_Position, gl_in[6].in_var_VS_To_DS_Position, gl_in[7].in_var_VS_To_DS_Position, gl_in[8].in_var_VS_To_DS_Position, gl_in[9].in_var_VS_To_DS_Position, gl_in[10].in_var_VS_To_DS_Position, gl_in[11].in_var_VS_To_DS_Position }); spvUnsafeArray _230 = spvUnsafeArray({ FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[0], _130[0], _131[0], _132[0] } }, _205[0] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[1], _130[1], _131[1], _132[1] } }, _205[1] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[2], _130[2], _131[2], _132[2] } }, _205[2] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[3], _130[3], _131[3], _132[3] } }, _205[3] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[4], _130[4], _131[4], _132[4] } }, _205[4] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[5], _130[5], _131[5], _132[5] } }, _205[5] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[6], _130[6], _131[6], _132[6] } }, _205[6] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[7], _130[7], _131[7], _132[7] } }, _205[7] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[8], _130[8], _131[8], _132[8] } }, _205[8] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[9], _130[9], _131[9], _132[9] } }, _205[9] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[10], _130[10], _131[10], _132[10] } }, _205[10] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[11], _130[11], _131[11], _132[11] } }, _205[11] } }); - spvUnsafeArray param_var_I; - param_var_I = _230; + spvUnsafeArray param_var_I = _230; float4 _247 = float4(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); float3 _251 = Primitive.Primitive_NonUniformScale.xyz * float3x3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz, cross(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz) * float3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.w), param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz); uint _254 = (gl_InvocationID < 2u) ? (gl_InvocationID + 1u) : 0u; diff --git a/reference/shaders-ue4/asm/tesc/tess-factor-must-be-threadgroup.invalid.asm.tesc b/reference/shaders-ue4/asm/tesc/tess-factor-must-be-threadgroup.invalid.asm.tesc index 9ae81e40..cab75e39 100644 --- a/reference/shaders-ue4/asm/tesc/tess-factor-must-be-threadgroup.invalid.asm.tesc +++ b/reference/shaders-ue4/asm/tesc/tess-factor-must-be-threadgroup.invalid.asm.tesc @@ -147,8 +147,7 @@ kernel void main0(main0_in in [[stage_in]], constant type_Primitive& Primitive [ spvUnsafeArray _91 = spvUnsafeArray({ gl_in[0].in_var_TEXCOORD11_centroid, gl_in[1].in_var_TEXCOORD11_centroid, gl_in[2].in_var_TEXCOORD11_centroid }); spvUnsafeArray _104 = spvUnsafeArray({ gl_in[0].in_var_VS_To_DS_Position, gl_in[1].in_var_VS_To_DS_Position, gl_in[2].in_var_VS_To_DS_Position }); spvUnsafeArray _111 = spvUnsafeArray({ FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _90[0], _91[0] } }, FBasePassInterpolantsVSToDS{ { } }, _104[0] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _90[1], _91[1] } }, FBasePassInterpolantsVSToDS{ { } }, _104[1] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _90[2], _91[2] } }, FBasePassInterpolantsVSToDS{ { } }, _104[2] } }); - spvUnsafeArray param_var_I; - param_var_I = _111; + spvUnsafeArray param_var_I = _111; float3 _128 = Primitive.Primitive_NonUniformScale.xyz * float3x3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz, cross(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz) * float3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.w), param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz); gl_out[gl_InvocationID].out_var_TEXCOORD10_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0; gl_out[gl_InvocationID].out_var_TEXCOORD11_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2; diff --git a/spirv_glsl.cpp b/spirv_glsl.cpp index a262a9b1..bc355d27 100644 --- a/spirv_glsl.cpp +++ b/spirv_glsl.cpp @@ -5115,6 +5115,13 @@ string CompilerGLSL::to_rerolled_array_expression(const SPIRType &parent_type, tmp_type = get(type.parent_type); tmp_type.basetype = backend.boolean_in_struct_remapped_type; } + else if (type.basetype == SPIRType::Boolean && backend.boolean_in_struct_remapped_type != SPIRType::Boolean) + { + // It's possible that we have an r-value expression that was OpLoaded from a struct. + // We have to reroll this and explicitly cast the input to bool, because the r-value is short. + tmp_type = get(type.parent_type); + remapped_boolean = true; + } uint32_t size = to_array_size_literal(type); auto &parent = get(type.parent_type); @@ -11776,7 +11783,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) // it is an array, and our backend does not support arrays as value types. // Emit the temporary, and copy it explicitly. e = &emit_uninitialized_temporary_expression(result_type, id); - emit_array_copy(to_expression(id), id, ptr, StorageClassFunction, get_expression_effective_storage_class(ptr)); + emit_array_copy(nullptr, id, ptr, StorageClassFunction, get_expression_effective_storage_class(ptr)); } else e = &emit_op(result_type, id, expr, forward, !usage_tracking); @@ -17377,8 +17384,14 @@ uint32_t CompilerGLSL::mask_relevant_memory_semantics(uint32_t semantics) MemorySemanticsCrossWorkgroupMemoryMask | MemorySemanticsSubgroupMemoryMask); } -bool CompilerGLSL::emit_array_copy(const string &lhs, uint32_t, uint32_t rhs_id, StorageClass, StorageClass) +bool CompilerGLSL::emit_array_copy(const char *expr, uint32_t lhs_id, uint32_t rhs_id, StorageClass, StorageClass) { + string lhs; + if (expr) + lhs = expr; + else + lhs = to_expression(lhs_id); + statement(lhs, " = ", to_expression(rhs_id), ";"); return true; } diff --git a/spirv_glsl.hpp b/spirv_glsl.hpp index 2cd41cb8..c19a0148 100644 --- a/spirv_glsl.hpp +++ b/spirv_glsl.hpp @@ -807,7 +807,7 @@ protected: std::string layout_for_variable(const SPIRVariable &variable); std::string to_combined_image_sampler(VariableID image_id, VariableID samp_id); virtual bool skip_argument(uint32_t id) const; - virtual bool emit_array_copy(const std::string &lhs, uint32_t lhs_id, uint32_t rhs_id, + virtual bool emit_array_copy(const char *expr, uint32_t lhs_id, uint32_t rhs_id, spv::StorageClass lhs_storage, spv::StorageClass rhs_storage); virtual void emit_block_hints(const SPIRBlock &block); virtual std::string to_initializer_expression(const SPIRVariable &var); diff --git a/spirv_msl.cpp b/spirv_msl.cpp index b7a0dc1b..c543de70 100644 --- a/spirv_msl.cpp +++ b/spirv_msl.cpp @@ -9470,7 +9470,7 @@ static bool storage_class_array_is_thread(StorageClass storage) } } -bool CompilerMSL::emit_array_copy(const string &lhs, uint32_t lhs_id, uint32_t rhs_id, +bool CompilerMSL::emit_array_copy(const char *expr, uint32_t lhs_id, uint32_t rhs_id, StorageClass lhs_storage, StorageClass rhs_storage) { // Allow Metal to use the array template to make arrays a value type. @@ -9514,6 +9514,16 @@ bool CompilerMSL::emit_array_copy(const string &lhs, uint32_t lhs_id, uint32_t r } else { + // Ensure the LHS variable has been declared + if (lhs_var) + flush_variable_declaration(lhs_var->self); + + string lhs; + if (expr) + lhs = expr; + else + lhs = to_expression(lhs_id); + // Assignment from an array initializer is fine. auto &type = expression_type(rhs_id); auto *var = maybe_get_backing_variable(rhs_id); @@ -9645,14 +9655,9 @@ bool CompilerMSL::maybe_emit_array_assignment(uint32_t id_lhs, uint32_t id_rhs) } } - // Ensure the LHS variable has been declared - auto *p_v_lhs = maybe_get_backing_variable(id_lhs); - if (p_v_lhs) - flush_variable_declaration(p_v_lhs->self); - auto lhs_storage = get_expression_effective_storage_class(id_lhs); auto rhs_storage = get_expression_effective_storage_class(id_rhs); - if (!emit_array_copy(to_expression(id_lhs), id_lhs, id_rhs, lhs_storage, rhs_storage)) + if (!emit_array_copy(nullptr, id_lhs, id_rhs, lhs_storage, rhs_storage)) return false; register_write(id_lhs); @@ -16790,20 +16795,31 @@ void CompilerMSL::cast_from_variable_load(uint32_t source_id, std::string &expr, auto *source_expr = maybe_get(source_id); auto *var = maybe_get_backing_variable(source_id); const SPIRType *var_type = nullptr, *phys_type = nullptr; + if (uint32_t phys_id = get_extended_decoration(source_id, SPIRVCrossDecorationPhysicalTypeID)) phys_type = &get(phys_id); else phys_type = &expr_type; + if (var) { source_id = var->self; var_type = &get_variable_data_type(*var); } + bool rewrite_boolean_load = + expr_type.basetype == SPIRType::Boolean && + (var && (var->storage == StorageClassWorkgroup || var_type->basetype == SPIRType::Struct)); + // Type fixups for workgroup variables if they are booleans. - if (var && (var->storage == StorageClassWorkgroup || var_type->basetype == SPIRType::Struct) && - expr_type.basetype == SPIRType::Boolean) - expr = join(type_to_glsl(expr_type), "(", expr, ")"); + if (rewrite_boolean_load) + { + if (type_is_top_level_array(expr_type)) + expr = to_rerolled_array_expression(expr_type, expr, expr_type); + else + expr = join(type_to_glsl(expr_type), "(", expr, ")"); + } + // Type fixups for workgroup variables if they are matrices. // Don't do fixup for packed types; those are handled specially. // FIXME: Maybe use a type like spvStorageMatrix for packed matrices? diff --git a/spirv_msl.hpp b/spirv_msl.hpp index 420ca930..4c5c753d 100644 --- a/spirv_msl.hpp +++ b/spirv_msl.hpp @@ -1032,7 +1032,7 @@ protected: void add_pragma_line(const std::string &line); void add_typedef_line(const std::string &line); void emit_barrier(uint32_t id_exe_scope, uint32_t id_mem_scope, uint32_t id_mem_sem); - bool emit_array_copy(const std::string &lhs, uint32_t lhs_id, uint32_t rhs_id, + bool emit_array_copy(const char *expr, uint32_t lhs_id, uint32_t rhs_id, spv::StorageClass lhs_storage, spv::StorageClass rhs_storage) override; void build_implicit_builtins(); uint32_t build_constant_uint_array_pointer();