test: Add missing cases for UBO dynamic loads

Looks like a typo in the test cases I wrote.

Change-Id: Ieb4d8ce28827e47ab0baef7b1178395d97f90ace
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/69841
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Ben Clayton 2021-11-17 14:54:07 +00:00 committed by Tint LUCI CQ
parent bf7ec8f70b
commit 8085671ed2
5 changed files with 62 additions and 24 deletions

View File

@ -30,4 +30,6 @@ fn main([[builtin(local_invocation_index)]] idx : u32) {
let g = s.arr[idx].g; let g = s.arr[idx].g;
let h = s.arr[idx].h; let h = s.arr[idx].h;
let i = s.arr[idx].i; let i = s.arr[idx].i;
let j = s.arr[idx].j;
let k = s.arr[idx].k;
} }

View File

@ -12,26 +12,50 @@ float2x3 tint_symbol_9(uint4 buffer[96], uint offset) {
return float2x3(asfloat(buffer[scalar_offset / 4].xyz), asfloat(buffer[scalar_offset_1 / 4].xyz)); return float2x3(asfloat(buffer[scalar_offset / 4].xyz), asfloat(buffer[scalar_offset_1 / 4].xyz));
} }
float3x2 tint_symbol_10(uint4 buffer[96], uint offset) {
const uint scalar_offset_2 = ((offset + 0u)) / 4;
uint4 ubo_load = buffer[scalar_offset_2 / 4];
const uint scalar_offset_3 = ((offset + 8u)) / 4;
uint4 ubo_load_1 = buffer[scalar_offset_3 / 4];
const uint scalar_offset_4 = ((offset + 16u)) / 4;
uint4 ubo_load_2 = buffer[scalar_offset_4 / 4];
return float3x2(asfloat(((scalar_offset_2 & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_3 & 2) ? ubo_load_1.zw : ubo_load_1.xy)), asfloat(((scalar_offset_4 & 2) ? ubo_load_2.zw : ubo_load_2.xy)));
}
typedef int4 tint_symbol_12_ret[4];
tint_symbol_12_ret tint_symbol_12(uint4 buffer[96], uint offset) {
int4 arr_1[4] = (int4[4])0;
{
for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
const uint scalar_offset_5 = ((offset + (i_1 * 16u))) / 4;
arr_1[i_1] = asint(buffer[scalar_offset_5 / 4]);
}
}
return arr_1;
}
void main_inner(uint idx) { void main_inner(uint idx) {
const uint scalar_offset_2 = ((192u * idx)) / 4; const uint scalar_offset_6 = ((192u * idx)) / 4;
const int3 a = asint(s[scalar_offset_2 / 4].xyz); const int3 a = asint(s[scalar_offset_6 / 4].xyz);
const uint scalar_offset_3 = (((192u * idx) + 12u)) / 4; const uint scalar_offset_7 = (((192u * idx) + 12u)) / 4;
const int b = asint(s[scalar_offset_3 / 4][scalar_offset_3 % 4]); const int b = asint(s[scalar_offset_7 / 4][scalar_offset_7 % 4]);
const uint scalar_offset_4 = (((192u * idx) + 16u)) / 4; const uint scalar_offset_8 = (((192u * idx) + 16u)) / 4;
const uint3 c = s[scalar_offset_4 / 4].xyz; const uint3 c = s[scalar_offset_8 / 4].xyz;
const uint scalar_offset_5 = (((192u * idx) + 28u)) / 4; const uint scalar_offset_9 = (((192u * idx) + 28u)) / 4;
const uint d = s[scalar_offset_5 / 4][scalar_offset_5 % 4]; const uint d = s[scalar_offset_9 / 4][scalar_offset_9 % 4];
const uint scalar_offset_6 = (((192u * idx) + 32u)) / 4; const uint scalar_offset_10 = (((192u * idx) + 32u)) / 4;
const float3 e = asfloat(s[scalar_offset_6 / 4].xyz); const float3 e = asfloat(s[scalar_offset_10 / 4].xyz);
const uint scalar_offset_7 = (((192u * idx) + 44u)) / 4; const uint scalar_offset_11 = (((192u * idx) + 44u)) / 4;
const float f = asfloat(s[scalar_offset_7 / 4][scalar_offset_7 % 4]); const float f = asfloat(s[scalar_offset_11 / 4][scalar_offset_11 % 4]);
const uint scalar_offset_8 = (((192u * idx) + 48u)) / 4; const uint scalar_offset_12 = (((192u * idx) + 48u)) / 4;
uint4 ubo_load = s[scalar_offset_8 / 4]; uint4 ubo_load_3 = s[scalar_offset_12 / 4];
const int2 g = asint(((scalar_offset_8 & 2) ? ubo_load.zw : ubo_load.xy)); const int2 g = asint(((scalar_offset_12 & 2) ? ubo_load_3.zw : ubo_load_3.xy));
const uint scalar_offset_9 = (((192u * idx) + 56u)) / 4; const uint scalar_offset_13 = (((192u * idx) + 56u)) / 4;
uint4 ubo_load_1 = s[scalar_offset_9 / 4]; uint4 ubo_load_4 = s[scalar_offset_13 / 4];
const int2 h = asint(((scalar_offset_9 & 2) ? ubo_load_1.zw : ubo_load_1.xy)); const int2 h = asint(((scalar_offset_13 & 2) ? ubo_load_4.zw : ubo_load_4.xy));
const float2x3 i = tint_symbol_9(s, ((192u * idx) + 64u)); const float2x3 i = tint_symbol_9(s, ((192u * idx) + 64u));
const float3x2 j = tint_symbol_10(s, ((192u * idx) + 96u));
const int4 k[4] = tint_symbol_12(s, ((192u * idx) + 128u));
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]

View File

@ -46,6 +46,8 @@ void tint_symbol_inner(uint idx, const constant S* const tint_symbol_1) {
int2 const g = (*(tint_symbol_1)).arr.arr[idx].g; int2 const g = (*(tint_symbol_1)).arr.arr[idx].g;
int2 const h = (*(tint_symbol_1)).arr.arr[idx].h; int2 const h = (*(tint_symbol_1)).arr.arr[idx].h;
float2x3 const i = (*(tint_symbol_1)).arr.arr[idx].i; float2x3 const i = (*(tint_symbol_1)).arr.arr[idx].i;
float3x2 const j = (*(tint_symbol_1)).arr.arr[idx].j;
tint_array_wrapper const k = (*(tint_symbol_1)).arr.arr[idx].k;
} }
kernel void tint_symbol(const constant S* tint_symbol_2 [[buffer(0)]], uint idx [[thread_index_in_threadgroup]]) { kernel void tint_symbol(const constant S* tint_symbol_2 [[buffer(0)]], uint idx [[thread_index_in_threadgroup]]) {

View File

@ -1,7 +1,7 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 65 ; Bound: 73
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -87,7 +87,11 @@
%_ptr_Uniform_v2int = OpTypePointer Uniform %v2int %_ptr_Uniform_v2int = OpTypePointer Uniform %v2int
%uint_7 = OpConstant %uint 7 %uint_7 = OpConstant %uint 7
%_ptr_Uniform_mat2v3float = OpTypePointer Uniform %mat2v3float %_ptr_Uniform_mat2v3float = OpTypePointer Uniform %mat2v3float
%60 = OpTypeFunction %void %uint_9 = OpConstant %uint 9
%_ptr_Uniform_mat3v2float = OpTypePointer Uniform %mat3v2float
%uint_10 = OpConstant %uint 10
%_ptr_Uniform__arr_v4int_uint_4 = OpTypePointer Uniform %_arr_v4int_uint_4
%68 = OpTypeFunction %void
%main_inner = OpFunction %void None %22 %main_inner = OpFunction %void None %22
%idx = OpFunctionParameter %uint %idx = OpFunctionParameter %uint
%26 = OpLabel %26 = OpLabel
@ -109,11 +113,15 @@
%56 = OpLoad %v2int %55 %56 = OpLoad %v2int %55
%58 = OpAccessChain %_ptr_Uniform_mat2v3float %s %uint_0 %idx %uint_8 %58 = OpAccessChain %_ptr_Uniform_mat2v3float %s %uint_0 %idx %uint_8
%59 = OpLoad %mat2v3float %58 %59 = OpLoad %mat2v3float %58
%62 = OpAccessChain %_ptr_Uniform_mat3v2float %s %uint_0 %idx %uint_9
%63 = OpLoad %mat3v2float %62
%66 = OpAccessChain %_ptr_Uniform__arr_v4int_uint_4 %s %uint_0 %idx %uint_10
%67 = OpLoad %_arr_v4int_uint_4 %66
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%main = OpFunction %void None %60 %main = OpFunction %void None %68
%62 = OpLabel %70 = OpLabel
%64 = OpLoad %uint %idx_1 %72 = OpLoad %uint %idx_1
%63 = OpFunctionCall %void %main_inner %64 %71 = OpFunctionCall %void %main_inner %72
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -32,4 +32,6 @@ fn main([[builtin(local_invocation_index)]] idx : u32) {
let g = s.arr[idx].g; let g = s.arr[idx].g;
let h = s.arr[idx].h; let h = s.arr[idx].h;
let i = s.arr[idx].i; let i = s.arr[idx].i;
let j = s.arr[idx].j;
let k = s.arr[idx].k;
} }