tint/writer: Handle unnested, uniform matCx2 matrices

Shuffle the transform orders to ensure that these are embedded in a structure before running the Std140 transform.

Add more end-to-end tests for these.

As pointed out in tint:1673, arrays of matrices are not correctly decomposed by the Std140 transform.
This will be addressed by a later change.

Bug: tint:1673
Change-Id: I47c93e458ff48578922d576819792e8ed3a5723c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102541
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Zhaoming Jiang <zhaoming.jiang@intel.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
Ben Clayton
2022-09-17 00:38:19 +00:00
committed by Dawn LUCI CQ
parent 2bfd9f8c83
commit 84b43d61fa
406 changed files with 9658 additions and 2134 deletions

View File

@@ -11,6 +11,8 @@ struct Inner {
ivec2 h;
mat2x3 i;
mat3x2 j;
uint pad;
uint pad_1;
ivec4 k[4];
};
@@ -32,10 +34,6 @@ struct Inner_std140 {
ivec4 k[4];
};
struct S {
Inner arr[8];
};
layout(binding = 0, std140) uniform S_std140_ubo {
Inner_std140 arr[8];
} s;

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 86
; Bound: 92
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -76,12 +76,13 @@
%mat3v2float = OpTypeMatrix %v2float 3
%21 = OpTypeFunction %mat3v2float %uint
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_Inner_std140 = OpTypePointer Uniform %Inner_std140
%uint_9 = OpConstant %uint 9
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%uint_10 = OpConstant %uint 10
%uint_11 = OpConstant %uint 11
%void = OpTypeVoid
%38 = OpTypeFunction %void %uint
%44 = OpTypeFunction %void %uint
%_ptr_Uniform_v3int = OpTypePointer Uniform %v3int
%uint_1 = OpConstant %uint 1
%_ptr_Uniform_int = OpTypePointer Uniform %int
@@ -98,48 +99,49 @@
%_ptr_Uniform_mat2v3float = OpTypePointer Uniform %mat2v3float
%uint_12 = OpConstant %uint 12
%_ptr_Uniform__arr_v4int_uint_4 = OpTypePointer Uniform %_arr_v4int_uint_4
%81 = OpTypeFunction %void
%87 = OpTypeFunction %void
%load_s_arr_p0_j = OpFunction %mat3v2float None %21
%p0 = OpFunctionParameter %uint
%25 = OpLabel
%29 = OpAccessChain %_ptr_Uniform_v2float %s %uint_0 %p0 %uint_9
%30 = OpLoad %v2float %29
%32 = OpAccessChain %_ptr_Uniform_v2float %s %uint_0 %p0 %uint_10
%33 = OpLoad %v2float %32
%35 = OpAccessChain %_ptr_Uniform_v2float %s %uint_0 %p0 %uint_11
%36 = OpLoad %v2float %35
%37 = OpCompositeConstruct %mat3v2float %30 %33 %36
OpReturnValue %37
%29 = OpAccessChain %_ptr_Uniform_Inner_std140 %s %uint_0 %p0
%33 = OpAccessChain %_ptr_Uniform_v2float %29 %uint_9
%34 = OpLoad %v2float %33
%37 = OpAccessChain %_ptr_Uniform_v2float %29 %uint_10
%38 = OpLoad %v2float %37
%41 = OpAccessChain %_ptr_Uniform_v2float %29 %uint_11
%42 = OpLoad %v2float %41
%43 = OpCompositeConstruct %mat3v2float %34 %38 %42
OpReturnValue %43
OpFunctionEnd
%main_inner = OpFunction %void None %38
%main_inner = OpFunction %void None %44
%idx = OpFunctionParameter %uint
%42 = OpLabel
%44 = OpAccessChain %_ptr_Uniform_v3int %s %uint_0 %idx %uint_0
%45 = OpLoad %v3int %44
%48 = OpAccessChain %_ptr_Uniform_int %s %uint_0 %idx %uint_1
%49 = OpLoad %int %48
%52 = OpAccessChain %_ptr_Uniform_v3uint %s %uint_0 %idx %uint_2
%53 = OpLoad %v3uint %52
%56 = OpAccessChain %_ptr_Uniform_uint %s %uint_0 %idx %uint_3
%57 = OpLoad %uint %56
%59 = OpAccessChain %_ptr_Uniform_v3float %s %uint_0 %idx %uint_4
%60 = OpLoad %v3float %59
%63 = OpAccessChain %_ptr_Uniform_float %s %uint_0 %idx %uint_5
%64 = OpLoad %float %63
%67 = OpAccessChain %_ptr_Uniform_v2int %s %uint_0 %idx %uint_6
%68 = OpLoad %v2int %67
%70 = OpAccessChain %_ptr_Uniform_v2int %s %uint_0 %idx %uint_7
%71 = OpLoad %v2int %70
%73 = OpAccessChain %_ptr_Uniform_mat2v3float %s %uint_0 %idx %uint_8
%74 = OpLoad %mat2v3float %73
%75 = OpFunctionCall %mat3v2float %load_s_arr_p0_j %idx
%79 = OpAccessChain %_ptr_Uniform__arr_v4int_uint_4 %s %uint_0 %idx %uint_12
%80 = OpLoad %_arr_v4int_uint_4 %79
%48 = OpLabel
%50 = OpAccessChain %_ptr_Uniform_v3int %s %uint_0 %idx %uint_0
%51 = OpLoad %v3int %50
%54 = OpAccessChain %_ptr_Uniform_int %s %uint_0 %idx %uint_1
%55 = OpLoad %int %54
%58 = OpAccessChain %_ptr_Uniform_v3uint %s %uint_0 %idx %uint_2
%59 = OpLoad %v3uint %58
%62 = OpAccessChain %_ptr_Uniform_uint %s %uint_0 %idx %uint_3
%63 = OpLoad %uint %62
%65 = OpAccessChain %_ptr_Uniform_v3float %s %uint_0 %idx %uint_4
%66 = OpLoad %v3float %65
%69 = OpAccessChain %_ptr_Uniform_float %s %uint_0 %idx %uint_5
%70 = OpLoad %float %69
%73 = OpAccessChain %_ptr_Uniform_v2int %s %uint_0 %idx %uint_6
%74 = OpLoad %v2int %73
%76 = OpAccessChain %_ptr_Uniform_v2int %s %uint_0 %idx %uint_7
%77 = OpLoad %v2int %76
%79 = OpAccessChain %_ptr_Uniform_mat2v3float %s %uint_0 %idx %uint_8
%80 = OpLoad %mat2v3float %79
%81 = OpFunctionCall %mat3v2float %load_s_arr_p0_j %idx
%85 = OpAccessChain %_ptr_Uniform__arr_v4int_uint_4 %s %uint_0 %idx %uint_12
%86 = OpLoad %_arr_v4int_uint_4 %85
OpReturn
OpFunctionEnd
%main = OpFunction %void None %81
%83 = OpLabel
%85 = OpLoad %uint %idx_1
%84 = OpFunctionCall %void %main_inner %85
%main = OpFunction %void None %87
%89 = OpLabel
%91 = OpLoad %uint %idx_1
%90 = OpFunctionCall %void %main_inner %91
OpReturn
OpFunctionEnd