tint/transform/std140: Correctly handle nested / bare matrices

Fixed tint:1673
Fixed tint:1674

Change-Id: Ifa5d2a69131cc1e4679d4d43143f857c7ba46dbd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102640
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Ben Clayton
2022-09-17 01:47:59 +00:00
committed by Dawn LUCI CQ
parent 84b43d61fa
commit 90b29e500a
67 changed files with 3714 additions and 919 deletions

View File

@@ -1,7 +1,12 @@
#version 310 es
layout(binding = 0, std140) uniform a_block_ubo {
mat2 inner[4];
struct mat2x2_f32 {
vec2 col0;
vec2 col1;
};
layout(binding = 0, std140) uniform a_block_std140_ubo {
mat2x2_f32 inner[4];
} a;
int counter = 0;
@@ -10,14 +15,46 @@ int i() {
return counter;
}
mat2 conv_mat2x2_f32(mat2x2_f32 val) {
return mat2(val.col0, val.col1);
}
mat2[4] conv_arr4_mat2x2_f32(mat2x2_f32 val[4]) {
mat2 arr[4] = mat2[4](mat2(0.0f, 0.0f, 0.0f, 0.0f), mat2(0.0f, 0.0f, 0.0f, 0.0f), mat2(0.0f, 0.0f, 0.0f, 0.0f), mat2(0.0f, 0.0f, 0.0f, 0.0f));
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
arr[i] = conv_mat2x2_f32(val[i]);
}
}
return arr;
}
vec2 load_a_inner_p0_p1(uint p0, uint p1) {
switch(p1) {
case 0u: {
return a.inner[p0].col0;
break;
}
case 1u: {
return a.inner[p0].col1;
break;
}
default: {
return vec2(0.0f);
break;
}
}
}
void f() {
mat2 p_a[4] = conv_arr4_mat2x2_f32(a.inner);
int tint_symbol = i();
int p_a_i_save = tint_symbol;
mat2 p_a_i = conv_mat2x2_f32(a.inner[tint_symbol]);
int tint_symbol_1 = i();
int p_a_i_i_save = tint_symbol_1;
mat2 l_a[4] = a.inner;
mat2 l_a_i = a.inner[p_a_i_save];
vec2 l_a_i_i = a.inner[p_a_i_save][p_a_i_i_save];
vec2 p_a_i_i = load_a_inner_p0_p1(uint(tint_symbol), uint(tint_symbol_1));
mat2 l_a[4] = conv_arr4_mat2x2_f32(a.inner);
mat2 l_a_i = conv_mat2x2_f32(a.inner[tint_symbol]);
vec2 l_a_i_i = load_a_inner_p0_p1(uint(tint_symbol), uint(tint_symbol_1));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@@ -1,47 +1,77 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 37
; Bound: 98
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %a_block "a_block"
OpMemberName %a_block 0 "inner"
OpName %a_block_std140 "a_block_std140"
OpMemberName %a_block_std140 0 "inner"
OpName %mat2x2_f32 "mat2x2_f32"
OpMemberName %mat2x2_f32 0 "col0"
OpMemberName %mat2x2_f32 1 "col1"
OpName %a "a"
OpName %counter "counter"
OpName %i "i"
OpName %conv_mat2x2_f32 "conv_mat2x2_f32"
OpName %val "val"
OpName %conv_arr4_mat2x2_f32 "conv_arr4_mat2x2_f32"
OpName %val_0 "val"
OpName %arr "arr"
OpName %i_0 "i"
OpName %var_for_index "var_for_index"
OpName %load_a_inner_p0_p1 "load_a_inner_p0_p1"
OpName %p0 "p0"
OpName %p1 "p1"
OpName %f "f"
OpDecorate %a_block Block
OpMemberDecorate %a_block 0 Offset 0
OpMemberDecorate %a_block 0 ColMajor
OpMemberDecorate %a_block 0 MatrixStride 8
OpDecorate %_arr_mat2v2float_uint_4 ArrayStride 16
OpDecorate %a_block_std140 Block
OpMemberDecorate %a_block_std140 0 Offset 0
OpMemberDecorate %mat2x2_f32 0 Offset 0
OpMemberDecorate %mat2x2_f32 1 Offset 8
OpDecorate %_arr_mat2x2_f32_uint_4 ArrayStride 16
OpDecorate %a NonWritable
OpDecorate %a DescriptorSet 0
OpDecorate %a Binding 0
OpDecorate %_arr_mat2v2float_uint_4 ArrayStride 16
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat2v2float = OpTypeMatrix %v2float 2
%mat2x2_f32 = OpTypeStruct %v2float %v2float
%uint = OpTypeInt 32 0
%uint_4 = OpConstant %uint 4
%_arr_mat2v2float_uint_4 = OpTypeArray %mat2v2float %uint_4
%a_block = OpTypeStruct %_arr_mat2v2float_uint_4
%_ptr_Uniform_a_block = OpTypePointer Uniform %a_block
%a = OpVariable %_ptr_Uniform_a_block Uniform
%_arr_mat2x2_f32_uint_4 = OpTypeArray %mat2x2_f32 %uint_4
%a_block_std140 = OpTypeStruct %_arr_mat2x2_f32_uint_4
%_ptr_Uniform_a_block_std140 = OpTypePointer Uniform %a_block_std140
%a = OpVariable %_ptr_Uniform_a_block_std140 Uniform
%int = OpTypeInt 32 1
%11 = OpConstantNull %int
%_ptr_Private_int = OpTypePointer Private %int
%counter = OpVariable %_ptr_Private_int Private %11
%14 = OpTypeFunction %int
%int_1 = OpConstant %int 1
%void = OpTypeVoid
%21 = OpTypeFunction %void
%mat2v2float = OpTypeMatrix %v2float 2
%21 = OpTypeFunction %mat2v2float %mat2x2_f32
%_arr_mat2v2float_uint_4 = OpTypeArray %mat2v2float %uint_4
%29 = OpTypeFunction %_arr_mat2v2float_uint_4 %_arr_mat2x2_f32_uint_4
%_ptr_Function__arr_mat2v2float_uint_4 = OpTypePointer Function %_arr_mat2v2float_uint_4
%36 = OpConstantNull %_arr_mat2v2float_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%39 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_mat2x2_f32_uint_4 = OpTypePointer Function %_arr_mat2x2_f32_uint_4
%52 = OpConstantNull %_arr_mat2x2_f32_uint_4
%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float
%_ptr_Function_mat2x2_f32 = OpTypePointer Function %mat2x2_f32
%uint_1 = OpConstant %uint 1
%65 = OpTypeFunction %v2float %uint %uint
%uint_0 = OpConstant %uint 0
%_ptr_Uniform__arr_mat2v2float_uint_4 = OpTypePointer Uniform %_arr_mat2v2float_uint_4
%_ptr_Uniform_mat2v2float = OpTypePointer Uniform %mat2v2float
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%80 = OpConstantNull %v2float
%void = OpTypeVoid
%81 = OpTypeFunction %void
%_ptr_Uniform__arr_mat2x2_f32_uint_4 = OpTypePointer Uniform %_arr_mat2x2_f32_uint_4
%_ptr_Uniform_mat2x2_f32 = OpTypePointer Uniform %mat2x2_f32
%i = OpFunction %int None %14
%16 = OpLabel
%17 = OpLoad %int %counter
@@ -50,15 +80,82 @@
%20 = OpLoad %int %counter
OpReturnValue %20
OpFunctionEnd
%f = OpFunction %void None %21
%24 = OpLabel
%25 = OpFunctionCall %int %i
%26 = OpFunctionCall %int %i
%29 = OpAccessChain %_ptr_Uniform__arr_mat2v2float_uint_4 %a %uint_0
%30 = OpLoad %_arr_mat2v2float_uint_4 %29
%32 = OpAccessChain %_ptr_Uniform_mat2v2float %a %uint_0 %25
%33 = OpLoad %mat2v2float %32
%35 = OpAccessChain %_ptr_Uniform_v2float %a %uint_0 %25 %26
%36 = OpLoad %v2float %35
%conv_mat2x2_f32 = OpFunction %mat2v2float None %21
%val = OpFunctionParameter %mat2x2_f32
%25 = OpLabel
%26 = OpCompositeExtract %v2float %val 0
%27 = OpCompositeExtract %v2float %val 1
%28 = OpCompositeConstruct %mat2v2float %26 %27
OpReturnValue %28
OpFunctionEnd
%conv_arr4_mat2x2_f32 = OpFunction %_arr_mat2v2float_uint_4 None %29
%val_0 = OpFunctionParameter %_arr_mat2x2_f32_uint_4
%33 = OpLabel
%arr = OpVariable %_ptr_Function__arr_mat2v2float_uint_4 Function %36
%i_0 = OpVariable %_ptr_Function_uint Function %39
%var_for_index = OpVariable %_ptr_Function__arr_mat2x2_f32_uint_4 Function %52
OpBranch %40
%40 = OpLabel
OpLoopMerge %41 %42 None
OpBranch %43
%43 = OpLabel
%45 = OpLoad %uint %i_0
%46 = OpULessThan %bool %45 %uint_4
%44 = OpLogicalNot %bool %46
OpSelectionMerge %48 None
OpBranchConditional %44 %49 %48
%49 = OpLabel
OpBranch %41
%48 = OpLabel
OpStore %var_for_index %val_0
%53 = OpLoad %uint %i_0
%55 = OpAccessChain %_ptr_Function_mat2v2float %arr %53
%57 = OpLoad %uint %i_0
%59 = OpAccessChain %_ptr_Function_mat2x2_f32 %var_for_index %57
%60 = OpLoad %mat2x2_f32 %59
%56 = OpFunctionCall %mat2v2float %conv_mat2x2_f32 %60
OpStore %55 %56
OpBranch %42
%42 = OpLabel
%61 = OpLoad %uint %i_0
%63 = OpIAdd %uint %61 %uint_1
OpStore %i_0 %63
OpBranch %40
%41 = OpLabel
%64 = OpLoad %_arr_mat2v2float_uint_4 %arr
OpReturnValue %64
OpFunctionEnd
%load_a_inner_p0_p1 = OpFunction %v2float None %65
%p0 = OpFunctionParameter %uint
%p1 = OpFunctionParameter %uint
%69 = OpLabel
OpSelectionMerge %70 None
OpSwitch %p1 %71 0 %72 1 %73
%72 = OpLabel
%76 = OpAccessChain %_ptr_Uniform_v2float %a %uint_0 %p0 %uint_0
%77 = OpLoad %v2float %76
OpReturnValue %77
%73 = OpLabel
%78 = OpAccessChain %_ptr_Uniform_v2float %a %uint_0 %p0 %uint_1
%79 = OpLoad %v2float %78
OpReturnValue %79
%71 = OpLabel
OpReturnValue %80
%70 = OpLabel
OpReturnValue %80
OpFunctionEnd
%f = OpFunction %void None %81
%84 = OpLabel
%85 = OpFunctionCall %int %i
%86 = OpFunctionCall %int %i
%89 = OpAccessChain %_ptr_Uniform__arr_mat2x2_f32_uint_4 %a %uint_0
%90 = OpLoad %_arr_mat2x2_f32_uint_4 %89
%87 = OpFunctionCall %_arr_mat2v2float_uint_4 %conv_arr4_mat2x2_f32 %90
%93 = OpAccessChain %_ptr_Uniform_mat2x2_f32 %a %uint_0 %85
%94 = OpLoad %mat2x2_f32 %93
%91 = OpFunctionCall %mat2v2float %conv_mat2x2_f32 %94
%96 = OpBitcast %uint %85
%97 = OpBitcast %uint %86
%95 = OpFunctionCall %v2float %load_a_inner_p0_p1 %96 %97
OpReturn
OpFunctionEnd

View File

@@ -1,13 +1,35 @@
#version 310 es
layout(binding = 0, std140) uniform a_block_ubo {
mat2 inner[4];
struct mat2x2_f32 {
vec2 col0;
vec2 col1;
};
layout(binding = 0, std140) uniform a_block_std140_ubo {
mat2x2_f32 inner[4];
} a;
mat2 conv_mat2x2_f32(mat2x2_f32 val) {
return mat2(val.col0, val.col1);
}
mat2[4] conv_arr4_mat2x2_f32(mat2x2_f32 val[4]) {
mat2 arr[4] = mat2[4](mat2(0.0f, 0.0f, 0.0f, 0.0f), mat2(0.0f, 0.0f, 0.0f, 0.0f), mat2(0.0f, 0.0f, 0.0f, 0.0f), mat2(0.0f, 0.0f, 0.0f, 0.0f));
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
arr[i] = conv_mat2x2_f32(val[i]);
}
}
return arr;
}
void f() {
mat2 l_a[4] = a.inner;
mat2 l_a_i = a.inner[2];
vec2 l_a_i_i = a.inner[2][1];
mat2 p_a[4] = conv_arr4_mat2x2_f32(a.inner);
mat2 p_a_2 = conv_mat2x2_f32(a.inner[2u]);
vec2 p_a_2_1 = a.inner[2u].col1;
mat2 l_a[4] = conv_arr4_mat2x2_f32(a.inner);
mat2 l_a_i = conv_mat2x2_f32(a.inner[2u]);
vec2 l_a_i_i = a.inner[2u].col1;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@@ -1,49 +1,119 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 27
; Bound: 71
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %a_block "a_block"
OpMemberName %a_block 0 "inner"
OpName %a_block_std140 "a_block_std140"
OpMemberName %a_block_std140 0 "inner"
OpName %mat2x2_f32 "mat2x2_f32"
OpMemberName %mat2x2_f32 0 "col0"
OpMemberName %mat2x2_f32 1 "col1"
OpName %a "a"
OpName %conv_mat2x2_f32 "conv_mat2x2_f32"
OpName %val "val"
OpName %conv_arr4_mat2x2_f32 "conv_arr4_mat2x2_f32"
OpName %val_0 "val"
OpName %arr "arr"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %f "f"
OpDecorate %a_block Block
OpMemberDecorate %a_block 0 Offset 0
OpMemberDecorate %a_block 0 ColMajor
OpMemberDecorate %a_block 0 MatrixStride 8
OpDecorate %_arr_mat2v2float_uint_4 ArrayStride 16
OpDecorate %a_block_std140 Block
OpMemberDecorate %a_block_std140 0 Offset 0
OpMemberDecorate %mat2x2_f32 0 Offset 0
OpMemberDecorate %mat2x2_f32 1 Offset 8
OpDecorate %_arr_mat2x2_f32_uint_4 ArrayStride 16
OpDecorate %a NonWritable
OpDecorate %a DescriptorSet 0
OpDecorate %a Binding 0
OpDecorate %_arr_mat2v2float_uint_4 ArrayStride 16
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat2v2float = OpTypeMatrix %v2float 2
%mat2x2_f32 = OpTypeStruct %v2float %v2float
%uint = OpTypeInt 32 0
%uint_4 = OpConstant %uint 4
%_arr_mat2x2_f32_uint_4 = OpTypeArray %mat2x2_f32 %uint_4
%a_block_std140 = OpTypeStruct %_arr_mat2x2_f32_uint_4
%_ptr_Uniform_a_block_std140 = OpTypePointer Uniform %a_block_std140
%a = OpVariable %_ptr_Uniform_a_block_std140 Uniform
%mat2v2float = OpTypeMatrix %v2float 2
%10 = OpTypeFunction %mat2v2float %mat2x2_f32
%_arr_mat2v2float_uint_4 = OpTypeArray %mat2v2float %uint_4
%a_block = OpTypeStruct %_arr_mat2v2float_uint_4
%_ptr_Uniform_a_block = OpTypePointer Uniform %a_block
%a = OpVariable %_ptr_Uniform_a_block Uniform
%18 = OpTypeFunction %_arr_mat2v2float_uint_4 %_arr_mat2x2_f32_uint_4
%_ptr_Function__arr_mat2v2float_uint_4 = OpTypePointer Function %_arr_mat2v2float_uint_4
%25 = OpConstantNull %_arr_mat2v2float_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%28 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_mat2x2_f32_uint_4 = OpTypePointer Function %_arr_mat2x2_f32_uint_4
%41 = OpConstantNull %_arr_mat2x2_f32_uint_4
%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float
%_ptr_Function_mat2x2_f32 = OpTypePointer Function %mat2x2_f32
%uint_1 = OpConstant %uint 1
%void = OpTypeVoid
%10 = OpTypeFunction %void
%54 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0
%_ptr_Uniform__arr_mat2v2float_uint_4 = OpTypePointer Uniform %_arr_mat2v2float_uint_4
%int = OpTypeInt 32 1
%int_2 = OpConstant %int 2
%_ptr_Uniform_mat2v2float = OpTypePointer Uniform %mat2v2float
%int_1 = OpConstant %int 1
%_ptr_Uniform__arr_mat2x2_f32_uint_4 = OpTypePointer Uniform %_arr_mat2x2_f32_uint_4
%uint_2 = OpConstant %uint 2
%_ptr_Uniform_mat2x2_f32 = OpTypePointer Uniform %mat2x2_f32
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%f = OpFunction %void None %10
%13 = OpLabel
%16 = OpAccessChain %_ptr_Uniform__arr_mat2v2float_uint_4 %a %uint_0
%17 = OpLoad %_arr_mat2v2float_uint_4 %16
%21 = OpAccessChain %_ptr_Uniform_mat2v2float %a %uint_0 %int_2
%22 = OpLoad %mat2v2float %21
%25 = OpAccessChain %_ptr_Uniform_v2float %a %uint_0 %int_2 %int_1
%26 = OpLoad %v2float %25
%conv_mat2x2_f32 = OpFunction %mat2v2float None %10
%val = OpFunctionParameter %mat2x2_f32
%14 = OpLabel
%15 = OpCompositeExtract %v2float %val 0
%16 = OpCompositeExtract %v2float %val 1
%17 = OpCompositeConstruct %mat2v2float %15 %16
OpReturnValue %17
OpFunctionEnd
%conv_arr4_mat2x2_f32 = OpFunction %_arr_mat2v2float_uint_4 None %18
%val_0 = OpFunctionParameter %_arr_mat2x2_f32_uint_4
%22 = OpLabel
%arr = OpVariable %_ptr_Function__arr_mat2v2float_uint_4 Function %25
%i = OpVariable %_ptr_Function_uint Function %28
%var_for_index = OpVariable %_ptr_Function__arr_mat2x2_f32_uint_4 Function %41
OpBranch %29
%29 = OpLabel
OpLoopMerge %30 %31 None
OpBranch %32
%32 = OpLabel
%34 = OpLoad %uint %i
%35 = OpULessThan %bool %34 %uint_4
%33 = OpLogicalNot %bool %35
OpSelectionMerge %37 None
OpBranchConditional %33 %38 %37
%38 = OpLabel
OpBranch %30
%37 = OpLabel
OpStore %var_for_index %val_0
%42 = OpLoad %uint %i
%44 = OpAccessChain %_ptr_Function_mat2v2float %arr %42
%46 = OpLoad %uint %i
%48 = OpAccessChain %_ptr_Function_mat2x2_f32 %var_for_index %46
%49 = OpLoad %mat2x2_f32 %48
%45 = OpFunctionCall %mat2v2float %conv_mat2x2_f32 %49
OpStore %44 %45
OpBranch %31
%31 = OpLabel
%50 = OpLoad %uint %i
%52 = OpIAdd %uint %50 %uint_1
OpStore %i %52
OpBranch %29
%30 = OpLabel
%53 = OpLoad %_arr_mat2v2float_uint_4 %arr
OpReturnValue %53
OpFunctionEnd
%f = OpFunction %void None %54
%57 = OpLabel
%61 = OpAccessChain %_ptr_Uniform__arr_mat2x2_f32_uint_4 %a %uint_0
%62 = OpLoad %_arr_mat2x2_f32_uint_4 %61
%58 = OpFunctionCall %_arr_mat2v2float_uint_4 %conv_arr4_mat2x2_f32 %62
%66 = OpAccessChain %_ptr_Uniform_mat2x2_f32 %a %uint_0 %uint_2
%67 = OpLoad %mat2x2_f32 %66
%63 = OpFunctionCall %mat2v2float %conv_mat2x2_f32 %67
%69 = OpAccessChain %_ptr_Uniform_v2float %a %uint_0 %uint_2 %uint_1
%70 = OpLoad %v2float %69
OpReturn
OpFunctionEnd

View File

@@ -1,13 +1,22 @@
#version 310 es
layout(binding = 0, std140) uniform u_block_ubo {
mat2 inner[4];
struct mat2x2_f32 {
vec2 col0;
vec2 col1;
};
layout(binding = 0, std140) uniform u_block_std140_ubo {
mat2x2_f32 inner[4];
} u;
mat2 conv_mat2x2_f32(mat2x2_f32 val) {
return mat2(val.col0, val.col1);
}
void f() {
mat2 t = transpose(u.inner[2]);
float l = length(u.inner[0][1].yx);
float a = abs(u.inner[0][1].yx.x);
mat2 t = transpose(conv_mat2x2_f32(u.inner[2u]));
float l = length(u.inner[0u].col1.yx);
float a = abs(u.inner[0u].col1.yx[0u]);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@@ -1,56 +1,71 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 34
; Bound: 42
; Schema: 0
OpCapability Shader
%22 = OpExtInstImport "GLSL.std.450"
%30 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %u_block "u_block"
OpMemberName %u_block 0 "inner"
OpName %u_block_std140 "u_block_std140"
OpMemberName %u_block_std140 0 "inner"
OpName %mat2x2_f32 "mat2x2_f32"
OpMemberName %mat2x2_f32 0 "col0"
OpMemberName %mat2x2_f32 1 "col1"
OpName %u "u"
OpName %conv_mat2x2_f32 "conv_mat2x2_f32"
OpName %val "val"
OpName %f "f"
OpDecorate %u_block Block
OpMemberDecorate %u_block 0 Offset 0
OpMemberDecorate %u_block 0 ColMajor
OpMemberDecorate %u_block 0 MatrixStride 8
OpDecorate %_arr_mat2v2float_uint_4 ArrayStride 16
OpDecorate %u_block_std140 Block
OpMemberDecorate %u_block_std140 0 Offset 0
OpMemberDecorate %mat2x2_f32 0 Offset 0
OpMemberDecorate %mat2x2_f32 1 Offset 8
OpDecorate %_arr_mat2x2_f32_uint_4 ArrayStride 16
OpDecorate %u NonWritable
OpDecorate %u DescriptorSet 0
OpDecorate %u Binding 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat2v2float = OpTypeMatrix %v2float 2
%mat2x2_f32 = OpTypeStruct %v2float %v2float
%uint = OpTypeInt 32 0
%uint_4 = OpConstant %uint 4
%_arr_mat2v2float_uint_4 = OpTypeArray %mat2v2float %uint_4
%u_block = OpTypeStruct %_arr_mat2v2float_uint_4
%_ptr_Uniform_u_block = OpTypePointer Uniform %u_block
%u = OpVariable %_ptr_Uniform_u_block Uniform
%_arr_mat2x2_f32_uint_4 = OpTypeArray %mat2x2_f32 %uint_4
%u_block_std140 = OpTypeStruct %_arr_mat2x2_f32_uint_4
%_ptr_Uniform_u_block_std140 = OpTypePointer Uniform %u_block_std140
%u = OpVariable %_ptr_Uniform_u_block_std140 Uniform
%mat2v2float = OpTypeMatrix %v2float 2
%10 = OpTypeFunction %mat2v2float %mat2x2_f32
%void = OpTypeVoid
%10 = OpTypeFunction %void
%18 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0
%int = OpTypeInt 32 1
%int_2 = OpConstant %int 2
%_ptr_Uniform_mat2v2float = OpTypePointer Uniform %mat2v2float
%23 = OpConstantNull %int
%int_1 = OpConstant %int 1
%uint_2 = OpConstant %uint 2
%_ptr_Uniform_mat2x2_f32 = OpTypePointer Uniform %mat2x2_f32
%31 = OpConstantNull %uint
%uint_1 = OpConstant %uint 1
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%f = OpFunction %void None %10
%13 = OpLabel
%19 = OpAccessChain %_ptr_Uniform_mat2v2float %u %uint_0 %int_2
%20 = OpLoad %mat2v2float %19
%14 = OpTranspose %mat2v2float %20
%26 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %23 %int_1
%27 = OpLoad %v2float %26
%28 = OpVectorShuffle %v2float %27 %27 1 0
%21 = OpExtInst %float %22 Length %28
%30 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %23 %int_1
%31 = OpLoad %v2float %30
%32 = OpVectorShuffle %v2float %31 %31 1 0
%33 = OpCompositeExtract %float %32 0
%29 = OpExtInst %float %22 FAbs %33
%conv_mat2x2_f32 = OpFunction %mat2v2float None %10
%val = OpFunctionParameter %mat2x2_f32
%14 = OpLabel
%15 = OpCompositeExtract %v2float %val 0
%16 = OpCompositeExtract %v2float %val 1
%17 = OpCompositeConstruct %mat2v2float %15 %16
OpReturnValue %17
OpFunctionEnd
%f = OpFunction %void None %18
%21 = OpLabel
%27 = OpAccessChain %_ptr_Uniform_mat2x2_f32 %u %uint_0 %uint_2
%28 = OpLoad %mat2x2_f32 %27
%23 = OpFunctionCall %mat2v2float %conv_mat2x2_f32 %28
%22 = OpTranspose %mat2v2float %23
%34 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %31 %uint_1
%35 = OpLoad %v2float %34
%36 = OpVectorShuffle %v2float %35 %35 1 0
%29 = OpExtInst %float %30 Length %36
%38 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %31 %uint_1
%39 = OpLoad %v2float %38
%40 = OpVectorShuffle %v2float %39 %39 1 0
%41 = OpCompositeExtract %float %40 0
%37 = OpExtInst %float %30 FAbs %41
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,12 @@
#version 310 es
layout(binding = 0, std140) uniform u_block_ubo {
mat2 inner[4];
struct mat2x2_f32 {
vec2 col0;
vec2 col1;
};
layout(binding = 0, std140) uniform u_block_std140_ubo {
mat2x2_f32 inner[4];
} u;
void a(mat2 a_1[4]) {
@@ -16,11 +21,25 @@ void c(vec2 v) {
void d(float f_1) {
}
mat2 conv_mat2x2_f32(mat2x2_f32 val) {
return mat2(val.col0, val.col1);
}
mat2[4] conv_arr4_mat2x2_f32(mat2x2_f32 val[4]) {
mat2 arr[4] = mat2[4](mat2(0.0f, 0.0f, 0.0f, 0.0f), mat2(0.0f, 0.0f, 0.0f, 0.0f), mat2(0.0f, 0.0f, 0.0f, 0.0f), mat2(0.0f, 0.0f, 0.0f, 0.0f));
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
arr[i] = conv_mat2x2_f32(val[i]);
}
}
return arr;
}
void f() {
a(u.inner);
b(u.inner[1]);
c(u.inner[1][0].yx);
d(u.inner[1][0].yx.x);
a(conv_arr4_mat2x2_f32(u.inner));
b(conv_mat2x2_f32(u.inner[1u]));
c(u.inner[1u].col0.yx);
d(u.inner[1u].col0.yx[0u]);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@@ -1,14 +1,17 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 52
; Bound: 95
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %u_block "u_block"
OpMemberName %u_block 0 "inner"
OpName %u_block_std140 "u_block_std140"
OpMemberName %u_block_std140 0 "inner"
OpName %mat2x2_f32 "mat2x2_f32"
OpMemberName %mat2x2_f32 0 "col0"
OpMemberName %mat2x2_f32 1 "col1"
OpName %u "u"
OpName %a "a"
OpName %a_1 "a_1"
@@ -18,73 +21,139 @@
OpName %v "v"
OpName %d "d"
OpName %f_1 "f_1"
OpName %conv_mat2x2_f32 "conv_mat2x2_f32"
OpName %val "val"
OpName %conv_arr4_mat2x2_f32 "conv_arr4_mat2x2_f32"
OpName %val_0 "val"
OpName %arr "arr"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %f "f"
OpDecorate %u_block Block
OpMemberDecorate %u_block 0 Offset 0
OpMemberDecorate %u_block 0 ColMajor
OpMemberDecorate %u_block 0 MatrixStride 8
OpDecorate %_arr_mat2v2float_uint_4 ArrayStride 16
OpDecorate %u_block_std140 Block
OpMemberDecorate %u_block_std140 0 Offset 0
OpMemberDecorate %mat2x2_f32 0 Offset 0
OpMemberDecorate %mat2x2_f32 1 Offset 8
OpDecorate %_arr_mat2x2_f32_uint_4 ArrayStride 16
OpDecorate %u NonWritable
OpDecorate %u DescriptorSet 0
OpDecorate %u Binding 0
OpDecorate %_arr_mat2v2float_uint_4 ArrayStride 16
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat2v2float = OpTypeMatrix %v2float 2
%mat2x2_f32 = OpTypeStruct %v2float %v2float
%uint = OpTypeInt 32 0
%uint_4 = OpConstant %uint 4
%_arr_mat2v2float_uint_4 = OpTypeArray %mat2v2float %uint_4
%u_block = OpTypeStruct %_arr_mat2v2float_uint_4
%_ptr_Uniform_u_block = OpTypePointer Uniform %u_block
%u = OpVariable %_ptr_Uniform_u_block Uniform
%_arr_mat2x2_f32_uint_4 = OpTypeArray %mat2x2_f32 %uint_4
%u_block_std140 = OpTypeStruct %_arr_mat2x2_f32_uint_4
%_ptr_Uniform_u_block_std140 = OpTypePointer Uniform %u_block_std140
%u = OpVariable %_ptr_Uniform_u_block_std140 Uniform
%void = OpTypeVoid
%mat2v2float = OpTypeMatrix %v2float 2
%_arr_mat2v2float_uint_4 = OpTypeArray %mat2v2float %uint_4
%10 = OpTypeFunction %void %_arr_mat2v2float_uint_4
%15 = OpTypeFunction %void %mat2v2float
%19 = OpTypeFunction %void %v2float
%23 = OpTypeFunction %void %float
%27 = OpTypeFunction %void
%17 = OpTypeFunction %void %mat2v2float
%21 = OpTypeFunction %void %v2float
%25 = OpTypeFunction %void %float
%29 = OpTypeFunction %mat2v2float %mat2x2_f32
%36 = OpTypeFunction %_arr_mat2v2float_uint_4 %_arr_mat2x2_f32_uint_4
%_ptr_Function__arr_mat2v2float_uint_4 = OpTypePointer Function %_arr_mat2v2float_uint_4
%42 = OpConstantNull %_arr_mat2v2float_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%45 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_mat2x2_f32_uint_4 = OpTypePointer Function %_arr_mat2x2_f32_uint_4
%58 = OpConstantNull %_arr_mat2x2_f32_uint_4
%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float
%_ptr_Function_mat2x2_f32 = OpTypePointer Function %mat2x2_f32
%uint_1 = OpConstant %uint 1
%71 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0
%_ptr_Uniform__arr_mat2v2float_uint_4 = OpTypePointer Uniform %_arr_mat2v2float_uint_4
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%_ptr_Uniform_mat2v2float = OpTypePointer Uniform %mat2v2float
%42 = OpConstantNull %int
%_ptr_Uniform__arr_mat2x2_f32_uint_4 = OpTypePointer Uniform %_arr_mat2x2_f32_uint_4
%_ptr_Uniform_mat2x2_f32 = OpTypePointer Uniform %mat2x2_f32
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%a = OpFunction %void None %10
%a_1 = OpFunctionParameter %_arr_mat2v2float_uint_4
%14 = OpLabel
%16 = OpLabel
OpReturn
OpFunctionEnd
%b = OpFunction %void None %15
%b = OpFunction %void None %17
%m = OpFunctionParameter %mat2v2float
%18 = OpLabel
%20 = OpLabel
OpReturn
OpFunctionEnd
%c = OpFunction %void None %19
%c = OpFunction %void None %21
%v = OpFunctionParameter %v2float
%22 = OpLabel
%24 = OpLabel
OpReturn
OpFunctionEnd
%d = OpFunction %void None %23
%d = OpFunction %void None %25
%f_1 = OpFunctionParameter %float
%26 = OpLabel
%28 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %void None %27
%29 = OpLabel
%33 = OpAccessChain %_ptr_Uniform__arr_mat2v2float_uint_4 %u %uint_0
%34 = OpLoad %_arr_mat2v2float_uint_4 %33
%30 = OpFunctionCall %void %a %34
%39 = OpAccessChain %_ptr_Uniform_mat2v2float %u %uint_0 %int_1
%40 = OpLoad %mat2v2float %39
%35 = OpFunctionCall %void %b %40
%44 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %int_1 %42
%45 = OpLoad %v2float %44
%46 = OpVectorShuffle %v2float %45 %45 1 0
%41 = OpFunctionCall %void %c %46
%48 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %int_1 %42
%49 = OpLoad %v2float %48
%50 = OpVectorShuffle %v2float %49 %49 1 0
%51 = OpCompositeExtract %float %50 0
%47 = OpFunctionCall %void %d %51
%conv_mat2x2_f32 = OpFunction %mat2v2float None %29
%val = OpFunctionParameter %mat2x2_f32
%32 = OpLabel
%33 = OpCompositeExtract %v2float %val 0
%34 = OpCompositeExtract %v2float %val 1
%35 = OpCompositeConstruct %mat2v2float %33 %34
OpReturnValue %35
OpFunctionEnd
%conv_arr4_mat2x2_f32 = OpFunction %_arr_mat2v2float_uint_4 None %36
%val_0 = OpFunctionParameter %_arr_mat2x2_f32_uint_4
%39 = OpLabel
%arr = OpVariable %_ptr_Function__arr_mat2v2float_uint_4 Function %42
%i = OpVariable %_ptr_Function_uint Function %45
%var_for_index = OpVariable %_ptr_Function__arr_mat2x2_f32_uint_4 Function %58
OpBranch %46
%46 = OpLabel
OpLoopMerge %47 %48 None
OpBranch %49
%49 = OpLabel
%51 = OpLoad %uint %i
%52 = OpULessThan %bool %51 %uint_4
%50 = OpLogicalNot %bool %52
OpSelectionMerge %54 None
OpBranchConditional %50 %55 %54
%55 = OpLabel
OpBranch %47
%54 = OpLabel
OpStore %var_for_index %val_0
%59 = OpLoad %uint %i
%61 = OpAccessChain %_ptr_Function_mat2v2float %arr %59
%63 = OpLoad %uint %i
%65 = OpAccessChain %_ptr_Function_mat2x2_f32 %var_for_index %63
%66 = OpLoad %mat2x2_f32 %65
%62 = OpFunctionCall %mat2v2float %conv_mat2x2_f32 %66
OpStore %61 %62
OpBranch %48
%48 = OpLabel
%67 = OpLoad %uint %i
%69 = OpIAdd %uint %67 %uint_1
OpStore %i %69
OpBranch %46
%47 = OpLabel
%70 = OpLoad %_arr_mat2v2float_uint_4 %arr
OpReturnValue %70
OpFunctionEnd
%f = OpFunction %void None %71
%73 = OpLabel
%78 = OpAccessChain %_ptr_Uniform__arr_mat2x2_f32_uint_4 %u %uint_0
%79 = OpLoad %_arr_mat2x2_f32_uint_4 %78
%75 = OpFunctionCall %_arr_mat2v2float_uint_4 %conv_arr4_mat2x2_f32 %79
%74 = OpFunctionCall %void %a %75
%83 = OpAccessChain %_ptr_Uniform_mat2x2_f32 %u %uint_0 %uint_1
%84 = OpLoad %mat2x2_f32 %83
%81 = OpFunctionCall %mat2v2float %conv_mat2x2_f32 %84
%80 = OpFunctionCall %void %b %81
%87 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %uint_1 %uint_0
%88 = OpLoad %v2float %87
%89 = OpVectorShuffle %v2float %88 %88 1 0
%85 = OpFunctionCall %void %c %89
%91 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %uint_1 %uint_0
%92 = OpLoad %v2float %91
%93 = OpVectorShuffle %v2float %92 %92 1 0
%94 = OpCompositeExtract %float %93 0
%90 = OpFunctionCall %void %d %94
OpReturn
OpFunctionEnd

View File

@@ -1,21 +1,40 @@
#version 310 es
struct mat2x2_f32 {
vec2 col0;
vec2 col1;
};
struct S {
int before;
mat2 m;
int after;
};
layout(binding = 0, std140) uniform u_block_ubo {
mat2 inner[4];
layout(binding = 0, std140) uniform u_block_std140_ubo {
mat2x2_f32 inner[4];
} u;
mat2 p[4] = mat2[4](mat2(0.0f, 0.0f, 0.0f, 0.0f), mat2(0.0f, 0.0f, 0.0f, 0.0f), mat2(0.0f, 0.0f, 0.0f, 0.0f), mat2(0.0f, 0.0f, 0.0f, 0.0f));
mat2 conv_mat2x2_f32(mat2x2_f32 val) {
return mat2(val.col0, val.col1);
}
mat2[4] conv_arr4_mat2x2_f32(mat2x2_f32 val[4]) {
mat2 arr[4] = mat2[4](mat2(0.0f, 0.0f, 0.0f, 0.0f), mat2(0.0f, 0.0f, 0.0f, 0.0f), mat2(0.0f, 0.0f, 0.0f, 0.0f), mat2(0.0f, 0.0f, 0.0f, 0.0f));
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
arr[i] = conv_mat2x2_f32(val[i]);
}
}
return arr;
}
void f() {
p = u.inner;
p[1] = u.inner[2];
p[1][0] = u.inner[0][1].yx;
p[1][0].x = u.inner[0][1].x;
p = conv_arr4_mat2x2_f32(u.inner);
p[1] = conv_mat2x2_f32(u.inner[2u]);
p[1][0] = u.inner[0u].col1.yx;
p[1][0].x = u.inner[0u].col1[0u];
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@@ -1,68 +1,139 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 41
; Bound: 86
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %u_block "u_block"
OpMemberName %u_block 0 "inner"
OpName %u_block_std140 "u_block_std140"
OpMemberName %u_block_std140 0 "inner"
OpName %mat2x2_f32 "mat2x2_f32"
OpMemberName %mat2x2_f32 0 "col0"
OpMemberName %mat2x2_f32 1 "col1"
OpName %u "u"
OpName %p "p"
OpName %conv_mat2x2_f32 "conv_mat2x2_f32"
OpName %val "val"
OpName %conv_arr4_mat2x2_f32 "conv_arr4_mat2x2_f32"
OpName %val_0 "val"
OpName %arr "arr"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %f "f"
OpDecorate %u_block Block
OpMemberDecorate %u_block 0 Offset 0
OpMemberDecorate %u_block 0 ColMajor
OpMemberDecorate %u_block 0 MatrixStride 8
OpDecorate %_arr_mat2v2float_uint_4 ArrayStride 16
OpDecorate %u_block_std140 Block
OpMemberDecorate %u_block_std140 0 Offset 0
OpMemberDecorate %mat2x2_f32 0 Offset 0
OpMemberDecorate %mat2x2_f32 1 Offset 8
OpDecorate %_arr_mat2x2_f32_uint_4 ArrayStride 16
OpDecorate %u NonWritable
OpDecorate %u DescriptorSet 0
OpDecorate %u Binding 0
OpDecorate %_arr_mat2v2float_uint_4 ArrayStride 16
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat2v2float = OpTypeMatrix %v2float 2
%mat2x2_f32 = OpTypeStruct %v2float %v2float
%uint = OpTypeInt 32 0
%uint_4 = OpConstant %uint 4
%_arr_mat2x2_f32_uint_4 = OpTypeArray %mat2x2_f32 %uint_4
%u_block_std140 = OpTypeStruct %_arr_mat2x2_f32_uint_4
%_ptr_Uniform_u_block_std140 = OpTypePointer Uniform %u_block_std140
%u = OpVariable %_ptr_Uniform_u_block_std140 Uniform
%mat2v2float = OpTypeMatrix %v2float 2
%_arr_mat2v2float_uint_4 = OpTypeArray %mat2v2float %uint_4
%u_block = OpTypeStruct %_arr_mat2v2float_uint_4
%_ptr_Uniform_u_block = OpTypePointer Uniform %u_block
%u = OpVariable %_ptr_Uniform_u_block Uniform
%_ptr_Private__arr_mat2v2float_uint_4 = OpTypePointer Private %_arr_mat2v2float_uint_4
%12 = OpConstantNull %_arr_mat2v2float_uint_4
%p = OpVariable %_ptr_Private__arr_mat2v2float_uint_4 Private %12
%14 = OpConstantNull %_arr_mat2v2float_uint_4
%p = OpVariable %_ptr_Private__arr_mat2v2float_uint_4 Private %14
%15 = OpTypeFunction %mat2v2float %mat2x2_f32
%22 = OpTypeFunction %_arr_mat2v2float_uint_4 %_arr_mat2x2_f32_uint_4
%_ptr_Function__arr_mat2v2float_uint_4 = OpTypePointer Function %_arr_mat2v2float_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%30 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_mat2x2_f32_uint_4 = OpTypePointer Function %_arr_mat2x2_f32_uint_4
%43 = OpConstantNull %_arr_mat2x2_f32_uint_4
%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float
%_ptr_Function_mat2x2_f32 = OpTypePointer Function %mat2x2_f32
%uint_1 = OpConstant %uint 1
%void = OpTypeVoid
%13 = OpTypeFunction %void
%56 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0
%_ptr_Uniform__arr_mat2v2float_uint_4 = OpTypePointer Uniform %_arr_mat2v2float_uint_4
%_ptr_Uniform__arr_mat2x2_f32_uint_4 = OpTypePointer Uniform %_arr_mat2x2_f32_uint_4
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%_ptr_Private_mat2v2float = OpTypePointer Private %mat2v2float
%int_2 = OpConstant %int 2
%_ptr_Uniform_mat2v2float = OpTypePointer Uniform %mat2v2float
%29 = OpConstantNull %int
%uint_2 = OpConstant %uint 2
%_ptr_Uniform_mat2x2_f32 = OpTypePointer Uniform %mat2x2_f32
%74 = OpConstantNull %int
%_ptr_Private_v2float = OpTypePointer Private %v2float
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%_ptr_Private_float = OpTypePointer Private %float
%_ptr_Uniform_float = OpTypePointer Uniform %float
%f = OpFunction %void None %13
%16 = OpLabel
%19 = OpAccessChain %_ptr_Uniform__arr_mat2v2float_uint_4 %u %uint_0
%20 = OpLoad %_arr_mat2v2float_uint_4 %19
OpStore %p %20
%24 = OpAccessChain %_ptr_Private_mat2v2float %p %int_1
%27 = OpAccessChain %_ptr_Uniform_mat2v2float %u %uint_0 %int_2
%28 = OpLoad %mat2v2float %27
OpStore %24 %28
%31 = OpAccessChain %_ptr_Private_v2float %p %int_1 %29
%33 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %29 %int_1
%34 = OpLoad %v2float %33
%35 = OpVectorShuffle %v2float %34 %34 1 0
OpStore %31 %35
%37 = OpAccessChain %_ptr_Private_float %p %int_1 %29 %uint_0
%39 = OpAccessChain %_ptr_Uniform_float %u %uint_0 %29 %int_1 %uint_0
%40 = OpLoad %float %39
OpStore %37 %40
%conv_mat2x2_f32 = OpFunction %mat2v2float None %15
%val = OpFunctionParameter %mat2x2_f32
%18 = OpLabel
%19 = OpCompositeExtract %v2float %val 0
%20 = OpCompositeExtract %v2float %val 1
%21 = OpCompositeConstruct %mat2v2float %19 %20
OpReturnValue %21
OpFunctionEnd
%conv_arr4_mat2x2_f32 = OpFunction %_arr_mat2v2float_uint_4 None %22
%val_0 = OpFunctionParameter %_arr_mat2x2_f32_uint_4
%25 = OpLabel
%arr = OpVariable %_ptr_Function__arr_mat2v2float_uint_4 Function %14
%i = OpVariable %_ptr_Function_uint Function %30
%var_for_index = OpVariable %_ptr_Function__arr_mat2x2_f32_uint_4 Function %43
OpBranch %31
%31 = OpLabel
OpLoopMerge %32 %33 None
OpBranch %34
%34 = OpLabel
%36 = OpLoad %uint %i
%37 = OpULessThan %bool %36 %uint_4
%35 = OpLogicalNot %bool %37
OpSelectionMerge %39 None
OpBranchConditional %35 %40 %39
%40 = OpLabel
OpBranch %32
%39 = OpLabel
OpStore %var_for_index %val_0
%44 = OpLoad %uint %i
%46 = OpAccessChain %_ptr_Function_mat2v2float %arr %44
%48 = OpLoad %uint %i
%50 = OpAccessChain %_ptr_Function_mat2x2_f32 %var_for_index %48
%51 = OpLoad %mat2x2_f32 %50
%47 = OpFunctionCall %mat2v2float %conv_mat2x2_f32 %51
OpStore %46 %47
OpBranch %33
%33 = OpLabel
%52 = OpLoad %uint %i
%54 = OpIAdd %uint %52 %uint_1
OpStore %i %54
OpBranch %31
%32 = OpLabel
%55 = OpLoad %_arr_mat2v2float_uint_4 %arr
OpReturnValue %55
OpFunctionEnd
%f = OpFunction %void None %56
%59 = OpLabel
%63 = OpAccessChain %_ptr_Uniform__arr_mat2x2_f32_uint_4 %u %uint_0
%64 = OpLoad %_arr_mat2x2_f32_uint_4 %63
%60 = OpFunctionCall %_arr_mat2v2float_uint_4 %conv_arr4_mat2x2_f32 %64
OpStore %p %60
%68 = OpAccessChain %_ptr_Private_mat2v2float %p %int_1
%72 = OpAccessChain %_ptr_Uniform_mat2x2_f32 %u %uint_0 %uint_2
%73 = OpLoad %mat2x2_f32 %72
%69 = OpFunctionCall %mat2v2float %conv_mat2x2_f32 %73
OpStore %68 %69
%76 = OpAccessChain %_ptr_Private_v2float %p %int_1 %74
%78 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %30 %uint_1
%79 = OpLoad %v2float %78
%80 = OpVectorShuffle %v2float %79 %79 1 0
OpStore %76 %80
%82 = OpAccessChain %_ptr_Private_float %p %int_1 %74 %uint_0
%84 = OpAccessChain %_ptr_Uniform_float %u %uint_0 %30 %uint_1 %30
%85 = OpLoad %float %84
OpStore %82 %85
OpReturn
OpFunctionEnd

View File

@@ -1,24 +1,43 @@
#version 310 es
struct mat2x2_f32 {
vec2 col0;
vec2 col1;
};
struct S {
int before;
mat2 m;
int after;
};
layout(binding = 0, std140) uniform u_block_ubo {
mat2 inner[4];
layout(binding = 0, std140) uniform u_block_std140_ubo {
mat2x2_f32 inner[4];
} u;
layout(binding = 1, std430) buffer u_block_ssbo {
mat2 inner[4];
} s;
mat2 conv_mat2x2_f32(mat2x2_f32 val) {
return mat2(val.col0, val.col1);
}
mat2[4] conv_arr4_mat2x2_f32(mat2x2_f32 val[4]) {
mat2 arr[4] = mat2[4](mat2(0.0f, 0.0f, 0.0f, 0.0f), mat2(0.0f, 0.0f, 0.0f, 0.0f), mat2(0.0f, 0.0f, 0.0f, 0.0f), mat2(0.0f, 0.0f, 0.0f, 0.0f));
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
arr[i] = conv_mat2x2_f32(val[i]);
}
}
return arr;
}
void f() {
s.inner = u.inner;
s.inner[1] = u.inner[2];
s.inner[1][0] = u.inner[0][1].yx;
s.inner[1][0].x = u.inner[0][1].x;
s.inner = conv_arr4_mat2x2_f32(u.inner);
s.inner[1] = conv_mat2x2_f32(u.inner[2u]);
s.inner[1][0] = u.inner[0u].col1.yx;
s.inner[1][0].x = u.inner[0u].col1[0u];
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@@ -1,71 +1,150 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 42
; Bound: 89
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %u_block_std140 "u_block_std140"
OpMemberName %u_block_std140 0 "inner"
OpName %mat2x2_f32 "mat2x2_f32"
OpMemberName %mat2x2_f32 0 "col0"
OpMemberName %mat2x2_f32 1 "col1"
OpName %u "u"
OpName %u_block "u_block"
OpMemberName %u_block 0 "inner"
OpName %u "u"
OpName %s "s"
OpName %conv_mat2x2_f32 "conv_mat2x2_f32"
OpName %val "val"
OpName %conv_arr4_mat2x2_f32 "conv_arr4_mat2x2_f32"
OpName %val_0 "val"
OpName %arr "arr"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %f "f"
OpDecorate %u_block_std140 Block
OpMemberDecorate %u_block_std140 0 Offset 0
OpMemberDecorate %mat2x2_f32 0 Offset 0
OpMemberDecorate %mat2x2_f32 1 Offset 8
OpDecorate %_arr_mat2x2_f32_uint_4 ArrayStride 16
OpDecorate %u NonWritable
OpDecorate %u DescriptorSet 0
OpDecorate %u Binding 0
OpDecorate %u_block Block
OpMemberDecorate %u_block 0 Offset 0
OpMemberDecorate %u_block 0 ColMajor
OpMemberDecorate %u_block 0 MatrixStride 8
OpDecorate %_arr_mat2v2float_uint_4 ArrayStride 16
OpDecorate %u NonWritable
OpDecorate %u DescriptorSet 0
OpDecorate %u Binding 0
OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat2v2float = OpTypeMatrix %v2float 2
%mat2x2_f32 = OpTypeStruct %v2float %v2float
%uint = OpTypeInt 32 0
%uint_4 = OpConstant %uint 4
%_arr_mat2x2_f32_uint_4 = OpTypeArray %mat2x2_f32 %uint_4
%u_block_std140 = OpTypeStruct %_arr_mat2x2_f32_uint_4
%_ptr_Uniform_u_block_std140 = OpTypePointer Uniform %u_block_std140
%u = OpVariable %_ptr_Uniform_u_block_std140 Uniform
%mat2v2float = OpTypeMatrix %v2float 2
%_arr_mat2v2float_uint_4 = OpTypeArray %mat2v2float %uint_4
%u_block = OpTypeStruct %_arr_mat2v2float_uint_4
%_ptr_Uniform_u_block = OpTypePointer Uniform %u_block
%u = OpVariable %_ptr_Uniform_u_block Uniform
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%15 = OpTypeFunction %mat2v2float %mat2x2_f32
%22 = OpTypeFunction %_arr_mat2v2float_uint_4 %_arr_mat2x2_f32_uint_4
%_ptr_Function__arr_mat2v2float_uint_4 = OpTypePointer Function %_arr_mat2v2float_uint_4
%28 = OpConstantNull %_arr_mat2v2float_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%31 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_mat2x2_f32_uint_4 = OpTypePointer Function %_arr_mat2x2_f32_uint_4
%44 = OpConstantNull %_arr_mat2x2_f32_uint_4
%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float
%_ptr_Function_mat2x2_f32 = OpTypePointer Function %mat2x2_f32
%uint_1 = OpConstant %uint 1
%void = OpTypeVoid
%12 = OpTypeFunction %void
%57 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer__arr_mat2v2float_uint_4 = OpTypePointer StorageBuffer %_arr_mat2v2float_uint_4
%_ptr_Uniform__arr_mat2v2float_uint_4 = OpTypePointer Uniform %_arr_mat2v2float_uint_4
%_ptr_Uniform__arr_mat2x2_f32_uint_4 = OpTypePointer Uniform %_arr_mat2x2_f32_uint_4
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_mat2v2float = OpTypePointer StorageBuffer %mat2v2float
%int_2 = OpConstant %int 2
%_ptr_Uniform_mat2v2float = OpTypePointer Uniform %mat2v2float
%30 = OpConstantNull %int
%uint_2 = OpConstant %uint 2
%_ptr_Uniform_mat2x2_f32 = OpTypePointer Uniform %mat2x2_f32
%77 = OpConstantNull %int
%_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%_ptr_Uniform_float = OpTypePointer Uniform %float
%f = OpFunction %void None %12
%15 = OpLabel
%18 = OpAccessChain %_ptr_StorageBuffer__arr_mat2v2float_uint_4 %s %uint_0
%20 = OpAccessChain %_ptr_Uniform__arr_mat2v2float_uint_4 %u %uint_0
%21 = OpLoad %_arr_mat2v2float_uint_4 %20
OpStore %18 %21
%25 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %s %uint_0 %int_1
%28 = OpAccessChain %_ptr_Uniform_mat2v2float %u %uint_0 %int_2
%29 = OpLoad %mat2v2float %28
OpStore %25 %29
%32 = OpAccessChain %_ptr_StorageBuffer_v2float %s %uint_0 %int_1 %30
%34 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %30 %int_1
%35 = OpLoad %v2float %34
%36 = OpVectorShuffle %v2float %35 %35 1 0
OpStore %32 %36
%38 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %int_1 %30 %uint_0
%40 = OpAccessChain %_ptr_Uniform_float %u %uint_0 %30 %int_1 %uint_0
%41 = OpLoad %float %40
OpStore %38 %41
%conv_mat2x2_f32 = OpFunction %mat2v2float None %15
%val = OpFunctionParameter %mat2x2_f32
%18 = OpLabel
%19 = OpCompositeExtract %v2float %val 0
%20 = OpCompositeExtract %v2float %val 1
%21 = OpCompositeConstruct %mat2v2float %19 %20
OpReturnValue %21
OpFunctionEnd
%conv_arr4_mat2x2_f32 = OpFunction %_arr_mat2v2float_uint_4 None %22
%val_0 = OpFunctionParameter %_arr_mat2x2_f32_uint_4
%25 = OpLabel
%arr = OpVariable %_ptr_Function__arr_mat2v2float_uint_4 Function %28
%i = OpVariable %_ptr_Function_uint Function %31
%var_for_index = OpVariable %_ptr_Function__arr_mat2x2_f32_uint_4 Function %44
OpBranch %32
%32 = OpLabel
OpLoopMerge %33 %34 None
OpBranch %35
%35 = OpLabel
%37 = OpLoad %uint %i
%38 = OpULessThan %bool %37 %uint_4
%36 = OpLogicalNot %bool %38
OpSelectionMerge %40 None
OpBranchConditional %36 %41 %40
%41 = OpLabel
OpBranch %33
%40 = OpLabel
OpStore %var_for_index %val_0
%45 = OpLoad %uint %i
%47 = OpAccessChain %_ptr_Function_mat2v2float %arr %45
%49 = OpLoad %uint %i
%51 = OpAccessChain %_ptr_Function_mat2x2_f32 %var_for_index %49
%52 = OpLoad %mat2x2_f32 %51
%48 = OpFunctionCall %mat2v2float %conv_mat2x2_f32 %52
OpStore %47 %48
OpBranch %34
%34 = OpLabel
%53 = OpLoad %uint %i
%55 = OpIAdd %uint %53 %uint_1
OpStore %i %55
OpBranch %32
%33 = OpLabel
%56 = OpLoad %_arr_mat2v2float_uint_4 %arr
OpReturnValue %56
OpFunctionEnd
%f = OpFunction %void None %57
%60 = OpLabel
%63 = OpAccessChain %_ptr_StorageBuffer__arr_mat2v2float_uint_4 %s %uint_0
%66 = OpAccessChain %_ptr_Uniform__arr_mat2x2_f32_uint_4 %u %uint_0
%67 = OpLoad %_arr_mat2x2_f32_uint_4 %66
%64 = OpFunctionCall %_arr_mat2v2float_uint_4 %conv_arr4_mat2x2_f32 %67
OpStore %63 %64
%71 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %s %uint_0 %int_1
%75 = OpAccessChain %_ptr_Uniform_mat2x2_f32 %u %uint_0 %uint_2
%76 = OpLoad %mat2x2_f32 %75
%72 = OpFunctionCall %mat2v2float %conv_mat2x2_f32 %76
OpStore %71 %72
%79 = OpAccessChain %_ptr_StorageBuffer_v2float %s %uint_0 %int_1 %77
%81 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %31 %uint_1
%82 = OpLoad %v2float %81
%83 = OpVectorShuffle %v2float %82 %82 1 0
OpStore %79 %83
%85 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %int_1 %77 %uint_0
%87 = OpAccessChain %_ptr_Uniform_float %u %uint_0 %31 %uint_1 %31
%88 = OpLoad %float %87
OpStore %85 %88
OpReturn
OpFunctionEnd

View File

@@ -1,16 +1,35 @@
#version 310 es
struct mat2x2_f32 {
vec2 col0;
vec2 col1;
};
struct S {
int before;
mat2 m;
int after;
};
layout(binding = 0, std140) uniform u_block_ubo {
mat2 inner[4];
layout(binding = 0, std140) uniform u_block_std140_ubo {
mat2x2_f32 inner[4];
} u;
shared mat2 w[4];
mat2 conv_mat2x2_f32(mat2x2_f32 val) {
return mat2(val.col0, val.col1);
}
mat2[4] conv_arr4_mat2x2_f32(mat2x2_f32 val[4]) {
mat2 arr[4] = mat2[4](mat2(0.0f, 0.0f, 0.0f, 0.0f), mat2(0.0f, 0.0f, 0.0f, 0.0f), mat2(0.0f, 0.0f, 0.0f, 0.0f), mat2(0.0f, 0.0f, 0.0f, 0.0f));
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
arr[i] = conv_mat2x2_f32(val[i]);
}
}
return arr;
}
void f(uint local_invocation_index) {
{
for(uint idx = local_invocation_index; (idx < 4u); idx = (idx + 1u)) {
@@ -19,10 +38,10 @@ void f(uint local_invocation_index) {
}
}
barrier();
w = u.inner;
w[1] = u.inner[2];
w[1][0] = u.inner[0][1].yx;
w[1][0].x = u.inner[0][1].x;
w = conv_arr4_mat2x2_f32(u.inner);
w[1] = conv_mat2x2_f32(u.inner[2u]);
w[1][0] = u.inner[0u].col1.yx;
w[1][0].x = u.inner[0u].col1[0u];
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@@ -1,115 +1,182 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 70
; Bound: 111
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f" %local_invocation_index_1
OpExecutionMode %f LocalSize 1 1 1
OpName %local_invocation_index_1 "local_invocation_index_1"
OpName %u_block "u_block"
OpMemberName %u_block 0 "inner"
OpName %u_block_std140 "u_block_std140"
OpMemberName %u_block_std140 0 "inner"
OpName %mat2x2_f32 "mat2x2_f32"
OpMemberName %mat2x2_f32 0 "col0"
OpMemberName %mat2x2_f32 1 "col1"
OpName %u "u"
OpName %w "w"
OpName %conv_mat2x2_f32 "conv_mat2x2_f32"
OpName %val "val"
OpName %conv_arr4_mat2x2_f32 "conv_arr4_mat2x2_f32"
OpName %val_0 "val"
OpName %arr "arr"
OpName %i "i"
OpName %var_for_index "var_for_index"
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 %u_block Block
OpMemberDecorate %u_block 0 Offset 0
OpMemberDecorate %u_block 0 ColMajor
OpMemberDecorate %u_block 0 MatrixStride 8
OpDecorate %_arr_mat2v2float_uint_4 ArrayStride 16
OpDecorate %u_block_std140 Block
OpMemberDecorate %u_block_std140 0 Offset 0
OpMemberDecorate %mat2x2_f32 0 Offset 0
OpMemberDecorate %mat2x2_f32 1 Offset 8
OpDecorate %_arr_mat2x2_f32_uint_4 ArrayStride 16
OpDecorate %u NonWritable
OpDecorate %u DescriptorSet 0
OpDecorate %u Binding 0
OpDecorate %_arr_mat2v2float_uint_4 ArrayStride 16
%uint = OpTypeInt 32 0
%_ptr_Input_uint = OpTypePointer Input %uint
%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat2v2float = OpTypeMatrix %v2float 2
%mat2x2_f32 = OpTypeStruct %v2float %v2float
%uint_4 = OpConstant %uint 4
%_arr_mat2x2_f32_uint_4 = OpTypeArray %mat2x2_f32 %uint_4
%u_block_std140 = OpTypeStruct %_arr_mat2x2_f32_uint_4
%_ptr_Uniform_u_block_std140 = OpTypePointer Uniform %u_block_std140
%u = OpVariable %_ptr_Uniform_u_block_std140 Uniform
%mat2v2float = OpTypeMatrix %v2float 2
%_arr_mat2v2float_uint_4 = OpTypeArray %mat2v2float %uint_4
%u_block = OpTypeStruct %_arr_mat2v2float_uint_4
%_ptr_Uniform_u_block = OpTypePointer Uniform %u_block
%u = OpVariable %_ptr_Uniform_u_block Uniform
%_ptr_Workgroup__arr_mat2v2float_uint_4 = OpTypePointer Workgroup %_arr_mat2v2float_uint_4
%w = OpVariable %_ptr_Workgroup__arr_mat2v2float_uint_4 Workgroup
%void = OpTypeVoid
%14 = OpTypeFunction %void %uint
%16 = OpTypeFunction %mat2v2float %mat2x2_f32
%23 = OpTypeFunction %_arr_mat2v2float_uint_4 %_arr_mat2x2_f32_uint_4
%_ptr_Function__arr_mat2v2float_uint_4 = OpTypePointer Function %_arr_mat2v2float_uint_4
%29 = OpConstantNull %_arr_mat2v2float_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%21 = OpConstantNull %uint
%32 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Workgroup_mat2v2float = OpTypePointer Workgroup %mat2v2float
%35 = OpConstantNull %mat2v2float
%_ptr_Function__arr_mat2x2_f32_uint_4 = OpTypePointer Function %_arr_mat2x2_f32_uint_4
%45 = OpConstantNull %_arr_mat2x2_f32_uint_4
%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float
%_ptr_Function_mat2x2_f32 = OpTypePointer Function %mat2x2_f32
%uint_1 = OpConstant %uint 1
%void = OpTypeVoid
%58 = OpTypeFunction %void %uint
%_ptr_Workgroup_mat2v2float = OpTypePointer Workgroup %mat2v2float
%76 = OpConstantNull %mat2v2float
%uint_2 = OpConstant %uint 2
%uint_264 = OpConstant %uint 264
%uint_0 = OpConstant %uint 0
%_ptr_Uniform__arr_mat2v2float_uint_4 = OpTypePointer Uniform %_arr_mat2v2float_uint_4
%_ptr_Uniform__arr_mat2x2_f32_uint_4 = OpTypePointer Uniform %_arr_mat2x2_f32_uint_4
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%int_2 = OpConstant %int 2
%_ptr_Uniform_mat2v2float = OpTypePointer Uniform %mat2v2float
%53 = OpConstantNull %int
%_ptr_Uniform_mat2x2_f32 = OpTypePointer Uniform %mat2x2_f32
%94 = OpConstantNull %int
%_ptr_Workgroup_v2float = OpTypePointer Workgroup %v2float
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%_ptr_Workgroup_float = OpTypePointer Workgroup %float
%_ptr_Uniform_float = OpTypePointer Uniform %float
%65 = OpTypeFunction %void
%f_inner = OpFunction %void None %14
%106 = OpTypeFunction %void
%conv_mat2x2_f32 = OpFunction %mat2v2float None %16
%val = OpFunctionParameter %mat2x2_f32
%19 = OpLabel
%20 = OpCompositeExtract %v2float %val 0
%21 = OpCompositeExtract %v2float %val 1
%22 = OpCompositeConstruct %mat2v2float %20 %21
OpReturnValue %22
OpFunctionEnd
%conv_arr4_mat2x2_f32 = OpFunction %_arr_mat2v2float_uint_4 None %23
%val_0 = OpFunctionParameter %_arr_mat2x2_f32_uint_4
%26 = OpLabel
%arr = OpVariable %_ptr_Function__arr_mat2v2float_uint_4 Function %29
%i = OpVariable %_ptr_Function_uint Function %32
%var_for_index = OpVariable %_ptr_Function__arr_mat2x2_f32_uint_4 Function %45
OpBranch %33
%33 = OpLabel
OpLoopMerge %34 %35 None
OpBranch %36
%36 = OpLabel
%38 = OpLoad %uint %i
%39 = OpULessThan %bool %38 %uint_4
%37 = OpLogicalNot %bool %39
OpSelectionMerge %41 None
OpBranchConditional %37 %42 %41
%42 = OpLabel
OpBranch %34
%41 = OpLabel
OpStore %var_for_index %val_0
%46 = OpLoad %uint %i
%48 = OpAccessChain %_ptr_Function_mat2v2float %arr %46
%50 = OpLoad %uint %i
%52 = OpAccessChain %_ptr_Function_mat2x2_f32 %var_for_index %50
%53 = OpLoad %mat2x2_f32 %52
%49 = OpFunctionCall %mat2v2float %conv_mat2x2_f32 %53
OpStore %48 %49
OpBranch %35
%35 = OpLabel
%54 = OpLoad %uint %i
%56 = OpIAdd %uint %54 %uint_1
OpStore %i %56
OpBranch %33
%34 = OpLabel
%57 = OpLoad %_arr_mat2v2float_uint_4 %arr
OpReturnValue %57
OpFunctionEnd
%f_inner = OpFunction %void None %58
%local_invocation_index = OpFunctionParameter %uint
%18 = OpLabel
%idx = OpVariable %_ptr_Function_uint Function %21
%62 = OpLabel
%idx = OpVariable %_ptr_Function_uint Function %32
OpStore %idx %local_invocation_index
OpBranch %22
%22 = OpLabel
OpLoopMerge %23 %24 None
OpBranch %25
%25 = OpLabel
%27 = OpLoad %uint %idx
%28 = OpULessThan %bool %27 %uint_4
%26 = OpLogicalNot %bool %28
OpSelectionMerge %30 None
OpBranchConditional %26 %31 %30
%31 = OpLabel
OpBranch %23
%30 = OpLabel
%32 = OpLoad %uint %idx
%34 = OpAccessChain %_ptr_Workgroup_mat2v2float %w %32
OpStore %34 %35
OpBranch %24
%24 = OpLabel
%36 = OpLoad %uint %idx
%38 = OpIAdd %uint %36 %uint_1
OpStore %idx %38
OpBranch %22
%23 = OpLabel
OpControlBarrier %uint_2 %uint_2 %uint_264
%44 = OpAccessChain %_ptr_Uniform__arr_mat2v2float_uint_4 %u %uint_0
%45 = OpLoad %_arr_mat2v2float_uint_4 %44
OpStore %w %45
%48 = OpAccessChain %_ptr_Workgroup_mat2v2float %w %int_1
%51 = OpAccessChain %_ptr_Uniform_mat2v2float %u %uint_0 %int_2
%52 = OpLoad %mat2v2float %51
OpStore %48 %52
%55 = OpAccessChain %_ptr_Workgroup_v2float %w %int_1 %53
%57 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %53 %int_1
%58 = OpLoad %v2float %57
%59 = OpVectorShuffle %v2float %58 %58 1 0
OpStore %55 %59
%61 = OpAccessChain %_ptr_Workgroup_float %w %int_1 %53 %uint_0
%63 = OpAccessChain %_ptr_Uniform_float %u %uint_0 %53 %int_1 %uint_0
%64 = OpLoad %float %63
OpStore %61 %64
OpReturn
OpFunctionEnd
%f = OpFunction %void None %65
OpBranch %64
%64 = OpLabel
OpLoopMerge %65 %66 None
OpBranch %67
%67 = OpLabel
%69 = OpLoad %uint %local_invocation_index_1
%68 = OpFunctionCall %void %f_inner %69
%69 = OpLoad %uint %idx
%70 = OpULessThan %bool %69 %uint_4
%68 = OpLogicalNot %bool %70
OpSelectionMerge %71 None
OpBranchConditional %68 %72 %71
%72 = OpLabel
OpBranch %65
%71 = OpLabel
%73 = OpLoad %uint %idx
%75 = OpAccessChain %_ptr_Workgroup_mat2v2float %w %73
OpStore %75 %76
OpBranch %66
%66 = OpLabel
%77 = OpLoad %uint %idx
%78 = OpIAdd %uint %77 %uint_1
OpStore %idx %78
OpBranch %64
%65 = OpLabel
OpControlBarrier %uint_2 %uint_2 %uint_264
%85 = OpAccessChain %_ptr_Uniform__arr_mat2x2_f32_uint_4 %u %uint_0
%86 = OpLoad %_arr_mat2x2_f32_uint_4 %85
%82 = OpFunctionCall %_arr_mat2v2float_uint_4 %conv_arr4_mat2x2_f32 %86
OpStore %w %82
%89 = OpAccessChain %_ptr_Workgroup_mat2v2float %w %int_1
%92 = OpAccessChain %_ptr_Uniform_mat2x2_f32 %u %uint_0 %uint_2
%93 = OpLoad %mat2x2_f32 %92
%90 = OpFunctionCall %mat2v2float %conv_mat2x2_f32 %93
OpStore %89 %90
%96 = OpAccessChain %_ptr_Workgroup_v2float %w %int_1 %94
%98 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %32 %uint_1
%99 = OpLoad %v2float %98
%100 = OpVectorShuffle %v2float %99 %99 1 0
OpStore %96 %100
%102 = OpAccessChain %_ptr_Workgroup_float %w %int_1 %94 %uint_0
%104 = OpAccessChain %_ptr_Uniform_float %u %uint_0 %32 %uint_1 %32
%105 = OpLoad %float %104
OpStore %102 %105
OpReturn
OpFunctionEnd
%f = OpFunction %void None %106
%108 = OpLabel
%110 = OpLoad %uint %local_invocation_index_1
%109 = OpFunctionCall %void %f_inner %110
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,14 @@
#version 310 es
layout(binding = 0, std140) uniform a_block_ubo {
mat4x2 inner[4];
struct mat4x2_f32 {
vec2 col0;
vec2 col1;
vec2 col2;
vec2 col3;
};
layout(binding = 0, std140) uniform a_block_std140_ubo {
mat4x2_f32 inner[4];
} a;
int counter = 0;
@@ -10,14 +17,54 @@ int i() {
return counter;
}
mat4x2 conv_mat4x2_f32(mat4x2_f32 val) {
return mat4x2(val.col0, val.col1, val.col2, val.col3);
}
mat4x2[4] conv_arr4_mat4x2_f32(mat4x2_f32 val[4]) {
mat4x2 arr[4] = mat4x2[4](mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f));
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
arr[i] = conv_mat4x2_f32(val[i]);
}
}
return arr;
}
vec2 load_a_inner_p0_p1(uint p0, uint p1) {
switch(p1) {
case 0u: {
return a.inner[p0].col0;
break;
}
case 1u: {
return a.inner[p0].col1;
break;
}
case 2u: {
return a.inner[p0].col2;
break;
}
case 3u: {
return a.inner[p0].col3;
break;
}
default: {
return vec2(0.0f);
break;
}
}
}
void f() {
mat4x2 p_a[4] = conv_arr4_mat4x2_f32(a.inner);
int tint_symbol = i();
int p_a_i_save = tint_symbol;
mat4x2 p_a_i = conv_mat4x2_f32(a.inner[tint_symbol]);
int tint_symbol_1 = i();
int p_a_i_i_save = tint_symbol_1;
mat4x2 l_a[4] = a.inner;
mat4x2 l_a_i = a.inner[p_a_i_save];
vec2 l_a_i_i = a.inner[p_a_i_save][p_a_i_i_save];
vec2 p_a_i_i = load_a_inner_p0_p1(uint(tint_symbol), uint(tint_symbol_1));
mat4x2 l_a[4] = conv_arr4_mat4x2_f32(a.inner);
mat4x2 l_a_i = conv_mat4x2_f32(a.inner[tint_symbol]);
vec2 l_a_i_i = load_a_inner_p0_p1(uint(tint_symbol), uint(tint_symbol_1));
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@@ -1,47 +1,83 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 37
; Bound: 108
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %a_block "a_block"
OpMemberName %a_block 0 "inner"
OpName %a_block_std140 "a_block_std140"
OpMemberName %a_block_std140 0 "inner"
OpName %mat4x2_f32 "mat4x2_f32"
OpMemberName %mat4x2_f32 0 "col0"
OpMemberName %mat4x2_f32 1 "col1"
OpMemberName %mat4x2_f32 2 "col2"
OpMemberName %mat4x2_f32 3 "col3"
OpName %a "a"
OpName %counter "counter"
OpName %i "i"
OpName %conv_mat4x2_f32 "conv_mat4x2_f32"
OpName %val "val"
OpName %conv_arr4_mat4x2_f32 "conv_arr4_mat4x2_f32"
OpName %val_0 "val"
OpName %arr "arr"
OpName %i_0 "i"
OpName %var_for_index "var_for_index"
OpName %load_a_inner_p0_p1 "load_a_inner_p0_p1"
OpName %p0 "p0"
OpName %p1 "p1"
OpName %f "f"
OpDecorate %a_block Block
OpMemberDecorate %a_block 0 Offset 0
OpMemberDecorate %a_block 0 ColMajor
OpMemberDecorate %a_block 0 MatrixStride 8
OpDecorate %_arr_mat4v2float_uint_4 ArrayStride 32
OpDecorate %a_block_std140 Block
OpMemberDecorate %a_block_std140 0 Offset 0
OpMemberDecorate %mat4x2_f32 0 Offset 0
OpMemberDecorate %mat4x2_f32 1 Offset 8
OpMemberDecorate %mat4x2_f32 2 Offset 16
OpMemberDecorate %mat4x2_f32 3 Offset 24
OpDecorate %_arr_mat4x2_f32_uint_4 ArrayStride 32
OpDecorate %a NonWritable
OpDecorate %a DescriptorSet 0
OpDecorate %a Binding 0
OpDecorate %_arr_mat4v2float_uint_4 ArrayStride 32
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat4v2float = OpTypeMatrix %v2float 4
%mat4x2_f32 = OpTypeStruct %v2float %v2float %v2float %v2float
%uint = OpTypeInt 32 0
%uint_4 = OpConstant %uint 4
%_arr_mat4v2float_uint_4 = OpTypeArray %mat4v2float %uint_4
%a_block = OpTypeStruct %_arr_mat4v2float_uint_4
%_ptr_Uniform_a_block = OpTypePointer Uniform %a_block
%a = OpVariable %_ptr_Uniform_a_block Uniform
%_arr_mat4x2_f32_uint_4 = OpTypeArray %mat4x2_f32 %uint_4
%a_block_std140 = OpTypeStruct %_arr_mat4x2_f32_uint_4
%_ptr_Uniform_a_block_std140 = OpTypePointer Uniform %a_block_std140
%a = OpVariable %_ptr_Uniform_a_block_std140 Uniform
%int = OpTypeInt 32 1
%11 = OpConstantNull %int
%_ptr_Private_int = OpTypePointer Private %int
%counter = OpVariable %_ptr_Private_int Private %11
%14 = OpTypeFunction %int
%int_1 = OpConstant %int 1
%void = OpTypeVoid
%21 = OpTypeFunction %void
%mat4v2float = OpTypeMatrix %v2float 4
%21 = OpTypeFunction %mat4v2float %mat4x2_f32
%_arr_mat4v2float_uint_4 = OpTypeArray %mat4v2float %uint_4
%31 = OpTypeFunction %_arr_mat4v2float_uint_4 %_arr_mat4x2_f32_uint_4
%_ptr_Function__arr_mat4v2float_uint_4 = OpTypePointer Function %_arr_mat4v2float_uint_4
%38 = OpConstantNull %_arr_mat4v2float_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%41 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_mat4x2_f32_uint_4 = OpTypePointer Function %_arr_mat4x2_f32_uint_4
%54 = OpConstantNull %_arr_mat4x2_f32_uint_4
%_ptr_Function_mat4v2float = OpTypePointer Function %mat4v2float
%_ptr_Function_mat4x2_f32 = OpTypePointer Function %mat4x2_f32
%uint_1 = OpConstant %uint 1
%67 = OpTypeFunction %v2float %uint %uint
%uint_0 = OpConstant %uint 0
%_ptr_Uniform__arr_mat4v2float_uint_4 = OpTypePointer Uniform %_arr_mat4v2float_uint_4
%_ptr_Uniform_mat4v2float = OpTypePointer Uniform %mat4v2float
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%uint_2 = OpConstant %uint 2
%uint_3 = OpConstant %uint 3
%90 = OpConstantNull %v2float
%void = OpTypeVoid
%91 = OpTypeFunction %void
%_ptr_Uniform__arr_mat4x2_f32_uint_4 = OpTypePointer Uniform %_arr_mat4x2_f32_uint_4
%_ptr_Uniform_mat4x2_f32 = OpTypePointer Uniform %mat4x2_f32
%i = OpFunction %int None %14
%16 = OpLabel
%17 = OpLoad %int %counter
@@ -50,15 +86,92 @@
%20 = OpLoad %int %counter
OpReturnValue %20
OpFunctionEnd
%f = OpFunction %void None %21
%24 = OpLabel
%25 = OpFunctionCall %int %i
%26 = OpFunctionCall %int %i
%29 = OpAccessChain %_ptr_Uniform__arr_mat4v2float_uint_4 %a %uint_0
%30 = OpLoad %_arr_mat4v2float_uint_4 %29
%32 = OpAccessChain %_ptr_Uniform_mat4v2float %a %uint_0 %25
%33 = OpLoad %mat4v2float %32
%35 = OpAccessChain %_ptr_Uniform_v2float %a %uint_0 %25 %26
%36 = OpLoad %v2float %35
%conv_mat4x2_f32 = OpFunction %mat4v2float None %21
%val = OpFunctionParameter %mat4x2_f32
%25 = OpLabel
%26 = OpCompositeExtract %v2float %val 0
%27 = OpCompositeExtract %v2float %val 1
%28 = OpCompositeExtract %v2float %val 2
%29 = OpCompositeExtract %v2float %val 3
%30 = OpCompositeConstruct %mat4v2float %26 %27 %28 %29
OpReturnValue %30
OpFunctionEnd
%conv_arr4_mat4x2_f32 = OpFunction %_arr_mat4v2float_uint_4 None %31
%val_0 = OpFunctionParameter %_arr_mat4x2_f32_uint_4
%35 = OpLabel
%arr = OpVariable %_ptr_Function__arr_mat4v2float_uint_4 Function %38
%i_0 = OpVariable %_ptr_Function_uint Function %41
%var_for_index = OpVariable %_ptr_Function__arr_mat4x2_f32_uint_4 Function %54
OpBranch %42
%42 = OpLabel
OpLoopMerge %43 %44 None
OpBranch %45
%45 = OpLabel
%47 = OpLoad %uint %i_0
%48 = OpULessThan %bool %47 %uint_4
%46 = OpLogicalNot %bool %48
OpSelectionMerge %50 None
OpBranchConditional %46 %51 %50
%51 = OpLabel
OpBranch %43
%50 = OpLabel
OpStore %var_for_index %val_0
%55 = OpLoad %uint %i_0
%57 = OpAccessChain %_ptr_Function_mat4v2float %arr %55
%59 = OpLoad %uint %i_0
%61 = OpAccessChain %_ptr_Function_mat4x2_f32 %var_for_index %59
%62 = OpLoad %mat4x2_f32 %61
%58 = OpFunctionCall %mat4v2float %conv_mat4x2_f32 %62
OpStore %57 %58
OpBranch %44
%44 = OpLabel
%63 = OpLoad %uint %i_0
%65 = OpIAdd %uint %63 %uint_1
OpStore %i_0 %65
OpBranch %42
%43 = OpLabel
%66 = OpLoad %_arr_mat4v2float_uint_4 %arr
OpReturnValue %66
OpFunctionEnd
%load_a_inner_p0_p1 = OpFunction %v2float None %67
%p0 = OpFunctionParameter %uint
%p1 = OpFunctionParameter %uint
%71 = OpLabel
OpSelectionMerge %72 None
OpSwitch %p1 %73 0 %74 1 %75 2 %76 3 %77
%74 = OpLabel
%80 = OpAccessChain %_ptr_Uniform_v2float %a %uint_0 %p0 %uint_0
%81 = OpLoad %v2float %80
OpReturnValue %81
%75 = OpLabel
%82 = OpAccessChain %_ptr_Uniform_v2float %a %uint_0 %p0 %uint_1
%83 = OpLoad %v2float %82
OpReturnValue %83
%76 = OpLabel
%85 = OpAccessChain %_ptr_Uniform_v2float %a %uint_0 %p0 %uint_2
%86 = OpLoad %v2float %85
OpReturnValue %86
%77 = OpLabel
%88 = OpAccessChain %_ptr_Uniform_v2float %a %uint_0 %p0 %uint_3
%89 = OpLoad %v2float %88
OpReturnValue %89
%73 = OpLabel
OpReturnValue %90
%72 = OpLabel
OpReturnValue %90
OpFunctionEnd
%f = OpFunction %void None %91
%94 = OpLabel
%95 = OpFunctionCall %int %i
%96 = OpFunctionCall %int %i
%99 = OpAccessChain %_ptr_Uniform__arr_mat4x2_f32_uint_4 %a %uint_0
%100 = OpLoad %_arr_mat4x2_f32_uint_4 %99
%97 = OpFunctionCall %_arr_mat4v2float_uint_4 %conv_arr4_mat4x2_f32 %100
%103 = OpAccessChain %_ptr_Uniform_mat4x2_f32 %a %uint_0 %95
%104 = OpLoad %mat4x2_f32 %103
%101 = OpFunctionCall %mat4v2float %conv_mat4x2_f32 %104
%106 = OpBitcast %uint %95
%107 = OpBitcast %uint %96
%105 = OpFunctionCall %v2float %load_a_inner_p0_p1 %106 %107
OpReturn
OpFunctionEnd

View File

@@ -1,13 +1,37 @@
#version 310 es
layout(binding = 0, std140) uniform a_block_ubo {
mat4x2 inner[4];
struct mat4x2_f32 {
vec2 col0;
vec2 col1;
vec2 col2;
vec2 col3;
};
layout(binding = 0, std140) uniform a_block_std140_ubo {
mat4x2_f32 inner[4];
} a;
mat4x2 conv_mat4x2_f32(mat4x2_f32 val) {
return mat4x2(val.col0, val.col1, val.col2, val.col3);
}
mat4x2[4] conv_arr4_mat4x2_f32(mat4x2_f32 val[4]) {
mat4x2 arr[4] = mat4x2[4](mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f));
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
arr[i] = conv_mat4x2_f32(val[i]);
}
}
return arr;
}
void f() {
mat4x2 l_a[4] = a.inner;
mat4x2 l_a_i = a.inner[2];
vec2 l_a_i_i = a.inner[2][1];
mat4x2 p_a[4] = conv_arr4_mat4x2_f32(a.inner);
mat4x2 p_a_2 = conv_mat4x2_f32(a.inner[2u]);
vec2 p_a_2_1 = a.inner[2u].col1;
mat4x2 l_a[4] = conv_arr4_mat4x2_f32(a.inner);
mat4x2 l_a_i = conv_mat4x2_f32(a.inner[2u]);
vec2 l_a_i_i = a.inner[2u].col1;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@@ -1,49 +1,125 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 27
; Bound: 73
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %a_block "a_block"
OpMemberName %a_block 0 "inner"
OpName %a_block_std140 "a_block_std140"
OpMemberName %a_block_std140 0 "inner"
OpName %mat4x2_f32 "mat4x2_f32"
OpMemberName %mat4x2_f32 0 "col0"
OpMemberName %mat4x2_f32 1 "col1"
OpMemberName %mat4x2_f32 2 "col2"
OpMemberName %mat4x2_f32 3 "col3"
OpName %a "a"
OpName %conv_mat4x2_f32 "conv_mat4x2_f32"
OpName %val "val"
OpName %conv_arr4_mat4x2_f32 "conv_arr4_mat4x2_f32"
OpName %val_0 "val"
OpName %arr "arr"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %f "f"
OpDecorate %a_block Block
OpMemberDecorate %a_block 0 Offset 0
OpMemberDecorate %a_block 0 ColMajor
OpMemberDecorate %a_block 0 MatrixStride 8
OpDecorate %_arr_mat4v2float_uint_4 ArrayStride 32
OpDecorate %a_block_std140 Block
OpMemberDecorate %a_block_std140 0 Offset 0
OpMemberDecorate %mat4x2_f32 0 Offset 0
OpMemberDecorate %mat4x2_f32 1 Offset 8
OpMemberDecorate %mat4x2_f32 2 Offset 16
OpMemberDecorate %mat4x2_f32 3 Offset 24
OpDecorate %_arr_mat4x2_f32_uint_4 ArrayStride 32
OpDecorate %a NonWritable
OpDecorate %a DescriptorSet 0
OpDecorate %a Binding 0
OpDecorate %_arr_mat4v2float_uint_4 ArrayStride 32
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat4v2float = OpTypeMatrix %v2float 4
%mat4x2_f32 = OpTypeStruct %v2float %v2float %v2float %v2float
%uint = OpTypeInt 32 0
%uint_4 = OpConstant %uint 4
%_arr_mat4x2_f32_uint_4 = OpTypeArray %mat4x2_f32 %uint_4
%a_block_std140 = OpTypeStruct %_arr_mat4x2_f32_uint_4
%_ptr_Uniform_a_block_std140 = OpTypePointer Uniform %a_block_std140
%a = OpVariable %_ptr_Uniform_a_block_std140 Uniform
%mat4v2float = OpTypeMatrix %v2float 4
%10 = OpTypeFunction %mat4v2float %mat4x2_f32
%_arr_mat4v2float_uint_4 = OpTypeArray %mat4v2float %uint_4
%a_block = OpTypeStruct %_arr_mat4v2float_uint_4
%_ptr_Uniform_a_block = OpTypePointer Uniform %a_block
%a = OpVariable %_ptr_Uniform_a_block Uniform
%20 = OpTypeFunction %_arr_mat4v2float_uint_4 %_arr_mat4x2_f32_uint_4
%_ptr_Function__arr_mat4v2float_uint_4 = OpTypePointer Function %_arr_mat4v2float_uint_4
%27 = OpConstantNull %_arr_mat4v2float_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%30 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_mat4x2_f32_uint_4 = OpTypePointer Function %_arr_mat4x2_f32_uint_4
%43 = OpConstantNull %_arr_mat4x2_f32_uint_4
%_ptr_Function_mat4v2float = OpTypePointer Function %mat4v2float
%_ptr_Function_mat4x2_f32 = OpTypePointer Function %mat4x2_f32
%uint_1 = OpConstant %uint 1
%void = OpTypeVoid
%10 = OpTypeFunction %void
%56 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0
%_ptr_Uniform__arr_mat4v2float_uint_4 = OpTypePointer Uniform %_arr_mat4v2float_uint_4
%int = OpTypeInt 32 1
%int_2 = OpConstant %int 2
%_ptr_Uniform_mat4v2float = OpTypePointer Uniform %mat4v2float
%int_1 = OpConstant %int 1
%_ptr_Uniform__arr_mat4x2_f32_uint_4 = OpTypePointer Uniform %_arr_mat4x2_f32_uint_4
%uint_2 = OpConstant %uint 2
%_ptr_Uniform_mat4x2_f32 = OpTypePointer Uniform %mat4x2_f32
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%f = OpFunction %void None %10
%13 = OpLabel
%16 = OpAccessChain %_ptr_Uniform__arr_mat4v2float_uint_4 %a %uint_0
%17 = OpLoad %_arr_mat4v2float_uint_4 %16
%21 = OpAccessChain %_ptr_Uniform_mat4v2float %a %uint_0 %int_2
%22 = OpLoad %mat4v2float %21
%25 = OpAccessChain %_ptr_Uniform_v2float %a %uint_0 %int_2 %int_1
%26 = OpLoad %v2float %25
%conv_mat4x2_f32 = OpFunction %mat4v2float None %10
%val = OpFunctionParameter %mat4x2_f32
%14 = OpLabel
%15 = OpCompositeExtract %v2float %val 0
%16 = OpCompositeExtract %v2float %val 1
%17 = OpCompositeExtract %v2float %val 2
%18 = OpCompositeExtract %v2float %val 3
%19 = OpCompositeConstruct %mat4v2float %15 %16 %17 %18
OpReturnValue %19
OpFunctionEnd
%conv_arr4_mat4x2_f32 = OpFunction %_arr_mat4v2float_uint_4 None %20
%val_0 = OpFunctionParameter %_arr_mat4x2_f32_uint_4
%24 = OpLabel
%arr = OpVariable %_ptr_Function__arr_mat4v2float_uint_4 Function %27
%i = OpVariable %_ptr_Function_uint Function %30
%var_for_index = OpVariable %_ptr_Function__arr_mat4x2_f32_uint_4 Function %43
OpBranch %31
%31 = OpLabel
OpLoopMerge %32 %33 None
OpBranch %34
%34 = OpLabel
%36 = OpLoad %uint %i
%37 = OpULessThan %bool %36 %uint_4
%35 = OpLogicalNot %bool %37
OpSelectionMerge %39 None
OpBranchConditional %35 %40 %39
%40 = OpLabel
OpBranch %32
%39 = OpLabel
OpStore %var_for_index %val_0
%44 = OpLoad %uint %i
%46 = OpAccessChain %_ptr_Function_mat4v2float %arr %44
%48 = OpLoad %uint %i
%50 = OpAccessChain %_ptr_Function_mat4x2_f32 %var_for_index %48
%51 = OpLoad %mat4x2_f32 %50
%47 = OpFunctionCall %mat4v2float %conv_mat4x2_f32 %51
OpStore %46 %47
OpBranch %33
%33 = OpLabel
%52 = OpLoad %uint %i
%54 = OpIAdd %uint %52 %uint_1
OpStore %i %54
OpBranch %31
%32 = OpLabel
%55 = OpLoad %_arr_mat4v2float_uint_4 %arr
OpReturnValue %55
OpFunctionEnd
%f = OpFunction %void None %56
%59 = OpLabel
%63 = OpAccessChain %_ptr_Uniform__arr_mat4x2_f32_uint_4 %a %uint_0
%64 = OpLoad %_arr_mat4x2_f32_uint_4 %63
%60 = OpFunctionCall %_arr_mat4v2float_uint_4 %conv_arr4_mat4x2_f32 %64
%68 = OpAccessChain %_ptr_Uniform_mat4x2_f32 %a %uint_0 %uint_2
%69 = OpLoad %mat4x2_f32 %68
%65 = OpFunctionCall %mat4v2float %conv_mat4x2_f32 %69
%71 = OpAccessChain %_ptr_Uniform_v2float %a %uint_0 %uint_2 %uint_1
%72 = OpLoad %v2float %71
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,14 @@
#version 310 es
layout(binding = 0, std140) uniform u_block_ubo {
mat4x2 inner[4];
struct mat4x2_f32 {
vec2 col0;
vec2 col1;
vec2 col2;
vec2 col3;
};
layout(binding = 0, std140) uniform u_block_std140_ubo {
mat4x2_f32 inner[4];
} u;
void a(mat4x2 a_1[4]) {
@@ -16,11 +23,25 @@ void c(vec2 v) {
void d(float f_1) {
}
mat4x2 conv_mat4x2_f32(mat4x2_f32 val) {
return mat4x2(val.col0, val.col1, val.col2, val.col3);
}
mat4x2[4] conv_arr4_mat4x2_f32(mat4x2_f32 val[4]) {
mat4x2 arr[4] = mat4x2[4](mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f));
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
arr[i] = conv_mat4x2_f32(val[i]);
}
}
return arr;
}
void f() {
a(u.inner);
b(u.inner[1]);
c(u.inner[1][0].yx);
d(u.inner[1][0].yx.x);
a(conv_arr4_mat4x2_f32(u.inner));
b(conv_mat4x2_f32(u.inner[1u]));
c(u.inner[1u].col0.yx);
d(u.inner[1u].col0.yx[0u]);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@@ -1,14 +1,19 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 52
; Bound: 97
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %u_block "u_block"
OpMemberName %u_block 0 "inner"
OpName %u_block_std140 "u_block_std140"
OpMemberName %u_block_std140 0 "inner"
OpName %mat4x2_f32 "mat4x2_f32"
OpMemberName %mat4x2_f32 0 "col0"
OpMemberName %mat4x2_f32 1 "col1"
OpMemberName %mat4x2_f32 2 "col2"
OpMemberName %mat4x2_f32 3 "col3"
OpName %u "u"
OpName %a "a"
OpName %a_1 "a_1"
@@ -18,73 +23,143 @@
OpName %v "v"
OpName %d "d"
OpName %f_1 "f_1"
OpName %conv_mat4x2_f32 "conv_mat4x2_f32"
OpName %val "val"
OpName %conv_arr4_mat4x2_f32 "conv_arr4_mat4x2_f32"
OpName %val_0 "val"
OpName %arr "arr"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %f "f"
OpDecorate %u_block Block
OpMemberDecorate %u_block 0 Offset 0
OpMemberDecorate %u_block 0 ColMajor
OpMemberDecorate %u_block 0 MatrixStride 8
OpDecorate %_arr_mat4v2float_uint_4 ArrayStride 32
OpDecorate %u_block_std140 Block
OpMemberDecorate %u_block_std140 0 Offset 0
OpMemberDecorate %mat4x2_f32 0 Offset 0
OpMemberDecorate %mat4x2_f32 1 Offset 8
OpMemberDecorate %mat4x2_f32 2 Offset 16
OpMemberDecorate %mat4x2_f32 3 Offset 24
OpDecorate %_arr_mat4x2_f32_uint_4 ArrayStride 32
OpDecorate %u NonWritable
OpDecorate %u DescriptorSet 0
OpDecorate %u Binding 0
OpDecorate %_arr_mat4v2float_uint_4 ArrayStride 32
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat4v2float = OpTypeMatrix %v2float 4
%mat4x2_f32 = OpTypeStruct %v2float %v2float %v2float %v2float
%uint = OpTypeInt 32 0
%uint_4 = OpConstant %uint 4
%_arr_mat4v2float_uint_4 = OpTypeArray %mat4v2float %uint_4
%u_block = OpTypeStruct %_arr_mat4v2float_uint_4
%_ptr_Uniform_u_block = OpTypePointer Uniform %u_block
%u = OpVariable %_ptr_Uniform_u_block Uniform
%_arr_mat4x2_f32_uint_4 = OpTypeArray %mat4x2_f32 %uint_4
%u_block_std140 = OpTypeStruct %_arr_mat4x2_f32_uint_4
%_ptr_Uniform_u_block_std140 = OpTypePointer Uniform %u_block_std140
%u = OpVariable %_ptr_Uniform_u_block_std140 Uniform
%void = OpTypeVoid
%mat4v2float = OpTypeMatrix %v2float 4
%_arr_mat4v2float_uint_4 = OpTypeArray %mat4v2float %uint_4
%10 = OpTypeFunction %void %_arr_mat4v2float_uint_4
%15 = OpTypeFunction %void %mat4v2float
%19 = OpTypeFunction %void %v2float
%23 = OpTypeFunction %void %float
%27 = OpTypeFunction %void
%17 = OpTypeFunction %void %mat4v2float
%21 = OpTypeFunction %void %v2float
%25 = OpTypeFunction %void %float
%29 = OpTypeFunction %mat4v2float %mat4x2_f32
%38 = OpTypeFunction %_arr_mat4v2float_uint_4 %_arr_mat4x2_f32_uint_4
%_ptr_Function__arr_mat4v2float_uint_4 = OpTypePointer Function %_arr_mat4v2float_uint_4
%44 = OpConstantNull %_arr_mat4v2float_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%47 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_mat4x2_f32_uint_4 = OpTypePointer Function %_arr_mat4x2_f32_uint_4
%60 = OpConstantNull %_arr_mat4x2_f32_uint_4
%_ptr_Function_mat4v2float = OpTypePointer Function %mat4v2float
%_ptr_Function_mat4x2_f32 = OpTypePointer Function %mat4x2_f32
%uint_1 = OpConstant %uint 1
%73 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0
%_ptr_Uniform__arr_mat4v2float_uint_4 = OpTypePointer Uniform %_arr_mat4v2float_uint_4
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%_ptr_Uniform_mat4v2float = OpTypePointer Uniform %mat4v2float
%42 = OpConstantNull %int
%_ptr_Uniform__arr_mat4x2_f32_uint_4 = OpTypePointer Uniform %_arr_mat4x2_f32_uint_4
%_ptr_Uniform_mat4x2_f32 = OpTypePointer Uniform %mat4x2_f32
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%a = OpFunction %void None %10
%a_1 = OpFunctionParameter %_arr_mat4v2float_uint_4
%14 = OpLabel
%16 = OpLabel
OpReturn
OpFunctionEnd
%b = OpFunction %void None %15
%b = OpFunction %void None %17
%m = OpFunctionParameter %mat4v2float
%18 = OpLabel
%20 = OpLabel
OpReturn
OpFunctionEnd
%c = OpFunction %void None %19
%c = OpFunction %void None %21
%v = OpFunctionParameter %v2float
%22 = OpLabel
%24 = OpLabel
OpReturn
OpFunctionEnd
%d = OpFunction %void None %23
%d = OpFunction %void None %25
%f_1 = OpFunctionParameter %float
%26 = OpLabel
%28 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %void None %27
%29 = OpLabel
%33 = OpAccessChain %_ptr_Uniform__arr_mat4v2float_uint_4 %u %uint_0
%34 = OpLoad %_arr_mat4v2float_uint_4 %33
%30 = OpFunctionCall %void %a %34
%39 = OpAccessChain %_ptr_Uniform_mat4v2float %u %uint_0 %int_1
%40 = OpLoad %mat4v2float %39
%35 = OpFunctionCall %void %b %40
%44 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %int_1 %42
%45 = OpLoad %v2float %44
%46 = OpVectorShuffle %v2float %45 %45 1 0
%41 = OpFunctionCall %void %c %46
%48 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %int_1 %42
%49 = OpLoad %v2float %48
%50 = OpVectorShuffle %v2float %49 %49 1 0
%51 = OpCompositeExtract %float %50 0
%47 = OpFunctionCall %void %d %51
%conv_mat4x2_f32 = OpFunction %mat4v2float None %29
%val = OpFunctionParameter %mat4x2_f32
%32 = OpLabel
%33 = OpCompositeExtract %v2float %val 0
%34 = OpCompositeExtract %v2float %val 1
%35 = OpCompositeExtract %v2float %val 2
%36 = OpCompositeExtract %v2float %val 3
%37 = OpCompositeConstruct %mat4v2float %33 %34 %35 %36
OpReturnValue %37
OpFunctionEnd
%conv_arr4_mat4x2_f32 = OpFunction %_arr_mat4v2float_uint_4 None %38
%val_0 = OpFunctionParameter %_arr_mat4x2_f32_uint_4
%41 = OpLabel
%arr = OpVariable %_ptr_Function__arr_mat4v2float_uint_4 Function %44
%i = OpVariable %_ptr_Function_uint Function %47
%var_for_index = OpVariable %_ptr_Function__arr_mat4x2_f32_uint_4 Function %60
OpBranch %48
%48 = OpLabel
OpLoopMerge %49 %50 None
OpBranch %51
%51 = OpLabel
%53 = OpLoad %uint %i
%54 = OpULessThan %bool %53 %uint_4
%52 = OpLogicalNot %bool %54
OpSelectionMerge %56 None
OpBranchConditional %52 %57 %56
%57 = OpLabel
OpBranch %49
%56 = OpLabel
OpStore %var_for_index %val_0
%61 = OpLoad %uint %i
%63 = OpAccessChain %_ptr_Function_mat4v2float %arr %61
%65 = OpLoad %uint %i
%67 = OpAccessChain %_ptr_Function_mat4x2_f32 %var_for_index %65
%68 = OpLoad %mat4x2_f32 %67
%64 = OpFunctionCall %mat4v2float %conv_mat4x2_f32 %68
OpStore %63 %64
OpBranch %50
%50 = OpLabel
%69 = OpLoad %uint %i
%71 = OpIAdd %uint %69 %uint_1
OpStore %i %71
OpBranch %48
%49 = OpLabel
%72 = OpLoad %_arr_mat4v2float_uint_4 %arr
OpReturnValue %72
OpFunctionEnd
%f = OpFunction %void None %73
%75 = OpLabel
%80 = OpAccessChain %_ptr_Uniform__arr_mat4x2_f32_uint_4 %u %uint_0
%81 = OpLoad %_arr_mat4x2_f32_uint_4 %80
%77 = OpFunctionCall %_arr_mat4v2float_uint_4 %conv_arr4_mat4x2_f32 %81
%76 = OpFunctionCall %void %a %77
%85 = OpAccessChain %_ptr_Uniform_mat4x2_f32 %u %uint_0 %uint_1
%86 = OpLoad %mat4x2_f32 %85
%83 = OpFunctionCall %mat4v2float %conv_mat4x2_f32 %86
%82 = OpFunctionCall %void %b %83
%89 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %uint_1 %uint_0
%90 = OpLoad %v2float %89
%91 = OpVectorShuffle %v2float %90 %90 1 0
%87 = OpFunctionCall %void %c %91
%93 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %uint_1 %uint_0
%94 = OpLoad %v2float %93
%95 = OpVectorShuffle %v2float %94 %94 1 0
%96 = OpCompositeExtract %float %95 0
%92 = OpFunctionCall %void %d %96
OpReturn
OpFunctionEnd

View File

@@ -1,21 +1,42 @@
#version 310 es
struct mat4x2_f32 {
vec2 col0;
vec2 col1;
vec2 col2;
vec2 col3;
};
struct S {
int before;
mat4x2 m;
int after;
};
layout(binding = 0, std140) uniform u_block_ubo {
mat4x2 inner[4];
layout(binding = 0, std140) uniform u_block_std140_ubo {
mat4x2_f32 inner[4];
} u;
mat4x2 p[4] = mat4x2[4](mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f));
mat4x2 conv_mat4x2_f32(mat4x2_f32 val) {
return mat4x2(val.col0, val.col1, val.col2, val.col3);
}
mat4x2[4] conv_arr4_mat4x2_f32(mat4x2_f32 val[4]) {
mat4x2 arr[4] = mat4x2[4](mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f));
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
arr[i] = conv_mat4x2_f32(val[i]);
}
}
return arr;
}
void f() {
p = u.inner;
p[1] = u.inner[2];
p[1][0] = u.inner[0][1].yx;
p[1][0].x = u.inner[0][1].x;
p = conv_arr4_mat4x2_f32(u.inner);
p[1] = conv_mat4x2_f32(u.inner[2u]);
p[1][0] = u.inner[0u].col1.yx;
p[1][0].x = u.inner[0u].col1[0u];
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@@ -1,68 +1,145 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 41
; Bound: 88
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %u_block "u_block"
OpMemberName %u_block 0 "inner"
OpName %u_block_std140 "u_block_std140"
OpMemberName %u_block_std140 0 "inner"
OpName %mat4x2_f32 "mat4x2_f32"
OpMemberName %mat4x2_f32 0 "col0"
OpMemberName %mat4x2_f32 1 "col1"
OpMemberName %mat4x2_f32 2 "col2"
OpMemberName %mat4x2_f32 3 "col3"
OpName %u "u"
OpName %p "p"
OpName %conv_mat4x2_f32 "conv_mat4x2_f32"
OpName %val "val"
OpName %conv_arr4_mat4x2_f32 "conv_arr4_mat4x2_f32"
OpName %val_0 "val"
OpName %arr "arr"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %f "f"
OpDecorate %u_block Block
OpMemberDecorate %u_block 0 Offset 0
OpMemberDecorate %u_block 0 ColMajor
OpMemberDecorate %u_block 0 MatrixStride 8
OpDecorate %_arr_mat4v2float_uint_4 ArrayStride 32
OpDecorate %u_block_std140 Block
OpMemberDecorate %u_block_std140 0 Offset 0
OpMemberDecorate %mat4x2_f32 0 Offset 0
OpMemberDecorate %mat4x2_f32 1 Offset 8
OpMemberDecorate %mat4x2_f32 2 Offset 16
OpMemberDecorate %mat4x2_f32 3 Offset 24
OpDecorate %_arr_mat4x2_f32_uint_4 ArrayStride 32
OpDecorate %u NonWritable
OpDecorate %u DescriptorSet 0
OpDecorate %u Binding 0
OpDecorate %_arr_mat4v2float_uint_4 ArrayStride 32
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat4v2float = OpTypeMatrix %v2float 4
%mat4x2_f32 = OpTypeStruct %v2float %v2float %v2float %v2float
%uint = OpTypeInt 32 0
%uint_4 = OpConstant %uint 4
%_arr_mat4x2_f32_uint_4 = OpTypeArray %mat4x2_f32 %uint_4
%u_block_std140 = OpTypeStruct %_arr_mat4x2_f32_uint_4
%_ptr_Uniform_u_block_std140 = OpTypePointer Uniform %u_block_std140
%u = OpVariable %_ptr_Uniform_u_block_std140 Uniform
%mat4v2float = OpTypeMatrix %v2float 4
%_arr_mat4v2float_uint_4 = OpTypeArray %mat4v2float %uint_4
%u_block = OpTypeStruct %_arr_mat4v2float_uint_4
%_ptr_Uniform_u_block = OpTypePointer Uniform %u_block
%u = OpVariable %_ptr_Uniform_u_block Uniform
%_ptr_Private__arr_mat4v2float_uint_4 = OpTypePointer Private %_arr_mat4v2float_uint_4
%12 = OpConstantNull %_arr_mat4v2float_uint_4
%p = OpVariable %_ptr_Private__arr_mat4v2float_uint_4 Private %12
%14 = OpConstantNull %_arr_mat4v2float_uint_4
%p = OpVariable %_ptr_Private__arr_mat4v2float_uint_4 Private %14
%15 = OpTypeFunction %mat4v2float %mat4x2_f32
%24 = OpTypeFunction %_arr_mat4v2float_uint_4 %_arr_mat4x2_f32_uint_4
%_ptr_Function__arr_mat4v2float_uint_4 = OpTypePointer Function %_arr_mat4v2float_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%32 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_mat4x2_f32_uint_4 = OpTypePointer Function %_arr_mat4x2_f32_uint_4
%45 = OpConstantNull %_arr_mat4x2_f32_uint_4
%_ptr_Function_mat4v2float = OpTypePointer Function %mat4v2float
%_ptr_Function_mat4x2_f32 = OpTypePointer Function %mat4x2_f32
%uint_1 = OpConstant %uint 1
%void = OpTypeVoid
%13 = OpTypeFunction %void
%58 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0
%_ptr_Uniform__arr_mat4v2float_uint_4 = OpTypePointer Uniform %_arr_mat4v2float_uint_4
%_ptr_Uniform__arr_mat4x2_f32_uint_4 = OpTypePointer Uniform %_arr_mat4x2_f32_uint_4
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%_ptr_Private_mat4v2float = OpTypePointer Private %mat4v2float
%int_2 = OpConstant %int 2
%_ptr_Uniform_mat4v2float = OpTypePointer Uniform %mat4v2float
%29 = OpConstantNull %int
%uint_2 = OpConstant %uint 2
%_ptr_Uniform_mat4x2_f32 = OpTypePointer Uniform %mat4x2_f32
%76 = OpConstantNull %int
%_ptr_Private_v2float = OpTypePointer Private %v2float
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%_ptr_Private_float = OpTypePointer Private %float
%_ptr_Uniform_float = OpTypePointer Uniform %float
%f = OpFunction %void None %13
%16 = OpLabel
%19 = OpAccessChain %_ptr_Uniform__arr_mat4v2float_uint_4 %u %uint_0
%20 = OpLoad %_arr_mat4v2float_uint_4 %19
OpStore %p %20
%24 = OpAccessChain %_ptr_Private_mat4v2float %p %int_1
%27 = OpAccessChain %_ptr_Uniform_mat4v2float %u %uint_0 %int_2
%28 = OpLoad %mat4v2float %27
OpStore %24 %28
%31 = OpAccessChain %_ptr_Private_v2float %p %int_1 %29
%33 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %29 %int_1
%34 = OpLoad %v2float %33
%35 = OpVectorShuffle %v2float %34 %34 1 0
OpStore %31 %35
%37 = OpAccessChain %_ptr_Private_float %p %int_1 %29 %uint_0
%39 = OpAccessChain %_ptr_Uniform_float %u %uint_0 %29 %int_1 %uint_0
%40 = OpLoad %float %39
OpStore %37 %40
%conv_mat4x2_f32 = OpFunction %mat4v2float None %15
%val = OpFunctionParameter %mat4x2_f32
%18 = OpLabel
%19 = OpCompositeExtract %v2float %val 0
%20 = OpCompositeExtract %v2float %val 1
%21 = OpCompositeExtract %v2float %val 2
%22 = OpCompositeExtract %v2float %val 3
%23 = OpCompositeConstruct %mat4v2float %19 %20 %21 %22
OpReturnValue %23
OpFunctionEnd
%conv_arr4_mat4x2_f32 = OpFunction %_arr_mat4v2float_uint_4 None %24
%val_0 = OpFunctionParameter %_arr_mat4x2_f32_uint_4
%27 = OpLabel
%arr = OpVariable %_ptr_Function__arr_mat4v2float_uint_4 Function %14
%i = OpVariable %_ptr_Function_uint Function %32
%var_for_index = OpVariable %_ptr_Function__arr_mat4x2_f32_uint_4 Function %45
OpBranch %33
%33 = OpLabel
OpLoopMerge %34 %35 None
OpBranch %36
%36 = OpLabel
%38 = OpLoad %uint %i
%39 = OpULessThan %bool %38 %uint_4
%37 = OpLogicalNot %bool %39
OpSelectionMerge %41 None
OpBranchConditional %37 %42 %41
%42 = OpLabel
OpBranch %34
%41 = OpLabel
OpStore %var_for_index %val_0
%46 = OpLoad %uint %i
%48 = OpAccessChain %_ptr_Function_mat4v2float %arr %46
%50 = OpLoad %uint %i
%52 = OpAccessChain %_ptr_Function_mat4x2_f32 %var_for_index %50
%53 = OpLoad %mat4x2_f32 %52
%49 = OpFunctionCall %mat4v2float %conv_mat4x2_f32 %53
OpStore %48 %49
OpBranch %35
%35 = OpLabel
%54 = OpLoad %uint %i
%56 = OpIAdd %uint %54 %uint_1
OpStore %i %56
OpBranch %33
%34 = OpLabel
%57 = OpLoad %_arr_mat4v2float_uint_4 %arr
OpReturnValue %57
OpFunctionEnd
%f = OpFunction %void None %58
%61 = OpLabel
%65 = OpAccessChain %_ptr_Uniform__arr_mat4x2_f32_uint_4 %u %uint_0
%66 = OpLoad %_arr_mat4x2_f32_uint_4 %65
%62 = OpFunctionCall %_arr_mat4v2float_uint_4 %conv_arr4_mat4x2_f32 %66
OpStore %p %62
%70 = OpAccessChain %_ptr_Private_mat4v2float %p %int_1
%74 = OpAccessChain %_ptr_Uniform_mat4x2_f32 %u %uint_0 %uint_2
%75 = OpLoad %mat4x2_f32 %74
%71 = OpFunctionCall %mat4v2float %conv_mat4x2_f32 %75
OpStore %70 %71
%78 = OpAccessChain %_ptr_Private_v2float %p %int_1 %76
%80 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %32 %uint_1
%81 = OpLoad %v2float %80
%82 = OpVectorShuffle %v2float %81 %81 1 0
OpStore %78 %82
%84 = OpAccessChain %_ptr_Private_float %p %int_1 %76 %uint_0
%86 = OpAccessChain %_ptr_Uniform_float %u %uint_0 %32 %uint_1 %32
%87 = OpLoad %float %86
OpStore %84 %87
OpReturn
OpFunctionEnd

View File

@@ -1,24 +1,45 @@
#version 310 es
struct mat4x2_f32 {
vec2 col0;
vec2 col1;
vec2 col2;
vec2 col3;
};
struct S {
int before;
mat4x2 m;
int after;
};
layout(binding = 0, std140) uniform u_block_ubo {
mat4x2 inner[4];
layout(binding = 0, std140) uniform u_block_std140_ubo {
mat4x2_f32 inner[4];
} u;
layout(binding = 1, std430) buffer u_block_ssbo {
mat4x2 inner[4];
} s;
mat4x2 conv_mat4x2_f32(mat4x2_f32 val) {
return mat4x2(val.col0, val.col1, val.col2, val.col3);
}
mat4x2[4] conv_arr4_mat4x2_f32(mat4x2_f32 val[4]) {
mat4x2 arr[4] = mat4x2[4](mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f));
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
arr[i] = conv_mat4x2_f32(val[i]);
}
}
return arr;
}
void f() {
s.inner = u.inner;
s.inner[1] = u.inner[2];
s.inner[1][0] = u.inner[0][1].yx;
s.inner[1][0].x = u.inner[0][1].x;
s.inner = conv_arr4_mat4x2_f32(u.inner);
s.inner[1] = conv_mat4x2_f32(u.inner[2u]);
s.inner[1][0] = u.inner[0u].col1.yx;
s.inner[1][0].x = u.inner[0u].col1[0u];
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@@ -1,71 +1,156 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 42
; Bound: 91
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %u_block_std140 "u_block_std140"
OpMemberName %u_block_std140 0 "inner"
OpName %mat4x2_f32 "mat4x2_f32"
OpMemberName %mat4x2_f32 0 "col0"
OpMemberName %mat4x2_f32 1 "col1"
OpMemberName %mat4x2_f32 2 "col2"
OpMemberName %mat4x2_f32 3 "col3"
OpName %u "u"
OpName %u_block "u_block"
OpMemberName %u_block 0 "inner"
OpName %u "u"
OpName %s "s"
OpName %conv_mat4x2_f32 "conv_mat4x2_f32"
OpName %val "val"
OpName %conv_arr4_mat4x2_f32 "conv_arr4_mat4x2_f32"
OpName %val_0 "val"
OpName %arr "arr"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %f "f"
OpDecorate %u_block_std140 Block
OpMemberDecorate %u_block_std140 0 Offset 0
OpMemberDecorate %mat4x2_f32 0 Offset 0
OpMemberDecorate %mat4x2_f32 1 Offset 8
OpMemberDecorate %mat4x2_f32 2 Offset 16
OpMemberDecorate %mat4x2_f32 3 Offset 24
OpDecorate %_arr_mat4x2_f32_uint_4 ArrayStride 32
OpDecorate %u NonWritable
OpDecorate %u DescriptorSet 0
OpDecorate %u Binding 0
OpDecorate %u_block Block
OpMemberDecorate %u_block 0 Offset 0
OpMemberDecorate %u_block 0 ColMajor
OpMemberDecorate %u_block 0 MatrixStride 8
OpDecorate %_arr_mat4v2float_uint_4 ArrayStride 32
OpDecorate %u NonWritable
OpDecorate %u DescriptorSet 0
OpDecorate %u Binding 0
OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat4v2float = OpTypeMatrix %v2float 4
%mat4x2_f32 = OpTypeStruct %v2float %v2float %v2float %v2float
%uint = OpTypeInt 32 0
%uint_4 = OpConstant %uint 4
%_arr_mat4x2_f32_uint_4 = OpTypeArray %mat4x2_f32 %uint_4
%u_block_std140 = OpTypeStruct %_arr_mat4x2_f32_uint_4
%_ptr_Uniform_u_block_std140 = OpTypePointer Uniform %u_block_std140
%u = OpVariable %_ptr_Uniform_u_block_std140 Uniform
%mat4v2float = OpTypeMatrix %v2float 4
%_arr_mat4v2float_uint_4 = OpTypeArray %mat4v2float %uint_4
%u_block = OpTypeStruct %_arr_mat4v2float_uint_4
%_ptr_Uniform_u_block = OpTypePointer Uniform %u_block
%u = OpVariable %_ptr_Uniform_u_block Uniform
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%15 = OpTypeFunction %mat4v2float %mat4x2_f32
%24 = OpTypeFunction %_arr_mat4v2float_uint_4 %_arr_mat4x2_f32_uint_4
%_ptr_Function__arr_mat4v2float_uint_4 = OpTypePointer Function %_arr_mat4v2float_uint_4
%30 = OpConstantNull %_arr_mat4v2float_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%33 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_mat4x2_f32_uint_4 = OpTypePointer Function %_arr_mat4x2_f32_uint_4
%46 = OpConstantNull %_arr_mat4x2_f32_uint_4
%_ptr_Function_mat4v2float = OpTypePointer Function %mat4v2float
%_ptr_Function_mat4x2_f32 = OpTypePointer Function %mat4x2_f32
%uint_1 = OpConstant %uint 1
%void = OpTypeVoid
%12 = OpTypeFunction %void
%59 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer__arr_mat4v2float_uint_4 = OpTypePointer StorageBuffer %_arr_mat4v2float_uint_4
%_ptr_Uniform__arr_mat4v2float_uint_4 = OpTypePointer Uniform %_arr_mat4v2float_uint_4
%_ptr_Uniform__arr_mat4x2_f32_uint_4 = OpTypePointer Uniform %_arr_mat4x2_f32_uint_4
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_mat4v2float = OpTypePointer StorageBuffer %mat4v2float
%int_2 = OpConstant %int 2
%_ptr_Uniform_mat4v2float = OpTypePointer Uniform %mat4v2float
%30 = OpConstantNull %int
%uint_2 = OpConstant %uint 2
%_ptr_Uniform_mat4x2_f32 = OpTypePointer Uniform %mat4x2_f32
%79 = OpConstantNull %int
%_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%_ptr_Uniform_float = OpTypePointer Uniform %float
%f = OpFunction %void None %12
%15 = OpLabel
%18 = OpAccessChain %_ptr_StorageBuffer__arr_mat4v2float_uint_4 %s %uint_0
%20 = OpAccessChain %_ptr_Uniform__arr_mat4v2float_uint_4 %u %uint_0
%21 = OpLoad %_arr_mat4v2float_uint_4 %20
OpStore %18 %21
%25 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %s %uint_0 %int_1
%28 = OpAccessChain %_ptr_Uniform_mat4v2float %u %uint_0 %int_2
%29 = OpLoad %mat4v2float %28
OpStore %25 %29
%32 = OpAccessChain %_ptr_StorageBuffer_v2float %s %uint_0 %int_1 %30
%34 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %30 %int_1
%35 = OpLoad %v2float %34
%36 = OpVectorShuffle %v2float %35 %35 1 0
OpStore %32 %36
%38 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %int_1 %30 %uint_0
%40 = OpAccessChain %_ptr_Uniform_float %u %uint_0 %30 %int_1 %uint_0
%41 = OpLoad %float %40
OpStore %38 %41
%conv_mat4x2_f32 = OpFunction %mat4v2float None %15
%val = OpFunctionParameter %mat4x2_f32
%18 = OpLabel
%19 = OpCompositeExtract %v2float %val 0
%20 = OpCompositeExtract %v2float %val 1
%21 = OpCompositeExtract %v2float %val 2
%22 = OpCompositeExtract %v2float %val 3
%23 = OpCompositeConstruct %mat4v2float %19 %20 %21 %22
OpReturnValue %23
OpFunctionEnd
%conv_arr4_mat4x2_f32 = OpFunction %_arr_mat4v2float_uint_4 None %24
%val_0 = OpFunctionParameter %_arr_mat4x2_f32_uint_4
%27 = OpLabel
%arr = OpVariable %_ptr_Function__arr_mat4v2float_uint_4 Function %30
%i = OpVariable %_ptr_Function_uint Function %33
%var_for_index = OpVariable %_ptr_Function__arr_mat4x2_f32_uint_4 Function %46
OpBranch %34
%34 = OpLabel
OpLoopMerge %35 %36 None
OpBranch %37
%37 = OpLabel
%39 = OpLoad %uint %i
%40 = OpULessThan %bool %39 %uint_4
%38 = OpLogicalNot %bool %40
OpSelectionMerge %42 None
OpBranchConditional %38 %43 %42
%43 = OpLabel
OpBranch %35
%42 = OpLabel
OpStore %var_for_index %val_0
%47 = OpLoad %uint %i
%49 = OpAccessChain %_ptr_Function_mat4v2float %arr %47
%51 = OpLoad %uint %i
%53 = OpAccessChain %_ptr_Function_mat4x2_f32 %var_for_index %51
%54 = OpLoad %mat4x2_f32 %53
%50 = OpFunctionCall %mat4v2float %conv_mat4x2_f32 %54
OpStore %49 %50
OpBranch %36
%36 = OpLabel
%55 = OpLoad %uint %i
%57 = OpIAdd %uint %55 %uint_1
OpStore %i %57
OpBranch %34
%35 = OpLabel
%58 = OpLoad %_arr_mat4v2float_uint_4 %arr
OpReturnValue %58
OpFunctionEnd
%f = OpFunction %void None %59
%62 = OpLabel
%65 = OpAccessChain %_ptr_StorageBuffer__arr_mat4v2float_uint_4 %s %uint_0
%68 = OpAccessChain %_ptr_Uniform__arr_mat4x2_f32_uint_4 %u %uint_0
%69 = OpLoad %_arr_mat4x2_f32_uint_4 %68
%66 = OpFunctionCall %_arr_mat4v2float_uint_4 %conv_arr4_mat4x2_f32 %69
OpStore %65 %66
%73 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %s %uint_0 %int_1
%77 = OpAccessChain %_ptr_Uniform_mat4x2_f32 %u %uint_0 %uint_2
%78 = OpLoad %mat4x2_f32 %77
%74 = OpFunctionCall %mat4v2float %conv_mat4x2_f32 %78
OpStore %73 %74
%81 = OpAccessChain %_ptr_StorageBuffer_v2float %s %uint_0 %int_1 %79
%83 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %33 %uint_1
%84 = OpLoad %v2float %83
%85 = OpVectorShuffle %v2float %84 %84 1 0
OpStore %81 %85
%87 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %int_1 %79 %uint_0
%89 = OpAccessChain %_ptr_Uniform_float %u %uint_0 %33 %uint_1 %33
%90 = OpLoad %float %89
OpStore %87 %90
OpReturn
OpFunctionEnd

View File

@@ -1,16 +1,37 @@
#version 310 es
struct mat4x2_f32 {
vec2 col0;
vec2 col1;
vec2 col2;
vec2 col3;
};
struct S {
int before;
mat4x2 m;
int after;
};
layout(binding = 0, std140) uniform u_block_ubo {
mat4x2 inner[4];
layout(binding = 0, std140) uniform u_block_std140_ubo {
mat4x2_f32 inner[4];
} u;
shared mat4x2 w[4];
mat4x2 conv_mat4x2_f32(mat4x2_f32 val) {
return mat4x2(val.col0, val.col1, val.col2, val.col3);
}
mat4x2[4] conv_arr4_mat4x2_f32(mat4x2_f32 val[4]) {
mat4x2 arr[4] = mat4x2[4](mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f));
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
arr[i] = conv_mat4x2_f32(val[i]);
}
}
return arr;
}
void f(uint local_invocation_index) {
{
for(uint idx = local_invocation_index; (idx < 4u); idx = (idx + 1u)) {
@@ -19,10 +40,10 @@ void f(uint local_invocation_index) {
}
}
barrier();
w = u.inner;
w[1] = u.inner[2];
w[1][0] = u.inner[0][1].yx;
w[1][0].x = u.inner[0][1].x;
w = conv_arr4_mat4x2_f32(u.inner);
w[1] = conv_mat4x2_f32(u.inner[2u]);
w[1][0] = u.inner[0u].col1.yx;
w[1][0].x = u.inner[0u].col1[0u];
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@@ -1,115 +1,188 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 70
; Bound: 113
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f" %local_invocation_index_1
OpExecutionMode %f LocalSize 1 1 1
OpName %local_invocation_index_1 "local_invocation_index_1"
OpName %u_block "u_block"
OpMemberName %u_block 0 "inner"
OpName %u_block_std140 "u_block_std140"
OpMemberName %u_block_std140 0 "inner"
OpName %mat4x2_f32 "mat4x2_f32"
OpMemberName %mat4x2_f32 0 "col0"
OpMemberName %mat4x2_f32 1 "col1"
OpMemberName %mat4x2_f32 2 "col2"
OpMemberName %mat4x2_f32 3 "col3"
OpName %u "u"
OpName %w "w"
OpName %conv_mat4x2_f32 "conv_mat4x2_f32"
OpName %val "val"
OpName %conv_arr4_mat4x2_f32 "conv_arr4_mat4x2_f32"
OpName %val_0 "val"
OpName %arr "arr"
OpName %i "i"
OpName %var_for_index "var_for_index"
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 %u_block Block
OpMemberDecorate %u_block 0 Offset 0
OpMemberDecorate %u_block 0 ColMajor
OpMemberDecorate %u_block 0 MatrixStride 8
OpDecorate %_arr_mat4v2float_uint_4 ArrayStride 32
OpDecorate %u_block_std140 Block
OpMemberDecorate %u_block_std140 0 Offset 0
OpMemberDecorate %mat4x2_f32 0 Offset 0
OpMemberDecorate %mat4x2_f32 1 Offset 8
OpMemberDecorate %mat4x2_f32 2 Offset 16
OpMemberDecorate %mat4x2_f32 3 Offset 24
OpDecorate %_arr_mat4x2_f32_uint_4 ArrayStride 32
OpDecorate %u NonWritable
OpDecorate %u DescriptorSet 0
OpDecorate %u Binding 0
OpDecorate %_arr_mat4v2float_uint_4 ArrayStride 32
%uint = OpTypeInt 32 0
%_ptr_Input_uint = OpTypePointer Input %uint
%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat4v2float = OpTypeMatrix %v2float 4
%mat4x2_f32 = OpTypeStruct %v2float %v2float %v2float %v2float
%uint_4 = OpConstant %uint 4
%_arr_mat4x2_f32_uint_4 = OpTypeArray %mat4x2_f32 %uint_4
%u_block_std140 = OpTypeStruct %_arr_mat4x2_f32_uint_4
%_ptr_Uniform_u_block_std140 = OpTypePointer Uniform %u_block_std140
%u = OpVariable %_ptr_Uniform_u_block_std140 Uniform
%mat4v2float = OpTypeMatrix %v2float 4
%_arr_mat4v2float_uint_4 = OpTypeArray %mat4v2float %uint_4
%u_block = OpTypeStruct %_arr_mat4v2float_uint_4
%_ptr_Uniform_u_block = OpTypePointer Uniform %u_block
%u = OpVariable %_ptr_Uniform_u_block Uniform
%_ptr_Workgroup__arr_mat4v2float_uint_4 = OpTypePointer Workgroup %_arr_mat4v2float_uint_4
%w = OpVariable %_ptr_Workgroup__arr_mat4v2float_uint_4 Workgroup
%void = OpTypeVoid
%14 = OpTypeFunction %void %uint
%16 = OpTypeFunction %mat4v2float %mat4x2_f32
%25 = OpTypeFunction %_arr_mat4v2float_uint_4 %_arr_mat4x2_f32_uint_4
%_ptr_Function__arr_mat4v2float_uint_4 = OpTypePointer Function %_arr_mat4v2float_uint_4
%31 = OpConstantNull %_arr_mat4v2float_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%21 = OpConstantNull %uint
%34 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Workgroup_mat4v2float = OpTypePointer Workgroup %mat4v2float
%35 = OpConstantNull %mat4v2float
%_ptr_Function__arr_mat4x2_f32_uint_4 = OpTypePointer Function %_arr_mat4x2_f32_uint_4
%47 = OpConstantNull %_arr_mat4x2_f32_uint_4
%_ptr_Function_mat4v2float = OpTypePointer Function %mat4v2float
%_ptr_Function_mat4x2_f32 = OpTypePointer Function %mat4x2_f32
%uint_1 = OpConstant %uint 1
%void = OpTypeVoid
%60 = OpTypeFunction %void %uint
%_ptr_Workgroup_mat4v2float = OpTypePointer Workgroup %mat4v2float
%78 = OpConstantNull %mat4v2float
%uint_2 = OpConstant %uint 2
%uint_264 = OpConstant %uint 264
%uint_0 = OpConstant %uint 0
%_ptr_Uniform__arr_mat4v2float_uint_4 = OpTypePointer Uniform %_arr_mat4v2float_uint_4
%_ptr_Uniform__arr_mat4x2_f32_uint_4 = OpTypePointer Uniform %_arr_mat4x2_f32_uint_4
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%int_2 = OpConstant %int 2
%_ptr_Uniform_mat4v2float = OpTypePointer Uniform %mat4v2float
%53 = OpConstantNull %int
%_ptr_Uniform_mat4x2_f32 = OpTypePointer Uniform %mat4x2_f32
%96 = OpConstantNull %int
%_ptr_Workgroup_v2float = OpTypePointer Workgroup %v2float
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%_ptr_Workgroup_float = OpTypePointer Workgroup %float
%_ptr_Uniform_float = OpTypePointer Uniform %float
%65 = OpTypeFunction %void
%f_inner = OpFunction %void None %14
%108 = OpTypeFunction %void
%conv_mat4x2_f32 = OpFunction %mat4v2float None %16
%val = OpFunctionParameter %mat4x2_f32
%19 = OpLabel
%20 = OpCompositeExtract %v2float %val 0
%21 = OpCompositeExtract %v2float %val 1
%22 = OpCompositeExtract %v2float %val 2
%23 = OpCompositeExtract %v2float %val 3
%24 = OpCompositeConstruct %mat4v2float %20 %21 %22 %23
OpReturnValue %24
OpFunctionEnd
%conv_arr4_mat4x2_f32 = OpFunction %_arr_mat4v2float_uint_4 None %25
%val_0 = OpFunctionParameter %_arr_mat4x2_f32_uint_4
%28 = OpLabel
%arr = OpVariable %_ptr_Function__arr_mat4v2float_uint_4 Function %31
%i = OpVariable %_ptr_Function_uint Function %34
%var_for_index = OpVariable %_ptr_Function__arr_mat4x2_f32_uint_4 Function %47
OpBranch %35
%35 = OpLabel
OpLoopMerge %36 %37 None
OpBranch %38
%38 = OpLabel
%40 = OpLoad %uint %i
%41 = OpULessThan %bool %40 %uint_4
%39 = OpLogicalNot %bool %41
OpSelectionMerge %43 None
OpBranchConditional %39 %44 %43
%44 = OpLabel
OpBranch %36
%43 = OpLabel
OpStore %var_for_index %val_0
%48 = OpLoad %uint %i
%50 = OpAccessChain %_ptr_Function_mat4v2float %arr %48
%52 = OpLoad %uint %i
%54 = OpAccessChain %_ptr_Function_mat4x2_f32 %var_for_index %52
%55 = OpLoad %mat4x2_f32 %54
%51 = OpFunctionCall %mat4v2float %conv_mat4x2_f32 %55
OpStore %50 %51
OpBranch %37
%37 = OpLabel
%56 = OpLoad %uint %i
%58 = OpIAdd %uint %56 %uint_1
OpStore %i %58
OpBranch %35
%36 = OpLabel
%59 = OpLoad %_arr_mat4v2float_uint_4 %arr
OpReturnValue %59
OpFunctionEnd
%f_inner = OpFunction %void None %60
%local_invocation_index = OpFunctionParameter %uint
%18 = OpLabel
%idx = OpVariable %_ptr_Function_uint Function %21
%64 = OpLabel
%idx = OpVariable %_ptr_Function_uint Function %34
OpStore %idx %local_invocation_index
OpBranch %22
%22 = OpLabel
OpLoopMerge %23 %24 None
OpBranch %25
%25 = OpLabel
%27 = OpLoad %uint %idx
%28 = OpULessThan %bool %27 %uint_4
%26 = OpLogicalNot %bool %28
OpSelectionMerge %30 None
OpBranchConditional %26 %31 %30
%31 = OpLabel
OpBranch %23
%30 = OpLabel
%32 = OpLoad %uint %idx
%34 = OpAccessChain %_ptr_Workgroup_mat4v2float %w %32
OpStore %34 %35
OpBranch %24
%24 = OpLabel
%36 = OpLoad %uint %idx
%38 = OpIAdd %uint %36 %uint_1
OpStore %idx %38
OpBranch %22
%23 = OpLabel
OpControlBarrier %uint_2 %uint_2 %uint_264
%44 = OpAccessChain %_ptr_Uniform__arr_mat4v2float_uint_4 %u %uint_0
%45 = OpLoad %_arr_mat4v2float_uint_4 %44
OpStore %w %45
%48 = OpAccessChain %_ptr_Workgroup_mat4v2float %w %int_1
%51 = OpAccessChain %_ptr_Uniform_mat4v2float %u %uint_0 %int_2
%52 = OpLoad %mat4v2float %51
OpStore %48 %52
%55 = OpAccessChain %_ptr_Workgroup_v2float %w %int_1 %53
%57 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %53 %int_1
%58 = OpLoad %v2float %57
%59 = OpVectorShuffle %v2float %58 %58 1 0
OpStore %55 %59
%61 = OpAccessChain %_ptr_Workgroup_float %w %int_1 %53 %uint_0
%63 = OpAccessChain %_ptr_Uniform_float %u %uint_0 %53 %int_1 %uint_0
%64 = OpLoad %float %63
OpStore %61 %64
OpReturn
OpFunctionEnd
%f = OpFunction %void None %65
OpBranch %66
%66 = OpLabel
OpLoopMerge %67 %68 None
OpBranch %69
%69 = OpLabel
%71 = OpLoad %uint %idx
%72 = OpULessThan %bool %71 %uint_4
%70 = OpLogicalNot %bool %72
OpSelectionMerge %73 None
OpBranchConditional %70 %74 %73
%74 = OpLabel
OpBranch %67
%73 = OpLabel
%75 = OpLoad %uint %idx
%77 = OpAccessChain %_ptr_Workgroup_mat4v2float %w %75
OpStore %77 %78
OpBranch %68
%68 = OpLabel
%79 = OpLoad %uint %idx
%80 = OpIAdd %uint %79 %uint_1
OpStore %idx %80
OpBranch %66
%67 = OpLabel
%69 = OpLoad %uint %local_invocation_index_1
%68 = OpFunctionCall %void %f_inner %69
OpControlBarrier %uint_2 %uint_2 %uint_264
%87 = OpAccessChain %_ptr_Uniform__arr_mat4x2_f32_uint_4 %u %uint_0
%88 = OpLoad %_arr_mat4x2_f32_uint_4 %87
%84 = OpFunctionCall %_arr_mat4v2float_uint_4 %conv_arr4_mat4x2_f32 %88
OpStore %w %84
%91 = OpAccessChain %_ptr_Workgroup_mat4v2float %w %int_1
%94 = OpAccessChain %_ptr_Uniform_mat4x2_f32 %u %uint_0 %uint_2
%95 = OpLoad %mat4x2_f32 %94
%92 = OpFunctionCall %mat4v2float %conv_mat4x2_f32 %95
OpStore %91 %92
%98 = OpAccessChain %_ptr_Workgroup_v2float %w %int_1 %96
%100 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %34 %uint_1
%101 = OpLoad %v2float %100
%102 = OpVectorShuffle %v2float %101 %101 1 0
OpStore %98 %102
%104 = OpAccessChain %_ptr_Workgroup_float %w %int_1 %96 %uint_0
%106 = OpAccessChain %_ptr_Uniform_float %u %uint_0 %34 %uint_1 %34
%107 = OpLoad %float %106
OpStore %104 %107
OpReturn
OpFunctionEnd
%f = OpFunction %void None %108
%110 = OpLabel
%112 = OpLoad %uint %local_invocation_index_1
%111 = OpFunctionCall %void %f_inner %112
OpReturn
OpFunctionEnd