spirv: Use generic transform to process shader IO

The refactored CanonicalizeEntryPointIO transform makes it much easier
to handle SPIR-V style IO as well, and doing this removes a lot of
duplicated code. Remove all of the SPIR-V transform code for shader IO
and vertex point size.

Bug: tint:920
Change-Id: Id1b97517619b4d2fd09b45d5aee848259f3dfa77
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/60840
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
James Price
2021-08-05 17:34:19 +00:00
committed by Tint LUCI CQ
parent 11e172ab64
commit 11c6fcdb51
1981 changed files with 55207 additions and 57171 deletions

View File

@@ -1,17 +1,17 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 122
; Bound: 121
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol_1
OpEntryPoint Fragment %main "main" %x_GLF_color_1_1
OpExecutionMode %main OriginUpperLeft
OpName %x_GLF_color_1_1 "x_GLF_color_1_1"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "zero"
OpName %x_8 "x_8"
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main_1 "main_1"
OpName %x_50 "x_50"
OpName %x_15 "x_15"
@@ -25,8 +25,7 @@
OpName %x_63_phi "x_63_phi"
OpName %main_out "main_out"
OpMemberName %main_out 0 "x_GLF_color_1"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %tint_symbol "tint_symbol"
OpName %main_inner "main_inner"
OpName %main "main"
OpName %func_struct_Array_i1_2_1_ "func_struct_Array_i1_2_1_"
OpName %a "a"
@@ -39,26 +38,26 @@
OpName %x_77_phi "x_77_phi"
OpName %x_13_phi "x_13_phi"
OpName %x_87_phi "x_87_phi"
OpDecorate %x_GLF_color_1_1 Location 0
OpDecorate %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %x_8 NonWritable
OpDecorate %x_8 DescriptorSet 0
OpDecorate %x_8 Binding 0
OpDecorate %tint_symbol_1 Location 0
OpMemberDecorate %Array 0 Offset 0
OpDecorate %_arr_int_uint_2 ArrayStride 4
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%x_GLF_color_1_1 = OpVariable %_ptr_Output_v4float Output %5
%int = OpTypeInt 32 1
%buf0 = OpTypeStruct %int
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_8 = OpVariable %_ptr_Uniform_buf0 Uniform
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%9 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5
%void = OpTypeVoid
%12 = OpTypeFunction %void
%bool = OpTypeBool
@@ -85,8 +84,8 @@
%70 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%71 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
%main_out = OpTypeStruct %v4float
%72 = OpTypeFunction %void %main_out
%84 = OpTypeFunction %int %_ptr_Function_Array
%72 = OpTypeFunction %main_out
%83 = OpTypeFunction %int %_ptr_Function_Array
%main_1 = OpFunction %void None %12
%15 = OpLabel
%x_50 = OpVariable %_ptr_Function_bool Function %20
@@ -161,24 +160,23 @@
%65 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %72
%tint_symbol = OpFunctionParameter %main_out
%76 = OpLabel
%77 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %77
OpReturn
%main_inner = OpFunction %main_out None %72
%75 = OpLabel
%76 = OpFunctionCall %void %main_1
%77 = OpLoad %v4float %x_GLF_color
%78 = OpCompositeConstruct %main_out %77
OpReturnValue %78
OpFunctionEnd
%main = OpFunction %void None %12
%79 = OpLabel
%80 = OpFunctionCall %void %main_1
%82 = OpLoad %v4float %x_GLF_color
%83 = OpCompositeConstruct %main_out %82
%81 = OpFunctionCall %void %tint_symbol_2 %83
%80 = OpLabel
%81 = OpFunctionCall %main_out %main_inner
%82 = OpCompositeExtract %v4float %81 0
OpStore %x_GLF_color_1_1 %82
OpReturn
OpFunctionEnd
%func_struct_Array_i1_2_1_ = OpFunction %int None %84
%func_struct_Array_i1_2_1_ = OpFunction %int None %83
%a = OpFunctionParameter %_ptr_Function_Array
%87 = OpLabel
%86 = OpLabel
%x_70 = OpVariable %_ptr_Function_bool Function %20
%x_12 = OpVariable %_ptr_Function_int Function %23
%x_13 = OpVariable %_ptr_Function_int Function %23
@@ -190,60 +188,60 @@
%x_87_phi = OpVariable %_ptr_Function_bool Function %20
OpStore %x_70 %false
OpStore %x_72_phi %false
OpBranch %93
%93 = OpLabel
OpLoopMerge %94 %95 None
OpBranch %96
%96 = OpLabel
%101 = OpLoad %bool %x_72_phi
OpStore %x_77_phi %101
OpBranch %102
%102 = OpLabel
OpLoopMerge %103 %104 None
OpBranch %105
%105 = OpLabel
%106 = OpLoad %bool %x_77_phi
OpStore %x_77 %106
%107 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0
%108 = OpLoad %int %107
%110 = OpAccessChain %_ptr_Function_int %a %uint_0 %108
%111 = OpLoad %int %110
%112 = OpIEqual %bool %111 %int_1
OpSelectionMerge %113 None
OpBranchConditional %112 %114 %113
%114 = OpLabel
OpBranch %92
%92 = OpLabel
OpLoopMerge %93 %94 None
OpBranch %95
%95 = OpLabel
%100 = OpLoad %bool %x_72_phi
OpStore %x_77_phi %100
OpBranch %101
%101 = OpLabel
OpLoopMerge %102 %103 None
OpBranch %104
%104 = OpLabel
%105 = OpLoad %bool %x_77_phi
OpStore %x_77 %105
%106 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0
%107 = OpLoad %int %106
%109 = OpAccessChain %_ptr_Function_int %a %uint_0 %107
%110 = OpLoad %int %109
%111 = OpIEqual %bool %110 %int_1
OpSelectionMerge %112 None
OpBranchConditional %111 %113 %112
%113 = OpLabel
OpStore %x_70 %true
OpStore %x_12 %int_1
OpStore %x_13_phi %int_1
OpStore %x_87_phi %true
OpBranch %103
%113 = OpLabel
OpBranch %102
%112 = OpLabel
OpStore %x_13_phi %int_0
%115 = OpLoad %bool %x_77
OpStore %x_87_phi %115
OpBranch %103
%104 = OpLabel
OpStore %x_77_phi %false
%114 = OpLoad %bool %x_77
OpStore %x_87_phi %114
OpBranch %102
%103 = OpLabel
%116 = OpLoad %int %x_13_phi
OpStore %x_13 %116
%117 = OpLoad %bool %x_87_phi
%118 = OpLoad %int %x_13
OpStore %x_14_phi %118
OpSelectionMerge %119 None
OpBranchConditional %117 %120 %119
%120 = OpLabel
OpBranch %94
OpStore %x_77_phi %false
OpBranch %101
%102 = OpLabel
%115 = OpLoad %int %x_13_phi
OpStore %x_13 %115
%116 = OpLoad %bool %x_87_phi
%117 = OpLoad %int %x_13
OpStore %x_14_phi %117
OpSelectionMerge %118 None
OpBranchConditional %116 %119 %118
%119 = OpLabel
OpBranch %93
%118 = OpLabel
OpStore %x_70 %true
OpStore %x_12 %int_1
OpStore %x_14_phi %int_1
OpBranch %94
%95 = OpLabel
OpStore %x_72_phi %false
OpBranch %93
%94 = OpLabel
%121 = OpLoad %int %x_14_phi
OpReturnValue %121
OpStore %x_72_phi %false
OpBranch %92
%93 = OpLabel
%120 = OpLoad %int %x_14_phi
OpReturnValue %120
OpFunctionEnd

