diff --git a/test/bug/tint/1088.spvasm.expected.hlsl b/test/bug/tint/1088.spvasm.expected.hlsl index a77d6dc0e0..c2274dbc71 100644 --- a/test/bug/tint/1088.spvasm.expected.hlsl +++ b/test/bug/tint/1088.spvasm.expected.hlsl @@ -7,7 +7,7 @@ static float2 uv = float2(0.0f, 0.0f); static float3 normal = float3(0.0f, 0.0f, 0.0f); static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); -float4x4 tint_symbol_5(uint4 buffer[17], uint offset) { +float4x4 tint_symbol_4(uint4 buffer[17], uint offset) { const uint scalar_offset = ((offset + 0u)) / 4; const uint scalar_offset_1 = ((offset + 16u)) / 4; const uint scalar_offset_2 = ((offset + 32u)) / 4; @@ -31,7 +31,7 @@ void main_1() { const float x_55 = p.y; const float x_57 = asfloat(x_14[4].x); p.y = (x_55 + sin((x_57 + 4.0f))); - const float4x4 x_69 = tint_symbol_5(x_14, 0u); + const float4x4 x_69 = tint_symbol_4(x_14, 0u); const float3 x_70 = p; gl_Position = mul(float4(x_70.x, x_70.y, x_70.z, 1.0f), x_69); vUV = uv; @@ -54,15 +54,19 @@ struct tint_symbol_2 { float4 gl_Position : SV_Position; }; -tint_symbol_2 main(tint_symbol_1 tint_symbol) { - const float3 position_param = tint_symbol.position_param; - const float2 uv_param = tint_symbol.uv_param; - const float3 normal_param = tint_symbol.normal_param; +main_out main_inner(float3 position_param, float2 uv_param, float3 normal_param) { position = position_param; uv = uv_param; normal = normal_param; main_1(); - const main_out tint_symbol_3 = {gl_Position, vUV}; - const tint_symbol_2 tint_symbol_7 = {tint_symbol_3.vUV_1, tint_symbol_3.gl_Position}; - return tint_symbol_7; + const main_out tint_symbol_6 = {gl_Position, vUV}; + return tint_symbol_6; +} + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const main_out inner_result = main_inner(tint_symbol.position_param, tint_symbol.uv_param, tint_symbol.normal_param); + tint_symbol_2 wrapper_result = (tint_symbol_2)0; + wrapper_result.gl_Position = inner_result.gl_Position; + wrapper_result.vUV_1 = inner_result.vUV_1; + return wrapper_result; } diff --git a/test/bug/tint/1088.spvasm.expected.msl b/test/bug/tint/1088.spvasm.expected.msl index 2e9e3da93d..1c1ef4a648 100644 --- a/test/bug/tint/1088.spvasm.expected.msl +++ b/test/bug/tint/1088.spvasm.expected.msl @@ -32,16 +32,16 @@ struct tint_symbol_3 { float4 gl_Position [[position]]; }; -void main_1(constant LeftOver& x_14, thread float3* const tint_symbol_6, thread float4* const tint_symbol_7, thread float2* const tint_symbol_8, thread float2* const tint_symbol_9) { +void main_1(constant LeftOver& x_14, thread float3* const tint_symbol_5, thread float4* const tint_symbol_6, thread float2* const tint_symbol_7, thread float2* const tint_symbol_8) { float4 q = 0.0f; float3 p = 0.0f; - float3 const x_13 = *(tint_symbol_6); + float3 const x_13 = *(tint_symbol_5); q = float4(x_13.x, x_13.y, x_13.z, 1.0f); float4 const x_21 = q; p = float3(x_21.x, x_21.y, x_21.z); float const x_27 = p.x; float const x_41 = x_14.test.arr[0].el; - float const x_45 = (*(tint_symbol_6)).y; + float const x_45 = (*(tint_symbol_5)).y; float const x_49 = x_14.time; p.x = (x_27 + sin(((x_41 * x_45) + x_49))); float const x_55 = p.y; @@ -49,29 +49,33 @@ void main_1(constant LeftOver& x_14, thread float3* const tint_symbol_6, thread p.y = (x_55 + sin((x_57 + 4.0f))); float4x4 const x_69 = x_14.worldViewProjection; float3 const x_70 = p; - *(tint_symbol_7) = (x_69 * float4(x_70.x, x_70.y, x_70.z, 1.0f)); - float2 const x_83 = *(tint_symbol_8); - *(tint_symbol_9) = x_83; - float const x_87 = (*(tint_symbol_7)).y; - (*(tint_symbol_7)).y = (x_87 * -1.0f); + *(tint_symbol_6) = (x_69 * float4(x_70.x, x_70.y, x_70.z, 1.0f)); + float2 const x_83 = *(tint_symbol_7); + *(tint_symbol_8) = x_83; + float const x_87 = (*(tint_symbol_6)).y; + (*(tint_symbol_6)).y = (x_87 * -1.0f); return; } -vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]], constant LeftOver& x_14 [[buffer(2)]]) { - thread float3 tint_symbol_10 = 0.0f; - thread float2 tint_symbol_11 = 0.0f; - thread float3 tint_symbol_12 = 0.0f; - thread float4 tint_symbol_13 = 0.0f; - thread float2 tint_symbol_14 = 0.0f; - float3 const position_param = tint_symbol_1.position_param; - float2 const uv_param = tint_symbol_1.uv_param; - float3 const normal_param = tint_symbol_1.normal_param; - tint_symbol_10 = position_param; - tint_symbol_11 = uv_param; - tint_symbol_12 = normal_param; - main_1(x_14, &(tint_symbol_10), &(tint_symbol_13), &(tint_symbol_11), &(tint_symbol_14)); - main_out const tint_symbol_4 = {.gl_Position=tint_symbol_13, .vUV_1=tint_symbol_14}; - tint_symbol_3 const tint_symbol_5 = {.vUV_1=tint_symbol_4.vUV_1, .gl_Position=tint_symbol_4.gl_Position}; - return tint_symbol_5; +main_out tint_symbol_inner(constant LeftOver& x_14, float3 position_param, float2 uv_param, float3 normal_param, thread float3* const tint_symbol_9, thread float2* const tint_symbol_10, thread float3* const tint_symbol_11, thread float4* const tint_symbol_12, thread float2* const tint_symbol_13) { + *(tint_symbol_9) = position_param; + *(tint_symbol_10) = uv_param; + *(tint_symbol_11) = normal_param; + main_1(x_14, tint_symbol_9, tint_symbol_12, tint_symbol_10, tint_symbol_13); + main_out const tint_symbol_4 = {.gl_Position=*(tint_symbol_12), .vUV_1=*(tint_symbol_13)}; + return tint_symbol_4; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]], constant LeftOver& x_14 [[buffer(2)]]) { + thread float3 tint_symbol_14 = 0.0f; + thread float2 tint_symbol_15 = 0.0f; + thread float3 tint_symbol_16 = 0.0f; + thread float4 tint_symbol_17 = 0.0f; + thread float2 tint_symbol_18 = 0.0f; + main_out const inner_result = tint_symbol_inner(x_14, tint_symbol_1.position_param, tint_symbol_1.uv_param, tint_symbol_1.normal_param, &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_16), &(tint_symbol_17), &(tint_symbol_18)); + tint_symbol_3 wrapper_result = {}; + wrapper_result.gl_Position = inner_result.gl_Position; + wrapper_result.vUV_1 = inner_result.vUV_1; + return wrapper_result; } diff --git a/test/bug/tint/1088.spvasm.expected.spvasm b/test/bug/tint/1088.spvasm.expected.spvasm index aef2a82bc4..721a011a1d 100644 --- a/test/bug/tint/1088.spvasm.expected.spvasm +++ b/test/bug/tint/1088.spvasm.expected.spvasm @@ -1,13 +1,18 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 119 +; Bound: 121 ; Schema: 0 OpCapability Shader %74 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_1 %tint_symbol_2 %tint_symbol_4 %tint_symbol_5 - OpName %tint_pointsize "tint_pointsize" + OpEntryPoint Vertex %main "main" %position_param_1 %uv_param_1 %normal_param_1 %gl_Position_1 %vUV_1_1 %vertex_point_size + OpName %position_param_1 "position_param_1" + OpName %uv_param_1 "uv_param_1" + OpName %normal_param_1 "normal_param_1" + OpName %gl_Position_1 "gl_Position_1" + OpName %vUV_1_1 "vUV_1_1" + OpName %vertex_point_size "vertex_point_size" OpName %position "position" OpName %LeftOver "LeftOver" OpMemberName %LeftOver 0 "worldViewProjection" @@ -19,21 +24,23 @@ OpName %uv "uv" OpName %normal "normal" OpName %gl_Position "gl_Position" - OpName %tint_symbol "tint_symbol" - OpName %tint_symbol_1 "tint_symbol_1" - OpName %tint_symbol_2 "tint_symbol_2" - OpName %tint_symbol_4 "tint_symbol_4" - OpName %tint_symbol_5 "tint_symbol_5" OpName %main_1 "main_1" OpName %q "q" OpName %p "p" OpName %main_out "main_out" OpMemberName %main_out 0 "gl_Position" OpMemberName %main_out 1 "vUV_1" - OpName %tint_symbol_6 "tint_symbol_6" - OpName %tint_symbol_3 "tint_symbol_3" + OpName %main_inner "main_inner" + OpName %position_param "position_param" + OpName %uv_param "uv_param" + OpName %normal_param "normal_param" OpName %main "main" - OpDecorate %tint_pointsize BuiltIn PointSize + OpDecorate %position_param_1 Location 0 + OpDecorate %uv_param_1 Location 2 + OpDecorate %normal_param_1 Location 1 + OpDecorate %gl_Position_1 BuiltIn Position + OpDecorate %vUV_1_1 Location 0 + OpDecorate %vertex_point_size BuiltIn PointSize OpDecorate %LeftOver Block OpMemberDecorate %LeftOver 0 Offset 0 OpMemberDecorate %LeftOver 0 ColMajor @@ -48,22 +55,29 @@ OpDecorate %x_14 NonWritable OpDecorate %x_14 DescriptorSet 2 OpDecorate %x_14 Binding 2 - OpDecorate %tint_symbol Location 0 - OpDecorate %tint_symbol_1 Location 2 - OpDecorate %tint_symbol_2 Location 1 - OpDecorate %tint_symbol_4 BuiltIn Position - OpDecorate %tint_symbol_5 Location 0 OpMemberDecorate %main_out 0 Offset 0 OpMemberDecorate %main_out 1 Offset 16 %float = OpTypeFloat 32 -%_ptr_Output_float = OpTypePointer Output %float - %4 = OpConstantNull %float -%tint_pointsize = OpVariable %_ptr_Output_float Output %4 %v3float = OpTypeVector %float 3 -%_ptr_Private_v3float = OpTypePointer Private %v3float - %8 = OpConstantNull %v3float - %position = OpVariable %_ptr_Private_v3float Private %8 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%position_param_1 = OpVariable %_ptr_Input_v3float Input + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %uv_param_1 = OpVariable %_ptr_Input_v2float Input +%normal_param_1 = OpVariable %_ptr_Input_v3float Input %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %12 = OpConstantNull %v4float +%gl_Position_1 = OpVariable %_ptr_Output_v4float Output %12 +%_ptr_Output_v2float = OpTypePointer Output %v2float + %15 = OpConstantNull %v2float + %vUV_1_1 = OpVariable %_ptr_Output_v2float Output %15 +%_ptr_Output_float = OpTypePointer Output %float + %18 = OpConstantNull %float +%vertex_point_size = OpVariable %_ptr_Output_float Output %18 +%_ptr_Private_v3float = OpTypePointer Private %v3float + %21 = OpConstantNull %v3float + %position = OpVariable %_ptr_Private_v3float Private %21 %mat4v4float = OpTypeMatrix %v4float 4 %uint = OpTypeInt 32 0 %uint_2 = OpConstant %uint 2 @@ -73,24 +87,12 @@ %LeftOver = OpTypeStruct %mat4v4float %float %_arr_mat4v4float_uint_2 %_arr_float_uint_4 %_ptr_Uniform_LeftOver = OpTypePointer Uniform %LeftOver %x_14 = OpVariable %_ptr_Uniform_LeftOver Uniform - %v2float = OpTypeVector %float 2 %_ptr_Private_v2float = OpTypePointer Private %v2float - %22 = OpConstantNull %v2float - %vUV = OpVariable %_ptr_Private_v2float Private %22 - %uv = OpVariable %_ptr_Private_v2float Private %22 - %normal = OpVariable %_ptr_Private_v3float Private %8 + %vUV = OpVariable %_ptr_Private_v2float Private %15 + %uv = OpVariable %_ptr_Private_v2float Private %15 + %normal = OpVariable %_ptr_Private_v3float Private %21 %_ptr_Private_v4float = OpTypePointer Private %v4float - %27 = OpConstantNull %v4float -%gl_Position = OpVariable %_ptr_Private_v4float Private %27 -%_ptr_Input_v3float = OpTypePointer Input %v3float -%tint_symbol = OpVariable %_ptr_Input_v3float Input -%_ptr_Input_v2float = OpTypePointer Input %v2float -%tint_symbol_1 = OpVariable %_ptr_Input_v2float Input -%tint_symbol_2 = OpVariable %_ptr_Input_v3float Input -%_ptr_Output_v4float = OpTypePointer Output %v4float -%tint_symbol_4 = OpVariable %_ptr_Output_v4float Output %27 -%_ptr_Output_v2float = OpTypePointer Output %v2float -%tint_symbol_5 = OpVariable %_ptr_Output_v2float Output %22 +%gl_Position = OpVariable %_ptr_Private_v4float Private %12 %void = OpTypeVoid %37 = OpTypeFunction %void %_ptr_Function_v4float = OpTypePointer Function %v4float @@ -108,11 +110,11 @@ %_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float %float_n1 = OpConstant %float -1 %main_out = OpTypeStruct %v4float %v2float - %102 = OpTypeFunction %void %main_out + %102 = OpTypeFunction %main_out %v3float %v2float %v3float %main_1 = OpFunction %void None %37 %40 = OpLabel - %q = OpVariable %_ptr_Function_v4float Function %27 - %p = OpVariable %_ptr_Function_v3float Function %8 + %q = OpVariable %_ptr_Function_v4float Function %12 + %p = OpVariable %_ptr_Function_v3float Function %21 %45 = OpLoad %v3float %position %46 = OpCompositeExtract %float %45 0 %47 = OpCompositeExtract %float %45 1 @@ -166,28 +168,30 @@ OpStore %99 %101 OpReturn OpFunctionEnd -%tint_symbol_6 = OpFunction %void None %102 -%tint_symbol_3 = OpFunctionParameter %main_out - %106 = OpLabel - %107 = OpCompositeExtract %v4float %tint_symbol_3 0 - OpStore %tint_symbol_4 %107 - %108 = OpCompositeExtract %v2float %tint_symbol_3 1 - OpStore %tint_symbol_5 %108 - OpReturn + %main_inner = OpFunction %main_out None %102 +%position_param = OpFunctionParameter %v3float + %uv_param = OpFunctionParameter %v2float +%normal_param = OpFunctionParameter %v3float + %108 = OpLabel + OpStore %position %position_param + OpStore %uv %uv_param + OpStore %normal %normal_param + %109 = OpFunctionCall %void %main_1 + %110 = OpLoad %v4float %gl_Position + %111 = OpLoad %v2float %vUV + %112 = OpCompositeConstruct %main_out %110 %111 + OpReturnValue %112 OpFunctionEnd %main = OpFunction %void None %37 - %110 = OpLabel - OpStore %tint_pointsize %float_1 - %111 = OpLoad %v3float %tint_symbol - OpStore %position %111 - %112 = OpLoad %v2float %tint_symbol_1 - OpStore %uv %112 - %113 = OpLoad %v3float %tint_symbol_2 - OpStore %normal %113 - %114 = OpFunctionCall %void %main_1 - %116 = OpLoad %v4float %gl_Position - %117 = OpLoad %v2float %vUV - %118 = OpCompositeConstruct %main_out %116 %117 - %115 = OpFunctionCall %void %tint_symbol_6 %118 + %114 = OpLabel + %116 = OpLoad %v3float %position_param_1 + %117 = OpLoad %v2float %uv_param_1 + %118 = OpLoad %v3float %normal_param_1 + %115 = OpFunctionCall %main_out %main_inner %116 %117 %118 + %119 = OpCompositeExtract %v4float %115 0 + OpStore %gl_Position_1 %119 + %120 = OpCompositeExtract %v2float %115 1 + OpStore %vUV_1_1 %120 + OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd