tint: Add PreservePadding transform

This is used to ensure that assignments to host-visible memory do not
modify padding bytes in structures and arrays. We decompose
assignments of whole structure and array types into member-wise or
element-wise copies, using helper functions.

This is used in all backends except HLSL, which already decomposes
memory accesses.

Bug: tint:1571
Change-Id: Id6de2f917fb80151cc654a7e1c8413ae956f0d61
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112720
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
This commit is contained in:
James Price
2022-12-06 18:32:19 +00:00
committed by Dawn LUCI CQ
parent f2b8d2b1ab
commit 8753796aac
90 changed files with 5411 additions and 1972 deletions

View File

@@ -78,6 +78,21 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4];
} s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
S conv_S(S_std140 val) {
return S(val.before, f16mat2(val.m_0, val.m_1), val.pad, val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.pad_11, val.pad_12, val.after, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21, val.pad_22, val.pad_23, val.pad_24, val.pad_25, val.pad_26, val.pad_27);
}
@@ -97,8 +112,9 @@ f16mat2 load_u_inner_2_m() {
}
void f() {
s.inner = conv_arr4_S(u.inner);
s.inner[1] = conv_S(u.inner[2u]);
assign_and_preserve_padding_s(conv_arr4_S(u.inner));
uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, conv_S(u.inner[2u]));
s.inner[3].m = load_u_inner_2_m();
s.inner[1].m[0] = u.inner[0u].m_1.yx;
}

View File

@@ -22,9 +22,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_1;
};
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1);
(*(tint_symbol))[1] = (*(tint_symbol_1))[2];
assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = half2((*(tint_symbol_1))[0].m[1]).yx;
return;

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 104
; Bound: 142
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -26,13 +26,20 @@
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %conv_S "conv_S"
OpName %val "val"
OpName %conv_arr4_S "conv_arr4_S"
OpName %val_0 "val"
OpName %arr "arr"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %i_0 "i"
OpName %var_for_index_1 "var_for_index_1"
OpName %load_u_inner_2_m "load_u_inner_2_m"
OpName %f "f"
OpDecorate %u_block_std140 Block
@@ -55,6 +62,7 @@
OpDecorate %_arr_S_uint_4 ArrayStride 128
OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
@@ -71,110 +79,164 @@
%u_block = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%17 = OpTypeFunction %S %S_std140
%27 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%33 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%36 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%49 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%void = OpTypeVoid
%uint_1 = OpConstant %uint 1
%62 = OpTypeFunction %mat2v2half
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%17 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0
%26 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat2v2half = OpTypePointer StorageBuffer %mat2v2half
%uint_2 = OpConstant %uint 2
%39 = OpTypeFunction %void %_arr_S_uint_4
%43 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%58 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%68 = OpTypeFunction %S %S_std140
%78 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%95 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%106 = OpTypeFunction %mat2v2half
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%_ptr_Uniform_v2half = OpTypePointer Uniform %v2half
%void = OpTypeVoid
%78 = OpTypeFunction %void
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%120 = OpTypeFunction %void
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%129 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%int_3 = OpConstant %int 3
%_ptr_StorageBuffer_mat2v2half = OpTypePointer StorageBuffer %mat2v2half
%98 = OpConstantNull %int
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_v2half = OpTypePointer StorageBuffer %v2half
%conv_S = OpFunction %S None %17
%val = OpFunctionParameter %S_std140
%20 = OpLabel
%21 = OpCompositeExtract %int %val 0
%22 = OpCompositeExtract %v2half %val 1
%23 = OpCompositeExtract %v2half %val 2
%24 = OpCompositeConstruct %mat2v2half %22 %23
%25 = OpCompositeExtract %int %val 3
%26 = OpCompositeConstruct %S %21 %24 %25
OpReturnValue %26
OpFunctionEnd
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %27
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%30 = OpLabel
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %33
%i = OpVariable %_ptr_Function_uint Function %36
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %49
OpBranch %37
%37 = OpLabel
OpLoopMerge %38 %39 None
OpBranch %40
%40 = OpLabel
%42 = OpLoad %uint %i
%43 = OpULessThan %bool %42 %uint_4
%41 = OpLogicalNot %bool %43
OpSelectionMerge %45 None
OpBranchConditional %41 %46 %45
%46 = OpLabel
OpBranch %38
%45 = OpLabel
OpStore %var_for_index %val_0
%50 = OpLoad %uint %i
%52 = OpAccessChain %_ptr_Function_S %arr %50
%54 = OpLoad %uint %i
%56 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %54
%57 = OpLoad %S_std140 %56
%53 = OpFunctionCall %S %conv_S %57
OpStore %52 %53
OpBranch %39
%39 = OpLabel
%58 = OpLoad %uint %i
%60 = OpIAdd %uint %58 %uint_1
OpStore %i %60
OpBranch %37
%38 = OpLabel
%61 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %61
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat2v2half None %62
%64 = OpLabel
%69 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%72 = OpAccessChain %_ptr_Uniform_v2half %69 %uint_1
%73 = OpLoad %v2half %72
%75 = OpAccessChain %_ptr_Uniform_v2half %69 %uint_2
%76 = OpLoad %v2half %75
%77 = OpCompositeConstruct %mat2v2half %73 %76
OpReturnValue %77
OpFunctionEnd
%f = OpFunction %void None %78
%81 = OpLabel
%83 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0
%86 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%87 = OpLoad %_arr_S_std140_uint_4 %86
%84 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %87
OpStore %83 %84
%90 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1
%92 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%93 = OpLoad %S_std140 %92
%91 = OpFunctionCall %S %conv_S %93
OpStore %90 %91
%96 = OpAccessChain %_ptr_StorageBuffer_mat2v2half %s %uint_0 %int_3 %uint_1
%97 = OpFunctionCall %mat2v2half %load_u_inner_2_m
OpStore %96 %97
%100 = OpAccessChain %_ptr_StorageBuffer_v2half %s %uint_0 %int_1 %uint_1 %98
%101 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0 %36 %uint_2
%102 = OpLoad %v2half %101
%103 = OpVectorShuffle %v2half %102 %102 1 0
OpStore %100 %103
%assign_and_preserve_padding_1_s_X = OpFunction %void None %17
%dest = OpFunctionParameter %_arr_uint_uint_1
%value = OpFunctionParameter %S
%24 = OpLabel
%27 = OpCompositeExtract %uint %dest 0
%29 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %27 %uint_0
%30 = OpCompositeExtract %int %value 0
OpStore %29 %30
%31 = OpCompositeExtract %uint %dest 0
%33 = OpAccessChain %_ptr_StorageBuffer_mat2v2half %s %uint_0 %31 %uint_1
%34 = OpCompositeExtract %mat2v2half %value 1
OpStore %33 %34
%35 = OpCompositeExtract %uint %dest 0
%37 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %35 %uint_2
%38 = OpCompositeExtract %int %value 2
OpStore %37 %38
OpReturn
OpFunctionEnd
%assign_and_preserve_padding_s = OpFunction %void None %39
%value_0 = OpFunctionParameter %_arr_S_uint_4
%42 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %43
%var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
OpStore %i %43
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 %value_0
%60 = OpLoad %uint %i
%61 = OpCompositeConstruct %_arr_uint_uint_1 %60
%62 = OpLoad %uint %i
%64 = OpAccessChain %_ptr_Function_S %var_for_index %62
%65 = OpLoad %S %64
%59 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %61 %65
OpBranch %48
%48 = OpLabel
%66 = OpLoad %uint %i
%67 = OpIAdd %uint %66 %uint_1
OpStore %i %67
OpBranch %46
%47 = OpLabel
OpReturn
OpFunctionEnd
%conv_S = OpFunction %S None %68
%val = OpFunctionParameter %S_std140
%71 = OpLabel
%72 = OpCompositeExtract %int %val 0
%73 = OpCompositeExtract %v2half %val 1
%74 = OpCompositeExtract %v2half %val 2
%75 = OpCompositeConstruct %mat2v2half %73 %74
%76 = OpCompositeExtract %int %val 3
%77 = OpCompositeConstruct %S %72 %75 %76
OpReturnValue %77
OpFunctionEnd
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %78
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%81 = OpLabel
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%i_0 = OpVariable %_ptr_Function_uint Function %43
%var_for_index_1 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %95
OpBranch %84
%84 = OpLabel
OpLoopMerge %85 %86 None
OpBranch %87
%87 = OpLabel
%89 = OpLoad %uint %i_0
%90 = OpULessThan %bool %89 %uint_4
%88 = OpLogicalNot %bool %90
OpSelectionMerge %91 None
OpBranchConditional %88 %92 %91
%92 = OpLabel
OpBranch %85
%91 = OpLabel
OpStore %var_for_index_1 %val_0
%96 = OpLoad %uint %i_0
%97 = OpAccessChain %_ptr_Function_S %arr %96
%99 = OpLoad %uint %i_0
%101 = OpAccessChain %_ptr_Function_S_std140 %var_for_index_1 %99
%102 = OpLoad %S_std140 %101
%98 = OpFunctionCall %S %conv_S %102
OpStore %97 %98
OpBranch %86
%86 = OpLabel
%103 = OpLoad %uint %i_0
%104 = OpIAdd %uint %103 %uint_1
OpStore %i_0 %104
OpBranch %84
%85 = OpLabel
%105 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %105
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat2v2half None %106
%108 = OpLabel
%111 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%114 = OpAccessChain %_ptr_Uniform_v2half %111 %uint_1
%115 = OpLoad %v2half %114
%117 = OpAccessChain %_ptr_Uniform_v2half %111 %uint_2
%118 = OpLoad %v2half %117
%119 = OpCompositeConstruct %mat2v2half %115 %118
OpReturnValue %119
OpFunctionEnd
%f = OpFunction %void None %120
%122 = OpLabel
%126 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%127 = OpLoad %_arr_S_std140_uint_4 %126
%124 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %127
%123 = OpFunctionCall %void %assign_and_preserve_padding_s %124
%131 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%132 = OpLoad %S_std140 %131
%130 = OpFunctionCall %S %conv_S %132
%128 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %129 %130
%134 = OpAccessChain %_ptr_StorageBuffer_mat2v2half %s %uint_0 %int_3 %uint_1
%135 = OpFunctionCall %mat2v2half %load_u_inner_2_m
OpStore %134 %135
%138 = OpAccessChain %_ptr_StorageBuffer_v2half %s %uint_0 %int_1 %uint_1 %26
%139 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0 %43 %uint_2
%140 = OpLoad %v2half %139
%141 = OpVectorShuffle %v2half %140 %140 1 0
OpStore %138 %141
OpReturn
OpFunctionEnd

View File

@@ -73,6 +73,21 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4];
} s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
S conv_S(S_std140 val) {
return S(val.before, val.pad, mat2(val.m_0, val.m_1), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.after, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21, val.pad_22, val.pad_23, val.pad_24, val.pad_25);
}
@@ -92,8 +107,9 @@ mat2 load_u_inner_2_m() {
}
void f() {
s.inner = conv_arr4_S(u.inner);
s.inner[1] = conv_S(u.inner[2u]);
assign_and_preserve_padding_s(conv_arr4_S(u.inner));
uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, conv_S(u.inner[2u]));
s.inner[3].m = load_u_inner_2_m();
s.inner[1].m[0] = u.inner[0u].m_1.yx;
}

View File

@@ -23,9 +23,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_2;
};
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1);
(*(tint_symbol))[1] = (*(tint_symbol_1))[2];
assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = float2((*(tint_symbol_1))[0].m[1]).yx;
return;

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 104
; Bound: 142
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -22,13 +22,20 @@
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %conv_S "conv_S"
OpName %val "val"
OpName %conv_arr4_S "conv_arr4_S"
OpName %val_0 "val"
OpName %arr "arr"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %i_0 "i"
OpName %var_for_index_1 "var_for_index_1"
OpName %load_u_inner_2_m "load_u_inner_2_m"
OpName %f "f"
OpDecorate %u_block_std140 Block
@@ -51,6 +58,7 @@
OpDecorate %_arr_S_uint_4 ArrayStride 128
OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
@@ -67,110 +75,164 @@
%u_block = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%17 = OpTypeFunction %S %S_std140
%27 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%33 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%36 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%49 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%void = OpTypeVoid
%uint_1 = OpConstant %uint 1
%62 = OpTypeFunction %mat2v2float
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%17 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0
%26 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat2v2float = OpTypePointer StorageBuffer %mat2v2float
%uint_2 = OpConstant %uint 2
%39 = OpTypeFunction %void %_arr_S_uint_4
%43 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%58 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%68 = OpTypeFunction %S %S_std140
%78 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%95 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%106 = OpTypeFunction %mat2v2float
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%void = OpTypeVoid
%78 = OpTypeFunction %void
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%120 = OpTypeFunction %void
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%129 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%int_3 = OpConstant %int 3
%_ptr_StorageBuffer_mat2v2float = OpTypePointer StorageBuffer %mat2v2float
%98 = OpConstantNull %int
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float
%conv_S = OpFunction %S None %17
%val = OpFunctionParameter %S_std140
%20 = OpLabel
%21 = OpCompositeExtract %int %val 0
%22 = OpCompositeExtract %v2float %val 1
%23 = OpCompositeExtract %v2float %val 2
%24 = OpCompositeConstruct %mat2v2float %22 %23
%25 = OpCompositeExtract %int %val 3
%26 = OpCompositeConstruct %S %21 %24 %25
OpReturnValue %26
OpFunctionEnd
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %27
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%30 = OpLabel
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %33
%i = OpVariable %_ptr_Function_uint Function %36
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %49
OpBranch %37
%37 = OpLabel
OpLoopMerge %38 %39 None
OpBranch %40
%40 = OpLabel
%42 = OpLoad %uint %i
%43 = OpULessThan %bool %42 %uint_4
%41 = OpLogicalNot %bool %43
OpSelectionMerge %45 None
OpBranchConditional %41 %46 %45
%46 = OpLabel
OpBranch %38
%45 = OpLabel
OpStore %var_for_index %val_0
%50 = OpLoad %uint %i
%52 = OpAccessChain %_ptr_Function_S %arr %50
%54 = OpLoad %uint %i
%56 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %54
%57 = OpLoad %S_std140 %56
%53 = OpFunctionCall %S %conv_S %57
OpStore %52 %53
OpBranch %39
%39 = OpLabel
%58 = OpLoad %uint %i
%60 = OpIAdd %uint %58 %uint_1
OpStore %i %60
OpBranch %37
%38 = OpLabel
%61 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %61
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat2v2float None %62
%64 = OpLabel
%69 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%72 = OpAccessChain %_ptr_Uniform_v2float %69 %uint_1
%73 = OpLoad %v2float %72
%75 = OpAccessChain %_ptr_Uniform_v2float %69 %uint_2
%76 = OpLoad %v2float %75
%77 = OpCompositeConstruct %mat2v2float %73 %76
OpReturnValue %77
OpFunctionEnd
%f = OpFunction %void None %78
%81 = OpLabel
%83 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0
%86 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%87 = OpLoad %_arr_S_std140_uint_4 %86
%84 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %87
OpStore %83 %84
%90 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1
%92 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%93 = OpLoad %S_std140 %92
%91 = OpFunctionCall %S %conv_S %93
OpStore %90 %91
%96 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %s %uint_0 %int_3 %uint_1
%97 = OpFunctionCall %mat2v2float %load_u_inner_2_m
OpStore %96 %97
%100 = OpAccessChain %_ptr_StorageBuffer_v2float %s %uint_0 %int_1 %uint_1 %98
%101 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %36 %uint_2
%102 = OpLoad %v2float %101
%103 = OpVectorShuffle %v2float %102 %102 1 0
OpStore %100 %103
%assign_and_preserve_padding_1_s_X = OpFunction %void None %17
%dest = OpFunctionParameter %_arr_uint_uint_1
%value = OpFunctionParameter %S
%24 = OpLabel
%27 = OpCompositeExtract %uint %dest 0
%29 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %27 %uint_0
%30 = OpCompositeExtract %int %value 0
OpStore %29 %30
%31 = OpCompositeExtract %uint %dest 0
%33 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %s %uint_0 %31 %uint_1
%34 = OpCompositeExtract %mat2v2float %value 1
OpStore %33 %34
%35 = OpCompositeExtract %uint %dest 0
%37 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %35 %uint_2
%38 = OpCompositeExtract %int %value 2
OpStore %37 %38
OpReturn
OpFunctionEnd
%assign_and_preserve_padding_s = OpFunction %void None %39
%value_0 = OpFunctionParameter %_arr_S_uint_4
%42 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %43
%var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
OpStore %i %43
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 %value_0
%60 = OpLoad %uint %i
%61 = OpCompositeConstruct %_arr_uint_uint_1 %60
%62 = OpLoad %uint %i
%64 = OpAccessChain %_ptr_Function_S %var_for_index %62
%65 = OpLoad %S %64
%59 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %61 %65
OpBranch %48
%48 = OpLabel
%66 = OpLoad %uint %i
%67 = OpIAdd %uint %66 %uint_1
OpStore %i %67
OpBranch %46
%47 = OpLabel
OpReturn
OpFunctionEnd
%conv_S = OpFunction %S None %68
%val = OpFunctionParameter %S_std140
%71 = OpLabel
%72 = OpCompositeExtract %int %val 0
%73 = OpCompositeExtract %v2float %val 1
%74 = OpCompositeExtract %v2float %val 2
%75 = OpCompositeConstruct %mat2v2float %73 %74
%76 = OpCompositeExtract %int %val 3
%77 = OpCompositeConstruct %S %72 %75 %76
OpReturnValue %77
OpFunctionEnd
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %78
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%81 = OpLabel
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%i_0 = OpVariable %_ptr_Function_uint Function %43
%var_for_index_1 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %95
OpBranch %84
%84 = OpLabel
OpLoopMerge %85 %86 None
OpBranch %87
%87 = OpLabel
%89 = OpLoad %uint %i_0
%90 = OpULessThan %bool %89 %uint_4
%88 = OpLogicalNot %bool %90
OpSelectionMerge %91 None
OpBranchConditional %88 %92 %91
%92 = OpLabel
OpBranch %85
%91 = OpLabel
OpStore %var_for_index_1 %val_0
%96 = OpLoad %uint %i_0
%97 = OpAccessChain %_ptr_Function_S %arr %96
%99 = OpLoad %uint %i_0
%101 = OpAccessChain %_ptr_Function_S_std140 %var_for_index_1 %99
%102 = OpLoad %S_std140 %101
%98 = OpFunctionCall %S %conv_S %102
OpStore %97 %98
OpBranch %86
%86 = OpLabel
%103 = OpLoad %uint %i_0
%104 = OpIAdd %uint %103 %uint_1
OpStore %i_0 %104
OpBranch %84
%85 = OpLabel
%105 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %105
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat2v2float None %106
%108 = OpLabel
%111 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%114 = OpAccessChain %_ptr_Uniform_v2float %111 %uint_1
%115 = OpLoad %v2float %114
%117 = OpAccessChain %_ptr_Uniform_v2float %111 %uint_2
%118 = OpLoad %v2float %117
%119 = OpCompositeConstruct %mat2v2float %115 %118
OpReturnValue %119
OpFunctionEnd
%f = OpFunction %void None %120
%122 = OpLabel
%126 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%127 = OpLoad %_arr_S_std140_uint_4 %126
%124 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %127
%123 = OpFunctionCall %void %assign_and_preserve_padding_s %124
%131 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%132 = OpLoad %S_std140 %131
%130 = OpFunctionCall %S %conv_S %132
%128 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %129 %130
%134 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %s %uint_0 %int_3 %uint_1
%135 = OpFunctionCall %mat2v2float %load_u_inner_2_m
OpStore %134 %135
%138 = OpAccessChain %_ptr_StorageBuffer_v2float %s %uint_0 %int_1 %uint_1 %26
%139 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %43 %uint_2
%140 = OpLoad %v2float %139
%141 = OpVectorShuffle %v2float %140 %140 1 0
OpStore %138 %141
OpReturn
OpFunctionEnd

View File