View File

@@ -1,17 +1,17 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 122
; Bound: 121
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol_1
OpEntryPoint Fragment %main "main" %x_GLF_color_1_1
OpExecutionMode %main OriginUpperLeft
OpName %x_GLF_color_1_1 "x_GLF_color_1_1"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "zero"
OpName %x_8 "x_8"
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main_1 "main_1"
OpName %x_50 "x_50"
OpName %x_15 "x_15"
@@ -25,8 +25,7 @@
OpName %x_63_phi "x_63_phi"
OpName %main_out "main_out"
OpMemberName %main_out 0 "x_GLF_color_1"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %tint_symbol "tint_symbol"
OpName %main_inner "main_inner"
OpName %main "main"
OpName %func_struct_Array_i1_2_1_ "func_struct_Array_i1_2_1_"
OpName %a "a"
@@ -39,26 +38,26 @@
OpName %x_77_phi "x_77_phi"
OpName %x_13_phi "x_13_phi"
OpName %x_87_phi "x_87_phi"
OpDecorate %x_GLF_color_1_1 Location 0
OpDecorate %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %x_8 NonWritable
OpDecorate %x_8 DescriptorSet 0
OpDecorate %x_8 Binding 0
OpDecorate %tint_symbol_1 Location 0
OpMemberDecorate %Array 0 Offset 0
OpDecorate %_arr_int_uint_2 ArrayStride 4
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%x_GLF_color_1_1 = OpVariable %_ptr_Output_v4float Output %5
%int = OpTypeInt 32 1
%buf0 = OpTypeStruct %int
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_8 = OpVariable %_ptr_Uniform_buf0 Uniform
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%9 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5
%void = OpTypeVoid
%12 = OpTypeFunction %void
%bool = OpTypeBool
@@ -85,8 +84,8 @@
%70 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%71 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
%main_out = OpTypeStruct %v4float
%72 = OpTypeFunction %void %main_out
%84 = OpTypeFunction %int %_ptr_Function_Array
%72 = OpTypeFunction %main_out
%83 = OpTypeFunction %int %_ptr_Function_Array
%main_1 = OpFunction %void None %12
%15 = OpLabel
%x_50 = OpVariable %_ptr_Function_bool Function %20
@@ -161,24 +160,23 @@
%65 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %72
%tint_symbol = OpFunctionParameter %main_out
%76 = OpLabel
%77 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %77
OpReturn
%main_inner = OpFunction %main_out None %72
%75 = OpLabel
%76 = OpFunctionCall %void %main_1
%77 = OpLoad %v4float %x_GLF_color
%78 = OpCompositeConstruct %main_out %77
OpReturnValue %78
OpFunctionEnd
%main = OpFunction %void None %12
%79 = OpLabel
%80 = OpFunctionCall %void %main_1
%82 = OpLoad %v4float %x_GLF_color
%83 = OpCompositeConstruct %main_out %82
%81 = OpFunctionCall %void %tint_symbol_2 %83
%80 = OpLabel
%81 = OpFunctionCall %main_out %main_inner
%82 = OpCompositeExtract %v4float %81 0
OpStore %x_GLF_color_1_1 %82
OpReturn
OpFunctionEnd
%func_struct_Array_i1_2_1_ = OpFunction %int None %84
%func_struct_Array_i1_2_1_ = OpFunction %int None %83
%a = OpFunctionParameter %_ptr_Function_Array
%87 = OpLabel
%86 = OpLabel
%x_70 = OpVariable %_ptr_Function_bool Function %20
%x_12 = OpVariable %_ptr_Function_int Function %23
%x_13 = OpVariable %_ptr_Function_int Function %23
@@ -190,60 +188,60 @@
%x_87_phi = OpVariable %_ptr_Function_bool Function %20
OpStore %x_70 %false
OpStore %x_72_phi %false
OpBranch %93
%93 = OpLabel
OpLoopMerge %94 %95 None
OpBranch %96
%96 = OpLabel
%101 = OpLoad %bool %x_72_phi
OpStore %x_77_phi %101
OpBranch %102
%102 = OpLabel
OpLoopMerge %103 %104 None
OpBranch %105
%105 = OpLabel
%106 = OpLoad %bool %x_77_phi
OpStore %x_77 %106
%107 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0
%108 = OpLoad %int %107
%110 = OpAccessChain %_ptr_Function_int %a %uint_0 %108
%111 = OpLoad %int %110
%112 = OpIEqual %bool %111 %int_1
OpSelectionMerge %113 None
OpBranchConditional %112 %114 %113
%114 = OpLabel
OpBranch %92
%92 = OpLabel
OpLoopMerge %93 %94 None
OpBranch %95
%95 = OpLabel
%100 = OpLoad %bool %x_72_phi
OpStore %x_77_phi %100
OpBranch %101
%101 = OpLabel
OpLoopMerge %102 %103 None
OpBranch %104
%104 = OpLabel
%105 = OpLoad %bool %x_77_phi
OpStore %x_77 %105
%106 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0
%107 = OpLoad %int %106
%109 = OpAccessChain %_ptr_Function_int %a %uint_0 %107
%110 = OpLoad %int %109
%111 = OpIEqual %bool %110 %int_1
OpSelectionMerge %112 None
OpBranchConditional %111 %113 %112
%113 = OpLabel
OpStore %x_70 %true
OpStore %x_12 %int_1
OpStore %x_13_phi %int_1
OpStore %x_87_phi %true
OpBranch %103
%113 = OpLabel
OpBranch %102
%112 = OpLabel
OpStore %x_13_phi %int_0
%115 = OpLoad %bool %x_77
OpStore %x_87_phi %115
OpBranch %103
%104 = OpLabel
OpStore %x_77_phi %false
%114 = OpLoad %bool %x_77
OpStore %x_87_phi %114
OpBranch %102
%103 = OpLabel
%116 = OpLoad %int %x_13_phi
OpStore %x_13 %116
%117 = OpLoad %bool %x_87_phi
%118 = OpLoad %int %x_13
OpStore %x_14_phi %118
OpSelectionMerge %119 None
OpBranchConditional %117 %120 %119
%120 = OpLabel
OpBranch %94
OpStore %x_77_phi %false
OpBranch %101
%102 = OpLabel
%115 = OpLoad %int %x_13_phi
OpStore %x_13 %115
%116 = OpLoad %bool %x_87_phi
%117 = OpLoad %int %x_13
OpStore %x_14_phi %117
OpSelectionMerge %118 None
OpBranchConditional %116 %119 %118
%119 = OpLabel
OpBranch %93
%118 = OpLabel
OpStore %x_70 %true
OpStore %x_12 %int_1
OpStore %x_14_phi %int_1
OpBranch %94
%95 = OpLabel
OpStore %x_72_phi %false
OpBranch %93
%94 = OpLabel
%121 = OpLoad %int %x_14_phi
OpReturnValue %121
OpStore %x_72_phi %false
OpBranch %92
%93 = OpLabel
%120 = OpLoad %int %x_14_phi
OpReturnValue %120
OpFunctionEnd