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: 68
; Bound: 65
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" %tint_symbol
OpEntryPoint GLCompute %main "main" %idx_1
OpExecutionMode %main LocalSize 1 1 1
OpName %idx_1 "idx_1"
OpName %S "S"
OpMemberName %S 0 "arr"
OpName %Inner "Inner"
@@ -20,8 +21,10 @@
OpMemberName %Inner 7 "h"
OpMemberName %Inner 8 "i"
OpName %s "s"
OpName %tint_symbol "tint_symbol"
OpName %main_inner "main_inner"
OpName %idx "idx"
OpName %main "main"
OpDecorate %idx_1 BuiltIn LocalInvocationIndex
OpDecorate %S Block
OpMemberDecorate %S 0 Offset 0
OpMemberDecorate %Inner 0 Offset 0
@@ -42,10 +45,11 @@
OpDecorate %s NonWritable
OpDecorate %s Binding 0
OpDecorate %s DescriptorSet 0
OpDecorate %tint_symbol BuiltIn LocalInvocationIndex
%uint = OpTypeInt 32 0
%_ptr_Input_uint = OpTypePointer Input %uint
%idx_1 = OpVariable %_ptr_Input_uint Input
%int = OpTypeInt 32 1
%v3int = OpTypeVector %int 3
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
@@ -60,10 +64,8 @@
%S = OpTypeStruct %_runtimearr_Inner
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%s = OpVariable %_ptr_StorageBuffer_S StorageBuffer
%_ptr_Input_uint = OpTypePointer Input %uint
%tint_symbol = OpVariable %_ptr_Input_uint Input
%void = OpTypeVoid
%20 = OpTypeFunction %void
%20 = OpTypeFunction %void %uint
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_v3int = OpTypePointer StorageBuffer %v3int
%uint_1 = OpConstant %uint 1
@@ -81,34 +83,33 @@
%_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float
%uint_8 = OpConstant %uint 8
%_ptr_StorageBuffer__arr_v4int_uint_4 = OpTypePointer StorageBuffer %_arr_v4int_uint_4
%main = OpFunction %void None %20
%23 = OpLabel
%25 = OpLoad %uint %tint_symbol
%27 = OpAccessChain %_ptr_StorageBuffer_v3int %s %uint_0 %25 %uint_0
%60 = OpTypeFunction %void
%main_inner = OpFunction %void None %20
%idx = OpFunctionParameter %uint
%24 = OpLabel
%27 = OpAccessChain %_ptr_StorageBuffer_v3int %s %uint_0 %idx %uint_0
%28 = OpLoad %v3int %27
%29 = OpLoad %uint %tint_symbol
%32 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %29 %uint_1
%33 = OpLoad %int %32
%34 = OpLoad %uint %tint_symbol
%37 = OpAccessChain %_ptr_StorageBuffer_v3uint %s %uint_0 %34 %uint_2
%38 = OpLoad %v3uint %37
%39 = OpLoad %uint %tint_symbol
%42 = OpAccessChain %_ptr_StorageBuffer_uint %s %uint_0 %39 %uint_3
%43 = OpLoad %uint %42
%44 = OpLoad %uint %tint_symbol
%46 = OpAccessChain %_ptr_StorageBuffer_v3float %s %uint_0 %44 %uint_4
%47 = OpLoad %v3float %46
%48 = OpLoad %uint %tint_symbol
%51 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %48 %uint_5
%52 = OpLoad %float %51
%53 = OpLoad %uint %tint_symbol
%56 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %s %uint_0 %53 %uint_6
%57 = OpLoad %mat2v3float %56
%58 = OpLoad %uint %tint_symbol
%61 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %s %uint_0 %58 %uint_7
%62 = OpLoad %mat3v2float %61
%63 = OpLoad %uint %tint_symbol
%66 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %s %uint_0 %63 %uint_8
%67 = OpLoad %_arr_v4int_uint_4 %66
%31 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %idx %uint_1
%32 = OpLoad %int %31
%35 = OpAccessChain %_ptr_StorageBuffer_v3uint %s %uint_0 %idx %uint_2
%36 = OpLoad %v3uint %35
%39 = OpAccessChain %_ptr_StorageBuffer_uint %s %uint_0 %idx %uint_3
%40 = OpLoad %uint %39
%42 = OpAccessChain %_ptr_StorageBuffer_v3float %s %uint_0 %idx %uint_4
%43 = OpLoad %v3float %42
%46 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %idx %uint_5
%47 = OpLoad %float %46
%50 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %s %uint_0 %idx %uint_6
%51 = OpLoad %mat2v3float %50
%54 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %s %uint_0 %idx %uint_7
%55 = OpLoad %mat3v2float %54
%58 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %s %uint_0 %idx %uint_8
%59 = OpLoad %_arr_v4int_uint_4 %58
OpReturn
OpFunctionEnd
%main = OpFunction %void None %60
%62 = OpLabel
%64 = OpLoad %uint %idx_1
%63 = OpFunctionCall %void %main_inner %64
OpReturn
OpFunctionEnd