@@ -74,6 +74,21 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4];
} s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
S conv_S(S_std140 val) {
return S(val.before, val.pad, f16mat2x3(val.m_0, val.m_1), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.after, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21, val.pad_22, val.pad_23, val.pad_24, val.pad_25);
}
@@ -93,8 +108,9 @@ f16mat2x3 load_u_inner_2_m() {
}
void f() {
s.inner = conv_arr4_S(u.inner);
s.inner[1] = conv_S(u.inner[2u]);
assign_and_preserve_padding_s(conv_arr4_S(u.inner));
uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, conv_S(u.inner[2u]));
s.inner[3].m = load_u_inner_2_m();
s.inner[1].m[0] = u.inner[0u].m_1.zxy;
}

View File

@@ -23,9 +23,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_2;
};
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1);
(*(tint_symbol))[1] = (*(tint_symbol_1))[2];
assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = half3((*(tint_symbol_1))[0].m[1]).zxy;
return;

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 104
; Bound: 142
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -26,13 +26,20 @@
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %conv_S "conv_S"
OpName %val "val"
OpName %conv_arr4_S "conv_arr4_S"
OpName %val_0 "val"
OpName %arr "arr"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %i_0 "i"
OpName %var_for_index_1 "var_for_index_1"
OpName %load_u_inner_2_m "load_u_inner_2_m"
OpName %f "f"
OpDecorate %u_block_std140 Block
@@ -55,6 +62,7 @@
OpDecorate %_arr_S_uint_4 ArrayStride 128
OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
@@ -71,110 +79,164 @@
%u_block = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%17 = OpTypeFunction %S %S_std140
%27 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%33 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%36 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%49 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%void = OpTypeVoid
%uint_1 = OpConstant %uint 1
%62 = OpTypeFunction %mat2v3half
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%17 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0
%26 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat2v3half = OpTypePointer StorageBuffer %mat2v3half
%uint_2 = OpConstant %uint 2
%39 = OpTypeFunction %void %_arr_S_uint_4
%43 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%58 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%68 = OpTypeFunction %S %S_std140
%78 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%95 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%106 = OpTypeFunction %mat2v3half
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%_ptr_Uniform_v3half = OpTypePointer Uniform %v3half
%void = OpTypeVoid
%78 = OpTypeFunction %void
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%120 = OpTypeFunction %void
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%129 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%int_3 = OpConstant %int 3
%_ptr_StorageBuffer_mat2v3half = OpTypePointer StorageBuffer %mat2v3half
%98 = OpConstantNull %int
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
%conv_S = OpFunction %S None %17
%val = OpFunctionParameter %S_std140
%20 = OpLabel
%21 = OpCompositeExtract %int %val 0
%22 = OpCompositeExtract %v3half %val 1
%23 = OpCompositeExtract %v3half %val 2
%24 = OpCompositeConstruct %mat2v3half %22 %23
%25 = OpCompositeExtract %int %val 3
%26 = OpCompositeConstruct %S %21 %24 %25
OpReturnValue %26
OpFunctionEnd
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %27
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%30 = OpLabel
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %33
%i = OpVariable %_ptr_Function_uint Function %36
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %49
OpBranch %37
%37 = OpLabel
OpLoopMerge %38 %39 None
OpBranch %40
%40 = OpLabel
%42 = OpLoad %uint %i
%43 = OpULessThan %bool %42 %uint_4
%41 = OpLogicalNot %bool %43
OpSelectionMerge %45 None
OpBranchConditional %41 %46 %45
%46 = OpLabel
OpBranch %38
%45 = OpLabel
OpStore %var_for_index %val_0
%50 = OpLoad %uint %i
%52 = OpAccessChain %_ptr_Function_S %arr %50
%54 = OpLoad %uint %i
%56 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %54
%57 = OpLoad %S_std140 %56
%53 = OpFunctionCall %S %conv_S %57
OpStore %52 %53
OpBranch %39
%39 = OpLabel
%58 = OpLoad %uint %i
%60 = OpIAdd %uint %58 %uint_1
OpStore %i %60
OpBranch %37
%38 = OpLabel
%61 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %61
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat2v3half None %62
%64 = OpLabel
%69 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%72 = OpAccessChain %_ptr_Uniform_v3half %69 %uint_1
%73 = OpLoad %v3half %72
%75 = OpAccessChain %_ptr_Uniform_v3half %69 %uint_2
%76 = OpLoad %v3half %75
%77 = OpCompositeConstruct %mat2v3half %73 %76
OpReturnValue %77
OpFunctionEnd
%f = OpFunction %void None %78
%81 = OpLabel
%83 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0
%86 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%87 = OpLoad %_arr_S_std140_uint_4 %86
%84 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %87
OpStore %83 %84
%90 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1
%92 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%93 = OpLoad %S_std140 %92
%91 = OpFunctionCall %S %conv_S %93
OpStore %90 %91
%96 = OpAccessChain %_ptr_StorageBuffer_mat2v3half %s %uint_0 %int_3 %uint_1
%97 = OpFunctionCall %mat2v3half %load_u_inner_2_m
OpStore %96 %97
%100 = OpAccessChain %_ptr_StorageBuffer_v3half %s %uint_0 %int_1 %uint_1 %98
%101 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0 %36 %uint_2
%102 = OpLoad %v3half %101
%103 = OpVectorShuffle %v3half %102 %102 2 0 1
OpStore %100 %103
%assign_and_preserve_padding_1_s_X = OpFunction %void None %17
%dest = OpFunctionParameter %_arr_uint_uint_1
%value = OpFunctionParameter %S
%24 = OpLabel
%27 = OpCompositeExtract %uint %dest 0
%29 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %27 %uint_0
%30 = OpCompositeExtract %int %value 0
OpStore %29 %30
%31 = OpCompositeExtract %uint %dest 0
%33 = OpAccessChain %_ptr_StorageBuffer_mat2v3half %s %uint_0 %31 %uint_1
%34 = OpCompositeExtract %mat2v3half %value 1
OpStore %33 %34
%35 = OpCompositeExtract %uint %dest 0
%37 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %35 %uint_2
%38 = OpCompositeExtract %int %value 2
OpStore %37 %38
OpReturn
OpFunctionEnd
%assign_and_preserve_padding_s = OpFunction %void None %39
%value_0 = OpFunctionParameter %_arr_S_uint_4
%42 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %43
%var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
OpStore %i %43
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 %value_0
%60 = OpLoad %uint %i
%61 = OpCompositeConstruct %_arr_uint_uint_1 %60
%62 = OpLoad %uint %i
%64 = OpAccessChain %_ptr_Function_S %var_for_index %62
%65 = OpLoad %S %64
%59 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %61 %65
OpBranch %48
%48 = OpLabel
%66 = OpLoad %uint %i
%67 = OpIAdd %uint %66 %uint_1
OpStore %i %67
OpBranch %46
%47 = OpLabel
OpReturn
OpFunctionEnd
%conv_S = OpFunction %S None %68
%val = OpFunctionParameter %S_std140
%71 = OpLabel
%72 = OpCompositeExtract %int %val 0
%73 = OpCompositeExtract %v3half %val 1
%74 = OpCompositeExtract %v3half %val 2
%75 = OpCompositeConstruct %mat2v3half %73 %74
%76 = OpCompositeExtract %int %val 3
%77 = OpCompositeConstruct %S %72 %75 %76
OpReturnValue %77
OpFunctionEnd
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %78
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%81 = OpLabel
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%i_0 = OpVariable %_ptr_Function_uint Function %43
%var_for_index_1 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %95
OpBranch %84
%84 = OpLabel
OpLoopMerge %85 %86 None
OpBranch %87
%87 = OpLabel
%89 = OpLoad %uint %i_0
%90 = OpULessThan %bool %89 %uint_4
%88 = OpLogicalNot %bool %90
OpSelectionMerge %91 None
OpBranchConditional %88 %92 %91
%92 = OpLabel
OpBranch %85
%91 = OpLabel
OpStore %var_for_index_1 %val_0
%96 = OpLoad %uint %i_0
%97 = OpAccessChain %_ptr_Function_S %arr %96
%99 = OpLoad %uint %i_0
%101 = OpAccessChain %_ptr_Function_S_std140 %var_for_index_1 %99
%102 = OpLoad %S_std140 %101
%98 = OpFunctionCall %S %conv_S %102
OpStore %97 %98
OpBranch %86
%86 = OpLabel
%103 = OpLoad %uint %i_0
%104 = OpIAdd %uint %103 %uint_1
OpStore %i_0 %104
OpBranch %84
%85 = OpLabel
%105 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %105
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat2v3half None %106
%108 = OpLabel
%111 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%114 = OpAccessChain %_ptr_Uniform_v3half %111 %uint_1
%115 = OpLoad %v3half %114
%117 = OpAccessChain %_ptr_Uniform_v3half %111 %uint_2
%118 = OpLoad %v3half %117
%119 = OpCompositeConstruct %mat2v3half %115 %118
OpReturnValue %119
OpFunctionEnd
%f = OpFunction %void None %120
%122 = OpLabel
%126 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%127 = OpLoad %_arr_S_std140_uint_4 %126
%124 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %127
%123 = OpFunctionCall %void %assign_and_preserve_padding_s %124
%131 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%132 = OpLoad %S_std140 %131
%130 = OpFunctionCall %S %conv_S %132
%128 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %129 %130
%134 = OpAccessChain %_ptr_StorageBuffer_mat2v3half %s %uint_0 %int_3 %uint_1
%135 = OpFunctionCall %mat2v3half %load_u_inner_2_m
OpStore %134 %135
%138 = OpAccessChain %_ptr_StorageBuffer_v3half %s %uint_0 %int_1 %uint_1 %26
%139 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0 %43 %uint_2
%140 = OpLoad %v3half %139
%141 = OpVectorShuffle %v3half %140 %140 2 0 1
OpStore %138 %141
OpReturn
OpFunctionEnd

View File

@@ -36,9 +36,25 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4];
} s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
void f() {
s.inner = u.inner;
s.inner[1] = u.inner[2];
assign_and_preserve_padding_s(u.inner);
uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, u.inner[2]);
s.inner[3].m = u.inner[2].m;
s.inner[1].m[0] = u.inner[0].m[1].zxy;
}

View File

@@ -23,9 +23,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_2;
};
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1);
(*(tint_symbol))[1] = (*(tint_symbol_1))[2];
assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = float3((*(tint_symbol_1))[0].m[1]).zxy;
return;

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 45
; Bound: 90
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -15,6 +15,13 @@
OpMemberName %S 2 "after"
OpName %u "u"
OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %f "f"
OpDecorate %u_block Block
OpMemberDecorate %u_block 0 Offset 0
@@ -29,6 +36,7 @@
OpDecorate %u Binding 0
OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
@@ -43,39 +51,100 @@
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%void = OpTypeVoid
%14 = OpTypeFunction %void
%uint_1 = OpConstant %uint 1
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%14 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%23 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat2v3float = OpTypePointer StorageBuffer %mat2v3float
%uint_2 = OpConstant %uint 2
%36 = OpTypeFunction %void %_arr_S_uint_4
%40 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%55 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%65 = OpTypeFunction %void
%_ptr_Uniform__arr_S_uint_4 = OpTypePointer Uniform %_arr_S_uint_4
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%73 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%int_2 = OpConstant %int 2
%_ptr_Uniform_S = OpTypePointer Uniform %S
%int_3 = OpConstant %int 3
%uint_1 = OpConstant %uint 1
%_ptr_StorageBuffer_mat2v3float = OpTypePointer StorageBuffer %mat2v3float
%_ptr_Uniform_mat2v3float = OpTypePointer Uniform %mat2v3float
%38 = OpConstantNull %int
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float
%f = OpFunction %void None %14
%17 = OpLabel
%20 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0
%22 = OpAccessChain %_ptr_Uniform__arr_S_uint_4 %u %uint_0
%23 = OpLoad %_arr_S_uint_4 %22
OpStore %20 %23
%26 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1
%29 = OpAccessChain %_ptr_Uniform_S %u %uint_0 %int_2
%30 = OpLoad %S %29
OpStore %26 %30
%34 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %s %uint_0 %int_3 %uint_1
%36 = OpAccessChain %_ptr_Uniform_mat2v3float %u %uint_0 %int_2 %uint_1
%37 = OpLoad %mat2v3float %36
OpStore %34 %37
%40 = OpAccessChain %_ptr_StorageBuffer_v3float %s %uint_0 %int_1 %uint_1 %38
%42 = OpAccessChain %_ptr_Uniform_v3float %u %uint_0 %38 %uint_1 %int_1
%43 = OpLoad %v3float %42
%44 = OpVectorShuffle %v3float %43 %43 2 0 1
OpStore %40 %44
%assign_and_preserve_padding_1_s_X = OpFunction %void None %14
%dest = OpFunctionParameter %_arr_uint_uint_1
%value = OpFunctionParameter %S
%21 = OpLabel
%24 = OpCompositeExtract %uint %dest 0
%26 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %24 %uint_0
%27 = OpCompositeExtract %int %value 0
OpStore %26 %27
%28 = OpCompositeExtract %uint %dest 0
%30 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %s %uint_0 %28 %uint_1
%31 = OpCompositeExtract %mat2v3float %value 1
OpStore %30 %31
%32 = OpCompositeExtract %uint %dest 0
%34 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %32 %uint_2
%35 = OpCompositeExtract %int %value 2
OpStore %34 %35
OpReturn
OpFunctionEnd
%assign_and_preserve_padding_s = OpFunction %void None %36
%value_0 = OpFunctionParameter %_arr_S_uint_4
%39 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %40
%var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %55
OpStore %i %40
OpBranch %43
%43 = OpLabel
OpLoopMerge %44 %45 None
OpBranch %46
%46 = OpLabel
%48 = OpLoad %uint %i
%49 = OpULessThan %bool %48 %uint_4
%47 = OpLogicalNot %bool %49
OpSelectionMerge %51 None
OpBranchConditional %47 %52 %51
%52 = OpLabel
OpBranch %44
%51 = OpLabel
OpStore %var_for_index %value_0
%57 = OpLoad %uint %i
%58 = OpCompositeConstruct %_arr_uint_uint_1 %57
%59 = OpLoad %uint %i
%61 = OpAccessChain %_ptr_Function_S %var_for_index %59
%62 = OpLoad %S %61
%56 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %58 %62
OpBranch %45
%45 = OpLabel
%63 = OpLoad %uint %i
%64 = OpIAdd %uint %63 %uint_1
OpStore %i %64
OpBranch %43
%44 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %void None %65
%67 = OpLabel
%70 = OpAccessChain %_ptr_Uniform__arr_S_uint_4 %u %uint_0
%71 = OpLoad %_arr_S_uint_4 %70
%68 = OpFunctionCall %void %assign_and_preserve_padding_s %71
%76 = OpAccessChain %_ptr_Uniform_S %u %uint_0 %int_2
%77 = OpLoad %S %76
%72 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %73 %77
%79 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %s %uint_0 %int_3 %uint_1
%81 = OpAccessChain %_ptr_Uniform_mat2v3float %u %uint_0 %int_2 %uint_1
%82 = OpLoad %mat2v3float %81
OpStore %79 %82
%85 = OpAccessChain %_ptr_StorageBuffer_v3float %s %uint_0 %int_1 %uint_1 %23
%87 = OpAccessChain %_ptr_Uniform_v3float %u %uint_0 %23 %uint_1 %int_1
%88 = OpLoad %v3float %87
%89 = OpVectorShuffle %v3float %88 %88 2 0 1
OpStore %85 %89
OpReturn
OpFunctionEnd

View File

@@ -74,6 +74,21 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4];
} s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
S conv_S(S_std140 val) {
return S(val.before, val.pad, f16mat2x4(val.m_0, val.m_1), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.after, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21, val.pad_22, val.pad_23, val.pad_24, val.pad_25);
}
@@ -93,8 +108,9 @@ f16mat2x4 load_u_inner_2_m() {
}
void f() {
s.inner = conv_arr4_S(u.inner);
s.inner[1] = conv_S(u.inner[2u]);
assign_and_preserve_padding_s(conv_arr4_S(u.inner));
uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, conv_S(u.inner[2u]));
s.inner[3].m = load_u_inner_2_m();
s.inner[1].m[0] = u.inner[0u].m_1.ywxz;
}

View File

