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: 204
; Bound: 203
; 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 "one"
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_68 "x_68"
OpName %x_29 "x_29"
@@ -40,8 +40,7 @@
OpName %x_22_1 "x_22_1"
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 %yieldsZero_ "yieldsZero_"
OpName %x_116 "x_116"
@@ -57,25 +56,25 @@
OpName %x_28_phi "x_28_phi"
OpName %x_26_phi "x_26_phi"
OpName %x_132_phi "x_132_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
OpDecorate %_arr_int_uint_10 ArrayStride 4
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
%buf0 = OpTypeStruct %float
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_8 = OpVariable %_ptr_Uniform_buf0 Uniform
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%8 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5
%void = OpTypeVoid
%11 = OpTypeFunction %void
%bool = OpTypeBool
@@ -106,8 +105,8 @@
%144 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%145 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
%main_out = OpTypeStruct %v4float
%146 = OpTypeFunction %void %main_out
%158 = OpTypeFunction %int
%146 = OpTypeFunction %main_out
%157 = OpTypeFunction %int
%main_1 = OpFunction %void None %11
%14 = OpLabel
%x_68 = OpVariable %_ptr_Function_bool Function %19
@@ -303,23 +302,22 @@
%139 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %146
%tint_symbol = OpFunctionParameter %main_out
%150 = OpLabel
%151 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %151
OpReturn
%main_inner = OpFunction %main_out None %146
%149 = OpLabel
%150 = OpFunctionCall %void %main_1
%151 = OpLoad %v4float %x_GLF_color
%152 = OpCompositeConstruct %main_out %151
OpReturnValue %152
OpFunctionEnd
%main = OpFunction %void None %11
%153 = OpLabel
%154 = OpFunctionCall %void %main_1
%156 = OpLoad %v4float %x_GLF_color
%157 = OpCompositeConstruct %main_out %156
%155 = OpFunctionCall %void %tint_symbol_2 %157
%154 = OpLabel
%155 = OpFunctionCall %main_out %main_inner
%156 = OpCompositeExtract %v4float %155 0
OpStore %x_GLF_color_1_1 %156
OpReturn
OpFunctionEnd
%yieldsZero_ = OpFunction %int None %158
%160 = OpLabel
%yieldsZero_ = OpFunction %int None %157
%159 = OpLabel
%x_116 = OpVariable %_ptr_Function_bool Function %19
%x_20 = OpVariable %_ptr_Function_int Function %23
%i = OpVariable %_ptr_Function_int Function %23
@@ -335,72 +333,72 @@
%x_132_phi = OpVariable %_ptr_Function_bool Function %19
OpStore %x_116 %false
OpStore %x_118_phi %false
OpBranch %168
%168 = OpLabel
OpLoopMerge %169 %170 None
OpBranch %171
%171 = OpLabel
%178 = OpLoad %bool %x_118_phi
OpBranch %167
%167 = OpLabel
OpLoopMerge %168 %169 None
OpBranch %170
%170 = OpLabel
%177 = OpLoad %bool %x_118_phi
OpStore %i %int_0
OpStore %x_123_phi %178
OpStore %x_123_phi %177
OpStore %x_28_phi %int_0
OpBranch %179
%179 = OpLabel
OpLoopMerge %180 %181 None
OpBranch %182
%182 = OpLabel
%183 = OpLoad %bool %x_123_phi
OpStore %x_123 %183
%184 = OpLoad %int %x_28_phi
OpStore %x_28 %184
%185 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0
%186 = OpLoad %float %185
OpStore %x_26_phi %int_0
%187 = OpLoad %bool %x_123
OpStore %x_132_phi %187
%188 = OpLoad %int %x_28
%189 = OpConvertFToS %int %186
%190 = OpSLessThan %bool %188 %189
OpSelectionMerge %191 None
OpBranchConditional %190 %192 %193
%192 = OpLabel
OpBranch %191
%193 = OpLabel
OpBranch %180
%191 = OpLabel
OpStore %x_116 %true
%194 = OpLoad %int %x_28
OpStore %x_20 %194
%195 = OpLoad %int %x_28
OpStore %x_26_phi %195
OpStore %x_132_phi %true
OpBranch %180
OpBranch %178
%178 = OpLabel
OpLoopMerge %179 %180 None
OpBranch %181
%181 = OpLabel
OpStore %x_123_phi %false
OpStore %x_28_phi %int_0
%182 = OpLoad %bool %x_123_phi
OpStore %x_123 %182
%183 = OpLoad %int %x_28_phi
OpStore %x_28 %183
%184 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0
%185 = OpLoad %float %184
OpStore %x_26_phi %int_0
%186 = OpLoad %bool %x_123
OpStore %x_132_phi %186
%187 = OpLoad %int %x_28
%188 = OpConvertFToS %int %185
%189 = OpSLessThan %bool %187 %188
OpSelectionMerge %190 None
OpBranchConditional %189 %191 %192
%191 = OpLabel
OpBranch %190
%192 = OpLabel
OpBranch %179
%190 = OpLabel
OpStore %x_116 %true
%193 = OpLoad %int %x_28
OpStore %x_20 %193
%194 = OpLoad %int %x_28
OpStore %x_26_phi %194
OpStore %x_132_phi %true
OpBranch %179
%180 = OpLabel
%196 = OpLoad %int %x_26_phi
OpStore %x_26 %196
%197 = OpLoad %bool %x_132_phi
%198 = OpLoad %int %x_26
OpStore %x_27_phi %198
OpSelectionMerge %199 None
OpBranchConditional %197 %200 %199
%200 = OpLabel
OpBranch %169
OpStore %x_123_phi %false
OpStore %x_28_phi %int_0
OpBranch %178
%179 = OpLabel
%195 = OpLoad %int %x_26_phi
OpStore %x_26 %195
%196 = OpLoad %bool %x_132_phi
%197 = OpLoad %int %x_26
OpStore %x_27_phi %197
OpSelectionMerge %198 None
OpBranchConditional %196 %199 %198
%199 = OpLabel
OpBranch %168
%198 = OpLabel
OpStore %x_134 %int_0
OpStore %x_116 %true
%200 = OpLoad %int %x_134
OpStore %x_20 %200
%201 = OpLoad %int %x_134
OpStore %x_20 %201
%202 = OpLoad %int %x_134
OpStore %x_27_phi %202
OpBranch %169
%170 = OpLabel
OpStore %x_118_phi %false
OpStore %x_27_phi %201
OpBranch %168
%169 = OpLabel
%203 = OpLoad %int %x_27_phi
OpReturnValue %203
OpStore %x_118_phi %false
OpBranch %167
%168 = OpLabel
%202 = OpLoad %int %x_27_phi
OpReturnValue %202
OpFunctionEnd

