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,12 +1,13 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 52
; Bound: 57
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f" %tint_symbol
OpEntryPoint GLCompute %f "f" %local_invocation_index_1
OpExecutionMode %f LocalSize 1 1 1
OpName %local_invocation_index_1 "local_invocation_index_1"
OpName %UBO "UBO"
OpMemberName %UBO 0 "dynamic_idx"
OpName %ubo "ubo"
@@ -16,9 +17,11 @@
OpName %S "S"
OpMemberName %S 0 "data"
OpName %s "s"
OpName %tint_symbol "tint_symbol"
OpName %f "f"
OpName %f_inner "f_inner"
OpName %local_invocation_index "local_invocation_index"
OpName %idx "idx"
OpName %f "f"
OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
OpDecorate %UBO Block
OpMemberDecorate %UBO 0 Offset 0
OpDecorate %ubo NonWritable
@@ -30,7 +33,9 @@
OpDecorate %result Binding 1
OpMemberDecorate %S 0 Offset 0
OpDecorate %_arr_int_uint_64 ArrayStride 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
%UBO = OpTypeStruct %int
%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO
@@ -38,16 +43,13 @@
%Result = OpTypeStruct %int
%_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result
%result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer
%uint = OpTypeInt 32 0
%uint_64 = OpConstant %uint 64
%_arr_int_uint_64 = OpTypeArray %int %uint_64
%S = OpTypeStruct %_arr_int_uint_64
%_ptr_Workgroup_S = OpTypePointer Workgroup %S
%s = OpVariable %_ptr_Workgroup_S Workgroup
%_ptr_Input_uint = OpTypePointer Input %uint
%tint_symbol = OpVariable %_ptr_Input_uint Input
%void = OpTypeVoid
%16 = OpTypeFunction %void
%16 = OpTypeFunction %void %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%23 = OpConstantNull %uint
%bool = OpTypeBool
@@ -59,11 +61,12 @@
%uint_264 = OpConstant %uint 264
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_Uniform_int = OpTypePointer Uniform %int
%f = OpFunction %void None %16
%19 = OpLabel
%52 = OpTypeFunction %void
%f_inner = OpFunction %void None %16
%local_invocation_index = OpFunctionParameter %uint
%20 = OpLabel
%idx = OpVariable %_ptr_Function_uint Function %23
%20 = OpLoad %uint %tint_symbol
OpStore %idx %20
OpStore %idx %local_invocation_index
OpBranch %24
%24 = OpLabel
OpLoopMerge %25 %26 None
@@ -96,3 +99,9 @@
OpStore %46 %51
OpReturn
OpFunctionEnd
%f = OpFunction %void None %52
%54 = OpLabel
%56 = OpLoad %uint %local_invocation_index_1
%55 = OpFunctionCall %void %f_inner %56
OpReturn
OpFunctionEnd

View File

@@ -1,12 +1,13 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 55
; Bound: 60
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f" %tint_symbol
OpEntryPoint GLCompute %f "f" %local_invocation_index_1
OpExecutionMode %f LocalSize 1 1 1
OpName %local_invocation_index_1 "local_invocation_index_1"
OpName %UBO "UBO"
OpMemberName %UBO 0 "dynamic_idx"
OpName %ubo "ubo"
@@ -16,9 +17,11 @@
OpName %S "S"
OpMemberName %S 0 "data"
OpName %s "s"
OpName %tint_symbol "tint_symbol"
OpName %f "f"
OpName %f_inner "f_inner"
OpName %local_invocation_index "local_invocation_index"
OpName %idx "idx"
OpName %f "f"
OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
OpDecorate %UBO Block
OpMemberDecorate %UBO 0 Offset 0
OpDecorate %ubo NonWritable
@@ -30,7 +33,9 @@
OpDecorate %result Binding 1
OpMemberDecorate %S 0 Offset 0
OpDecorate %_arr_int_uint_64 ArrayStride 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
%UBO = OpTypeStruct %int
%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO
@@ -38,16 +43,13 @@
%Result = OpTypeStruct %int
%_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result
%result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer
%uint = OpTypeInt 32 0
%uint_64 = OpConstant %uint 64
%_arr_int_uint_64 = OpTypeArray %int %uint_64
%S = OpTypeStruct %_arr_int_uint_64
%_ptr_Workgroup_S = OpTypePointer Workgroup %S
%s = OpVariable %_ptr_Workgroup_S Workgroup
%_ptr_Input_uint = OpTypePointer Input %uint
%tint_symbol = OpVariable %_ptr_Input_uint Input
%void = OpTypeVoid
%16 = OpTypeFunction %void
%16 = OpTypeFunction %void %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%23 = OpConstantNull %uint
%bool = OpTypeBool
@@ -61,11 +63,12 @@
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%int_3 = OpConstant %int 3
%f = OpFunction %void None %16
%19 = OpLabel
%55 = OpTypeFunction %void
%f_inner = OpFunction %void None %16
%local_invocation_index = OpFunctionParameter %uint
%20 = OpLabel
%idx = OpVariable %_ptr_Function_uint Function %23
%20 = OpLoad %uint %tint_symbol
OpStore %idx %20
OpStore %idx %local_invocation_index
OpBranch %24
%24 = OpLabel
OpLoopMerge %25 %26 None
@@ -100,3 +103,9 @@
OpStore %51 %54
OpReturn
OpFunctionEnd
%f = OpFunction %void None %55
%57 = OpLabel
%59 = OpLoad %uint %local_invocation_index_1
%58 = OpFunctionCall %void %f_inner %59
OpReturn
OpFunctionEnd