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

@@ -7,21 +7,6 @@ struct Inner {
uint pad_2;
};
struct S {
ivec3 a;
int b;
uvec3 c;
uint d;
vec3 e;
float f;
ivec2 g;
ivec2 h;
mat2x3 i;
mat3x2 j;
Inner k;
Inner l[4];
};
layout(binding = 0, std140) uniform S_std140_ubo {
ivec3 a;
int b;

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 78
; Bound: 82
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -71,7 +71,7 @@
%uint_10 = OpConstant %uint 10
%uint_11 = OpConstant %uint 11
%void = OpTypeVoid
%31 = OpTypeFunction %void
%35 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_v3int = OpTypePointer Uniform %v3int
%uint_1 = OpConstant %uint 1
@@ -94,39 +94,39 @@
%_ptr_Uniform__arr_Inner_uint_4 = OpTypePointer Uniform %_arr_Inner_uint_4
%load_s_j = OpFunction %mat3v2float None %16
%19 = OpLabel
%22 = OpAccessChain %_ptr_Uniform_v2float %s %uint_9
%23 = OpLoad %v2float %22
%25 = OpAccessChain %_ptr_Uniform_v2float %s %uint_10
%26 = OpLoad %v2float %25
%28 = OpAccessChain %_ptr_Uniform_v2float %s %uint_11
%24 = OpAccessChain %_ptr_Uniform_v2float %s %uint_9
%25 = OpLoad %v2float %24
%28 = OpAccessChain %_ptr_Uniform_v2float %s %uint_10
%29 = OpLoad %v2float %28
%30 = OpCompositeConstruct %mat3v2float %23 %26 %29
OpReturnValue %30
%32 = OpAccessChain %_ptr_Uniform_v2float %s %uint_11
%33 = OpLoad %v2float %32
%34 = OpCompositeConstruct %mat3v2float %25 %29 %33
OpReturnValue %34
OpFunctionEnd
%main = OpFunction %void None %31
%34 = OpLabel
%37 = OpAccessChain %_ptr_Uniform_v3int %s %uint_0
%38 = OpLoad %v3int %37
%41 = OpAccessChain %_ptr_Uniform_int %s %uint_1
%42 = OpLoad %int %41
%45 = OpAccessChain %_ptr_Uniform_v3uint %s %uint_2
%46 = OpLoad %v3uint %45
%49 = OpAccessChain %_ptr_Uniform_uint %s %uint_3
%50 = OpLoad %uint %49
%52 = OpAccessChain %_ptr_Uniform_v3float %s %uint_4
%53 = OpLoad %v3float %52
%56 = OpAccessChain %_ptr_Uniform_float %s %uint_5
%57 = OpLoad %float %56
%60 = OpAccessChain %_ptr_Uniform_v2int %s %uint_6
%61 = OpLoad %v2int %60
%63 = OpAccessChain %_ptr_Uniform_v2int %s %uint_7
%64 = OpLoad %v2int %63
%67 = OpAccessChain %_ptr_Uniform_mat2v3float %s %uint_8
%68 = OpLoad %mat2v3float %67
%69 = OpFunctionCall %mat3v2float %load_s_j
%72 = OpAccessChain %_ptr_Uniform_Inner %s %uint_12
%73 = OpLoad %Inner %72
%76 = OpAccessChain %_ptr_Uniform__arr_Inner_uint_4 %s %uint_13
%77 = OpLoad %_arr_Inner_uint_4 %76
%main = OpFunction %void None %35
%38 = OpLabel
%41 = OpAccessChain %_ptr_Uniform_v3int %s %uint_0
%42 = OpLoad %v3int %41
%45 = OpAccessChain %_ptr_Uniform_int %s %uint_1
%46 = OpLoad %int %45
%49 = OpAccessChain %_ptr_Uniform_v3uint %s %uint_2
%50 = OpLoad %v3uint %49
%53 = OpAccessChain %_ptr_Uniform_uint %s %uint_3
%54 = OpLoad %uint %53
%56 = OpAccessChain %_ptr_Uniform_v3float %s %uint_4
%57 = OpLoad %v3float %56
%60 = OpAccessChain %_ptr_Uniform_float %s %uint_5
%61 = OpLoad %float %60
%64 = OpAccessChain %_ptr_Uniform_v2int %s %uint_6
%65 = OpLoad %v2int %64
%67 = OpAccessChain %_ptr_Uniform_v2int %s %uint_7
%68 = OpLoad %v2int %67
%71 = OpAccessChain %_ptr_Uniform_mat2v3float %s %uint_8
%72 = OpLoad %mat2v3float %71
%73 = OpFunctionCall %mat3v2float %load_s_j
%76 = OpAccessChain %_ptr_Uniform_Inner %s %uint_12
%77 = OpLoad %Inner %76
%80 = OpAccessChain %_ptr_Uniform__arr_Inner_uint_4 %s %uint_13
%81 = OpLoad %_arr_Inner_uint_4 %80
OpReturn
OpFunctionEnd