@@ -23,9 +23,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_2;
};
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1);
(*(tint_symbol))[1] = (*(tint_symbol_1))[2];
assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = half4((*(tint_symbol_1))[0].m[1]).ywxz;
return;

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 104
; Bound: 142
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -26,13 +26,20 @@
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %conv_S "conv_S"
OpName %val "val"
OpName %conv_arr4_S "conv_arr4_S"
OpName %val_0 "val"
OpName %arr "arr"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %i_0 "i"
OpName %var_for_index_1 "var_for_index_1"
OpName %load_u_inner_2_m "load_u_inner_2_m"
OpName %f "f"
OpDecorate %u_block_std140 Block
@@ -55,6 +62,7 @@
OpDecorate %_arr_S_uint_4 ArrayStride 128
OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
@@ -71,110 +79,164 @@
%u_block = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%17 = OpTypeFunction %S %S_std140
%27 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%33 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%36 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%49 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%void = OpTypeVoid
%uint_1 = OpConstant %uint 1
%62 = OpTypeFunction %mat2v4half
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%17 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0
%26 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat2v4half = OpTypePointer StorageBuffer %mat2v4half
%uint_2 = OpConstant %uint 2
%39 = OpTypeFunction %void %_arr_S_uint_4
%43 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%58 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%68 = OpTypeFunction %S %S_std140
%78 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%95 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%106 = OpTypeFunction %mat2v4half
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%_ptr_Uniform_v4half = OpTypePointer Uniform %v4half
%void = OpTypeVoid
%78 = OpTypeFunction %void
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%120 = OpTypeFunction %void
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%129 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%int_3 = OpConstant %int 3
%_ptr_StorageBuffer_mat2v4half = OpTypePointer StorageBuffer %mat2v4half
%98 = OpConstantNull %int
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_v4half = OpTypePointer StorageBuffer %v4half
%conv_S = OpFunction %S None %17
%val = OpFunctionParameter %S_std140
%20 = OpLabel
%21 = OpCompositeExtract %int %val 0
%22 = OpCompositeExtract %v4half %val 1
%23 = OpCompositeExtract %v4half %val 2
%24 = OpCompositeConstruct %mat2v4half %22 %23
%25 = OpCompositeExtract %int %val 3
%26 = OpCompositeConstruct %S %21 %24 %25
OpReturnValue %26
OpFunctionEnd
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %27
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%30 = OpLabel
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %33
%i = OpVariable %_ptr_Function_uint Function %36
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %49
OpBranch %37
%37 = OpLabel
OpLoopMerge %38 %39 None
OpBranch %40
%40 = OpLabel
%42 = OpLoad %uint %i
%43 = OpULessThan %bool %42 %uint_4
%41 = OpLogicalNot %bool %43
OpSelectionMerge %45 None
OpBranchConditional %41 %46 %45
%46 = OpLabel
OpBranch %38
%45 = OpLabel
OpStore %var_for_index %val_0
%50 = OpLoad %uint %i
%52 = OpAccessChain %_ptr_Function_S %arr %50
%54 = OpLoad %uint %i
%56 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %54
%57 = OpLoad %S_std140 %56
%53 = OpFunctionCall %S %conv_S %57
OpStore %52 %53
OpBranch %39
%39 = OpLabel
%58 = OpLoad %uint %i
%60 = OpIAdd %uint %58 %uint_1
OpStore %i %60
OpBranch %37
%38 = OpLabel
%61 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %61
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat2v4half None %62
%64 = OpLabel
%69 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%72 = OpAccessChain %_ptr_Uniform_v4half %69 %uint_1
%73 = OpLoad %v4half %72
%75 = OpAccessChain %_ptr_Uniform_v4half %69 %uint_2
%76 = OpLoad %v4half %75
%77 = OpCompositeConstruct %mat2v4half %73 %76
OpReturnValue %77
OpFunctionEnd
%f = OpFunction %void None %78
%81 = OpLabel
%83 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0
%86 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%87 = OpLoad %_arr_S_std140_uint_4 %86
%84 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %87
OpStore %83 %84
%90 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1
%92 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%93 = OpLoad %S_std140 %92
%91 = OpFunctionCall %S %conv_S %93
OpStore %90 %91
%96 = OpAccessChain %_ptr_StorageBuffer_mat2v4half %s %uint_0 %int_3 %uint_1
%97 = OpFunctionCall %mat2v4half %load_u_inner_2_m
OpStore %96 %97
%100 = OpAccessChain %_ptr_StorageBuffer_v4half %s %uint_0 %int_1 %uint_1 %98
%101 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0 %36 %uint_2
%102 = OpLoad %v4half %101
%103 = OpVectorShuffle %v4half %102 %102 1 3 0 2
OpStore %100 %103
%assign_and_preserve_padding_1_s_X = OpFunction %void None %17
%dest = OpFunctionParameter %_arr_uint_uint_1
%value = OpFunctionParameter %S
%24 = OpLabel
%27 = OpCompositeExtract %uint %dest 0
%29 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %27 %uint_0
%30 = OpCompositeExtract %int %value 0
OpStore %29 %30
%31 = OpCompositeExtract %uint %dest 0
%33 = OpAccessChain %_ptr_StorageBuffer_mat2v4half %s %uint_0 %31 %uint_1
%34 = OpCompositeExtract %mat2v4half %value 1
OpStore %33 %34
%35 = OpCompositeExtract %uint %dest 0
%37 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %35 %uint_2
%38 = OpCompositeExtract %int %value 2
OpStore %37 %38
OpReturn
OpFunctionEnd
%assign_and_preserve_padding_s = OpFunction %void None %39
%value_0 = OpFunctionParameter %_arr_S_uint_4
%42 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %43
%var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
OpStore %i %43
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 %value_0
%60 = OpLoad %uint %i
%61 = OpCompositeConstruct %_arr_uint_uint_1 %60
%62 = OpLoad %uint %i
%64 = OpAccessChain %_ptr_Function_S %var_for_index %62
%65 = OpLoad %S %64
%59 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %61 %65
OpBranch %48
%48 = OpLabel
%66 = OpLoad %uint %i
%67 = OpIAdd %uint %66 %uint_1
OpStore %i %67
OpBranch %46
%47 = OpLabel
OpReturn
OpFunctionEnd
%conv_S = OpFunction %S None %68
%val = OpFunctionParameter %S_std140
%71 = OpLabel
%72 = OpCompositeExtract %int %val 0
%73 = OpCompositeExtract %v4half %val 1
%74 = OpCompositeExtract %v4half %val 2
%75 = OpCompositeConstruct %mat2v4half %73 %74
%76 = OpCompositeExtract %int %val 3
%77 = OpCompositeConstruct %S %72 %75 %76
OpReturnValue %77
OpFunctionEnd
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %78
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%81 = OpLabel
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%i_0 = OpVariable %_ptr_Function_uint Function %43
%var_for_index_1 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %95
OpBranch %84
%84 = OpLabel
OpLoopMerge %85 %86 None
OpBranch %87
%87 = OpLabel
%89 = OpLoad %uint %i_0
%90 = OpULessThan %bool %89 %uint_4
%88 = OpLogicalNot %bool %90
OpSelectionMerge %91 None
OpBranchConditional %88 %92 %91
%92 = OpLabel
OpBranch %85
%91 = OpLabel
OpStore %var_for_index_1 %val_0
%96 = OpLoad %uint %i_0
%97 = OpAccessChain %_ptr_Function_S %arr %96
%99 = OpLoad %uint %i_0
%101 = OpAccessChain %_ptr_Function_S_std140 %var_for_index_1 %99
%102 = OpLoad %S_std140 %101
%98 = OpFunctionCall %S %conv_S %102
OpStore %97 %98
OpBranch %86
%86 = OpLabel
%103 = OpLoad %uint %i_0
%104 = OpIAdd %uint %103 %uint_1
OpStore %i_0 %104
OpBranch %84
%85 = OpLabel
%105 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %105
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat2v4half None %106
%108 = OpLabel
%111 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%114 = OpAccessChain %_ptr_Uniform_v4half %111 %uint_1
%115 = OpLoad %v4half %114
%117 = OpAccessChain %_ptr_Uniform_v4half %111 %uint_2
%118 = OpLoad %v4half %117
%119 = OpCompositeConstruct %mat2v4half %115 %118
OpReturnValue %119
OpFunctionEnd
%f = OpFunction %void None %120
%122 = OpLabel
%126 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%127 = OpLoad %_arr_S_std140_uint_4 %126
%124 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %127
%123 = OpFunctionCall %void %assign_and_preserve_padding_s %124
%131 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%132 = OpLoad %S_std140 %131
%130 = OpFunctionCall %S %conv_S %132
%128 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %129 %130
%134 = OpAccessChain %_ptr_StorageBuffer_mat2v4half %s %uint_0 %int_3 %uint_1
%135 = OpFunctionCall %mat2v4half %load_u_inner_2_m
OpStore %134 %135
%138 = OpAccessChain %_ptr_StorageBuffer_v4half %s %uint_0 %int_1 %uint_1 %26
%139 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0 %43 %uint_2
%140 = OpLoad %v4half %139
%141 = OpVectorShuffle %v4half %140 %140 1 3 0 2
OpStore %138 %141
OpReturn
OpFunctionEnd

View File

@@ -36,9 +36,25 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4];
} s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
void f() {
s.inner = u.inner;
s.inner[1] = u.inner[2];
assign_and_preserve_padding_s(u.inner);
uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, u.inner[2]);
s.inner[3].m = u.inner[2].m;
s.inner[1].m[0] = u.inner[0].m[1].ywxz;
}

View File

@@ -23,9 +23,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_2;
};
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1);
(*(tint_symbol))[1] = (*(tint_symbol_1))[2];
assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = float4((*(tint_symbol_1))[0].m[1]).ywxz;
return;

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 45
; Bound: 90
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -15,6 +15,13 @@
OpMemberName %S 2 "after"
OpName %u "u"
OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %f "f"
OpDecorate %u_block Block
OpMemberDecorate %u_block 0 Offset 0
@@ -29,6 +36,7 @@
OpDecorate %u Binding 0
OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
@@ -43,39 +51,100 @@
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%void = OpTypeVoid
%14 = OpTypeFunction %void
%uint_1 = OpConstant %uint 1
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%14 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%23 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat2v4float = OpTypePointer StorageBuffer %mat2v4float
%uint_2 = OpConstant %uint 2
%36 = OpTypeFunction %void %_arr_S_uint_4
%40 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%55 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%65 = OpTypeFunction %void
%_ptr_Uniform__arr_S_uint_4 = OpTypePointer Uniform %_arr_S_uint_4
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%73 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%int_2 = OpConstant %int 2
%_ptr_Uniform_S = OpTypePointer Uniform %S
%int_3 = OpConstant %int 3
%uint_1 = OpConstant %uint 1
%_ptr_StorageBuffer_mat2v4float = OpTypePointer StorageBuffer %mat2v4float
%_ptr_Uniform_mat2v4float = OpTypePointer Uniform %mat2v4float
%38 = OpConstantNull %int
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%f = OpFunction %void None %14
%17 = OpLabel
%20 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0
%22 = OpAccessChain %_ptr_Uniform__arr_S_uint_4 %u %uint_0
%23 = OpLoad %_arr_S_uint_4 %22
OpStore %20 %23
%26 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1
%29 = OpAccessChain %_ptr_Uniform_S %u %uint_0 %int_2
%30 = OpLoad %S %29
OpStore %26 %30
%34 = OpAccessChain %_ptr_StorageBuffer_mat2v4float %s %uint_0 %int_3 %uint_1
%36 = OpAccessChain %_ptr_Uniform_mat2v4float %u %uint_0 %int_2 %uint_1
%37 = OpLoad %mat2v4float %36
OpStore %34 %37
%40 = OpAccessChain %_ptr_StorageBuffer_v4float %s %uint_0 %int_1 %uint_1 %38
%42 = OpAccessChain %_ptr_Uniform_v4float %u %uint_0 %38 %uint_1 %int_1
%43 = OpLoad %v4float %42
%44 = OpVectorShuffle %v4float %43 %43 1 3 0 2
OpStore %40 %44
%assign_and_preserve_padding_1_s_X = OpFunction %void None %14
%dest = OpFunctionParameter %_arr_uint_uint_1
%value = OpFunctionParameter %S
%21 = OpLabel
%24 = OpCompositeExtract %uint %dest 0
%26 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %24 %uint_0
%27 = OpCompositeExtract %int %value 0
OpStore %26 %27
%28 = OpCompositeExtract %uint %dest 0
%30 = OpAccessChain %_ptr_StorageBuffer_mat2v4float %s %uint_0 %28 %uint_1
%31 = OpCompositeExtract %mat2v4float %value 1
OpStore %30 %31
%32 = OpCompositeExtract %uint %dest 0
%34 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %32 %uint_2
%35 = OpCompositeExtract %int %value 2
OpStore %34 %35
OpReturn
OpFunctionEnd
%assign_and_preserve_padding_s = OpFunction %void None %36
%value_0 = OpFunctionParameter %_arr_S_uint_4
%39 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %40
%var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %55
OpStore %i %40
OpBranch %43
%43 = OpLabel
OpLoopMerge %44 %45 None
OpBranch %46
%46 = OpLabel
%48 = OpLoad %uint %i
%49 = OpULessThan %bool %48 %uint_4
%47 = OpLogicalNot %bool %49
OpSelectionMerge %51 None
OpBranchConditional %47 %52 %51
%52 = OpLabel
OpBranch %44
%51 = OpLabel
OpStore %var_for_index %value_0
%57 = OpLoad %uint %i
%58 = OpCompositeConstruct %_arr_uint_uint_1 %57
%59 = OpLoad %uint %i
%61 = OpAccessChain %_ptr_Function_S %var_for_index %59
%62 = OpLoad %S %61
%56 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %58 %62
OpBranch %45
%45 = OpLabel
%63 = OpLoad %uint %i
%64 = OpIAdd %uint %63 %uint_1
OpStore %i %64
OpBranch %43
%44 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %void None %65
%67 = OpLabel
%70 = OpAccessChain %_ptr_Uniform__arr_S_uint_4 %u %uint_0
%71 = OpLoad %_arr_S_uint_4 %70
%68 = OpFunctionCall %void %assign_and_preserve_padding_s %71
%76 = OpAccessChain %_ptr_Uniform_S %u %uint_0 %int_2
%77 = OpLoad %S %76
%72 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %73 %77
%79 = OpAccessChain %_ptr_StorageBuffer_mat2v4float %s %uint_0 %int_3 %uint_1
%81 = OpAccessChain %_ptr_Uniform_mat2v4float %u %uint_0 %int_2 %uint_1
%82 = OpLoad %mat2v4float %81
OpStore %79 %82
%85 = OpAccessChain %_ptr_StorageBuffer_v4float %s %uint_0 %int_1 %uint_1 %23
%87 = OpAccessChain %_ptr_Uniform_v4float %u %uint_0 %23 %uint_1 %int_1
%88 = OpLoad %v4float %87
%89 = OpVectorShuffle %v4float %88 %88 1 3 0 2
OpStore %85 %89
OpReturn
OpFunctionEnd

View File

@@ -77,6 +77,21 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4];
} s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
S conv_S(S_std140 val) {
return S(val.before, f16mat3x2(val.m_0, val.m_1, val.m_2), val.pad, val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.pad_11, val.after, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21, val.pad_22, val.pad_23, val.pad_24, val.pad_25, val.pad_26);
}
@@ -96,8 +111,9 @@ f16mat3x2 load_u_inner_2_m() {
}
void f() {
s.inner = conv_arr4_S(u.inner);
s.inner[1] = conv_S(u.inner[2u]);
assign_and_preserve_padding_s(conv_arr4_S(u.inner));
uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, conv_S(u.inner[2u]));
s.inner[3].m = load_u_inner_2_m();
s.inner[1].m[0] = u.inner[0u].m_1.yx;
}

View File

@@ -22,9 +22,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_1;
};
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1);
(*(tint_symbol))[1] = (*(tint_symbol_1))[2];
assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = half2((*(tint_symbol_1))[0].m[1]).yx;
return;

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 109
; Bound: 147
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -27,13 +27,20 @@
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %conv_S "conv_S"
OpName %val "val"
OpName %conv_arr4_S "conv_arr4_S"
OpName %val_0 "val"
OpName %arr "arr"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %i_0 "i"
OpName %var_for_index_1 "var_for_index_1"
OpName %load_u_inner_2_m "load_u_inner_2_m"
OpName %f "f"
OpDecorate %u_block_std140 Block
@@ -57,6 +64,7 @@
OpDecorate %_arr_S_uint_4 ArrayStride 128
OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
@@ -73,114 +81,168 @@
%u_block = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%17 = OpTypeFunction %S %S_std140
%28 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%34 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%37 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%50 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%void = OpTypeVoid
%uint_1 = OpConstant %uint 1
%63 = OpTypeFunction %mat3v2half
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%17 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0
%26 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat3v2half = OpTypePointer StorageBuffer %mat3v2half
%uint_2 = OpConstant %uint 2
%39 = OpTypeFunction %void %_arr_S_uint_4
%43 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%58 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%68 = OpTypeFunction %S %S_std140
%79 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%96 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%107 = OpTypeFunction %mat3v2half
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%_ptr_Uniform_v2half = OpTypePointer Uniform %v2half
%uint_3 = OpConstant %uint 3
%void = OpTypeVoid
%83 = OpTypeFunction %void
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%125 = OpTypeFunction %void
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%134 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%int_3 = OpConstant %int 3
%_ptr_StorageBuffer_mat3v2half = OpTypePointer StorageBuffer %mat3v2half
%103 = OpConstantNull %int
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_v2half = OpTypePointer StorageBuffer %v2half
%conv_S = OpFunction %S None %17
%val = OpFunctionParameter %S_std140
%20 = OpLabel
%21 = OpCompositeExtract %int %val 0
%22 = OpCompositeExtract %v2half %val 1
%23 = OpCompositeExtract %v2half %val 2
%24 = OpCompositeExtract %v2half %val 3
%25 = OpCompositeConstruct %mat3v2half %22 %23 %24
%26 = OpCompositeExtract %int %val 4
%27 = OpCompositeConstruct %S %21 %25 %26
OpReturnValue %27
OpFunctionEnd
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %28
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%31 = OpLabel
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %34
%i = OpVariable %_ptr_Function_uint Function %37
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %50
OpBranch %38
%38 = OpLabel
OpLoopMerge %39 %40 None
OpBranch %41
%41 = OpLabel
%43 = OpLoad %uint %i
%44 = OpULessThan %bool %43 %uint_4
%42 = OpLogicalNot %bool %44
OpSelectionMerge %46 None
OpBranchConditional %42 %47 %46
%47 = OpLabel
OpBranch %39
%46 = OpLabel
OpStore %var_for_index %val_0
%51 = OpLoad %uint %i
%53 = OpAccessChain %_ptr_Function_S %arr %51
%55 = OpLoad %uint %i
%57 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %55
%58 = OpLoad %S_std140 %57
%54 = OpFunctionCall %S %conv_S %58
OpStore %53 %54
OpBranch %40
%40 = OpLabel
%59 = OpLoad %uint %i
%61 = OpIAdd %uint %59 %uint_1
OpStore %i %61
OpBranch %38
%39 = OpLabel
%62 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %62
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat3v2half None %63
%65 = OpLabel
%70 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%73 = OpAccessChain %_ptr_Uniform_v2half %70 %uint_1
%74 = OpLoad %v2half %73
%76 = OpAccessChain %_ptr_Uniform_v2half %70 %uint_2
%77 = OpLoad %v2half %76
%80 = OpAccessChain %_ptr_Uniform_v2half %70 %uint_3
%81 = OpLoad %v2half %80
%82 = OpCompositeConstruct %mat3v2half %74 %77 %81
OpReturnValue %82
OpFunctionEnd
%f = OpFunction %void None %83
%86 = OpLabel
%88 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0
%91 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%92 = OpLoad %_arr_S_std140_uint_4 %91
%89 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %92
OpStore %88 %89
%95 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1
%97 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%98 = OpLoad %S_std140 %97
%96 = OpFunctionCall %S %conv_S %98
OpStore %95 %96
%101 = OpAccessChain %_ptr_StorageBuffer_mat3v2half %s %uint_0 %int_3 %uint_1
%102 = OpFunctionCall %mat3v2half %load_u_inner_2_m
OpStore %101 %102
%105 = OpAccessChain %_ptr_StorageBuffer_v2half %s %uint_0 %int_1 %uint_1 %103
%106 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0 %37 %uint_2
%107 = OpLoad %v2half %106
%108 = OpVectorShuffle %v2half %107 %107 1 0
OpStore %105 %108
%assign_and_preserve_padding_1_s_X = OpFunction %void None %17
%dest = OpFunctionParameter %_arr_uint_uint_1
%value = OpFunctionParameter %S
%24 = OpLabel
%27 = OpCompositeExtract %uint %dest 0
%29 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %27 %uint_0
%30 = OpCompositeExtract %int %value 0
OpStore %29 %30
%31 = OpCompositeExtract %uint %dest 0
%33 = OpAccessChain %_ptr_StorageBuffer_mat3v2half %s %uint_0 %31 %uint_1
%34 = OpCompositeExtract %mat3v2half %value 1
OpStore %33 %34
%35 = OpCompositeExtract %uint %dest 0
%37 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %35 %uint_2
%38 = OpCompositeExtract %int %value 2
OpStore %37 %38
OpReturn
OpFunctionEnd
%assign_and_preserve_padding_s = OpFunction %void None %39
%value_0 = OpFunctionParameter %_arr_S_uint_4
%42 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %43
%var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
OpStore %i %43
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 %value_0
%60 = OpLoad %uint %i
%61 = OpCompositeConstruct %_arr_uint_uint_1 %60
%62 = OpLoad %uint %i
%64 = OpAccessChain %_ptr_Function_S %var_for_index %62
%65 = OpLoad %S %64
%59 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %61 %65
OpBranch %48
%48 = OpLabel
%66 = OpLoad %uint %i
%67 = OpIAdd %uint %66 %uint_1
OpStore %i %67
OpBranch %46
%47 = OpLabel
OpReturn
OpFunctionEnd
%conv_S = OpFunction %S None %68
%val = OpFunctionParameter %S_std140
%71 = OpLabel
%72 = OpCompositeExtract %int %val 0
%73 = OpCompositeExtract %v2half %val 1
%74 = OpCompositeExtract %v2half %val 2
%75 = OpCompositeExtract %v2half %val 3
%76 = OpCompositeConstruct %mat3v2half %73 %74 %75
%77 = OpCompositeExtract %int %val 4
%78 = OpCompositeConstruct %S %72 %76 %77
OpReturnValue %78
OpFunctionEnd
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %79
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%82 = OpLabel
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%i_0 = OpVariable %_ptr_Function_uint Function %43
%var_for_index_1 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %96
OpBranch %85
%85 = OpLabel
OpLoopMerge %86 %87 None
OpBranch %88
%88 = OpLabel
%90 = OpLoad %uint %i_0
%91 = OpULessThan %bool %90 %uint_4
%89 = OpLogicalNot %bool %91
OpSelectionMerge %92 None
OpBranchConditional %89 %93 %92
%93 = OpLabel
OpBranch %86
%92 = OpLabel
OpStore %var_for_index_1 %val_0
%97 = OpLoad %uint %i_0
%98 = OpAccessChain %_ptr_Function_S %arr %97
%100 = OpLoad %uint %i_0
%102 = OpAccessChain %_ptr_Function_S_std140 %var_for_index_1 %100
%103 = OpLoad %S_std140 %102
%99 = OpFunctionCall %S %conv_S %103
OpStore %98 %99
OpBranch %87
%87 = OpLabel
%104 = OpLoad %uint %i_0
%105 = OpIAdd %uint %104 %uint_1
OpStore %i_0 %105
OpBranch %85
%86 = OpLabel
%106 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %106
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat3v2half None %107
%109 = OpLabel
%112 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%115 = OpAccessChain %_ptr_Uniform_v2half %112 %uint_1
%116 = OpLoad %v2half %115
%118 = OpAccessChain %_ptr_Uniform_v2half %112 %uint_2
%119 = OpLoad %v2half %118
%122 = OpAccessChain %_ptr_Uniform_v2half %112 %uint_3
%123 = OpLoad %v2half %122
%124 = OpCompositeConstruct %mat3v2half %116 %119 %123
OpReturnValue %124
OpFunctionEnd
%f = OpFunction %void None %125
%127 = OpLabel
%131 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%132 = OpLoad %_arr_S_std140_uint_4 %131
%129 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %132
%128 = OpFunctionCall %void %assign_and_preserve_padding_s %129
%136 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%137 = OpLoad %S_std140 %136
%135 = OpFunctionCall %S %conv_S %137
%133 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %134 %135
%139 = OpAccessChain %_ptr_StorageBuffer_mat3v2half %s %uint_0 %int_3 %uint_1
%140 = OpFunctionCall %mat3v2half %load_u_inner_2_m
OpStore %139 %140
%143 = OpAccessChain %_ptr_StorageBuffer_v2half %s %uint_0 %int_1 %uint_1 %26
%144 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0 %43 %uint_2
%145 = OpLoad %v2half %144
%146 = OpVectorShuffle %v2half %145 %145 1 0
OpStore %143 %146
OpReturn
OpFunctionEnd