View File

@@ -1,12 +1,13 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 68
; Bound: 65
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" %tint_symbol
OpEntryPoint GLCompute %main "main" %idx_1
OpExecutionMode %main LocalSize 1 1 1
OpName %idx_1 "idx_1"
OpName %S "S"
OpMemberName %S 0 "arr"
OpName %Inner "Inner"
@@ -20,8 +21,10 @@
OpMemberName %Inner 7 "h"
OpMemberName %Inner 8 "i"
OpName %s "s"
OpName %tint_symbol "tint_symbol"
OpName %main_inner "main_inner"
OpName %idx "idx"
OpName %main "main"
OpDecorate %idx_1 BuiltIn LocalInvocationIndex
OpDecorate %S Block
OpMemberDecorate %S 0 Offset 0
OpMemberDecorate %Inner 0 Offset 0
@@ -41,10 +44,11 @@
OpDecorate %_runtimearr_Inner ArrayStride 176
OpDecorate %s Binding 0
OpDecorate %s DescriptorSet 0
OpDecorate %tint_symbol BuiltIn LocalInvocationIndex
%uint = OpTypeInt 32 0
%_ptr_Input_uint = OpTypePointer Input %uint
%idx_1 = OpVariable %_ptr_Input_uint Input
%int = OpTypeInt 32 1
%v3int = OpTypeVector %int 3
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
@@ -59,64 +63,61 @@
%S = OpTypeStruct %_runtimearr_Inner
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%s = OpVariable %_ptr_StorageBuffer_S StorageBuffer
%_ptr_Input_uint = OpTypePointer Input %uint
%tint_symbol = OpVariable %_ptr_Input_uint Input
%void = OpTypeVoid
%20 = OpTypeFunction %void
%20 = OpTypeFunction %void %uint
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_v3int = OpTypePointer StorageBuffer %v3int
%28 = OpConstantNull %v3int
%uint_1 = OpConstant %uint 1
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%33 = OpConstantNull %int
%32 = OpConstantNull %int
%uint_2 = OpConstant %uint 2
%_ptr_StorageBuffer_v3uint = OpTypePointer StorageBuffer %v3uint
%38 = OpConstantNull %v3uint
%36 = OpConstantNull %v3uint
%uint_3 = OpConstant %uint 3
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%43 = OpConstantNull %uint
%40 = OpConstantNull %uint
%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
%47 = OpConstantNull %v3float
%43 = OpConstantNull %v3float
%uint_5 = OpConstant %uint 5
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%52 = OpConstantNull %float
%47 = OpConstantNull %float
%uint_6 = OpConstant %uint 6
%_ptr_StorageBuffer_mat2v3float = OpTypePointer StorageBuffer %mat2v3float
%57 = OpConstantNull %mat2v3float
%51 = OpConstantNull %mat2v3float
%uint_7 = OpConstant %uint 7
%_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float
%62 = OpConstantNull %mat3v2float
%55 = OpConstantNull %mat3v2float
%uint_8 = OpConstant %uint 8
%_ptr_StorageBuffer__arr_v4int_uint_4 = OpTypePointer StorageBuffer %_arr_v4int_uint_4
%67 = OpConstantNull %_arr_v4int_uint_4
%main = OpFunction %void None %20
%23 = OpLabel
%25 = OpLoad %uint %tint_symbol
%27 = OpAccessChain %_ptr_StorageBuffer_v3int %s %uint_0 %25 %uint_0
%59 = OpConstantNull %_arr_v4int_uint_4
%60 = OpTypeFunction %void
%main_inner = OpFunction %void None %20
%idx = OpFunctionParameter %uint
%24 = OpLabel
%27 = OpAccessChain %_ptr_StorageBuffer_v3int %s %uint_0 %idx %uint_0
OpStore %27 %28
%29 = OpLoad %uint %tint_symbol
%32 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %29 %uint_1
OpStore %32 %33
%34 = OpLoad %uint %tint_symbol
%37 = OpAccessChain %_ptr_StorageBuffer_v3uint %s %uint_0 %34 %uint_2
OpStore %37 %38
%39 = OpLoad %uint %tint_symbol
%42 = OpAccessChain %_ptr_StorageBuffer_uint %s %uint_0 %39 %uint_3
%31 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %idx %uint_1
OpStore %31 %32
%35 = OpAccessChain %_ptr_StorageBuffer_v3uint %s %uint_0 %idx %uint_2
OpStore %35 %36
%39 = OpAccessChain %_ptr_StorageBuffer_uint %s %uint_0 %idx %uint_3
OpStore %39 %40
%42 = OpAccessChain %_ptr_StorageBuffer_v3float %s %uint_0 %idx %uint_4
OpStore %42 %43
%44 = OpLoad %uint %tint_symbol
%46 = OpAccessChain %_ptr_StorageBuffer_v3float %s %uint_0 %44 %uint_4
%46 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %idx %uint_5
OpStore %46 %47
%48 = OpLoad %uint %tint_symbol
%51 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %48 %uint_5
OpStore %51 %52
%53 = OpLoad %uint %tint_symbol
%56 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %s %uint_0 %53 %uint_6
OpStore %56 %57
%58 = OpLoad %uint %tint_symbol
%61 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %s %uint_0 %58 %uint_7
OpStore %61 %62
%63 = OpLoad %uint %tint_symbol
%66 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %s %uint_0 %63 %uint_8
OpStore %66 %67
%50 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %s %uint_0 %idx %uint_6
OpStore %50 %51
%54 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %s %uint_0 %idx %uint_7
OpStore %54 %55
%58 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %s %uint_0 %idx %uint_8
OpStore %58 %59
OpReturn
OpFunctionEnd
%main = OpFunction %void None %60
%62 = OpLabel
%64 = OpLoad %uint %idx_1
%63 = OpFunctionCall %void %main_inner %64
OpReturn
OpFunctionEnd