View File

@@ -1,17 +1,17 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 204
; Bound: 203
; 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 "one"
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_68 "x_68"
OpName %x_29 "x_29"
@@ -40,8 +40,7 @@
OpName %x_22_1 "x_22_1"
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 %yieldsZero_ "yieldsZero_"
OpName %x_116 "x_116"
@@ -57,25 +56,25 @@
OpName %x_28_phi "x_28_phi"
OpName %x_26_phi "x_26_phi"
OpName %x_132_phi "x_132_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
OpDecorate %_arr_int_uint_10 ArrayStride 4
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
%buf0 = OpTypeStruct %float
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_8 = OpVariable %_ptr_Uniform_buf0 Uniform
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%8 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5
%void = OpTypeVoid
%11 = OpTypeFunction %void
%bool = OpTypeBool
@@ -106,8 +105,8 @@
%144 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%145 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
%main_out = OpTypeStruct %v4float
%146 = OpTypeFunction %void %main_out
%158 = OpTypeFunction %int
%146 = OpTypeFunction %main_out
%157 = OpTypeFunction %int
%main_1 = OpFunction %void None %11
%14 = OpLabel
%x_68 = OpVariable %_ptr_Function_bool Function %19
@@ -303,23 +302,22 @@
%139 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %146
%tint_symbol = OpFunctionParameter %main_out
%150 = OpLabel
%151 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %151
OpReturn
%main_inner = OpFunction %main_out None %146
%149 = OpLabel
%150 = OpFunctionCall %void %main_1
%151 = OpLoad %v4float %x_GLF_color
%152 = OpCompositeConstruct %main_out %151
OpReturnValue %152
OpFunctionEnd
%main = OpFunction %void None %11
%153 = OpLabel
%154 = OpFunctionCall %void %main_1
%156 = OpLoad %v4float %x_GLF_color
%157 = OpCompositeConstruct %main_out %156
%155 = OpFunctionCall %void %tint_symbol_2 %157
%154 = OpLabel
%155 = OpFunctionCall %main_out %main_inner
%156 = OpCompositeExtract %v4float %155 0
OpStore %x_GLF_color_1_1 %156
OpReturn
OpFunctionEnd
%yieldsZero_ = OpFunction %int None %158
%160 = OpLabel
%yieldsZero_ = OpFunction %int None %157
%159 = OpLabel
%x_116 = OpVariable %_ptr_Function_bool Function %19
%x_20 = OpVariable %_ptr_Function_int Function %23
%i = OpVariable %_ptr_Function_int Function %23
@@ -335,72 +333,72 @@
%x_132_phi = OpVariable %_ptr_Function_bool Function %19
OpStore %x_116 %false
OpStore %x_118_phi %false
OpBranch %168
%168 = OpLabel
OpLoopMerge %169 %170 None
OpBranch %171
%171 = OpLabel
%178 = OpLoad %bool %x_118_phi
OpBranch %167
%167 = OpLabel
OpLoopMerge %168 %169 None
OpBranch %170
%170 = OpLabel
%177 = OpLoad %bool %x_118_phi
OpStore %i %int_0
OpStore %x_123_phi %178
OpStore %x_123_phi %177
OpStore %x_28_phi %int_0
OpBranch %179
%179 = OpLabel
OpLoopMerge %180 %181 None
OpBranch %182
%182 = OpLabel
%183 = OpLoad %bool %x_123_phi
OpStore %x_123 %183
%184 = OpLoad %int %x_28_phi
OpStore %x_28 %184
%185 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0
%186 = OpLoad %float %185
OpStore %x_26_phi %int_0
%187 = OpLoad %bool %x_123
OpStore %x_132_phi %187
%188 = OpLoad %int %x_28
%189 = OpConvertFToS %int %186
%190 = OpSLessThan %bool %188 %189
OpSelectionMerge %191 None
OpBranchConditional %190 %192 %193
%192 = OpLabel
OpBranch %191
%193 = OpLabel
OpBranch %180
%191 = OpLabel
OpStore %x_116 %true
%194 = OpLoad %int %x_28
OpStore %x_20 %194
%195 = OpLoad %int %x_28
OpStore %x_26_phi %195
OpStore %x_132_phi %true
OpBranch %180
OpBranch %178
%178 = OpLabel
OpLoopMerge %179 %180 None
OpBranch %181
%181 = OpLabel
OpStore %x_123_phi %false
OpStore %x_28_phi %int_0
%182 = OpLoad %bool %x_123_phi
OpStore %x_123 %182
%183 = OpLoad %int %x_28_phi
OpStore %x_28 %183
%184 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0
%185 = OpLoad %float %184
OpStore %x_26_phi %int_0
%186 = OpLoad %bool %x_123
OpStore %x_132_phi %186
%187 = OpLoad %int %x_28
%188 = OpConvertFToS %int %185
%189 = OpSLessThan %bool %187 %188
OpSelectionMerge %190 None
OpBranchConditional %189 %191 %192
%191 = OpLabel
OpBranch %190
%192 = OpLabel
OpBranch %179
%190 = OpLabel
OpStore %x_116 %true
%193 = OpLoad %int %x_28
OpStore %x_20 %193
%194 = OpLoad %int %x_28
OpStore %x_26_phi %194
OpStore %x_132_phi %true
OpBranch %179
%180 = OpLabel
%196 = OpLoad %int %x_26_phi
OpStore %x_26 %196
%197 = OpLoad %bool %x_132_phi
%198 = OpLoad %int %x_26
OpStore %x_27_phi %198
OpSelectionMerge %199 None
OpBranchConditional %197 %200 %199
%200 = OpLabel
OpBranch %169
OpStore %x_123_phi %false
OpStore %x_28_phi %int_0
OpBranch %178
%179 = OpLabel
%195 = OpLoad %int %x_26_phi
OpStore %x_26 %195
%196 = OpLoad %bool %x_132_phi
%197 = OpLoad %int %x_26
OpStore %x_27_phi %197
OpSelectionMerge %198 None
OpBranchConditional %196 %199 %198
%199 = OpLabel
OpBranch %168
%198 = OpLabel
OpStore %x_134 %int_0
OpStore %x_116 %true
%200 = OpLoad %int %x_134
OpStore %x_20 %200
%201 = OpLoad %int %x_134
OpStore %x_20 %201
%202 = OpLoad %int %x_134
OpStore %x_27_phi %202
OpBranch %169
%170 = OpLabel
OpStore %x_118_phi %false
OpStore %x_27_phi %201
OpBranch %168
%169 = OpLabel
%203 = OpLoad %int %x_27_phi
OpReturnValue %203
OpStore %x_118_phi %false
OpBranch %167
%168 = OpLabel
%202 = OpLoad %int %x_27_phi
OpReturnValue %202
OpFunctionEnd