View File

@@ -70,6 +70,21 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4];
} s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
S conv_S(S_std140 val) {
return S(val.before, val.pad, mat3x2(val.m_0, val.m_1, val.m_2), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.after, val.pad_9, val.pad_10, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21, val.pad_22, val.pad_23);
}
@@ -89,8 +104,9 @@ mat3x2 load_u_inner_2_m() {
}
void f() {
s.inner = conv_arr4_S(u.inner);
s.inner[1] = conv_S(u.inner[2u]);
assign_and_preserve_padding_s(conv_arr4_S(u.inner));
uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, conv_S(u.inner[2u]));
s.inner[3].m = load_u_inner_2_m();
s.inner[1].m[0] = u.inner[0u].m_1.yx;
}

View File

@@ -23,9 +23,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_2;
};
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1);
(*(tint_symbol))[1] = (*(tint_symbol_1))[2];
assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = float2((*(tint_symbol_1))[0].m[1]).yx;
return;

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 109
; Bound: 147
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -23,13 +23,20 @@
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %conv_S "conv_S"
OpName %val "val"
OpName %conv_arr4_S "conv_arr4_S"
OpName %val_0 "val"
OpName %arr "arr"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %i_0 "i"
OpName %var_for_index_1 "var_for_index_1"
OpName %load_u_inner_2_m "load_u_inner_2_m"
OpName %f "f"
OpDecorate %u_block_std140 Block
@@ -53,6 +60,7 @@
OpDecorate %_arr_S_uint_4 ArrayStride 128
OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
@@ -69,114 +77,168 @@
%u_block = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%17 = OpTypeFunction %S %S_std140
%28 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%34 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%37 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%50 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%void = OpTypeVoid
%uint_1 = OpConstant %uint 1
%63 = OpTypeFunction %mat3v2float
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%17 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0
%26 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float
%uint_2 = OpConstant %uint 2
%39 = OpTypeFunction %void %_arr_S_uint_4
%43 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%58 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%68 = OpTypeFunction %S %S_std140
%79 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%96 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%107 = OpTypeFunction %mat3v2float
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%uint_3 = OpConstant %uint 3
%void = OpTypeVoid
%83 = OpTypeFunction %void
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%125 = OpTypeFunction %void
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%134 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%int_3 = OpConstant %int 3
%_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float
%103 = OpConstantNull %int
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float
%conv_S = OpFunction %S None %17
%val = OpFunctionParameter %S_std140
%20 = OpLabel
%21 = OpCompositeExtract %int %val 0
%22 = OpCompositeExtract %v2float %val 1
%23 = OpCompositeExtract %v2float %val 2
%24 = OpCompositeExtract %v2float %val 3
%25 = OpCompositeConstruct %mat3v2float %22 %23 %24
%26 = OpCompositeExtract %int %val 4
%27 = OpCompositeConstruct %S %21 %25 %26
OpReturnValue %27
OpFunctionEnd
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %28
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%31 = OpLabel
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %34
%i = OpVariable %_ptr_Function_uint Function %37
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %50
OpBranch %38
%38 = OpLabel
OpLoopMerge %39 %40 None
OpBranch %41
%41 = OpLabel
%43 = OpLoad %uint %i
%44 = OpULessThan %bool %43 %uint_4
%42 = OpLogicalNot %bool %44
OpSelectionMerge %46 None
OpBranchConditional %42 %47 %46
%47 = OpLabel
OpBranch %39
%46 = OpLabel
OpStore %var_for_index %val_0
%51 = OpLoad %uint %i
%53 = OpAccessChain %_ptr_Function_S %arr %51
%55 = OpLoad %uint %i
%57 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %55
%58 = OpLoad %S_std140 %57
%54 = OpFunctionCall %S %conv_S %58
OpStore %53 %54
OpBranch %40
%40 = OpLabel
%59 = OpLoad %uint %i
%61 = OpIAdd %uint %59 %uint_1
OpStore %i %61
OpBranch %38
%39 = OpLabel
%62 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %62
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat3v2float None %63
%65 = OpLabel
%70 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%73 = OpAccessChain %_ptr_Uniform_v2float %70 %uint_1
%74 = OpLoad %v2float %73
%76 = OpAccessChain %_ptr_Uniform_v2float %70 %uint_2
%77 = OpLoad %v2float %76
%80 = OpAccessChain %_ptr_Uniform_v2float %70 %uint_3
%81 = OpLoad %v2float %80
%82 = OpCompositeConstruct %mat3v2float %74 %77 %81
OpReturnValue %82
OpFunctionEnd
%f = OpFunction %void None %83
%86 = OpLabel
%88 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0
%91 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%92 = OpLoad %_arr_S_std140_uint_4 %91
%89 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %92
OpStore %88 %89
%95 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1
%97 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%98 = OpLoad %S_std140 %97
%96 = OpFunctionCall %S %conv_S %98
OpStore %95 %96
%101 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %s %uint_0 %int_3 %uint_1
%102 = OpFunctionCall %mat3v2float %load_u_inner_2_m
OpStore %101 %102
%105 = OpAccessChain %_ptr_StorageBuffer_v2float %s %uint_0 %int_1 %uint_1 %103
%106 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %37 %uint_2
%107 = OpLoad %v2float %106
%108 = OpVectorShuffle %v2float %107 %107 1 0
OpStore %105 %108
%assign_and_preserve_padding_1_s_X = OpFunction %void None %17
%dest = OpFunctionParameter %_arr_uint_uint_1
%value = OpFunctionParameter %S
%24 = OpLabel
%27 = OpCompositeExtract %uint %dest 0
%29 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %27 %uint_0
%30 = OpCompositeExtract %int %value 0
OpStore %29 %30
%31 = OpCompositeExtract %uint %dest 0
%33 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %s %uint_0 %31 %uint_1
%34 = OpCompositeExtract %mat3v2float %value 1
OpStore %33 %34
%35 = OpCompositeExtract %uint %dest 0
%37 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %35 %uint_2
%38 = OpCompositeExtract %int %value 2
OpStore %37 %38
OpReturn
OpFunctionEnd
%assign_and_preserve_padding_s = OpFunction %void None %39
%value_0 = OpFunctionParameter %_arr_S_uint_4
%42 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %43
%var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
OpStore %i %43
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 %value_0
%60 = OpLoad %uint %i
%61 = OpCompositeConstruct %_arr_uint_uint_1 %60
%62 = OpLoad %uint %i
%64 = OpAccessChain %_ptr_Function_S %var_for_index %62
%65 = OpLoad %S %64
%59 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %61 %65
OpBranch %48
%48 = OpLabel
%66 = OpLoad %uint %i
%67 = OpIAdd %uint %66 %uint_1
OpStore %i %67
OpBranch %46
%47 = OpLabel
OpReturn
OpFunctionEnd
%conv_S = OpFunction %S None %68
%val = OpFunctionParameter %S_std140
%71 = OpLabel
%72 = OpCompositeExtract %int %val 0
%73 = OpCompositeExtract %v2float %val 1
%74 = OpCompositeExtract %v2float %val 2
%75 = OpCompositeExtract %v2float %val 3
%76 = OpCompositeConstruct %mat3v2float %73 %74 %75
%77 = OpCompositeExtract %int %val 4
%78 = OpCompositeConstruct %S %72 %76 %77
OpReturnValue %78
OpFunctionEnd
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %79
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%82 = OpLabel
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%i_0 = OpVariable %_ptr_Function_uint Function %43
%var_for_index_1 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %96
OpBranch %85
%85 = OpLabel
OpLoopMerge %86 %87 None
OpBranch %88
%88 = OpLabel
%90 = OpLoad %uint %i_0
%91 = OpULessThan %bool %90 %uint_4
%89 = OpLogicalNot %bool %91
OpSelectionMerge %92 None
OpBranchConditional %89 %93 %92
%93 = OpLabel
OpBranch %86
%92 = OpLabel
OpStore %var_for_index_1 %val_0
%97 = OpLoad %uint %i_0
%98 = OpAccessChain %_ptr_Function_S %arr %97
%100 = OpLoad %uint %i_0
%102 = OpAccessChain %_ptr_Function_S_std140 %var_for_index_1 %100
%103 = OpLoad %S_std140 %102
%99 = OpFunctionCall %S %conv_S %103
OpStore %98 %99
OpBranch %87
%87 = OpLabel
%104 = OpLoad %uint %i_0
%105 = OpIAdd %uint %104 %uint_1
OpStore %i_0 %105
OpBranch %85
%86 = OpLabel
%106 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %106
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat3v2float None %107
%109 = OpLabel
%112 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%115 = OpAccessChain %_ptr_Uniform_v2float %112 %uint_1
%116 = OpLoad %v2float %115
%118 = OpAccessChain %_ptr_Uniform_v2float %112 %uint_2
%119 = OpLoad %v2float %118
%122 = OpAccessChain %_ptr_Uniform_v2float %112 %uint_3
%123 = OpLoad %v2float %122
%124 = OpCompositeConstruct %mat3v2float %116 %119 %123
OpReturnValue %124
OpFunctionEnd
%f = OpFunction %void None %125
%127 = OpLabel
%131 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%132 = OpLoad %_arr_S_std140_uint_4 %131
%129 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %132
%128 = OpFunctionCall %void %assign_and_preserve_padding_s %129
%136 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%137 = OpLoad %S_std140 %136
%135 = OpFunctionCall %S %conv_S %137
%133 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %134 %135
%139 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %s %uint_0 %int_3 %uint_1
%140 = OpFunctionCall %mat3v2float %load_u_inner_2_m
OpStore %139 %140
%143 = OpAccessChain %_ptr_StorageBuffer_v2float %s %uint_0 %int_1 %uint_1 %26
%144 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %43 %uint_2
%145 = OpLoad %v2float %144
%146 = OpVectorShuffle %v2float %145 %145 1 0
OpStore %143 %146
OpReturn
OpFunctionEnd

View File

@@ -71,6 +71,21 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4];
} s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
S conv_S(S_std140 val) {
return S(val.before, val.pad, f16mat3(val.m_0, val.m_1, val.m_2), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.after, val.pad_9, val.pad_10, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21, val.pad_22, val.pad_23);
}
@@ -90,8 +105,9 @@ f16mat3 load_u_inner_2_m() {
}
void f() {
s.inner = conv_arr4_S(u.inner);
s.inner[1] = conv_S(u.inner[2u]);
assign_and_preserve_padding_s(conv_arr4_S(u.inner));
uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, conv_S(u.inner[2u]));
s.inner[3].m = load_u_inner_2_m();
s.inner[1].m[0] = u.inner[0u].m_1.zxy;
}

View File

@@ -23,9 +23,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_2;
};
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1);
(*(tint_symbol))[1] = (*(tint_symbol_1))[2];
assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = half3((*(tint_symbol_1))[0].m[1]).zxy;
return;

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 109
; Bound: 147
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -27,13 +27,20 @@
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %conv_S "conv_S"
OpName %val "val"
OpName %conv_arr4_S "conv_arr4_S"
OpName %val_0 "val"
OpName %arr "arr"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %i_0 "i"
OpName %var_for_index_1 "var_for_index_1"
OpName %load_u_inner_2_m "load_u_inner_2_m"
OpName %f "f"
OpDecorate %u_block_std140 Block
@@ -57,6 +64,7 @@
OpDecorate %_arr_S_uint_4 ArrayStride 128
OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
@@ -73,114 +81,168 @@
%u_block = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%17 = OpTypeFunction %S %S_std140
%28 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%34 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%37 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%50 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%void = OpTypeVoid
%uint_1 = OpConstant %uint 1
%63 = OpTypeFunction %mat3v3half
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%17 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0
%26 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat3v3half = OpTypePointer StorageBuffer %mat3v3half
%uint_2 = OpConstant %uint 2
%39 = OpTypeFunction %void %_arr_S_uint_4
%43 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%58 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%68 = OpTypeFunction %S %S_std140
%79 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%96 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%107 = OpTypeFunction %mat3v3half
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%_ptr_Uniform_v3half = OpTypePointer Uniform %v3half
%uint_3 = OpConstant %uint 3
%void = OpTypeVoid
%83 = OpTypeFunction %void
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%125 = OpTypeFunction %void
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%134 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%int_3 = OpConstant %int 3
%_ptr_StorageBuffer_mat3v3half = OpTypePointer StorageBuffer %mat3v3half
%103 = OpConstantNull %int
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
%conv_S = OpFunction %S None %17
%val = OpFunctionParameter %S_std140
%20 = OpLabel
%21 = OpCompositeExtract %int %val 0
%22 = OpCompositeExtract %v3half %val 1
%23 = OpCompositeExtract %v3half %val 2
%24 = OpCompositeExtract %v3half %val 3
%25 = OpCompositeConstruct %mat3v3half %22 %23 %24
%26 = OpCompositeExtract %int %val 4
%27 = OpCompositeConstruct %S %21 %25 %26
OpReturnValue %27
OpFunctionEnd
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %28
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%31 = OpLabel
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %34
%i = OpVariable %_ptr_Function_uint Function %37
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %50
OpBranch %38
%38 = OpLabel
OpLoopMerge %39 %40 None
OpBranch %41
%41 = OpLabel
%43 = OpLoad %uint %i
%44 = OpULessThan %bool %43 %uint_4
%42 = OpLogicalNot %bool %44
OpSelectionMerge %46 None
OpBranchConditional %42 %47 %46
%47 = OpLabel
OpBranch %39
%46 = OpLabel
OpStore %var_for_index %val_0
%51 = OpLoad %uint %i
%53 = OpAccessChain %_ptr_Function_S %arr %51
%55 = OpLoad %uint %i
%57 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %55
%58 = OpLoad %S_std140 %57
%54 = OpFunctionCall %S %conv_S %58
OpStore %53 %54
OpBranch %40
%40 = OpLabel
%59 = OpLoad %uint %i
%61 = OpIAdd %uint %59 %uint_1
OpStore %i %61
OpBranch %38
%39 = OpLabel
%62 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %62
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat3v3half None %63
%65 = OpLabel
%70 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%73 = OpAccessChain %_ptr_Uniform_v3half %70 %uint_1
%74 = OpLoad %v3half %73
%76 = OpAccessChain %_ptr_Uniform_v3half %70 %uint_2
%77 = OpLoad %v3half %76
%80 = OpAccessChain %_ptr_Uniform_v3half %70 %uint_3
%81 = OpLoad %v3half %80
%82 = OpCompositeConstruct %mat3v3half %74 %77 %81
OpReturnValue %82
OpFunctionEnd
%f = OpFunction %void None %83
%86 = OpLabel
%88 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0
%91 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%92 = OpLoad %_arr_S_std140_uint_4 %91
%89 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %92
OpStore %88 %89
%95 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1
%97 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%98 = OpLoad %S_std140 %97
%96 = OpFunctionCall %S %conv_S %98
OpStore %95 %96
%101 = OpAccessChain %_ptr_StorageBuffer_mat3v3half %s %uint_0 %int_3 %uint_1
%102 = OpFunctionCall %mat3v3half %load_u_inner_2_m
OpStore %101 %102
%105 = OpAccessChain %_ptr_StorageBuffer_v3half %s %uint_0 %int_1 %uint_1 %103
%106 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0 %37 %uint_2
%107 = OpLoad %v3half %106
%108 = OpVectorShuffle %v3half %107 %107 2 0 1
OpStore %105 %108
%assign_and_preserve_padding_1_s_X = OpFunction %void None %17
%dest = OpFunctionParameter %_arr_uint_uint_1
%value = OpFunctionParameter %S
%24 = OpLabel
%27 = OpCompositeExtract %uint %dest 0
%29 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %27 %uint_0
%30 = OpCompositeExtract %int %value 0
OpStore %29 %30
%31 = OpCompositeExtract %uint %dest 0
%33 = OpAccessChain %_ptr_StorageBuffer_mat3v3half %s %uint_0 %31 %uint_1
%34 = OpCompositeExtract %mat3v3half %value 1
OpStore %33 %34
%35 = OpCompositeExtract %uint %dest 0
%37 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %35 %uint_2
%38 = OpCompositeExtract %int %value 2
OpStore %37 %38
OpReturn
OpFunctionEnd
%assign_and_preserve_padding_s = OpFunction %void None %39
%value_0 = OpFunctionParameter %_arr_S_uint_4
%42 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %43
%var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
OpStore %i %43
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 %value_0
%60 = OpLoad %uint %i
%61 = OpCompositeConstruct %_arr_uint_uint_1 %60
%62 = OpLoad %uint %i
%64 = OpAccessChain %_ptr_Function_S %var_for_index %62
%65 = OpLoad %S %64
%59 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %61 %65
OpBranch %48
%48 = OpLabel
%66 = OpLoad %uint %i
%67 = OpIAdd %uint %66 %uint_1
OpStore %i %67
OpBranch %46
%47 = OpLabel
OpReturn
OpFunctionEnd
%conv_S = OpFunction %S None %68
%val = OpFunctionParameter %S_std140
%71 = OpLabel
%72 = OpCompositeExtract %int %val 0
%73 = OpCompositeExtract %v3half %val 1
%74 = OpCompositeExtract %v3half %val 2
%75 = OpCompositeExtract %v3half %val 3
%76 = OpCompositeConstruct %mat3v3half %73 %74 %75
%77 = OpCompositeExtract %int %val 4
%78 = OpCompositeConstruct %S %72 %76 %77
OpReturnValue %78
OpFunctionEnd
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %79
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%82 = OpLabel
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%i_0 = OpVariable %_ptr_Function_uint Function %43
%var_for_index_1 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %96
OpBranch %85
%85 = OpLabel
OpLoopMerge %86 %87 None
OpBranch %88
%88 = OpLabel
%90 = OpLoad %uint %i_0
%91 = OpULessThan %bool %90 %uint_4
%89 = OpLogicalNot %bool %91
OpSelectionMerge %92 None
OpBranchConditional %89 %93 %92
%93 = OpLabel
OpBranch %86
%92 = OpLabel
OpStore %var_for_index_1 %val_0
%97 = OpLoad %uint %i_0
%98 = OpAccessChain %_ptr_Function_S %arr %97
%100 = OpLoad %uint %i_0
%102 = OpAccessChain %_ptr_Function_S_std140 %var_for_index_1 %100
%103 = OpLoad %S_std140 %102
%99 = OpFunctionCall %S %conv_S %103
OpStore %98 %99
OpBranch %87
%87 = OpLabel
%104 = OpLoad %uint %i_0
%105 = OpIAdd %uint %104 %uint_1
OpStore %i_0 %105
OpBranch %85
%86 = OpLabel
%106 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %106
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat3v3half None %107
%109 = OpLabel
%112 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%115 = OpAccessChain %_ptr_Uniform_v3half %112 %uint_1
%116 = OpLoad %v3half %115
%118 = OpAccessChain %_ptr_Uniform_v3half %112 %uint_2
%119 = OpLoad %v3half %118
%122 = OpAccessChain %_ptr_Uniform_v3half %112 %uint_3
%123 = OpLoad %v3half %122
%124 = OpCompositeConstruct %mat3v3half %116 %119 %123
OpReturnValue %124
OpFunctionEnd
%f = OpFunction %void None %125
%127 = OpLabel
%131 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%132 = OpLoad %_arr_S_std140_uint_4 %131
%129 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %132
%128 = OpFunctionCall %void %assign_and_preserve_padding_s %129
%136 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%137 = OpLoad %S_std140 %136
%135 = OpFunctionCall %S %conv_S %137
%133 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %134 %135
%139 = OpAccessChain %_ptr_StorageBuffer_mat3v3half %s %uint_0 %int_3 %uint_1
%140 = OpFunctionCall %mat3v3half %load_u_inner_2_m
OpStore %139 %140
%143 = OpAccessChain %_ptr_StorageBuffer_v3half %s %uint_0 %int_1 %uint_1 %26
%144 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0 %43 %uint_2
%145 = OpLoad %v3half %144
%146 = OpVectorShuffle %v3half %145 %145 2 0 1
OpStore %143 %146
OpReturn
OpFunctionEnd