View File

@@ -1,12 +1,13 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 68
; Bound: 65
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" %tint_symbol
OpEntryPoint GLCompute %main "main" %idx_1
OpExecutionMode %main LocalSize 1 1 1
OpName %idx_1 "idx_1"
OpName %S "S"
OpMemberName %S 0 "arr"
OpName %Inner "Inner"
@@ -22,8 +23,10 @@
OpMemberName %Inner 9 "j"
OpMemberName %Inner 10 "k"
OpName %s "s"
OpName %tint_symbol "tint_symbol"
OpName %main_inner "main_inner"
OpName %idx "idx"
OpName %main "main"
OpDecorate %idx_1 BuiltIn LocalInvocationIndex
OpDecorate %S Block
OpMemberDecorate %S 0 Offset 0
OpMemberDecorate %Inner 0 Offset 0
@@ -46,10 +49,11 @@
OpDecorate %s NonWritable
OpDecorate %s Binding 0
OpDecorate %s DescriptorSet 0
OpDecorate %tint_symbol BuiltIn LocalInvocationIndex
%uint = OpTypeInt 32 0
%_ptr_Input_uint = OpTypePointer Input %uint
%idx_1 = OpVariable %_ptr_Input_uint Input
%int = OpTypeInt 32 1
%v3int = OpTypeVector %int 3
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
@@ -66,10 +70,8 @@
%S = OpTypeStruct %_arr_Inner_uint_8
%_ptr_Uniform_S = OpTypePointer Uniform %S
%s = OpVariable %_ptr_Uniform_S Uniform
%_ptr_Input_uint = OpTypePointer Input %uint
%tint_symbol = OpVariable %_ptr_Input_uint Input
%void = OpTypeVoid
%22 = OpTypeFunction %void
%22 = OpTypeFunction %void %uint
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_v3int = OpTypePointer Uniform %v3int
%uint_1 = OpConstant %uint 1
@@ -85,34 +87,33 @@
%_ptr_Uniform_v2int = OpTypePointer Uniform %v2int
%uint_7 = OpConstant %uint 7
%_ptr_Uniform_mat2v3float = OpTypePointer Uniform %mat2v3float
%main = OpFunction %void None %22
%25 = OpLabel
%27 = OpLoad %uint %tint_symbol
%29 = OpAccessChain %_ptr_Uniform_v3int %s %uint_0 %27 %uint_0
%60 = OpTypeFunction %void
%main_inner = OpFunction %void None %22
%idx = OpFunctionParameter %uint
%26 = OpLabel
%29 = OpAccessChain %_ptr_Uniform_v3int %s %uint_0 %idx %uint_0
%30 = OpLoad %v3int %29
%31 = OpLoad %uint %tint_symbol
%34 = OpAccessChain %_ptr_Uniform_int %s %uint_0 %31 %uint_1
%35 = OpLoad %int %34
%36 = OpLoad %uint %tint_symbol
%39 = OpAccessChain %_ptr_Uniform_v3uint %s %uint_0 %36 %uint_2
%40 = OpLoad %v3uint %39
%41 = OpLoad %uint %tint_symbol
%44 = OpAccessChain %_ptr_Uniform_uint %s %uint_0 %41 %uint_3
%45 = OpLoad %uint %44
%46 = OpLoad %uint %tint_symbol
%48 = OpAccessChain %_ptr_Uniform_v3float %s %uint_0 %46 %uint_4
%49 = OpLoad %v3float %48
%50 = OpLoad %uint %tint_symbol
%53 = OpAccessChain %_ptr_Uniform_float %s %uint_0 %50 %uint_5
%54 = OpLoad %float %53
%55 = OpLoad %uint %tint_symbol
%58 = OpAccessChain %_ptr_Uniform_v2int %s %uint_0 %55 %uint_6
%59 = OpLoad %v2int %58
%60 = OpLoad %uint %tint_symbol
%62 = OpAccessChain %_ptr_Uniform_v2int %s %uint_0 %60 %uint_7
%63 = OpLoad %v2int %62
%64 = OpLoad %uint %tint_symbol
%66 = OpAccessChain %_ptr_Uniform_mat2v3float %s %uint_0 %64 %uint_8
%67 = OpLoad %mat2v3float %66
%33 = OpAccessChain %_ptr_Uniform_int %s %uint_0 %idx %uint_1
%34 = OpLoad %int %33
%37 = OpAccessChain %_ptr_Uniform_v3uint %s %uint_0 %idx %uint_2
%38 = OpLoad %v3uint %37
%41 = OpAccessChain %_ptr_Uniform_uint %s %uint_0 %idx %uint_3
%42 = OpLoad %uint %41
%44 = OpAccessChain %_ptr_Uniform_v3float %s %uint_0 %idx %uint_4
%45 = OpLoad %v3float %44
%48 = OpAccessChain %_ptr_Uniform_float %s %uint_0 %idx %uint_5
%49 = OpLoad %float %48
%52 = OpAccessChain %_ptr_Uniform_v2int %s %uint_0 %idx %uint_6
%53 = OpLoad %v2int %52
%55 = OpAccessChain %_ptr_Uniform_v2int %s %uint_0 %idx %uint_7
%56 = OpLoad %v2int %55
%58 = OpAccessChain %_ptr_Uniform_mat2v3float %s %uint_0 %idx %uint_8
%59 = OpLoad %mat2v3float %58
OpReturn
OpFunctionEnd
%main = OpFunction %void None %60
%62 = OpLabel
%64 = OpLoad %uint %idx_1
%63 = OpFunctionCall %void %main_inner %64
OpReturn
OpFunctionEnd