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,28 +1,30 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 39
; Bound: 44
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" %tint_symbol
OpEntryPoint GLCompute %main "main" %local_invocation_index_1
OpExecutionMode %main LocalSize 1 1 1
OpName %local_invocation_index_1 "local_invocation_index_1"
OpName %v "v"
OpName %tint_symbol "tint_symbol"
OpName %main "main"
OpName %main_inner "main_inner"
OpName %local_invocation_index "local_invocation_index"
OpName %idx "idx"
OpName %main "main"
OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
OpDecorate %_arr_int_uint_3 ArrayStride 4
OpDecorate %tint_symbol BuiltIn LocalInvocationIndex
%int = OpTypeInt 32 1
%uint = OpTypeInt 32 0
%_ptr_Input_uint = OpTypePointer Input %uint
%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
%int = OpTypeInt 32 1
%uint_3 = OpConstant %uint 3
%_arr_int_uint_3 = OpTypeArray %int %uint_3
%_ptr_Workgroup__arr_int_uint_3 = OpTypePointer Workgroup %_arr_int_uint_3
%v = OpVariable %_ptr_Workgroup__arr_int_uint_3 Workgroup
%_ptr_Input_uint = OpTypePointer Input %uint
%tint_symbol = OpVariable %_ptr_Input_uint Input
%void = OpTypeVoid
%9 = OpTypeFunction %void
%9 = OpTypeFunction %void %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%16 = OpConstantNull %uint
%bool = OpTypeBool
@@ -31,11 +33,12 @@
%uint_1 = OpConstant %uint 1
%uint_2 = OpConstant %uint 2
%uint_264 = OpConstant %uint 264
%main = OpFunction %void None %9
%12 = OpLabel
%39 = OpTypeFunction %void
%main_inner = OpFunction %void None %9
%local_invocation_index = OpFunctionParameter %uint
%13 = OpLabel
%idx = OpVariable %_ptr_Function_uint Function %16
%13 = OpLoad %uint %tint_symbol
OpStore %idx %13
OpStore %idx %local_invocation_index
OpBranch %17
%17 = OpLabel
OpLoopMerge %18 %19 None
@@ -63,3 +66,9 @@
%38 = OpLoad %_arr_int_uint_3 %v
OpReturn
OpFunctionEnd
%main = OpFunction %void None %39
%41 = OpLabel
%43 = OpLoad %uint %local_invocation_index_1
%42 = OpFunctionCall %void %main_inner %43
OpReturn
OpFunctionEnd

View File

@@ -1,33 +1,43 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 19
; Bound: 25
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpEntryPoint GLCompute %main "main" %local_invocation_index_1
OpExecutionMode %main LocalSize 1 1 1
OpName %local_invocation_index_1 "local_invocation_index_1"
OpName %v "v"
OpName %tint_symbol "tint_symbol"
OpName %main_inner "main_inner"
OpName %local_invocation_index "local_invocation_index"
OpName %main "main"
OpDecorate %tint_symbol BuiltIn LocalInvocationIndex
OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
%uint = OpTypeInt 32 0
%_ptr_Input_uint = OpTypePointer Input %uint
%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat2v3float = OpTypeMatrix %v3float 2
%_ptr_Workgroup_mat2v3float = OpTypePointer Workgroup %mat2v3float
%v = OpVariable %_ptr_Workgroup_mat2v3float Workgroup
%uint = OpTypeInt 32 0
%_ptr_Input_uint = OpTypePointer Input %uint
%tint_symbol = OpVariable %_ptr_Input_uint Input
%void = OpTypeVoid
%9 = OpTypeFunction %void
%13 = OpConstantNull %mat2v3float
%9 = OpTypeFunction %void %uint
%14 = OpConstantNull %mat2v3float
%uint_2 = OpConstant %uint 2
%uint_264 = OpConstant %uint 264
%main = OpFunction %void None %9
%12 = OpLabel
OpStore %v %13
%20 = OpTypeFunction %void
%main_inner = OpFunction %void None %9
%local_invocation_index = OpFunctionParameter %uint
%13 = OpLabel
OpStore %v %14
OpControlBarrier %uint_2 %uint_2 %uint_264
%18 = OpLoad %mat2v3float %v
%19 = OpLoad %mat2v3float %v
OpReturn
OpFunctionEnd
%main = OpFunction %void None %20
%22 = OpLabel
%24 = OpLoad %uint %local_invocation_index_1
%23 = OpFunctionCall %void %main_inner %24
OpReturn
OpFunctionEnd

View File