View File

@@ -32,9 +32,25 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4];
} s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
void f() {
s.inner = u.inner;
s.inner[1] = u.inner[2];
assign_and_preserve_padding_s(u.inner);
uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, u.inner[2]);
s.inner[3].m = u.inner[2].m;
s.inner[1].m[0] = u.inner[0].m[1].zxy;
}

View File

@@ -22,9 +22,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_1;
};
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1);
(*(tint_symbol))[1] = (*(tint_symbol_1))[2];
assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = float3((*(tint_symbol_1))[0].m[1]).zxy;
return;

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 45
; Bound: 90
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -15,6 +15,13 @@
OpMemberName %S 2 "after"
OpName %u "u"
OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %f "f"
OpDecorate %u_block Block
OpMemberDecorate %u_block 0 Offset 0
@@ -29,6 +36,7 @@
OpDecorate %u Binding 0
OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
@@ -43,39 +51,100 @@
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%void = OpTypeVoid
%14 = OpTypeFunction %void
%uint_1 = OpConstant %uint 1
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%14 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%23 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat3v3float = OpTypePointer StorageBuffer %mat3v3float
%uint_2 = OpConstant %uint 2
%36 = OpTypeFunction %void %_arr_S_uint_4
%40 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%55 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%65 = OpTypeFunction %void
%_ptr_Uniform__arr_S_uint_4 = OpTypePointer Uniform %_arr_S_uint_4
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%73 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%int_2 = OpConstant %int 2
%_ptr_Uniform_S = OpTypePointer Uniform %S
%int_3 = OpConstant %int 3
%uint_1 = OpConstant %uint 1
%_ptr_StorageBuffer_mat3v3float = OpTypePointer StorageBuffer %mat3v3float
%_ptr_Uniform_mat3v3float = OpTypePointer Uniform %mat3v3float
%38 = OpConstantNull %int
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float
%f = OpFunction %void None %14
%17 = OpLabel
%20 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0
%22 = OpAccessChain %_ptr_Uniform__arr_S_uint_4 %u %uint_0
%23 = OpLoad %_arr_S_uint_4 %22
OpStore %20 %23
%26 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1
%29 = OpAccessChain %_ptr_Uniform_S %u %uint_0 %int_2
%30 = OpLoad %S %29
OpStore %26 %30
%34 = OpAccessChain %_ptr_StorageBuffer_mat3v3float %s %uint_0 %int_3 %uint_1
%36 = OpAccessChain %_ptr_Uniform_mat3v3float %u %uint_0 %int_2 %uint_1
%37 = OpLoad %mat3v3float %36
OpStore %34 %37
%40 = OpAccessChain %_ptr_StorageBuffer_v3float %s %uint_0 %int_1 %uint_1 %38
%42 = OpAccessChain %_ptr_Uniform_v3float %u %uint_0 %38 %uint_1 %int_1
%43 = OpLoad %v3float %42
%44 = OpVectorShuffle %v3float %43 %43 2 0 1
OpStore %40 %44
%assign_and_preserve_padding_1_s_X = OpFunction %void None %14
%dest = OpFunctionParameter %_arr_uint_uint_1
%value = OpFunctionParameter %S
%21 = OpLabel
%24 = OpCompositeExtract %uint %dest 0
%26 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %24 %uint_0
%27 = OpCompositeExtract %int %value 0
OpStore %26 %27
%28 = OpCompositeExtract %uint %dest 0
%30 = OpAccessChain %_ptr_StorageBuffer_mat3v3float %s %uint_0 %28 %uint_1
%31 = OpCompositeExtract %mat3v3float %value 1
OpStore %30 %31
%32 = OpCompositeExtract %uint %dest 0
%34 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %32 %uint_2
%35 = OpCompositeExtract %int %value 2
OpStore %34 %35
OpReturn
OpFunctionEnd
%assign_and_preserve_padding_s = OpFunction %void None %36
%value_0 = OpFunctionParameter %_arr_S_uint_4
%39 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %40
%var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %55
OpStore %i %40
OpBranch %43
%43 = OpLabel
OpLoopMerge %44 %45 None
OpBranch %46
%46 = OpLabel
%48 = OpLoad %uint %i
%49 = OpULessThan %bool %48 %uint_4
%47 = OpLogicalNot %bool %49
OpSelectionMerge %51 None
OpBranchConditional %47 %52 %51
%52 = OpLabel
OpBranch %44
%51 = OpLabel
OpStore %var_for_index %value_0
%57 = OpLoad %uint %i
%58 = OpCompositeConstruct %_arr_uint_uint_1 %57
%59 = OpLoad %uint %i
%61 = OpAccessChain %_ptr_Function_S %var_for_index %59
%62 = OpLoad %S %61
%56 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %58 %62
OpBranch %45
%45 = OpLabel
%63 = OpLoad %uint %i
%64 = OpIAdd %uint %63 %uint_1
OpStore %i %64
OpBranch %43
%44 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %void None %65
%67 = OpLabel
%70 = OpAccessChain %_ptr_Uniform__arr_S_uint_4 %u %uint_0
%71 = OpLoad %_arr_S_uint_4 %70
%68 = OpFunctionCall %void %assign_and_preserve_padding_s %71
%76 = OpAccessChain %_ptr_Uniform_S %u %uint_0 %int_2
%77 = OpLoad %S %76
%72 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %73 %77
%79 = OpAccessChain %_ptr_StorageBuffer_mat3v3float %s %uint_0 %int_3 %uint_1
%81 = OpAccessChain %_ptr_Uniform_mat3v3float %u %uint_0 %int_2 %uint_1
%82 = OpLoad %mat3v3float %81
OpStore %79 %82
%85 = OpAccessChain %_ptr_StorageBuffer_v3float %s %uint_0 %int_1 %uint_1 %23
%87 = OpAccessChain %_ptr_Uniform_v3float %u %uint_0 %23 %uint_1 %int_1
%88 = OpLoad %v3float %87
%89 = OpVectorShuffle %v3float %88 %88 2 0 1
OpStore %85 %89
OpReturn
OpFunctionEnd

View File

@@ -71,6 +71,21 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4];
} s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
S conv_S(S_std140 val) {
return S(val.before, val.pad, f16mat3x4(val.m_0, val.m_1, val.m_2), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.after, val.pad_9, val.pad_10, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21, val.pad_22, val.pad_23);
}
@@ -90,8 +105,9 @@ f16mat3x4 load_u_inner_2_m() {
}
void f() {
s.inner = conv_arr4_S(u.inner);
s.inner[1] = conv_S(u.inner[2u]);
assign_and_preserve_padding_s(conv_arr4_S(u.inner));
uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, conv_S(u.inner[2u]));
s.inner[3].m = load_u_inner_2_m();
s.inner[1].m[0] = u.inner[0u].m_1.ywxz;
}

View File

@@ -23,9 +23,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_2;
};
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1);
(*(tint_symbol))[1] = (*(tint_symbol_1))[2];
assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = half4((*(tint_symbol_1))[0].m[1]).ywxz;
return;

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 109
; Bound: 147
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -27,13 +27,20 @@
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %conv_S "conv_S"
OpName %val "val"
OpName %conv_arr4_S "conv_arr4_S"
OpName %val_0 "val"
OpName %arr "arr"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %i_0 "i"
OpName %var_for_index_1 "var_for_index_1"
OpName %load_u_inner_2_m "load_u_inner_2_m"
OpName %f "f"
OpDecorate %u_block_std140 Block
@@ -57,6 +64,7 @@
OpDecorate %_arr_S_uint_4 ArrayStride 128
OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
@@ -73,114 +81,168 @@
%u_block = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%17 = OpTypeFunction %S %S_std140
%28 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%34 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%37 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%50 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%void = OpTypeVoid
%uint_1 = OpConstant %uint 1
%63 = OpTypeFunction %mat3v4half
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%17 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0
%26 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat3v4half = OpTypePointer StorageBuffer %mat3v4half
%uint_2 = OpConstant %uint 2
%39 = OpTypeFunction %void %_arr_S_uint_4
%43 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%58 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%68 = OpTypeFunction %S %S_std140
%79 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%96 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%107 = OpTypeFunction %mat3v4half
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%_ptr_Uniform_v4half = OpTypePointer Uniform %v4half
%uint_3 = OpConstant %uint 3
%void = OpTypeVoid
%83 = OpTypeFunction %void
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%125 = OpTypeFunction %void
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%134 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%int_3 = OpConstant %int 3
%_ptr_StorageBuffer_mat3v4half = OpTypePointer StorageBuffer %mat3v4half
%103 = OpConstantNull %int
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_v4half = OpTypePointer StorageBuffer %v4half
%conv_S = OpFunction %S None %17
%val = OpFunctionParameter %S_std140
%20 = OpLabel
%21 = OpCompositeExtract %int %val 0
%22 = OpCompositeExtract %v4half %val 1
%23 = OpCompositeExtract %v4half %val 2
%24 = OpCompositeExtract %v4half %val 3
%25 = OpCompositeConstruct %mat3v4half %22 %23 %24
%26 = OpCompositeExtract %int %val 4
%27 = OpCompositeConstruct %S %21 %25 %26
OpReturnValue %27
OpFunctionEnd
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %28
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%31 = OpLabel
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %34
%i = OpVariable %_ptr_Function_uint Function %37
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %50
OpBranch %38
%38 = OpLabel
OpLoopMerge %39 %40 None
OpBranch %41
%41 = OpLabel
%43 = OpLoad %uint %i
%44 = OpULessThan %bool %43 %uint_4
%42 = OpLogicalNot %bool %44
OpSelectionMerge %46 None
OpBranchConditional %42 %47 %46
%47 = OpLabel
OpBranch %39
%46 = OpLabel
OpStore %var_for_index %val_0
%51 = OpLoad %uint %i
%53 = OpAccessChain %_ptr_Function_S %arr %51
%55 = OpLoad %uint %i
%57 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %55
%58 = OpLoad %S_std140 %57
%54 = OpFunctionCall %S %conv_S %58
OpStore %53 %54
OpBranch %40
%40 = OpLabel
%59 = OpLoad %uint %i
%61 = OpIAdd %uint %59 %uint_1
OpStore %i %61
OpBranch %38
%39 = OpLabel
%62 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %62
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat3v4half None %63
%65 = OpLabel
%70 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%73 = OpAccessChain %_ptr_Uniform_v4half %70 %uint_1
%74 = OpLoad %v4half %73
%76 = OpAccessChain %_ptr_Uniform_v4half %70 %uint_2
%77 = OpLoad %v4half %76
%80 = OpAccessChain %_ptr_Uniform_v4half %70 %uint_3
%81 = OpLoad %v4half %80
%82 = OpCompositeConstruct %mat3v4half %74 %77 %81
OpReturnValue %82
OpFunctionEnd
%f = OpFunction %void None %83
%86 = OpLabel
%88 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0
%91 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%92 = OpLoad %_arr_S_std140_uint_4 %91
%89 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %92
OpStore %88 %89
%95 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1
%97 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%98 = OpLoad %S_std140 %97
%96 = OpFunctionCall %S %conv_S %98
OpStore %95 %96
%101 = OpAccessChain %_ptr_StorageBuffer_mat3v4half %s %uint_0 %int_3 %uint_1
%102 = OpFunctionCall %mat3v4half %load_u_inner_2_m
OpStore %101 %102
%105 = OpAccessChain %_ptr_StorageBuffer_v4half %s %uint_0 %int_1 %uint_1 %103
%106 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0 %37 %uint_2
%107 = OpLoad %v4half %106
%108 = OpVectorShuffle %v4half %107 %107 1 3 0 2
OpStore %105 %108
%assign_and_preserve_padding_1_s_X = OpFunction %void None %17
%dest = OpFunctionParameter %_arr_uint_uint_1
%value = OpFunctionParameter %S
%24 = OpLabel
%27 = OpCompositeExtract %uint %dest 0
%29 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %27 %uint_0
%30 = OpCompositeExtract %int %value 0
OpStore %29 %30
%31 = OpCompositeExtract %uint %dest 0
%33 = OpAccessChain %_ptr_StorageBuffer_mat3v4half %s %uint_0 %31 %uint_1
%34 = OpCompositeExtract %mat3v4half %value 1
OpStore %33 %34
%35 = OpCompositeExtract %uint %dest 0
%37 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %35 %uint_2
%38 = OpCompositeExtract %int %value 2
OpStore %37 %38
OpReturn
OpFunctionEnd
%assign_and_preserve_padding_s = OpFunction %void None %39
%value_0 = OpFunctionParameter %_arr_S_uint_4
%42 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %43
%var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
OpStore %i %43
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 %value_0
%60 = OpLoad %uint %i
%61 = OpCompositeConstruct %_arr_uint_uint_1 %60
%62 = OpLoad %uint %i
%64 = OpAccessChain %_ptr_Function_S %var_for_index %62
%65 = OpLoad %S %64
%59 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %61 %65
OpBranch %48
%48 = OpLabel
%66 = OpLoad %uint %i
%67 = OpIAdd %uint %66 %uint_1
OpStore %i %67
OpBranch %46
%47 = OpLabel
OpReturn
OpFunctionEnd
%conv_S = OpFunction %S None %68
%val = OpFunctionParameter %S_std140
%71 = OpLabel
%72 = OpCompositeExtract %int %val 0
%73 = OpCompositeExtract %v4half %val 1
%74 = OpCompositeExtract %v4half %val 2
%75 = OpCompositeExtract %v4half %val 3
%76 = OpCompositeConstruct %mat3v4half %73 %74 %75
%77 = OpCompositeExtract %int %val 4
%78 = OpCompositeConstruct %S %72 %76 %77
OpReturnValue %78
OpFunctionEnd
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %79
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%82 = OpLabel
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%i_0 = OpVariable %_ptr_Function_uint Function %43
%var_for_index_1 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %96
OpBranch %85
%85 = OpLabel
OpLoopMerge %86 %87 None
OpBranch %88
%88 = OpLabel
%90 = OpLoad %uint %i_0
%91 = OpULessThan %bool %90 %uint_4
%89 = OpLogicalNot %bool %91
OpSelectionMerge %92 None
OpBranchConditional %89 %93 %92
%93 = OpLabel
OpBranch %86
%92 = OpLabel
OpStore %var_for_index_1 %val_0
%97 = OpLoad %uint %i_0
%98 = OpAccessChain %_ptr_Function_S %arr %97
%100 = OpLoad %uint %i_0
%102 = OpAccessChain %_ptr_Function_S_std140 %var_for_index_1 %100
%103 = OpLoad %S_std140 %102
%99 = OpFunctionCall %S %conv_S %103
OpStore %98 %99
OpBranch %87
%87 = OpLabel
%104 = OpLoad %uint %i_0
%105 = OpIAdd %uint %104 %uint_1
OpStore %i_0 %105
OpBranch %85
%86 = OpLabel
%106 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %106
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat3v4half None %107
%109 = OpLabel
%112 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%115 = OpAccessChain %_ptr_Uniform_v4half %112 %uint_1
%116 = OpLoad %v4half %115
%118 = OpAccessChain %_ptr_Uniform_v4half %112 %uint_2
%119 = OpLoad %v4half %118
%122 = OpAccessChain %_ptr_Uniform_v4half %112 %uint_3
%123 = OpLoad %v4half %122
%124 = OpCompositeConstruct %mat3v4half %116 %119 %123
OpReturnValue %124
OpFunctionEnd
%f = OpFunction %void None %125
%127 = OpLabel
%131 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%132 = OpLoad %_arr_S_std140_uint_4 %131
%129 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %132
%128 = OpFunctionCall %void %assign_and_preserve_padding_s %129
%136 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%137 = OpLoad %S_std140 %136
%135 = OpFunctionCall %S %conv_S %137
%133 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %134 %135
%139 = OpAccessChain %_ptr_StorageBuffer_mat3v4half %s %uint_0 %int_3 %uint_1
%140 = OpFunctionCall %mat3v4half %load_u_inner_2_m
OpStore %139 %140
%143 = OpAccessChain %_ptr_StorageBuffer_v4half %s %uint_0 %int_1 %uint_1 %26
%144 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0 %43 %uint_2
%145 = OpLoad %v4half %144
%146 = OpVectorShuffle %v4half %145 %145 1 3 0 2
OpStore %143 %146
OpReturn
OpFunctionEnd

View File

@@ -32,9 +32,25 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4];
} s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
void f() {
s.inner = u.inner;
s.inner[1] = u.inner[2];
assign_and_preserve_padding_s(u.inner);
uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, u.inner[2]);
s.inner[3].m = u.inner[2].m;
s.inner[1].m[0] = u.inner[0].m[1].ywxz;
}

View File

@@ -22,9 +22,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_1;
};
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1);
(*(tint_symbol))[1] = (*(tint_symbol_1))[2];
assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = float4((*(tint_symbol_1))[0].m[1]).ywxz;
return;

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 45
; Bound: 90
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -15,6 +15,13 @@
OpMemberName %S 2 "after"
OpName %u "u"
OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %f "f"
OpDecorate %u_block Block
OpMemberDecorate %u_block 0 Offset 0
@@ -29,6 +36,7 @@
OpDecorate %u Binding 0
OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
@@ -43,39 +51,100 @@
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%void = OpTypeVoid
%14 = OpTypeFunction %void
%uint_1 = OpConstant %uint 1
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%14 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%23 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat3v4float = OpTypePointer StorageBuffer %mat3v4float
%uint_2 = OpConstant %uint 2
%36 = OpTypeFunction %void %_arr_S_uint_4
%40 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%55 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%65 = OpTypeFunction %void
%_ptr_Uniform__arr_S_uint_4 = OpTypePointer Uniform %_arr_S_uint_4
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%73 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%int_2 = OpConstant %int 2
%_ptr_Uniform_S = OpTypePointer Uniform %S
%int_3 = OpConstant %int 3
%uint_1 = OpConstant %uint 1
%_ptr_StorageBuffer_mat3v4float = OpTypePointer StorageBuffer %mat3v4float
%_ptr_Uniform_mat3v4float = OpTypePointer Uniform %mat3v4float
%38 = OpConstantNull %int
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%f = OpFunction %void None %14
%17 = OpLabel
%20 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0
%22 = OpAccessChain %_ptr_Uniform__arr_S_uint_4 %u %uint_0
%23 = OpLoad %_arr_S_uint_4 %22
OpStore %20 %23
%26 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1
%29 = OpAccessChain %_ptr_Uniform_S %u %uint_0 %int_2
%30 = OpLoad %S %29
OpStore %26 %30
%34 = OpAccessChain %_ptr_StorageBuffer_mat3v4float %s %uint_0 %int_3 %uint_1
%36 = OpAccessChain %_ptr_Uniform_mat3v4float %u %uint_0 %int_2 %uint_1
%37 = OpLoad %mat3v4float %36
OpStore %34 %37
%40 = OpAccessChain %_ptr_StorageBuffer_v4float %s %uint_0 %int_1 %uint_1 %38
%42 = OpAccessChain %_ptr_Uniform_v4float %u %uint_0 %38 %uint_1 %int_1
%43 = OpLoad %v4float %42
%44 = OpVectorShuffle %v4float %43 %43 1 3 0 2
OpStore %40 %44
%assign_and_preserve_padding_1_s_X = OpFunction %void None %14
%dest = OpFunctionParameter %_arr_uint_uint_1
%value = OpFunctionParameter %S
%21 = OpLabel
%24 = OpCompositeExtract %uint %dest 0
%26 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %24 %uint_0
%27 = OpCompositeExtract %int %value 0
OpStore %26 %27
%28 = OpCompositeExtract %uint %dest 0
%30 = OpAccessChain %_ptr_StorageBuffer_mat3v4float %s %uint_0 %28 %uint_1
%31 = OpCompositeExtract %mat3v4float %value 1
OpStore %30 %31
%32 = OpCompositeExtract %uint %dest 0
%34 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %32 %uint_2
%35 = OpCompositeExtract %int %value 2
OpStore %34 %35
OpReturn
OpFunctionEnd
%assign_and_preserve_padding_s = OpFunction %void None %36
%value_0 = OpFunctionParameter %_arr_S_uint_4
%39 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %40
%var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %55
OpStore %i %40
OpBranch %43
%43 = OpLabel
OpLoopMerge %44 %45 None
OpBranch %46
%46 = OpLabel
%48 = OpLoad %uint %i
%49 = OpULessThan %bool %48 %uint_4
%47 = OpLogicalNot %bool %49
OpSelectionMerge %51 None
OpBranchConditional %47 %52 %51
%52 = OpLabel
OpBranch %44
%51 = OpLabel
OpStore %var_for_index %value_0
%57 = OpLoad %uint %i
%58 = OpCompositeConstruct %_arr_uint_uint_1 %57
%59 = OpLoad %uint %i
%61 = OpAccessChain %_ptr_Function_S %var_for_index %59
%62 = OpLoad %S %61
%56 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %58 %62
OpBranch %45
%45 = OpLabel
%63 = OpLoad %uint %i
%64 = OpIAdd %uint %63 %uint_1
OpStore %i %64
OpBranch %43
%44 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %void None %65
%67 = OpLabel
%70 = OpAccessChain %_ptr_Uniform__arr_S_uint_4 %u %uint_0
%71 = OpLoad %_arr_S_uint_4 %70
%68 = OpFunctionCall %void %assign_and_preserve_padding_s %71
%76 = OpAccessChain %_ptr_Uniform_S %u %uint_0 %int_2
%77 = OpLoad %S %76
%72 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %73 %77
%79 = OpAccessChain %_ptr_StorageBuffer_mat3v4float %s %uint_0 %int_3 %uint_1
%81 = OpAccessChain %_ptr_Uniform_mat3v4float %u %uint_0 %int_2 %uint_1
%82 = OpLoad %mat3v4float %81
OpStore %79 %82
%85 = OpAccessChain %_ptr_StorageBuffer_v4float %s %uint_0 %int_1 %uint_1 %23
%87 = OpAccessChain %_ptr_Uniform_v4float %u %uint_0 %23 %uint_1 %int_1
%88 = OpLoad %v4float %87
%89 = OpVectorShuffle %v4float %88 %88 1 3 0 2
OpStore %85 %89
OpReturn
OpFunctionEnd

View File

@@ -76,6 +76,21 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4];
} s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
S conv_S(S_std140 val) {
return S(val.before, f16mat4x2(val.m_0, val.m_1, val.m_2, val.m_3), val.pad, val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.after, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21, val.pad_22, val.pad_23, val.pad_24, val.pad_25);
}
@@ -95,8 +110,9 @@ f16mat4x2 load_u_inner_2_m() {
}
void f() {
s.inner = conv_arr4_S(u.inner);
s.inner[1] = conv_S(u.inner[2u]);
assign_and_preserve_padding_s(conv_arr4_S(u.inner));
uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, conv_S(u.inner[2u]));
s.inner[3].m = load_u_inner_2_m();
s.inner[1].m[0] = u.inner[0u].m_1.yx;
}

View File

@@ -22,9 +22,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_1;
};
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1);
(*(tint_symbol))[1] = (*(tint_symbol_1))[2];
assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = half2((*(tint_symbol_1))[0].m[1]).yx;
return;

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 113
; Bound: 151
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -28,13 +28,20 @@
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %conv_S "conv_S"
OpName %val "val"
OpName %conv_arr4_S "conv_arr4_S"
OpName %val_0 "val"
OpName %arr "arr"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %i_0 "i"
OpName %var_for_index_1 "var_for_index_1"
OpName %load_u_inner_2_m "load_u_inner_2_m"
OpName %f "f"
OpDecorate %u_block_std140 Block
@@ -59,6 +66,7 @@
OpDecorate %_arr_S_uint_4 ArrayStride 128
OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
@@ -75,117 +83,171 @@
%u_block = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%17 = OpTypeFunction %S %S_std140
%29 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%35 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%38 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%51 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%void = OpTypeVoid
%uint_1 = OpConstant %uint 1
%64 = OpTypeFunction %mat4v2half
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%17 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0
%26 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat4v2half = OpTypePointer StorageBuffer %mat4v2half
%uint_2 = OpConstant %uint 2
%39 = OpTypeFunction %void %_arr_S_uint_4
%43 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%58 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%68 = OpTypeFunction %S %S_std140
%80 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%97 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%108 = OpTypeFunction %mat4v2half
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%_ptr_Uniform_v2half = OpTypePointer Uniform %v2half
%uint_3 = OpConstant %uint 3
%void = OpTypeVoid
%87 = OpTypeFunction %void
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%129 = OpTypeFunction %void
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%138 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%int_3 = OpConstant %int 3
%_ptr_StorageBuffer_mat4v2half = OpTypePointer StorageBuffer %mat4v2half
%107 = OpConstantNull %int
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_v2half = OpTypePointer StorageBuffer %v2half
%conv_S = OpFunction %S None %17
%val = OpFunctionParameter %S_std140
%20 = OpLabel
%21 = OpCompositeExtract %int %val 0
%22 = OpCompositeExtract %v2half %val 1
%23 = OpCompositeExtract %v2half %val 2
%24 = OpCompositeExtract %v2half %val 3
%25 = OpCompositeExtract %v2half %val 4
%26 = OpCompositeConstruct %mat4v2half %22 %23 %24 %25
%27 = OpCompositeExtract %int %val 5
%28 = OpCompositeConstruct %S %21 %26 %27
OpReturnValue %28
OpFunctionEnd
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %29
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%32 = OpLabel
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %35
%i = OpVariable %_ptr_Function_uint Function %38
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %51
OpBranch %39
%39 = OpLabel
OpLoopMerge %40 %41 None
OpBranch %42
%42 = OpLabel
%44 = OpLoad %uint %i
%45 = OpULessThan %bool %44 %uint_4
%43 = OpLogicalNot %bool %45
OpSelectionMerge %47 None
OpBranchConditional %43 %48 %47
%48 = OpLabel
OpBranch %40
%47 = OpLabel
OpStore %var_for_index %val_0
%52 = OpLoad %uint %i
%54 = OpAccessChain %_ptr_Function_S %arr %52
%56 = OpLoad %uint %i
%58 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %56
%59 = OpLoad %S_std140 %58
%55 = OpFunctionCall %S %conv_S %59
OpStore %54 %55
OpBranch %41
%41 = OpLabel
%60 = OpLoad %uint %i
%62 = OpIAdd %uint %60 %uint_1
OpStore %i %62
OpBranch %39
%40 = OpLabel
%63 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %63
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat4v2half None %64
%66 = OpLabel
%71 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%74 = OpAccessChain %_ptr_Uniform_v2half %71 %uint_1
%75 = OpLoad %v2half %74
%77 = OpAccessChain %_ptr_Uniform_v2half %71 %uint_2
%78 = OpLoad %v2half %77
%81 = OpAccessChain %_ptr_Uniform_v2half %71 %uint_3
%82 = OpLoad %v2half %81
%84 = OpAccessChain %_ptr_Uniform_v2half %71 %uint_4
%85 = OpLoad %v2half %84
%86 = OpCompositeConstruct %mat4v2half %75 %78 %82 %85
OpReturnValue %86
OpFunctionEnd
%f = OpFunction %void None %87
%90 = OpLabel
%92 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0
%95 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%96 = OpLoad %_arr_S_std140_uint_4 %95
%93 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %96
OpStore %92 %93
%99 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1
%101 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%102 = OpLoad %S_std140 %101
%100 = OpFunctionCall %S %conv_S %102
OpStore %99 %100
%105 = OpAccessChain %_ptr_StorageBuffer_mat4v2half %s %uint_0 %int_3 %uint_1
%106 = OpFunctionCall %mat4v2half %load_u_inner_2_m
OpStore %105 %106
%109 = OpAccessChain %_ptr_StorageBuffer_v2half %s %uint_0 %int_1 %uint_1 %107
%110 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0 %38 %uint_2
%111 = OpLoad %v2half %110
%112 = OpVectorShuffle %v2half %111 %111 1 0
OpStore %109 %112
%assign_and_preserve_padding_1_s_X = OpFunction %void None %17
%dest = OpFunctionParameter %_arr_uint_uint_1
%value = OpFunctionParameter %S
%24 = OpLabel
%27 = OpCompositeExtract %uint %dest 0
%29 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %27 %uint_0
%30 = OpCompositeExtract %int %value 0
OpStore %29 %30
%31 = OpCompositeExtract %uint %dest 0
%33 = OpAccessChain %_ptr_StorageBuffer_mat4v2half %s %uint_0 %31 %uint_1
%34 = OpCompositeExtract %mat4v2half %value 1
OpStore %33 %34
%35 = OpCompositeExtract %uint %dest 0
%37 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %35 %uint_2
%38 = OpCompositeExtract %int %value 2
OpStore %37 %38
OpReturn
OpFunctionEnd
%assign_and_preserve_padding_s = OpFunction %void None %39
%value_0 = OpFunctionParameter %_arr_S_uint_4
%42 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %43
%var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
OpStore %i %43
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 %value_0
%60 = OpLoad %uint %i
%61 = OpCompositeConstruct %_arr_uint_uint_1 %60
%62 = OpLoad %uint %i
%64 = OpAccessChain %_ptr_Function_S %var_for_index %62
%65 = OpLoad %S %64
%59 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %61 %65
OpBranch %48
%48 = OpLabel
%66 = OpLoad %uint %i
%67 = OpIAdd %uint %66 %uint_1
OpStore %i %67
OpBranch %46
%47 = OpLabel
OpReturn
OpFunctionEnd
%conv_S = OpFunction %S None %68
%val = OpFunctionParameter %S_std140
%71 = OpLabel
%72 = OpCompositeExtract %int %val 0
%73 = OpCompositeExtract %v2half %val 1
%74 = OpCompositeExtract %v2half %val 2
%75 = OpCompositeExtract %v2half %val 3
%76 = OpCompositeExtract %v2half %val 4
%77 = OpCompositeConstruct %mat4v2half %73 %74 %75 %76
%78 = OpCompositeExtract %int %val 5
%79 = OpCompositeConstruct %S %72 %77 %78
OpReturnValue %79
OpFunctionEnd
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %80
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%83 = OpLabel
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%i_0 = OpVariable %_ptr_Function_uint Function %43
%var_for_index_1 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %97
OpBranch %86
%86 = OpLabel
OpLoopMerge %87 %88 None
OpBranch %89
%89 = OpLabel
%91 = OpLoad %uint %i_0
%92 = OpULessThan %bool %91 %uint_4
%90 = OpLogicalNot %bool %92
OpSelectionMerge %93 None
OpBranchConditional %90 %94 %93
%94 = OpLabel
OpBranch %87
%93 = OpLabel
OpStore %var_for_index_1 %val_0
%98 = OpLoad %uint %i_0
%99 = OpAccessChain %_ptr_Function_S %arr %98
%101 = OpLoad %uint %i_0
%103 = OpAccessChain %_ptr_Function_S_std140 %var_for_index_1 %101
%104 = OpLoad %S_std140 %103
%100 = OpFunctionCall %S %conv_S %104
OpStore %99 %100
OpBranch %88
%88 = OpLabel
%105 = OpLoad %uint %i_0
%106 = OpIAdd %uint %105 %uint_1
OpStore %i_0 %106
OpBranch %86
%87 = OpLabel
%107 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %107
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat4v2half None %108
%110 = OpLabel
%113 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%116 = OpAccessChain %_ptr_Uniform_v2half %113 %uint_1
%117 = OpLoad %v2half %116
%119 = OpAccessChain %_ptr_Uniform_v2half %113 %uint_2
%120 = OpLoad %v2half %119
%123 = OpAccessChain %_ptr_Uniform_v2half %113 %uint_3
%124 = OpLoad %v2half %123
%126 = OpAccessChain %_ptr_Uniform_v2half %113 %uint_4
%127 = OpLoad %v2half %126
%128 = OpCompositeConstruct %mat4v2half %117 %120 %124 %127
OpReturnValue %128
OpFunctionEnd
%f = OpFunction %void None %129
%131 = OpLabel
%135 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%136 = OpLoad %_arr_S_std140_uint_4 %135
%133 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %136
%132 = OpFunctionCall %void %assign_and_preserve_padding_s %133
%140 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%141 = OpLoad %S_std140 %140
%139 = OpFunctionCall %S %conv_S %141
%137 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %138 %139
%143 = OpAccessChain %_ptr_StorageBuffer_mat4v2half %s %uint_0 %int_3 %uint_1
%144 = OpFunctionCall %mat4v2half %load_u_inner_2_m
OpStore %143 %144
%147 = OpAccessChain %_ptr_StorageBuffer_v2half %s %uint_0 %int_1 %uint_1 %26
%148 = OpAccessChain %_ptr_Uniform_v2half %u %uint_0 %43 %uint_2
%149 = OpLoad %v2half %148
%150 = OpVectorShuffle %v2half %149 %149 1 0
OpStore %147 %150
OpReturn
OpFunctionEnd

View File

@@ -67,6 +67,21 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4];
} s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
S conv_S(S_std140 val) {
return S(val.before, val.pad, mat4x2(val.m_0, val.m_1, val.m_2, val.m_3), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.after, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21);
}
@@ -86,8 +101,9 @@ mat4x2 load_u_inner_2_m() {
}
void f() {
s.inner = conv_arr4_S(u.inner);
s.inner[1] = conv_S(u.inner[2u]);
assign_and_preserve_padding_s(conv_arr4_S(u.inner));
uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, conv_S(u.inner[2u]));
s.inner[3].m = load_u_inner_2_m();
s.inner[1].m[0] = u.inner[0u].m_1.yx;
}

View File

@@ -23,9 +23,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_2;
};
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1);
(*(tint_symbol))[1] = (*(tint_symbol_1))[2];
assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = float2((*(tint_symbol_1))[0].m[1]).yx;
return;

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 113
; Bound: 151
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -24,13 +24,20 @@
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %conv_S "conv_S"
OpName %val "val"
OpName %conv_arr4_S "conv_arr4_S"
OpName %val_0 "val"
OpName %arr "arr"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %i_0 "i"
OpName %var_for_index_1 "var_for_index_1"
OpName %load_u_inner_2_m "load_u_inner_2_m"
OpName %f "f"
OpDecorate %u_block_std140 Block
@@ -55,6 +62,7 @@
OpDecorate %_arr_S_uint_4 ArrayStride 128
OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
@@ -71,117 +79,171 @@
%u_block = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%17 = OpTypeFunction %S %S_std140
%29 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%35 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%38 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%51 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%void = OpTypeVoid
%uint_1 = OpConstant %uint 1
%64 = OpTypeFunction %mat4v2float
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%17 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0
%26 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat4v2float = OpTypePointer StorageBuffer %mat4v2float
%uint_2 = OpConstant %uint 2
%39 = OpTypeFunction %void %_arr_S_uint_4
%43 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%58 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%68 = OpTypeFunction %S %S_std140
%80 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%97 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%108 = OpTypeFunction %mat4v2float
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%uint_3 = OpConstant %uint 3
%void = OpTypeVoid
%87 = OpTypeFunction %void
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%129 = OpTypeFunction %void
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%138 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%int_3 = OpConstant %int 3
%_ptr_StorageBuffer_mat4v2float = OpTypePointer StorageBuffer %mat4v2float
%107 = OpConstantNull %int
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float
%conv_S = OpFunction %S None %17
%val = OpFunctionParameter %S_std140
%20 = OpLabel
%21 = OpCompositeExtract %int %val 0
%22 = OpCompositeExtract %v2float %val 1
%23 = OpCompositeExtract %v2float %val 2
%24 = OpCompositeExtract %v2float %val 3
%25 = OpCompositeExtract %v2float %val 4
%26 = OpCompositeConstruct %mat4v2float %22 %23 %24 %25
%27 = OpCompositeExtract %int %val 5
%28 = OpCompositeConstruct %S %21 %26 %27
OpReturnValue %28
OpFunctionEnd
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %29
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%32 = OpLabel
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %35
%i = OpVariable %_ptr_Function_uint Function %38
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %51
OpBranch %39
%39 = OpLabel
OpLoopMerge %40 %41 None
OpBranch %42
%42 = OpLabel
%44 = OpLoad %uint %i
%45 = OpULessThan %bool %44 %uint_4
%43 = OpLogicalNot %bool %45
OpSelectionMerge %47 None
OpBranchConditional %43 %48 %47
%48 = OpLabel
OpBranch %40
%47 = OpLabel
OpStore %var_for_index %val_0
%52 = OpLoad %uint %i
%54 = OpAccessChain %_ptr_Function_S %arr %52
%56 = OpLoad %uint %i
%58 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %56
%59 = OpLoad %S_std140 %58
%55 = OpFunctionCall %S %conv_S %59
OpStore %54 %55
OpBranch %41
%41 = OpLabel
%60 = OpLoad %uint %i
%62 = OpIAdd %uint %60 %uint_1
OpStore %i %62
OpBranch %39
%40 = OpLabel
%63 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %63
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat4v2float None %64
%66 = OpLabel
%71 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%74 = OpAccessChain %_ptr_Uniform_v2float %71 %uint_1
%75 = OpLoad %v2float %74
%77 = OpAccessChain %_ptr_Uniform_v2float %71 %uint_2
%78 = OpLoad %v2float %77
%81 = OpAccessChain %_ptr_Uniform_v2float %71 %uint_3
%82 = OpLoad %v2float %81
%84 = OpAccessChain %_ptr_Uniform_v2float %71 %uint_4
%85 = OpLoad %v2float %84
%86 = OpCompositeConstruct %mat4v2float %75 %78 %82 %85
OpReturnValue %86
OpFunctionEnd
%f = OpFunction %void None %87
%90 = OpLabel
%92 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0
%95 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%96 = OpLoad %_arr_S_std140_uint_4 %95
%93 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %96
OpStore %92 %93
%99 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1
%101 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%102 = OpLoad %S_std140 %101
%100 = OpFunctionCall %S %conv_S %102
OpStore %99 %100
%105 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %s %uint_0 %int_3 %uint_1
%106 = OpFunctionCall %mat4v2float %load_u_inner_2_m
OpStore %105 %106
%109 = OpAccessChain %_ptr_StorageBuffer_v2float %s %uint_0 %int_1 %uint_1 %107
%110 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %38 %uint_2
%111 = OpLoad %v2float %110
%112 = OpVectorShuffle %v2float %111 %111 1 0
OpStore %109 %112
%assign_and_preserve_padding_1_s_X = OpFunction %void None %17
%dest = OpFunctionParameter %_arr_uint_uint_1
%value = OpFunctionParameter %S
%24 = OpLabel
%27 = OpCompositeExtract %uint %dest 0
%29 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %27 %uint_0
%30 = OpCompositeExtract %int %value 0
OpStore %29 %30
%31 = OpCompositeExtract %uint %dest 0
%33 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %s %uint_0 %31 %uint_1
%34 = OpCompositeExtract %mat4v2float %value 1
OpStore %33 %34
%35 = OpCompositeExtract %uint %dest 0
%37 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %35 %uint_2
%38 = OpCompositeExtract %int %value 2
OpStore %37 %38
OpReturn
OpFunctionEnd
%assign_and_preserve_padding_s = OpFunction %void None %39
%value_0 = OpFunctionParameter %_arr_S_uint_4
%42 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %43
%var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
OpStore %i %43
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 %value_0
%60 = OpLoad %uint %i
%61 = OpCompositeConstruct %_arr_uint_uint_1 %60
%62 = OpLoad %uint %i
%64 = OpAccessChain %_ptr_Function_S %var_for_index %62
%65 = OpLoad %S %64
%59 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %61 %65
OpBranch %48
%48 = OpLabel
%66 = OpLoad %uint %i
%67 = OpIAdd %uint %66 %uint_1
OpStore %i %67
OpBranch %46
%47 = OpLabel
OpReturn
OpFunctionEnd
%conv_S = OpFunction %S None %68
%val = OpFunctionParameter %S_std140
%71 = OpLabel
%72 = OpCompositeExtract %int %val 0
%73 = OpCompositeExtract %v2float %val 1
%74 = OpCompositeExtract %v2float %val 2
%75 = OpCompositeExtract %v2float %val 3
%76 = OpCompositeExtract %v2float %val 4
%77 = OpCompositeConstruct %mat4v2float %73 %74 %75 %76
%78 = OpCompositeExtract %int %val 5
%79 = OpCompositeConstruct %S %72 %77 %78
OpReturnValue %79
OpFunctionEnd
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %80
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%83 = OpLabel
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%i_0 = OpVariable %_ptr_Function_uint Function %43
%var_for_index_1 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %97
OpBranch %86
%86 = OpLabel
OpLoopMerge %87 %88 None
OpBranch %89
%89 = OpLabel
%91 = OpLoad %uint %i_0
%92 = OpULessThan %bool %91 %uint_4
%90 = OpLogicalNot %bool %92
OpSelectionMerge %93 None
OpBranchConditional %90 %94 %93
%94 = OpLabel
OpBranch %87
%93 = OpLabel
OpStore %var_for_index_1 %val_0
%98 = OpLoad %uint %i_0
%99 = OpAccessChain %_ptr_Function_S %arr %98
%101 = OpLoad %uint %i_0
%103 = OpAccessChain %_ptr_Function_S_std140 %var_for_index_1 %101
%104 = OpLoad %S_std140 %103
%100 = OpFunctionCall %S %conv_S %104
OpStore %99 %100
OpBranch %88
%88 = OpLabel
%105 = OpLoad %uint %i_0
%106 = OpIAdd %uint %105 %uint_1
OpStore %i_0 %106
OpBranch %86
%87 = OpLabel
%107 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %107
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat4v2float None %108
%110 = OpLabel
%113 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%116 = OpAccessChain %_ptr_Uniform_v2float %113 %uint_1
%117 = OpLoad %v2float %116
%119 = OpAccessChain %_ptr_Uniform_v2float %113 %uint_2
%120 = OpLoad %v2float %119
%123 = OpAccessChain %_ptr_Uniform_v2float %113 %uint_3
%124 = OpLoad %v2float %123
%126 = OpAccessChain %_ptr_Uniform_v2float %113 %uint_4
%127 = OpLoad %v2float %126
%128 = OpCompositeConstruct %mat4v2float %117 %120 %124 %127
OpReturnValue %128
OpFunctionEnd
%f = OpFunction %void None %129
%131 = OpLabel
%135 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%136 = OpLoad %_arr_S_std140_uint_4 %135
%133 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %136
%132 = OpFunctionCall %void %assign_and_preserve_padding_s %133
%140 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%141 = OpLoad %S_std140 %140
%139 = OpFunctionCall %S %conv_S %141
%137 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %138 %139
%143 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %s %uint_0 %int_3 %uint_1
%144 = OpFunctionCall %mat4v2float %load_u_inner_2_m
OpStore %143 %144
%147 = OpAccessChain %_ptr_StorageBuffer_v2float %s %uint_0 %int_1 %uint_1 %26
%148 = OpAccessChain %_ptr_Uniform_v2float %u %uint_0 %43 %uint_2
%149 = OpLoad %v2float %148
%150 = OpVectorShuffle %v2float %149 %149 1 0
OpStore %147 %150
OpReturn
OpFunctionEnd