@@ -1,31 +1,41 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 17
; Bound: 23
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpEntryPoint GLCompute %main "main" %local_invocation_index_1
OpExecutionMode %main LocalSize 1 1 1
OpName %local_invocation_index_1 "local_invocation_index_1"
OpName %v "v"
OpName %tint_symbol "tint_symbol"
OpName %main_inner "main_inner"
OpName %local_invocation_index "local_invocation_index"
OpName %main "main"
OpDecorate %tint_symbol BuiltIn LocalInvocationIndex
OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
%uint = OpTypeInt 32 0
%_ptr_Input_uint = OpTypePointer Input %uint
%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
%int = OpTypeInt 32 1
%_ptr_Workgroup_int = OpTypePointer Workgroup %int
%v = OpVariable %_ptr_Workgroup_int Workgroup
%uint = OpTypeInt 32 0
%_ptr_Input_uint = OpTypePointer Input %uint
%tint_symbol = OpVariable %_ptr_Input_uint Input
%void = OpTypeVoid
%7 = OpTypeFunction %void
%11 = OpConstantNull %int
%7 = OpTypeFunction %void %uint
%12 = OpConstantNull %int
%uint_2 = OpConstant %uint 2
%uint_264 = OpConstant %uint 264
%main = OpFunction %void None %7
%10 = OpLabel
OpStore %v %11
%18 = OpTypeFunction %void
%main_inner = OpFunction %void None %7
%local_invocation_index = OpFunctionParameter %uint
%11 = OpLabel
OpStore %v %12
OpControlBarrier %uint_2 %uint_2 %uint_264
%16 = OpLoad %int %v
%17 = OpLoad %int %v
OpReturn
OpFunctionEnd
%main = OpFunction %void None %18
%20 = OpLabel
%22 = OpLoad %uint %local_invocation_index_1
%21 = OpFunctionCall %void %main_inner %22
OpReturn
OpFunctionEnd

View File

@@ -1,38 +1,48 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 19
; Bound: 25
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpEntryPoint GLCompute %main "main" %local_invocation_index_1
OpExecutionMode %main LocalSize 1 1 1
OpName %local_invocation_index_1 "local_invocation_index_1"
OpName %S "S"
OpMemberName %S 0 "a"
OpMemberName %S 1 "b"
OpName %v "v"
OpName %tint_symbol "tint_symbol"
OpName %main_inner "main_inner"
OpName %local_invocation_index "local_invocation_index"
OpName %main "main"
OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
OpMemberDecorate %S 0 Offset 0
OpMemberDecorate %S 1 Offset 4
OpDecorate %tint_symbol BuiltIn LocalInvocationIndex
%uint = OpTypeInt 32 0
%_ptr_Input_uint = OpTypePointer Input %uint
%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
%int = OpTypeInt 32 1
%float = OpTypeFloat 32
%S = OpTypeStruct %int %float
%_ptr_Workgroup_S = OpTypePointer Workgroup %S
%v = OpVariable %_ptr_Workgroup_S Workgroup
%uint = OpTypeInt 32 0
%_ptr_Input_uint = OpTypePointer Input %uint
%tint_symbol = OpVariable %_ptr_Input_uint Input
%void = OpTypeVoid
%9 = OpTypeFunction %void
%13 = OpConstantNull %S
%9 = OpTypeFunction %void %uint
%14 = OpConstantNull %S
%uint_2 = OpConstant %uint 2
%uint_264 = OpConstant %uint 264
%main = OpFunction %void None %9
%12 = OpLabel
OpStore %v %13
%20 = OpTypeFunction %void
%main_inner = OpFunction %void None %9
%local_invocation_index = OpFunctionParameter %uint
%13 = OpLabel
OpStore %v %14
OpControlBarrier %uint_2 %uint_2 %uint_264
%18 = OpLoad %S %v
%19 = OpLoad %S %v
OpReturn
OpFunctionEnd
%main = OpFunction %void None %20
%22 = OpLabel
%24 = OpLoad %uint %local_invocation_index_1
%23 = OpFunctionCall %void %main_inner %24
OpReturn
OpFunctionEnd

View File

@@ -1,32 +1,42 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 18
; Bound: 24
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpEntryPoint GLCompute %main "main" %local_invocation_index_1
OpExecutionMode %main LocalSize 1 1 1
OpName %local_invocation_index_1 "local_invocation_index_1"
OpName %v "v"
OpName %tint_symbol "tint_symbol"
OpName %main_inner "main_inner"
OpName %local_invocation_index "local_invocation_index"
OpName %main "main"
OpDecorate %tint_symbol BuiltIn LocalInvocationIndex
OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
%uint = OpTypeInt 32 0
%_ptr_Input_uint = OpTypePointer Input %uint
%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
%int = OpTypeInt 32 1
%v3int = OpTypeVector %int 3
%_ptr_Workgroup_v3int = OpTypePointer Workgroup %v3int
%v = OpVariable %_ptr_Workgroup_v3int Workgroup
%uint = OpTypeInt 32 0
%_ptr_Input_uint = OpTypePointer Input %uint
%tint_symbol = OpVariable %_ptr_Input_uint Input
%void = OpTypeVoid
%8 = OpTypeFunction %void
%12 = OpConstantNull %v3int
%8 = OpTypeFunction %void %uint
%13 = OpConstantNull %v3int
%uint_2 = OpConstant %uint 2
%uint_264 = OpConstant %uint 264
%main = OpFunction %void None %8
%11 = OpLabel
OpStore %v %12
%19 = OpTypeFunction %void
%main_inner = OpFunction %void None %8
%local_invocation_index = OpFunctionParameter %uint
%12 = OpLabel
OpStore %v %13
OpControlBarrier %uint_2 %uint_2 %uint_264
%17 = OpLoad %v3int %v
%18 = OpLoad %v3int %v
OpReturn
OpFunctionEnd
%main = OpFunction %void None %19
%21 = OpLabel
%23 = OpLoad %uint %local_invocation_index_1
%22 = OpFunctionCall %void %main_inner %23
OpReturn
OpFunctionEnd