View File

@@ -68,6 +68,21 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4];
} s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
S conv_S(S_std140 val) {
return S(val.before, val.pad, f16mat4x3(val.m_0, val.m_1, val.m_2, val.m_3), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.after, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21);
}
@@ -87,8 +102,9 @@ f16mat4x3 load_u_inner_2_m() {
}
void f() {
s.inner = conv_arr4_S(u.inner);
s.inner[1] = conv_S(u.inner[2u]);
assign_and_preserve_padding_s(conv_arr4_S(u.inner));
uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, conv_S(u.inner[2u]));
s.inner[3].m = load_u_inner_2_m();
s.inner[1].m[0] = u.inner[0u].m_1.zxy;
}

View File

@@ -23,9 +23,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_2;
};
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1);
(*(tint_symbol))[1] = (*(tint_symbol_1))[2];
assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = half3((*(tint_symbol_1))[0].m[1]).zxy;
return;

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 113
; Bound: 151
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -28,13 +28,20 @@
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %conv_S "conv_S"
OpName %val "val"
OpName %conv_arr4_S "conv_arr4_S"
OpName %val_0 "val"
OpName %arr "arr"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %i_0 "i"
OpName %var_for_index_1 "var_for_index_1"
OpName %load_u_inner_2_m "load_u_inner_2_m"
OpName %f "f"
OpDecorate %u_block_std140 Block
@@ -59,6 +66,7 @@
OpDecorate %_arr_S_uint_4 ArrayStride 128
OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
@@ -75,117 +83,171 @@
%u_block = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%17 = OpTypeFunction %S %S_std140
%29 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%35 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%38 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%51 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%void = OpTypeVoid
%uint_1 = OpConstant %uint 1
%64 = OpTypeFunction %mat4v3half
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%17 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0
%26 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat4v3half = OpTypePointer StorageBuffer %mat4v3half
%uint_2 = OpConstant %uint 2
%39 = OpTypeFunction %void %_arr_S_uint_4
%43 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%58 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%68 = OpTypeFunction %S %S_std140
%80 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%97 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%108 = OpTypeFunction %mat4v3half
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%_ptr_Uniform_v3half = OpTypePointer Uniform %v3half
%uint_3 = OpConstant %uint 3
%void = OpTypeVoid
%87 = OpTypeFunction %void
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%129 = OpTypeFunction %void
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%138 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%int_3 = OpConstant %int 3
%_ptr_StorageBuffer_mat4v3half = OpTypePointer StorageBuffer %mat4v3half
%107 = OpConstantNull %int
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
%conv_S = OpFunction %S None %17
%val = OpFunctionParameter %S_std140
%20 = OpLabel
%21 = OpCompositeExtract %int %val 0
%22 = OpCompositeExtract %v3half %val 1
%23 = OpCompositeExtract %v3half %val 2
%24 = OpCompositeExtract %v3half %val 3
%25 = OpCompositeExtract %v3half %val 4
%26 = OpCompositeConstruct %mat4v3half %22 %23 %24 %25
%27 = OpCompositeExtract %int %val 5
%28 = OpCompositeConstruct %S %21 %26 %27
OpReturnValue %28
OpFunctionEnd
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %29
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%32 = OpLabel
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %35
%i = OpVariable %_ptr_Function_uint Function %38
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %51
OpBranch %39
%39 = OpLabel
OpLoopMerge %40 %41 None
OpBranch %42
%42 = OpLabel
%44 = OpLoad %uint %i
%45 = OpULessThan %bool %44 %uint_4
%43 = OpLogicalNot %bool %45
OpSelectionMerge %47 None
OpBranchConditional %43 %48 %47
%48 = OpLabel
OpBranch %40
%47 = OpLabel
OpStore %var_for_index %val_0
%52 = OpLoad %uint %i
%54 = OpAccessChain %_ptr_Function_S %arr %52
%56 = OpLoad %uint %i
%58 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %56
%59 = OpLoad %S_std140 %58
%55 = OpFunctionCall %S %conv_S %59
OpStore %54 %55
OpBranch %41
%41 = OpLabel
%60 = OpLoad %uint %i
%62 = OpIAdd %uint %60 %uint_1
OpStore %i %62
OpBranch %39
%40 = OpLabel
%63 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %63
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat4v3half None %64
%66 = OpLabel
%71 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%74 = OpAccessChain %_ptr_Uniform_v3half %71 %uint_1
%75 = OpLoad %v3half %74
%77 = OpAccessChain %_ptr_Uniform_v3half %71 %uint_2
%78 = OpLoad %v3half %77
%81 = OpAccessChain %_ptr_Uniform_v3half %71 %uint_3
%82 = OpLoad %v3half %81
%84 = OpAccessChain %_ptr_Uniform_v3half %71 %uint_4
%85 = OpLoad %v3half %84
%86 = OpCompositeConstruct %mat4v3half %75 %78 %82 %85
OpReturnValue %86
OpFunctionEnd
%f = OpFunction %void None %87
%90 = OpLabel
%92 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0
%95 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%96 = OpLoad %_arr_S_std140_uint_4 %95
%93 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %96
OpStore %92 %93
%99 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1
%101 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%102 = OpLoad %S_std140 %101
%100 = OpFunctionCall %S %conv_S %102
OpStore %99 %100
%105 = OpAccessChain %_ptr_StorageBuffer_mat4v3half %s %uint_0 %int_3 %uint_1
%106 = OpFunctionCall %mat4v3half %load_u_inner_2_m
OpStore %105 %106
%109 = OpAccessChain %_ptr_StorageBuffer_v3half %s %uint_0 %int_1 %uint_1 %107
%110 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0 %38 %uint_2
%111 = OpLoad %v3half %110
%112 = OpVectorShuffle %v3half %111 %111 2 0 1
OpStore %109 %112
%assign_and_preserve_padding_1_s_X = OpFunction %void None %17
%dest = OpFunctionParameter %_arr_uint_uint_1
%value = OpFunctionParameter %S
%24 = OpLabel
%27 = OpCompositeExtract %uint %dest 0
%29 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %27 %uint_0
%30 = OpCompositeExtract %int %value 0
OpStore %29 %30
%31 = OpCompositeExtract %uint %dest 0
%33 = OpAccessChain %_ptr_StorageBuffer_mat4v3half %s %uint_0 %31 %uint_1
%34 = OpCompositeExtract %mat4v3half %value 1
OpStore %33 %34
%35 = OpCompositeExtract %uint %dest 0
%37 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %35 %uint_2
%38 = OpCompositeExtract %int %value 2
OpStore %37 %38
OpReturn
OpFunctionEnd
%assign_and_preserve_padding_s = OpFunction %void None %39
%value_0 = OpFunctionParameter %_arr_S_uint_4
%42 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %43
%var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
OpStore %i %43
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 %value_0
%60 = OpLoad %uint %i
%61 = OpCompositeConstruct %_arr_uint_uint_1 %60
%62 = OpLoad %uint %i
%64 = OpAccessChain %_ptr_Function_S %var_for_index %62
%65 = OpLoad %S %64
%59 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %61 %65
OpBranch %48
%48 = OpLabel
%66 = OpLoad %uint %i
%67 = OpIAdd %uint %66 %uint_1
OpStore %i %67
OpBranch %46
%47 = OpLabel
OpReturn
OpFunctionEnd
%conv_S = OpFunction %S None %68
%val = OpFunctionParameter %S_std140
%71 = OpLabel
%72 = OpCompositeExtract %int %val 0
%73 = OpCompositeExtract %v3half %val 1
%74 = OpCompositeExtract %v3half %val 2
%75 = OpCompositeExtract %v3half %val 3
%76 = OpCompositeExtract %v3half %val 4
%77 = OpCompositeConstruct %mat4v3half %73 %74 %75 %76
%78 = OpCompositeExtract %int %val 5
%79 = OpCompositeConstruct %S %72 %77 %78
OpReturnValue %79
OpFunctionEnd
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %80
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%83 = OpLabel
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%i_0 = OpVariable %_ptr_Function_uint Function %43
%var_for_index_1 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %97
OpBranch %86
%86 = OpLabel
OpLoopMerge %87 %88 None
OpBranch %89
%89 = OpLabel
%91 = OpLoad %uint %i_0
%92 = OpULessThan %bool %91 %uint_4
%90 = OpLogicalNot %bool %92
OpSelectionMerge %93 None
OpBranchConditional %90 %94 %93
%94 = OpLabel
OpBranch %87
%93 = OpLabel
OpStore %var_for_index_1 %val_0
%98 = OpLoad %uint %i_0
%99 = OpAccessChain %_ptr_Function_S %arr %98
%101 = OpLoad %uint %i_0
%103 = OpAccessChain %_ptr_Function_S_std140 %var_for_index_1 %101
%104 = OpLoad %S_std140 %103
%100 = OpFunctionCall %S %conv_S %104
OpStore %99 %100
OpBranch %88
%88 = OpLabel
%105 = OpLoad %uint %i_0
%106 = OpIAdd %uint %105 %uint_1
OpStore %i_0 %106
OpBranch %86
%87 = OpLabel
%107 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %107
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat4v3half None %108
%110 = OpLabel
%113 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%116 = OpAccessChain %_ptr_Uniform_v3half %113 %uint_1
%117 = OpLoad %v3half %116
%119 = OpAccessChain %_ptr_Uniform_v3half %113 %uint_2
%120 = OpLoad %v3half %119
%123 = OpAccessChain %_ptr_Uniform_v3half %113 %uint_3
%124 = OpLoad %v3half %123
%126 = OpAccessChain %_ptr_Uniform_v3half %113 %uint_4
%127 = OpLoad %v3half %126
%128 = OpCompositeConstruct %mat4v3half %117 %120 %124 %127
OpReturnValue %128
OpFunctionEnd
%f = OpFunction %void None %129
%131 = OpLabel
%135 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%136 = OpLoad %_arr_S_std140_uint_4 %135
%133 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %136
%132 = OpFunctionCall %void %assign_and_preserve_padding_s %133
%140 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%141 = OpLoad %S_std140 %140
%139 = OpFunctionCall %S %conv_S %141
%137 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %138 %139
%143 = OpAccessChain %_ptr_StorageBuffer_mat4v3half %s %uint_0 %int_3 %uint_1
%144 = OpFunctionCall %mat4v3half %load_u_inner_2_m
OpStore %143 %144
%147 = OpAccessChain %_ptr_StorageBuffer_v3half %s %uint_0 %int_1 %uint_1 %26
%148 = OpAccessChain %_ptr_Uniform_v3half %u %uint_0 %43 %uint_2
%149 = OpLoad %v3half %148
%150 = OpVectorShuffle %v3half %149 %149 2 0 1
OpStore %147 %150
OpReturn
OpFunctionEnd

View File

@@ -44,9 +44,25 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4];
} s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
void f() {
s.inner = u.inner;
s.inner[1] = u.inner[2];
assign_and_preserve_padding_s(u.inner);
uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, u.inner[2]);
s.inner[3].m = u.inner[2].m;
s.inner[1].m[0] = u.inner[0].m[1].zxy;
}

View File

@@ -23,9 +23,21 @@ struct S {
/* 0x0084 */ tint_array<int8_t, 60> tint_pad_2;
};
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1);
(*(tint_symbol))[1] = (*(tint_symbol_1))[2];
assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = float3((*(tint_symbol_1))[0].m[1]).zxy;
return;

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 45
; Bound: 90
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -15,6 +15,13 @@
OpMemberName %S 2 "after"
OpName %u "u"
OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %f "f"
OpDecorate %u_block Block
OpMemberDecorate %u_block 0 Offset 0
@@ -29,6 +36,7 @@
OpDecorate %u Binding 0
OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
@@ -43,39 +51,100 @@
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%void = OpTypeVoid
%14 = OpTypeFunction %void
%uint_1 = OpConstant %uint 1
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%14 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%23 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat4v3float = OpTypePointer StorageBuffer %mat4v3float
%uint_2 = OpConstant %uint 2
%36 = OpTypeFunction %void %_arr_S_uint_4
%40 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%55 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%65 = OpTypeFunction %void
%_ptr_Uniform__arr_S_uint_4 = OpTypePointer Uniform %_arr_S_uint_4
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%73 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%int_2 = OpConstant %int 2
%_ptr_Uniform_S = OpTypePointer Uniform %S
%int_3 = OpConstant %int 3
%uint_1 = OpConstant %uint 1
%_ptr_StorageBuffer_mat4v3float = OpTypePointer StorageBuffer %mat4v3float
%_ptr_Uniform_mat4v3float = OpTypePointer Uniform %mat4v3float
%38 = OpConstantNull %int
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float
%f = OpFunction %void None %14
%17 = OpLabel
%20 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0
%22 = OpAccessChain %_ptr_Uniform__arr_S_uint_4 %u %uint_0
%23 = OpLoad %_arr_S_uint_4 %22
OpStore %20 %23
%26 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1
%29 = OpAccessChain %_ptr_Uniform_S %u %uint_0 %int_2
%30 = OpLoad %S %29
OpStore %26 %30
%34 = OpAccessChain %_ptr_StorageBuffer_mat4v3float %s %uint_0 %int_3 %uint_1
%36 = OpAccessChain %_ptr_Uniform_mat4v3float %u %uint_0 %int_2 %uint_1
%37 = OpLoad %mat4v3float %36
OpStore %34 %37
%40 = OpAccessChain %_ptr_StorageBuffer_v3float %s %uint_0 %int_1 %uint_1 %38
%42 = OpAccessChain %_ptr_Uniform_v3float %u %uint_0 %38 %uint_1 %int_1
%43 = OpLoad %v3float %42
%44 = OpVectorShuffle %v3float %43 %43 2 0 1
OpStore %40 %44
%assign_and_preserve_padding_1_s_X = OpFunction %void None %14
%dest = OpFunctionParameter %_arr_uint_uint_1
%value = OpFunctionParameter %S
%21 = OpLabel
%24 = OpCompositeExtract %uint %dest 0
%26 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %24 %uint_0
%27 = OpCompositeExtract %int %value 0
OpStore %26 %27
%28 = OpCompositeExtract %uint %dest 0
%30 = OpAccessChain %_ptr_StorageBuffer_mat4v3float %s %uint_0 %28 %uint_1
%31 = OpCompositeExtract %mat4v3float %value 1
OpStore %30 %31
%32 = OpCompositeExtract %uint %dest 0
%34 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %32 %uint_2
%35 = OpCompositeExtract %int %value 2
OpStore %34 %35
OpReturn
OpFunctionEnd
%assign_and_preserve_padding_s = OpFunction %void None %36
%value_0 = OpFunctionParameter %_arr_S_uint_4
%39 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %40
%var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %55
OpStore %i %40
OpBranch %43
%43 = OpLabel
OpLoopMerge %44 %45 None
OpBranch %46
%46 = OpLabel
%48 = OpLoad %uint %i
%49 = OpULessThan %bool %48 %uint_4
%47 = OpLogicalNot %bool %49
OpSelectionMerge %51 None
OpBranchConditional %47 %52 %51
%52 = OpLabel
OpBranch %44
%51 = OpLabel
OpStore %var_for_index %value_0
%57 = OpLoad %uint %i
%58 = OpCompositeConstruct %_arr_uint_uint_1 %57
%59 = OpLoad %uint %i
%61 = OpAccessChain %_ptr_Function_S %var_for_index %59
%62 = OpLoad %S %61
%56 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %58 %62
OpBranch %45
%45 = OpLabel
%63 = OpLoad %uint %i
%64 = OpIAdd %uint %63 %uint_1
OpStore %i %64
OpBranch %43
%44 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %void None %65
%67 = OpLabel
%70 = OpAccessChain %_ptr_Uniform__arr_S_uint_4 %u %uint_0
%71 = OpLoad %_arr_S_uint_4 %70
%68 = OpFunctionCall %void %assign_and_preserve_padding_s %71
%76 = OpAccessChain %_ptr_Uniform_S %u %uint_0 %int_2
%77 = OpLoad %S %76
%72 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %73 %77
%79 = OpAccessChain %_ptr_StorageBuffer_mat4v3float %s %uint_0 %int_3 %uint_1
%81 = OpAccessChain %_ptr_Uniform_mat4v3float %u %uint_0 %int_2 %uint_1
%82 = OpLoad %mat4v3float %81
OpStore %79 %82
%85 = OpAccessChain %_ptr_StorageBuffer_v3float %s %uint_0 %int_1 %uint_1 %23
%87 = OpAccessChain %_ptr_Uniform_v3float %u %uint_0 %23 %uint_1 %int_1
%88 = OpLoad %v3float %87
%89 = OpVectorShuffle %v3float %88 %88 2 0 1
OpStore %85 %89
OpReturn
OpFunctionEnd

View File

@@ -68,6 +68,21 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4];
} s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
S conv_S(S_std140 val) {
return S(val.before, val.pad, f16mat4(val.m_0, val.m_1, val.m_2, val.m_3), val.pad_1, val.pad_2, val.pad_3, val.pad_4, val.pad_5, val.pad_6, val.after, val.pad_7, val.pad_8, val.pad_9, val.pad_10, val.pad_11, val.pad_12, val.pad_13, val.pad_14, val.pad_15, val.pad_16, val.pad_17, val.pad_18, val.pad_19, val.pad_20, val.pad_21);
}
@@ -87,8 +102,9 @@ f16mat4 load_u_inner_2_m() {
}
void f() {
s.inner = conv_arr4_S(u.inner);
s.inner[1] = conv_S(u.inner[2u]);
assign_and_preserve_padding_s(conv_arr4_S(u.inner));
uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, conv_S(u.inner[2u]));
s.inner[3].m = load_u_inner_2_m();
s.inner[1].m[0] = u.inner[0u].m_1.ywxz;
}

View File

@@ -23,9 +23,21 @@ struct S {
/* 0x0044 */ tint_array<int8_t, 60> tint_pad_2;
};
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1);
(*(tint_symbol))[1] = (*(tint_symbol_1))[2];
assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = half4((*(tint_symbol_1))[0].m[1]).ywxz;
return;

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 113
; Bound: 151
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -28,13 +28,20 @@
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %conv_S "conv_S"
OpName %val "val"
OpName %conv_arr4_S "conv_arr4_S"
OpName %val_0 "val"
OpName %arr "arr"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %i_0 "i"
OpName %var_for_index_1 "var_for_index_1"
OpName %load_u_inner_2_m "load_u_inner_2_m"
OpName %f "f"
OpDecorate %u_block_std140 Block
@@ -59,6 +66,7 @@
OpDecorate %_arr_S_uint_4 ArrayStride 128
OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
@@ -75,117 +83,171 @@
%u_block = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%17 = OpTypeFunction %S %S_std140
%29 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%35 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_uint = OpTypePointer Function %uint
%38 = OpConstantNull %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%51 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%void = OpTypeVoid
%uint_1 = OpConstant %uint 1
%64 = OpTypeFunction %mat4v4half
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%17 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0
%26 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat4v4half = OpTypePointer StorageBuffer %mat4v4half
%uint_2 = OpConstant %uint 2
%39 = OpTypeFunction %void %_arr_S_uint_4
%43 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%58 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%68 = OpTypeFunction %S %S_std140
%80 = OpTypeFunction %_arr_S_uint_4 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
%97 = OpConstantNull %_arr_S_std140_uint_4
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
%108 = OpTypeFunction %mat4v4half
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%_ptr_Uniform_v4half = OpTypePointer Uniform %v4half
%uint_3 = OpConstant %uint 3
%void = OpTypeVoid
%87 = OpTypeFunction %void
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%129 = OpTypeFunction %void
%_ptr_Uniform__arr_S_std140_uint_4 = OpTypePointer Uniform %_arr_S_std140_uint_4
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%138 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%int_3 = OpConstant %int 3
%_ptr_StorageBuffer_mat4v4half = OpTypePointer StorageBuffer %mat4v4half
%107 = OpConstantNull %int
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_v4half = OpTypePointer StorageBuffer %v4half
%conv_S = OpFunction %S None %17
%val = OpFunctionParameter %S_std140
%20 = OpLabel
%21 = OpCompositeExtract %int %val 0
%22 = OpCompositeExtract %v4half %val 1
%23 = OpCompositeExtract %v4half %val 2
%24 = OpCompositeExtract %v4half %val 3
%25 = OpCompositeExtract %v4half %val 4
%26 = OpCompositeConstruct %mat4v4half %22 %23 %24 %25
%27 = OpCompositeExtract %int %val 5
%28 = OpCompositeConstruct %S %21 %26 %27
OpReturnValue %28
OpFunctionEnd
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %29
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%32 = OpLabel
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %35
%i = OpVariable %_ptr_Function_uint Function %38
%var_for_index = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %51
OpBranch %39
%39 = OpLabel
OpLoopMerge %40 %41 None
OpBranch %42
%42 = OpLabel
%44 = OpLoad %uint %i
%45 = OpULessThan %bool %44 %uint_4
%43 = OpLogicalNot %bool %45
OpSelectionMerge %47 None
OpBranchConditional %43 %48 %47
%48 = OpLabel
OpBranch %40
%47 = OpLabel
OpStore %var_for_index %val_0
%52 = OpLoad %uint %i
%54 = OpAccessChain %_ptr_Function_S %arr %52
%56 = OpLoad %uint %i
%58 = OpAccessChain %_ptr_Function_S_std140 %var_for_index %56
%59 = OpLoad %S_std140 %58
%55 = OpFunctionCall %S %conv_S %59
OpStore %54 %55
OpBranch %41
%41 = OpLabel
%60 = OpLoad %uint %i
%62 = OpIAdd %uint %60 %uint_1
OpStore %i %62
OpBranch %39
%40 = OpLabel
%63 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %63
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat4v4half None %64
%66 = OpLabel
%71 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%74 = OpAccessChain %_ptr_Uniform_v4half %71 %uint_1
%75 = OpLoad %v4half %74
%77 = OpAccessChain %_ptr_Uniform_v4half %71 %uint_2
%78 = OpLoad %v4half %77
%81 = OpAccessChain %_ptr_Uniform_v4half %71 %uint_3
%82 = OpLoad %v4half %81
%84 = OpAccessChain %_ptr_Uniform_v4half %71 %uint_4
%85 = OpLoad %v4half %84
%86 = OpCompositeConstruct %mat4v4half %75 %78 %82 %85
OpReturnValue %86
OpFunctionEnd
%f = OpFunction %void None %87
%90 = OpLabel
%92 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0
%95 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%96 = OpLoad %_arr_S_std140_uint_4 %95
%93 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %96
OpStore %92 %93
%99 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1
%101 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%102 = OpLoad %S_std140 %101
%100 = OpFunctionCall %S %conv_S %102
OpStore %99 %100
%105 = OpAccessChain %_ptr_StorageBuffer_mat4v4half %s %uint_0 %int_3 %uint_1
%106 = OpFunctionCall %mat4v4half %load_u_inner_2_m
OpStore %105 %106
%109 = OpAccessChain %_ptr_StorageBuffer_v4half %s %uint_0 %int_1 %uint_1 %107
%110 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0 %38 %uint_2
%111 = OpLoad %v4half %110
%112 = OpVectorShuffle %v4half %111 %111 1 3 0 2
OpStore %109 %112
%assign_and_preserve_padding_1_s_X = OpFunction %void None %17
%dest = OpFunctionParameter %_arr_uint_uint_1
%value = OpFunctionParameter %S
%24 = OpLabel
%27 = OpCompositeExtract %uint %dest 0
%29 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %27 %uint_0
%30 = OpCompositeExtract %int %value 0
OpStore %29 %30
%31 = OpCompositeExtract %uint %dest 0
%33 = OpAccessChain %_ptr_StorageBuffer_mat4v4half %s %uint_0 %31 %uint_1
%34 = OpCompositeExtract %mat4v4half %value 1
OpStore %33 %34
%35 = OpCompositeExtract %uint %dest 0
%37 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %35 %uint_2
%38 = OpCompositeExtract %int %value 2
OpStore %37 %38
OpReturn
OpFunctionEnd
%assign_and_preserve_padding_s = OpFunction %void None %39
%value_0 = OpFunctionParameter %_arr_S_uint_4
%42 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %43
%var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
OpStore %i %43
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 %value_0
%60 = OpLoad %uint %i
%61 = OpCompositeConstruct %_arr_uint_uint_1 %60
%62 = OpLoad %uint %i
%64 = OpAccessChain %_ptr_Function_S %var_for_index %62
%65 = OpLoad %S %64
%59 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %61 %65
OpBranch %48
%48 = OpLabel
%66 = OpLoad %uint %i
%67 = OpIAdd %uint %66 %uint_1
OpStore %i %67
OpBranch %46
%47 = OpLabel
OpReturn
OpFunctionEnd
%conv_S = OpFunction %S None %68
%val = OpFunctionParameter %S_std140
%71 = OpLabel
%72 = OpCompositeExtract %int %val 0
%73 = OpCompositeExtract %v4half %val 1
%74 = OpCompositeExtract %v4half %val 2
%75 = OpCompositeExtract %v4half %val 3
%76 = OpCompositeExtract %v4half %val 4
%77 = OpCompositeConstruct %mat4v4half %73 %74 %75 %76
%78 = OpCompositeExtract %int %val 5
%79 = OpCompositeConstruct %S %72 %77 %78
OpReturnValue %79
OpFunctionEnd
%conv_arr4_S = OpFunction %_arr_S_uint_4 None %80
%val_0 = OpFunctionParameter %_arr_S_std140_uint_4
%83 = OpLabel
%arr = OpVariable %_ptr_Function__arr_S_uint_4 Function %58
%i_0 = OpVariable %_ptr_Function_uint Function %43
%var_for_index_1 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function %97
OpBranch %86
%86 = OpLabel
OpLoopMerge %87 %88 None
OpBranch %89
%89 = OpLabel
%91 = OpLoad %uint %i_0
%92 = OpULessThan %bool %91 %uint_4
%90 = OpLogicalNot %bool %92
OpSelectionMerge %93 None
OpBranchConditional %90 %94 %93
%94 = OpLabel
OpBranch %87
%93 = OpLabel
OpStore %var_for_index_1 %val_0
%98 = OpLoad %uint %i_0
%99 = OpAccessChain %_ptr_Function_S %arr %98
%101 = OpLoad %uint %i_0
%103 = OpAccessChain %_ptr_Function_S_std140 %var_for_index_1 %101
%104 = OpLoad %S_std140 %103
%100 = OpFunctionCall %S %conv_S %104
OpStore %99 %100
OpBranch %88
%88 = OpLabel
%105 = OpLoad %uint %i_0
%106 = OpIAdd %uint %105 %uint_1
OpStore %i_0 %106
OpBranch %86
%87 = OpLabel
%107 = OpLoad %_arr_S_uint_4 %arr
OpReturnValue %107
OpFunctionEnd
%load_u_inner_2_m = OpFunction %mat4v4half None %108
%110 = OpLabel
%113 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%116 = OpAccessChain %_ptr_Uniform_v4half %113 %uint_1
%117 = OpLoad %v4half %116
%119 = OpAccessChain %_ptr_Uniform_v4half %113 %uint_2
%120 = OpLoad %v4half %119
%123 = OpAccessChain %_ptr_Uniform_v4half %113 %uint_3
%124 = OpLoad %v4half %123
%126 = OpAccessChain %_ptr_Uniform_v4half %113 %uint_4
%127 = OpLoad %v4half %126
%128 = OpCompositeConstruct %mat4v4half %117 %120 %124 %127
OpReturnValue %128
OpFunctionEnd
%f = OpFunction %void None %129
%131 = OpLabel
%135 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %u %uint_0
%136 = OpLoad %_arr_S_std140_uint_4 %135
%133 = OpFunctionCall %_arr_S_uint_4 %conv_arr4_S %136
%132 = OpFunctionCall %void %assign_and_preserve_padding_s %133
%140 = OpAccessChain %_ptr_Uniform_S_std140 %u %uint_0 %uint_2
%141 = OpLoad %S_std140 %140
%139 = OpFunctionCall %S %conv_S %141
%137 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %138 %139
%143 = OpAccessChain %_ptr_StorageBuffer_mat4v4half %s %uint_0 %int_3 %uint_1
%144 = OpFunctionCall %mat4v4half %load_u_inner_2_m
OpStore %143 %144
%147 = OpAccessChain %_ptr_StorageBuffer_v4half %s %uint_0 %int_1 %uint_1 %26
%148 = OpAccessChain %_ptr_Uniform_v4half %u %uint_0 %43 %uint_2
%149 = OpLoad %v4half %148
%150 = OpVectorShuffle %v4half %149 %149 1 3 0 2
OpStore %147 %150
OpReturn
OpFunctionEnd

View File

@@ -44,9 +44,25 @@ layout(binding = 1, std430) buffer u_block_ssbo {
S inner[4];
} s;
void assign_and_preserve_padding_1_s_X(uint dest[1], S value) {
s.inner[dest[0]].before = value.before;
s.inner[dest[0]].m = value.m;
s.inner[dest[0]].after = value.after;
}
void assign_and_preserve_padding_s(S value[4]) {
{
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
uint tint_symbol[1] = uint[1](i);
assign_and_preserve_padding_1_s_X(tint_symbol, value[i]);
}
}
}
void f() {
s.inner = u.inner;
s.inner[1] = u.inner[2];
assign_and_preserve_padding_s(u.inner);
uint tint_symbol_1[1] = uint[1](1u);
assign_and_preserve_padding_1_s_X(tint_symbol_1, u.inner[2]);
s.inner[3].m = u.inner[2].m;
s.inner[1].m[0] = u.inner[0].m[1].ywxz;
}

View File

@@ -23,9 +23,21 @@ struct S {
/* 0x0084 */ tint_array<int8_t, 60> tint_pad_2;
};
void assign_and_preserve_padding_1(device S* const dest, S value) {
(*(dest)).before = value.before;
(*(dest)).m = value.m;
(*(dest)).after = value.after;
}
void assign_and_preserve_padding(device tint_array<S, 4>* const dest, tint_array<S, 4> value) {
for(uint i = 0u; (i < 4u); i = (i + 1u)) {
assign_and_preserve_padding_1(&((*(dest))[i]), value[i]);
}
}
kernel void f(device tint_array<S, 4>* tint_symbol [[buffer(1)]], const constant tint_array<S, 4>* tint_symbol_1 [[buffer(0)]]) {
*(tint_symbol) = *(tint_symbol_1);
(*(tint_symbol))[1] = (*(tint_symbol_1))[2];
assign_and_preserve_padding(tint_symbol, *(tint_symbol_1));
assign_and_preserve_padding_1(&((*(tint_symbol))[1]), (*(tint_symbol_1))[2]);
(*(tint_symbol))[3].m = (*(tint_symbol_1))[2].m;
(*(tint_symbol))[1].m[0] = float4((*(tint_symbol_1))[0].m[1]).ywxz;
return;

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 45
; Bound: 90
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -15,6 +15,13 @@
OpMemberName %S 2 "after"
OpName %u "u"
OpName %s "s"
OpName %assign_and_preserve_padding_1_s_X "assign_and_preserve_padding_1_s_X"
OpName %dest "dest"
OpName %value "value"
OpName %assign_and_preserve_padding_s "assign_and_preserve_padding_s"
OpName %value_0 "value"
OpName %i "i"
OpName %var_for_index "var_for_index"
OpName %f "f"
OpDecorate %u_block Block
OpMemberDecorate %u_block 0 Offset 0
@@ -29,6 +36,7 @@
OpDecorate %u Binding 0
OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1
OpDecorate %_arr_uint_uint_1 ArrayStride 4
%int = OpTypeInt 32 1
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
@@ -43,39 +51,100 @@
%_ptr_StorageBuffer_u_block = OpTypePointer StorageBuffer %u_block
%s = OpVariable %_ptr_StorageBuffer_u_block StorageBuffer
%void = OpTypeVoid
%14 = OpTypeFunction %void
%uint_1 = OpConstant %uint 1
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
%14 = OpTypeFunction %void %_arr_uint_uint_1 %S
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer__arr_S_uint_4 = OpTypePointer StorageBuffer %_arr_S_uint_4
%23 = OpConstantNull %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_StorageBuffer_mat4v4float = OpTypePointer StorageBuffer %mat4v4float
%uint_2 = OpConstant %uint 2
%36 = OpTypeFunction %void %_arr_S_uint_4
%40 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
%55 = OpConstantNull %_arr_S_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%65 = OpTypeFunction %void
%_ptr_Uniform__arr_S_uint_4 = OpTypePointer Uniform %_arr_S_uint_4
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%73 = OpConstantComposite %_arr_uint_uint_1 %uint_1
%int_2 = OpConstant %int 2
%_ptr_Uniform_S = OpTypePointer Uniform %S
%int_3 = OpConstant %int 3
%uint_1 = OpConstant %uint 1
%_ptr_StorageBuffer_mat4v4float = OpTypePointer StorageBuffer %mat4v4float
%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float
%38 = OpConstantNull %int
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%f = OpFunction %void None %14
%17 = OpLabel
%20 = OpAccessChain %_ptr_StorageBuffer__arr_S_uint_4 %s %uint_0
%22 = OpAccessChain %_ptr_Uniform__arr_S_uint_4 %u %uint_0
%23 = OpLoad %_arr_S_uint_4 %22
OpStore %20 %23
%26 = OpAccessChain %_ptr_StorageBuffer_S %s %uint_0 %int_1
%29 = OpAccessChain %_ptr_Uniform_S %u %uint_0 %int_2
%30 = OpLoad %S %29
OpStore %26 %30
%34 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %s %uint_0 %int_3 %uint_1
%36 = OpAccessChain %_ptr_Uniform_mat4v4float %u %uint_0 %int_2 %uint_1
%37 = OpLoad %mat4v4float %36
OpStore %34 %37
%40 = OpAccessChain %_ptr_StorageBuffer_v4float %s %uint_0 %int_1 %uint_1 %38
%42 = OpAccessChain %_ptr_Uniform_v4float %u %uint_0 %38 %uint_1 %int_1
%43 = OpLoad %v4float %42
%44 = OpVectorShuffle %v4float %43 %43 1 3 0 2
OpStore %40 %44
%assign_and_preserve_padding_1_s_X = OpFunction %void None %14
%dest = OpFunctionParameter %_arr_uint_uint_1
%value = OpFunctionParameter %S
%21 = OpLabel
%24 = OpCompositeExtract %uint %dest 0
%26 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %24 %uint_0
%27 = OpCompositeExtract %int %value 0
OpStore %26 %27
%28 = OpCompositeExtract %uint %dest 0
%30 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %s %uint_0 %28 %uint_1
%31 = OpCompositeExtract %mat4v4float %value 1
OpStore %30 %31
%32 = OpCompositeExtract %uint %dest 0
%34 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %32 %uint_2
%35 = OpCompositeExtract %int %value 2
OpStore %34 %35
OpReturn
OpFunctionEnd
%assign_and_preserve_padding_s = OpFunction %void None %36
%value_0 = OpFunctionParameter %_arr_S_uint_4
%39 = OpLabel
%i = OpVariable %_ptr_Function_uint Function %40
%var_for_index = OpVariable %_ptr_Function__arr_S_uint_4 Function %55
OpStore %i %40
OpBranch %43
%43 = OpLabel
OpLoopMerge %44 %45 None
OpBranch %46
%46 = OpLabel
%48 = OpLoad %uint %i
%49 = OpULessThan %bool %48 %uint_4
%47 = OpLogicalNot %bool %49
OpSelectionMerge %51 None
OpBranchConditional %47 %52 %51
%52 = OpLabel
OpBranch %44
%51 = OpLabel
OpStore %var_for_index %value_0
%57 = OpLoad %uint %i
%58 = OpCompositeConstruct %_arr_uint_uint_1 %57
%59 = OpLoad %uint %i
%61 = OpAccessChain %_ptr_Function_S %var_for_index %59
%62 = OpLoad %S %61
%56 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %58 %62
OpBranch %45
%45 = OpLabel
%63 = OpLoad %uint %i
%64 = OpIAdd %uint %63 %uint_1
OpStore %i %64
OpBranch %43
%44 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %void None %65
%67 = OpLabel
%70 = OpAccessChain %_ptr_Uniform__arr_S_uint_4 %u %uint_0
%71 = OpLoad %_arr_S_uint_4 %70
%68 = OpFunctionCall %void %assign_and_preserve_padding_s %71
%76 = OpAccessChain %_ptr_Uniform_S %u %uint_0 %int_2
%77 = OpLoad %S %76
%72 = OpFunctionCall %void %assign_and_preserve_padding_1_s_X %73 %77
%79 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %s %uint_0 %int_3 %uint_1
%81 = OpAccessChain %_ptr_Uniform_mat4v4float %u %uint_0 %int_2 %uint_1
%82 = OpLoad %mat4v4float %81
OpStore %79 %82
%85 = OpAccessChain %_ptr_StorageBuffer_v4float %s %uint_0 %int_1 %uint_1 %23
%87 = OpAccessChain %_ptr_Uniform_v4float %u %uint_0 %23 %uint_1 %int_1
%88 = OpLoad %v4float %87
%89 = OpVectorShuffle %v4float %88 %88 1 3 0 2
OpStore %85 %89
OpReturn
OpFunctionEnd