SPIR-V 1.4: Allow function/private to have explicit layout
Fixed: 401585324
* Modify ForkExplicitLayoutTypes to only require an explicit layout for
function/private in SPIR-V 1.5 or later
* Add a SPIR-V 1.5 version enum for testing purposes only
Change-Id: Ia0081595a0a38e7022c5e59b8825a57bdf9a2c16
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/246094
Commit-Queue: Alan Baker <alanbaker@google.com>
Reviewed-by: James Price <jrprice@google.com>
Auto-Submit: Alan Baker <alanbaker@google.com>
diff --git a/src/tint/lang/spirv/writer/common/options.h b/src/tint/lang/spirv/writer/common/options.h
index e9f4f15..d29bfe5 100644
--- a/src/tint/lang/spirv/writer/common/options.h
+++ b/src/tint/lang/spirv/writer/common/options.h
@@ -133,6 +133,7 @@
enum class SpvVersion : uint32_t {
kSpv13 = 0x10300u, // SPIR-V 1.3
kSpv14 = 0x10400u, // SPIR-V 1.4
+ kSpv15 = 0x10500u, // SPIR-V 1.5, for testing purposes only
};
/// Configuration options used for generating SPIR-V.
diff --git a/src/tint/lang/spirv/writer/raise/fork_explicit_layout_types.cc b/src/tint/lang/spirv/writer/raise/fork_explicit_layout_types.cc
index a479c47..51c796b 100644
--- a/src/tint/lang/spirv/writer/raise/fork_explicit_layout_types.cc
+++ b/src/tint/lang/spirv/writer/raise/fork_explicit_layout_types.cc
@@ -91,8 +91,10 @@
case core::AddressSpace::kFunction:
case core::AddressSpace::kPrivate:
- // TODO(crbug.com/401585324): Only do this for SPIR-V 1.5 and later.
- RecordTypesThatMustNotHaveExplicitLayout(ptr);
+ // In SPIR-V 1.4 and earlier, Vulkan allowed explicit layout decorations.
+ if (version > SpvVersion::kSpv14) {
+ RecordTypesThatMustNotHaveExplicitLayout(ptr);
+ }
break;
case core::AddressSpace::kWorkgroup:
diff --git a/src/tint/lang/spirv/writer/raise/fork_explicit_layout_types_test.cc b/src/tint/lang/spirv/writer/raise/fork_explicit_layout_types_test.cc
index 215f132..f704bd7 100644
--- a/src/tint/lang/spirv/writer/raise/fork_explicit_layout_types_test.cc
+++ b/src/tint/lang/spirv/writer/raise/fork_explicit_layout_types_test.cc
@@ -240,6 +240,44 @@
EXPECT_EQ(src, str());
auto* expect = R"(
+MyStruct = struct @align(4), @core.explicit_layout {
+ a:u32 @offset(0)
+}
+
+$B1: { # root
+ %buffer:ptr<immediate, MyStruct, read> = var undef
+ %local:ptr<private, MyStruct, read_write> = var undef
+}
+
+)";
+
+ Run(ForkExplicitLayoutTypes, SpvVersion::kSpv13);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(SpirvWriter_ForkExplicitLayoutTypesTest, PushConstant_SharedWithPrivate_Spv15) {
+ auto* structure = ty.Struct(mod.symbols.New("MyStruct"), {
+ {mod.symbols.New("a"), ty.u32()},
+ });
+
+ mod.root_block->Append(b.Var("buffer", ty.ptr(immediate, structure)));
+ mod.root_block->Append(b.Var("local", ty.ptr(private_, structure)));
+
+ auto* src = R"(
+MyStruct = struct @align(4) {
+ a:u32 @offset(0)
+}
+
+$B1: { # root
+ %buffer:ptr<immediate, MyStruct, read> = var undef
+ %local:ptr<private, MyStruct, read_write> = var undef
+}
+
+)";
+ EXPECT_EQ(src, str());
+
+ auto* expect = R"(
MyStruct = struct @align(4) {
a:u32 @offset(0)
}
@@ -255,7 +293,7 @@
)";
- Run(ForkExplicitLayoutTypes, SpvVersion::kSpv13);
+ Run(ForkExplicitLayoutTypes, SpvVersion::kSpv15);
EXPECT_EQ(expect, str());
}
@@ -284,6 +322,46 @@
EXPECT_EQ(src, str());
auto* expect = R"(
+MyStruct = struct @align(4), @core.explicit_layout {
+ a:u32 @offset(0)
+}
+
+$B1: { # root
+ %buffer:ptr<storage, MyStruct, read_write> = var undef @binding_point(0, 0)
+ %local:ptr<private, MyStruct, read_write> = var undef
+}
+
+)";
+
+ Run(ForkExplicitLayoutTypes, SpvVersion::kSpv13);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(SpirvWriter_ForkExplicitLayoutTypesTest, Storage_SharedWithPrivate_Spv15) {
+ auto* structure = ty.Struct(mod.symbols.New("MyStruct"), {
+ {mod.symbols.New("a"), ty.u32()},
+ });
+
+ auto* buffer = b.Var("buffer", ty.ptr(storage, structure));
+ buffer->SetBindingPoint(0, 0);
+ mod.root_block->Append(buffer);
+ mod.root_block->Append(b.Var("local", ty.ptr(private_, structure)));
+
+ auto* src = R"(
+MyStruct = struct @align(4) {
+ a:u32 @offset(0)
+}
+
+$B1: { # root
+ %buffer:ptr<storage, MyStruct, read_write> = var undef @binding_point(0, 0)
+ %local:ptr<private, MyStruct, read_write> = var undef
+}
+
+)";
+ EXPECT_EQ(src, str());
+
+ auto* expect = R"(
MyStruct = struct @align(4) {
a:u32 @offset(0)
}
@@ -299,7 +377,7 @@
)";
- Run(ForkExplicitLayoutTypes, SpvVersion::kSpv13);
+ Run(ForkExplicitLayoutTypes, SpvVersion::kSpv15);
EXPECT_EQ(expect, str());
}
@@ -328,6 +406,46 @@
EXPECT_EQ(src, str());
auto* expect = R"(
+MyStruct = struct @align(4), @core.explicit_layout {
+ a:u32 @offset(0)
+}
+
+$B1: { # root
+ %buffer:ptr<uniform, MyStruct, read> = var undef @binding_point(0, 0)
+ %local:ptr<private, MyStruct, read_write> = var undef
+}
+
+)";
+
+ Run(ForkExplicitLayoutTypes, SpvVersion::kSpv13);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(SpirvWriter_ForkExplicitLayoutTypesTest, Uniform_SharedWithPrivate_Spv15) {
+ auto* structure = ty.Struct(mod.symbols.New("MyStruct"), {
+ {mod.symbols.New("a"), ty.u32()},
+ });
+
+ auto* buffer = b.Var("buffer", ty.ptr(uniform, structure));
+ buffer->SetBindingPoint(0, 0);
+ mod.root_block->Append(buffer);
+ mod.root_block->Append(b.Var("local", ty.ptr(private_, structure)));
+
+ auto* src = R"(
+MyStruct = struct @align(4) {
+ a:u32 @offset(0)
+}
+
+$B1: { # root
+ %buffer:ptr<uniform, MyStruct, read> = var undef @binding_point(0, 0)
+ %local:ptr<private, MyStruct, read_write> = var undef
+}
+
+)";
+ EXPECT_EQ(src, str());
+
+ auto* expect = R"(
MyStruct = struct @align(4) {
a:u32 @offset(0)
}
@@ -343,7 +461,7 @@
)";
- Run(ForkExplicitLayoutTypes, SpvVersion::kSpv13);
+ Run(ForkExplicitLayoutTypes, SpvVersion::kSpv15);
EXPECT_EQ(expect, str());
}
@@ -392,6 +510,50 @@
EXPECT_EQ(expect, str());
}
+TEST_F(SpirvWriter_ForkExplicitLayoutTypesTest, Storage_SharedWithWorkgroup_Spv15) {
+ auto* structure = ty.Struct(mod.symbols.New("MyStruct"), {
+ {mod.symbols.New("a"), ty.u32()},
+ });
+
+ auto* buffer = b.Var("buffer", ty.ptr(storage, structure));
+ buffer->SetBindingPoint(0, 0);
+ mod.root_block->Append(buffer);
+ mod.root_block->Append(b.Var("local", ty.ptr(workgroup, structure)));
+
+ auto* src = R"(
+MyStruct = struct @align(4) {
+ a:u32 @offset(0)
+}
+
+$B1: { # root
+ %buffer:ptr<storage, MyStruct, read_write> = var undef @binding_point(0, 0)
+ %local:ptr<workgroup, MyStruct, read_write> = var undef
+}
+
+)";
+ EXPECT_EQ(src, str());
+
+ auto* expect = R"(
+MyStruct = struct @align(4) {
+ a:u32 @offset(0)
+}
+
+MyStruct_tint_explicit_layout = struct @align(4), @core.explicit_layout {
+ a:u32 @offset(0)
+}
+
+$B1: { # root
+ %buffer:ptr<storage, MyStruct_tint_explicit_layout, read_write> = var undef @binding_point(0, 0)
+ %local:ptr<workgroup, MyStruct, read_write> = var undef
+}
+
+)";
+
+ Run(ForkExplicitLayoutTypes, SpvVersion::kSpv15);
+
+ EXPECT_EQ(expect, str());
+}
+
TEST_F(SpirvWriter_ForkExplicitLayoutTypesTest, Storage_SharedWithInOut) {
auto* array = ty.array<u32, 1>();
b.Append(mod.root_block, [&] {
@@ -461,6 +623,61 @@
EXPECT_EQ(src, str());
auto* expect = R"(
+MyStruct = struct @align(4), @core.explicit_layout {
+ a:u32 @offset(0)
+}
+
+$B1: { # root
+ %buffer:ptr<storage, MyStruct, read_write> = var undef @binding_point(0, 0)
+}
+
+%foo = func():void {
+ $B2: {
+ %local:ptr<function, MyStruct, read_write> = var MyStruct(0u)
+ ret
+ }
+}
+)";
+
+ Run(ForkExplicitLayoutTypes, SpvVersion::kSpv13);
+
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(SpirvWriter_ForkExplicitLayoutTypesTest, Storage_SharedWithFunction_Spv15) {
+ auto* structure = ty.Struct(mod.symbols.New("MyStruct"), {
+ {mod.symbols.New("a"), ty.u32()},
+ });
+
+ auto* buffer = b.Var("buffer", ty.ptr(storage, structure));
+ buffer->SetBindingPoint(0, 0);
+ mod.root_block->Append(buffer);
+
+ auto* func = b.Function("foo", ty.void_());
+ b.Append(func->Block(), [&] {
+ b.Var("local", b.Zero(structure));
+ b.Return(func);
+ });
+
+ auto* src = R"(
+MyStruct = struct @align(4) {
+ a:u32 @offset(0)
+}
+
+$B1: { # root
+ %buffer:ptr<storage, MyStruct, read_write> = var undef @binding_point(0, 0)
+}
+
+%foo = func():void {
+ $B2: {
+ %local:ptr<function, MyStruct, read_write> = var MyStruct(0u)
+ ret
+ }
+}
+)";
+ EXPECT_EQ(src, str());
+
+ auto* expect = R"(
MyStruct = struct @align(4) {
a:u32 @offset(0)
}
@@ -481,7 +698,7 @@
}
)";
- Run(ForkExplicitLayoutTypes, SpvVersion::kSpv13);
+ Run(ForkExplicitLayoutTypes, SpvVersion::kSpv15);
EXPECT_EQ(expect, str());
}
@@ -495,10 +712,12 @@
auto* buffer = b.Var("buffer", ty.ptr(storage, structure));
buffer->SetBindingPoint(0, 0);
mod.root_block->Append(buffer);
+ auto* wg = b.Var("wg", ty.ptr(workgroup, structure));
+ mod.root_block->Append(wg);
auto* func = b.Function("foo", ty.void_());
b.Append(func->Block(), [&] {
- b.Var("local", b.Load(buffer));
+ b.Store(wg, b.Load(buffer));
b.Return(func);
});
@@ -510,12 +729,13 @@
$B1: { # root
%buffer:ptr<storage, MyStruct, read_write> = var undef @binding_point(0, 0)
+ %wg:ptr<workgroup, MyStruct, read_write> = var undef
}
%foo = func():void {
$B2: {
- %3:MyStruct = load %buffer
- %local:ptr<function, MyStruct, read_write> = var %3
+ %4:MyStruct = load %buffer
+ store %wg, %4
ret
}
}
@@ -535,13 +755,14 @@
$B1: { # root
%buffer:ptr<storage, MyStruct_tint_explicit_layout, read_write> = var undef @binding_point(0, 0)
+ %wg:ptr<workgroup, MyStruct, read_write> = var undef
}
%foo = func():void {
$B2: {
- %3:MyStruct_tint_explicit_layout = load %buffer
- %4:MyStruct = call %tint_convert_explicit_layout, %3
- %local:ptr<function, MyStruct, read_write> = var %4
+ %4:MyStruct_tint_explicit_layout = load %buffer
+ %5:MyStruct = call %tint_convert_explicit_layout, %4
+ store %wg, %5
ret
}
}
@@ -573,10 +794,12 @@
auto* buffer = b.Var("buffer", ty.ptr(storage, outer));
buffer->SetBindingPoint(0, 0);
mod.root_block->Append(buffer);
+ auto* wg = b.Var("wg", ty.ptr(workgroup, outer));
+ mod.root_block->Append(wg);
auto* func = b.Function("foo", ty.void_());
b.Append(func->Block(), [&] {
- b.Var("local", b.Load(buffer));
+ b.Store(wg, b.Load(buffer));
b.Return(func);
});
@@ -593,12 +816,13 @@
$B1: { # root
%buffer:ptr<storage, Outer, read_write> = var undef @binding_point(0, 0)
+ %wg:ptr<workgroup, Outer, read_write> = var undef
}
%foo = func():void {
$B2: {
- %3:Outer = load %buffer
- %local:ptr<function, Outer, read_write> = var %3
+ %4:Outer = load %buffer
+ store %wg, %4
ret
}
}
@@ -628,13 +852,14 @@
$B1: { # root
%buffer:ptr<storage, Outer_tint_explicit_layout, read_write> = var undef @binding_point(0, 0)
+ %wg:ptr<workgroup, Outer, read_write> = var undef
}
%foo = func():void {
$B2: {
- %3:Outer_tint_explicit_layout = load %buffer
- %4:Outer = call %tint_convert_explicit_layout, %3
- %local:ptr<function, Outer, read_write> = var %4
+ %4:Outer_tint_explicit_layout = load %buffer
+ %5:Outer = call %tint_convert_explicit_layout, %4
+ store %wg, %5
ret
}
}
@@ -672,11 +897,12 @@
auto* buffer = b.Var("buffer", ty.ptr(storage, structure, read_write));
buffer->SetBindingPoint(0, 0);
mod.root_block->Append(buffer);
+ auto* wg = b.Var("wg", ty.ptr(workgroup, structure));
+ mod.root_block->Append(wg);
auto* func = b.Function("foo", ty.void_());
b.Append(func->Block(), [&] {
- auto* local = b.Var("local", ty.ptr<function>(structure));
- b.Store(buffer, b.Load(local));
+ b.Store(buffer, b.Load(wg));
b.Return(func);
});
@@ -688,12 +914,12 @@
$B1: { # root
%buffer:ptr<storage, MyStruct, read_write> = var undef @binding_point(0, 0)
+ %wg:ptr<workgroup, MyStruct, read_write> = var undef
}
%foo = func():void {
$B2: {
- %local:ptr<function, MyStruct, read_write> = var undef
- %4:MyStruct = load %local
+ %4:MyStruct = load %wg
store %buffer, %4
ret
}
@@ -714,12 +940,12 @@
$B1: { # root
%buffer:ptr<storage, MyStruct_tint_explicit_layout, read_write> = var undef @binding_point(0, 0)
+ %wg:ptr<workgroup, MyStruct, read_write> = var undef
}
%foo = func():void {
$B2: {
- %local:ptr<function, MyStruct, read_write> = var undef
- %4:MyStruct = load %local
+ %4:MyStruct = load %wg
%5:MyStruct_tint_explicit_layout = call %tint_convert_explicit_layout, %4
store %buffer, %5
ret
@@ -753,11 +979,12 @@
auto* buffer = b.Var("buffer", ty.ptr(storage, outer, read_write));
buffer->SetBindingPoint(0, 0);
mod.root_block->Append(buffer);
+ auto* wg = b.Var("wg", ty.ptr(workgroup, outer));
+ mod.root_block->Append(wg);
auto* func = b.Function("foo", ty.void_());
b.Append(func->Block(), [&] {
- auto* local = b.Var("local", ty.ptr<function>(outer));
- b.Store(buffer, b.Load(local));
+ b.Store(buffer, b.Load(wg));
b.Return(func);
});
@@ -774,12 +1001,12 @@
$B1: { # root
%buffer:ptr<storage, Outer, read_write> = var undef @binding_point(0, 0)
+ %wg:ptr<workgroup, Outer, read_write> = var undef
}
%foo = func():void {
$B2: {
- %local:ptr<function, Outer, read_write> = var undef
- %4:Outer = load %local
+ %4:Outer = load %wg
store %buffer, %4
ret
}
@@ -810,12 +1037,12 @@
$B1: { # root
%buffer:ptr<storage, Outer_tint_explicit_layout, read_write> = var undef @binding_point(0, 0)
+ %wg:ptr<workgroup, Outer, read_write> = var undef
}
%foo = func():void {
$B2: {
- %local:ptr<function, Outer, read_write> = var undef
- %4:Outer = load %local
+ %4:Outer = load %wg
%5:Outer_tint_explicit_layout = call %tint_convert_explicit_layout, %4
store %buffer, %5
ret
@@ -859,11 +1086,12 @@
auto* buffer = b.Var("buffer", ty.ptr(storage, outer, read_write));
buffer->SetBindingPoint(0, 0);
mod.root_block->Append(buffer);
+ auto* wg = b.Var("wg", ty.ptr(workgroup, inner));
+ mod.root_block->Append(wg);
auto* func = b.Function("foo", ty.void_());
b.Append(func->Block(), [&] {
- auto* local = b.Var("local", ty.ptr<function>(inner));
- auto* load_inner = b.Load(local);
+ auto* load_inner = b.Load(wg);
b.Store(buffer, b.Construct(outer, load_inner, load_inner));
b.Return(func);
});
@@ -881,12 +1109,12 @@
$B1: { # root
%buffer:ptr<storage, Outer, read_write> = var undef @binding_point(0, 0)
+ %wg:ptr<workgroup, Inner, read_write> = var undef
}
%foo = func():void {
$B2: {
- %local:ptr<function, Inner, read_write> = var undef
- %4:Inner = load %local
+ %4:Inner = load %wg
%5:Outer = construct %4, %4
store %buffer, %5
ret
@@ -918,12 +1146,12 @@
$B1: { # root
%buffer:ptr<storage, Outer_tint_explicit_layout, read_write> = var undef @binding_point(0, 0)
+ %wg:ptr<workgroup, Inner, read_write> = var undef
}
%foo = func():void {
$B2: {
- %local:ptr<function, Inner, read_write> = var undef
- %4:Inner = load %local
+ %4:Inner = load %wg
%5:Outer = construct %4, %4
%6:Outer_tint_explicit_layout = call %tint_convert_explicit_layout, %5
store %buffer, %6
@@ -975,10 +1203,11 @@
auto* buffer = b.Var("buffer", ty.ptr(storage, outer, read_write));
buffer->SetBindingPoint(0, 0);
mod.root_block->Append(buffer);
+ auto* wg = b.Var("wg", ty.ptr(workgroup, inner_shared));
+ mod.root_block->Append(wg);
auto* func = b.Function("foo", ty.void_());
b.Append(func->Block(), [&] {
- b.Var("local", ty.ptr<function>(inner_shared));
b.Store(buffer, b.Construct(outer, b.Zero(inner_shared), b.Zero(inner_not_shared)));
b.Return(func);
});
@@ -1001,11 +1230,11 @@
$B1: { # root
%buffer:ptr<storage, Outer, read_write> = var undef @binding_point(0, 0)
+ %wg:ptr<workgroup, InnerShared, read_write> = var undef
}
%foo = func():void {
$B2: {
- %local:ptr<function, InnerShared, read_write> = var undef
%4:Outer = construct InnerShared(0u), InnerNotShared(0u)
store %buffer, %4
ret
@@ -1042,11 +1271,11 @@
$B1: { # root
%buffer:ptr<storage, Outer_tint_explicit_layout, read_write> = var undef @binding_point(0, 0)
+ %wg:ptr<workgroup, InnerShared, read_write> = var undef
}
%foo = func():void {
$B2: {
- %local:ptr<function, InnerShared, read_write> = var undef
%4:Outer = construct InnerShared(0u), InnerNotShared(0u)
%5:Outer_tint_explicit_layout = call %tint_convert_explicit_layout, %4
store %buffer, %5
@@ -1086,11 +1315,13 @@
auto* buffer = b.Var("buffer", ty.ptr(storage, structure));
buffer->SetBindingPoint(0, 0);
mod.root_block->Append(buffer);
+ auto* wg = b.Var("wg", ty.ptr(workgroup, structure));
+ mod.root_block->Append(wg);
auto* func = b.Function("foo", ty.void_());
b.Append(func->Block(), [&] {
auto* let = b.Let("let", b.Load(buffer));
- b.Var("local", b.Load(buffer));
+ b.Store(wg, b.Load(buffer));
b.Store(buffer, b.Zero(structure));
b.Store(buffer, let);
b.Return(func);
@@ -1104,14 +1335,15 @@
$B1: { # root
%buffer:ptr<storage, MyStruct, read_write> = var undef @binding_point(0, 0)
+ %wg:ptr<workgroup, MyStruct, read_write> = var undef
}
%foo = func():void {
$B2: {
- %3:MyStruct = load %buffer
- %let:MyStruct = let %3
- %5:MyStruct = load %buffer
- %local:ptr<function, MyStruct, read_write> = var %5
+ %4:MyStruct = load %buffer
+ %let:MyStruct = let %4
+ %6:MyStruct = load %buffer
+ store %wg, %6
store %buffer, MyStruct(0u)
store %buffer, %let
ret
@@ -1133,16 +1365,17 @@
$B1: { # root
%buffer:ptr<storage, MyStruct_tint_explicit_layout, read_write> = var undef @binding_point(0, 0)
+ %wg:ptr<workgroup, MyStruct, read_write> = var undef
}
%foo = func():void {
$B2: {
- %3:MyStruct_tint_explicit_layout = load %buffer
- %4:MyStruct = call %tint_convert_explicit_layout, %3
- %let:MyStruct = let %4
- %7:MyStruct_tint_explicit_layout = load %buffer
- %8:MyStruct = call %tint_convert_explicit_layout, %7
- %local:ptr<function, MyStruct, read_write> = var %8
+ %4:MyStruct_tint_explicit_layout = load %buffer
+ %5:MyStruct = call %tint_convert_explicit_layout, %4
+ %let:MyStruct = let %5
+ %8:MyStruct_tint_explicit_layout = load %buffer
+ %9:MyStruct = call %tint_convert_explicit_layout, %8
+ store %wg, %9
%10:MyStruct_tint_explicit_layout = call %tint_convert_explicit_layout_1, MyStruct(0u)
store %buffer, %10
%12:MyStruct_tint_explicit_layout = call %tint_convert_explicit_layout_1, %let
@@ -1182,10 +1415,11 @@
auto* buffer = b.Var("buffer", ty.ptr(storage, structure));
buffer->SetBindingPoint(0, 0);
mod.root_block->Append(buffer);
+ auto* wg = b.Var("wg", ty.ptr(workgroup, structure));
+ mod.root_block->Append(wg);
auto* func = b.Function("foo", ty.void_());
b.Append(func->Block(), [&] {
- b.Var("local", ty.ptr(function, structure));
auto* let_ptr = b.Let("let_ptr", buffer);
auto* load = b.Load(let_ptr);
b.Store(let_ptr, load);
@@ -1200,11 +1434,11 @@
$B1: { # root
%buffer:ptr<storage, MyStruct, read_write> = var undef @binding_point(0, 0)
+ %wg:ptr<workgroup, MyStruct, read_write> = var undef
}
%foo = func():void {
$B2: {
- %local:ptr<function, MyStruct, read_write> = var undef
%let_ptr:ptr<storage, MyStruct, read_write> = let %buffer
%5:MyStruct = load %let_ptr
store %let_ptr, %5
@@ -1227,11 +1461,11 @@
$B1: { # root
%buffer:ptr<storage, MyStruct_tint_explicit_layout, read_write> = var undef @binding_point(0, 0)
+ %wg:ptr<workgroup, MyStruct, read_write> = var undef
}
%foo = func():void {
$B2: {
- %local:ptr<function, MyStruct, read_write> = var undef
%let_ptr:ptr<storage, MyStruct_tint_explicit_layout, read_write> = let %buffer
%5:MyStruct_tint_explicit_layout = load %let_ptr
%6:MyStruct = call %tint_convert_explicit_layout, %5
@@ -1272,10 +1506,11 @@
auto* buffer = b.Var("buffer", ty.ptr(storage, structure, read_write));
buffer->SetBindingPoint(0, 0);
mod.root_block->Append(buffer);
+ auto* wg = b.Var("wg", ty.ptr(workgroup, structure));
+ mod.root_block->Append(wg);
auto* func = b.Function("foo", ty.void_());
b.Append(func->Block(), [&] {
- b.Var("local", ty.ptr<function>(structure));
auto* load = b.Load(b.Access(ty.ptr<storage, u32, read_write>(), buffer, 0_u));
b.Store(b.Access(ty.ptr<storage, u32, read_write>(), buffer, 1_u), load);
b.Return(func);
@@ -1289,11 +1524,11 @@
$B1: { # root
%buffer:ptr<storage, MyStruct, read_write> = var undef @binding_point(0, 0)
+ %wg:ptr<workgroup, MyStruct, read_write> = var undef
}
%foo = func():void {
$B2: {
- %local:ptr<function, MyStruct, read_write> = var undef
%4:ptr<storage, u32, read_write> = access %buffer, 0u
%5:u32 = load %4
%6:ptr<storage, u32, read_write> = access %buffer, 1u
@@ -1317,11 +1552,11 @@
$B1: { # root
%buffer:ptr<storage, MyStruct_tint_explicit_layout, read_write> = var undef @binding_point(0, 0)
+ %wg:ptr<workgroup, MyStruct, read_write> = var undef
}
%foo = func():void {
$B2: {
- %local:ptr<function, MyStruct, read_write> = var undef
%4:ptr<storage, u32, read_write> = access %buffer, 0u
%5:u32 = load %4
%6:ptr<storage, u32, read_write> = access %buffer, 1u
@@ -1349,10 +1584,11 @@
auto* buffer = b.Var("buffer", ty.ptr(storage, outer, read_write));
buffer->SetBindingPoint(0, 0);
mod.root_block->Append(buffer);
+ auto* wg = b.Var("wg", ty.ptr(workgroup, outer));
+ mod.root_block->Append(wg);
auto* func = b.Function("foo", ty.void_());
b.Append(func->Block(), [&] {
- b.Var("local", ty.ptr<function>(outer));
auto* load = b.Load(b.Access(ty.ptr(storage, inner, read_write), buffer, 0_u));
b.Store(b.Access(ty.ptr(storage, inner, read_write), buffer, 1_u), load);
b.Return(func);
@@ -1371,11 +1607,11 @@
$B1: { # root
%buffer:ptr<storage, Outer, read_write> = var undef @binding_point(0, 0)
+ %wg:ptr<workgroup, Outer, read_write> = var undef
}
%foo = func():void {
$B2: {
- %local:ptr<function, Outer, read_write> = var undef
%4:ptr<storage, Inner, read_write> = access %buffer, 0u
%5:Inner = load %4
%6:ptr<storage, Inner, read_write> = access %buffer, 1u
@@ -1409,11 +1645,11 @@
$B1: { # root
%buffer:ptr<storage, Outer_tint_explicit_layout, read_write> = var undef @binding_point(0, 0)
+ %wg:ptr<workgroup, Outer, read_write> = var undef
}
%foo = func():void {
$B2: {
- %local:ptr<function, Outer, read_write> = var undef
%4:ptr<storage, Inner_tint_explicit_layout, read_write> = access %buffer, 0u
%5:Inner_tint_explicit_layout = load %4
%6:Inner = call %tint_convert_explicit_layout, %5
@@ -1461,10 +1697,11 @@
mod.root_block->Append(buffer_0);
mod.root_block->Append(buffer_1);
mod.root_block->Append(buffer_2);
+ auto* wg = b.Var("wg", ty.ptr(workgroup, structure));
+ mod.root_block->Append(wg);
auto* func = b.Function("foo", ty.void_());
b.Append(func->Block(), [&] {
- b.Var("local", b.Zero(structure));
b.Let("let_0", b.Load(buffer_0));
b.Let("let_1", b.Load(buffer_1));
b.Let("let_2", b.Load(buffer_2));
@@ -1481,11 +1718,11 @@
%buffer_0:ptr<storage, MyStruct, read_write> = var undef @binding_point(0, 0)
%buffer_1:ptr<storage, MyStruct, read_write> = var undef @binding_point(0, 1)
%buffer_2:ptr<storage, MyStruct, read_write> = var undef @binding_point(0, 2)
+ %wg:ptr<workgroup, MyStruct, read_write> = var undef
}
%foo = func():void {
$B2: {
- %local:ptr<function, MyStruct, read_write> = var MyStruct(0u)
%6:MyStruct = load %buffer_0
%let_0:MyStruct = let %6
%8:MyStruct = load %buffer_1
@@ -1513,11 +1750,11 @@
%buffer_0:ptr<storage, MyStruct_tint_explicit_layout, read_write> = var undef @binding_point(0, 0)
%buffer_1:ptr<storage, MyStruct_tint_explicit_layout, read_write> = var undef @binding_point(0, 1)
%buffer_2:ptr<storage, MyStruct_tint_explicit_layout, read_write> = var undef @binding_point(0, 2)
+ %wg:ptr<workgroup, MyStruct, read_write> = var undef
}
%foo = func():void {
$B2: {
- %local:ptr<function, MyStruct, read_write> = var MyStruct(0u)
%6:MyStruct_tint_explicit_layout = load %buffer_0
%7:MyStruct = call %tint_convert_explicit_layout, %6
%let_0:MyStruct = let %7
@@ -1568,12 +1805,15 @@
mod.root_block->Append(buffer_0);
mod.root_block->Append(buffer_1);
mod.root_block->Append(buffer_2);
+ auto* wg_0 = b.Var("wg_0", ty.ptr(workgroup, s0));
+ auto* wg_1 = b.Var("wg_1", ty.ptr(workgroup, s1));
+ auto* wg_2 = b.Var("wg_2", ty.ptr(workgroup, s2));
+ mod.root_block->Append(wg_0);
+ mod.root_block->Append(wg_1);
+ mod.root_block->Append(wg_2);
auto* func = b.Function("foo", ty.void_());
b.Append(func->Block(), [&] {
- b.Var("local", b.Zero(s0));
- b.Var("local", b.Zero(s1));
- b.Var("local", b.Zero(s2));
b.Let("let_0", b.Load(buffer_0));
b.Let("let_1", b.Load(buffer_1));
b.Let("let_2", b.Load(buffer_2));
@@ -1600,13 +1840,13 @@
%buffer_0:ptr<storage, S_0, read_write> = var undef @binding_point(0, 0)
%buffer_1:ptr<storage, S_1, read_write> = var undef @binding_point(0, 1)
%buffer_2:ptr<storage, S_2, read_write> = var undef @binding_point(0, 2)
+ %wg_0:ptr<workgroup, S_0, read_write> = var undef
+ %wg_1:ptr<workgroup, S_1, read_write> = var undef
+ %wg_2:ptr<workgroup, S_2, read_write> = var undef
}
%foo = func():void {
$B2: {
- %local:ptr<function, S_0, read_write> = var S_0(0u)
- %local_1:ptr<function, S_1, read_write> = var S_1(0.0f) # %local_1: 'local'
- %local_2:ptr<function, S_2, read_write> = var S_2(0i) # %local_2: 'local'
%8:S_0 = load %buffer_0
%let_0:S_0 = let %8
%10:S_1 = load %buffer_1
@@ -1654,13 +1894,13 @@
%buffer_0:ptr<storage, S_0_tint_explicit_layout, read_write> = var undef @binding_point(0, 0)
%buffer_1:ptr<storage, S_1_tint_explicit_layout, read_write> = var undef @binding_point(0, 1)
%buffer_2:ptr<storage, S_2_tint_explicit_layout, read_write> = var undef @binding_point(0, 2)
+ %wg_0:ptr<workgroup, S_0, read_write> = var undef
+ %wg_1:ptr<workgroup, S_1, read_write> = var undef
+ %wg_2:ptr<workgroup, S_2, read_write> = var undef
}
%foo = func():void {
$B2: {
- %local:ptr<function, S_0, read_write> = var S_0(0u)
- %local_1:ptr<function, S_1, read_write> = var S_1(0.0f) # %local_1: 'local'
- %local_2:ptr<function, S_2, read_write> = var S_2(0i) # %local_2: 'local'
%8:S_0_tint_explicit_layout = load %buffer_0
%9:S_0 = call %tint_convert_explicit_layout, %8
%let_0:S_0 = let %9
diff --git a/test/tint/buffer/uniform/std140/struct/mat2x2_f16/to_storage.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/struct/mat2x2_f16/to_storage.wgsl.expected.spvasm
index 1f8ac9f..4b83a6c 100644
--- a/test/tint/buffer/uniform/std140/struct/mat2x2_f16/to_storage.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/struct/mat2x2_f16/to_storage.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 140
+; Bound: 139
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -17,17 +17,13 @@
OpName %S_std140 "S_std140"
OpMemberName %u_block_std140_tint_explicit_layout 0 "inner"
OpName %u_block_std140_tint_explicit_layout "u_block_std140_tint_explicit_layout"
- OpMemberName %S_tint_explicit_layout 0 "before"
- OpMemberName %S_tint_explicit_layout 1 "m"
- OpMemberName %S_tint_explicit_layout 2 "after"
- OpName %S_tint_explicit_layout "S_tint_explicit_layout"
- OpMemberName %s_block_tint_explicit_layout 0 "inner"
- OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
- OpName %f "f"
OpMemberName %S 0 "before"
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %S "S"
+ OpMemberName %s_block_tint_explicit_layout 0 "inner"
+ OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
+ OpName %f "f"
OpName %tint_store_and_preserve_padding "tint_store_and_preserve_padding"
OpName %value_param "value_param"
OpName %tint_store_and_preserve_padding_0 "tint_store_and_preserve_padding"
@@ -47,12 +43,12 @@
OpDecorate %1 DescriptorSet 0
OpDecorate %1 Binding 0
OpDecorate %1 NonWritable
- OpMemberDecorate %S_tint_explicit_layout 0 Offset 0
- OpMemberDecorate %S_tint_explicit_layout 1 Offset 4
- OpMemberDecorate %S_tint_explicit_layout 1 ColMajor
- OpMemberDecorate %S_tint_explicit_layout 1 MatrixStride 4
- OpMemberDecorate %S_tint_explicit_layout 2 Offset 64
- OpDecorate %_arr_S_tint_explicit_layout_uint_4 ArrayStride 128
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 4
+ OpMemberDecorate %S 1 ColMajor
+ OpMemberDecorate %S 1 MatrixStride 4
+ OpMemberDecorate %S 2 Offset 64
+ OpDecorate %_arr_S_uint_4 ArrayStride 128
OpMemberDecorate %s_block_tint_explicit_layout 0 Offset 0
OpDecorate %s_block_tint_explicit_layout Block
OpDecorate %11 DescriptorSet 0
@@ -69,9 +65,9 @@
%_ptr_Uniform_u_block_std140_tint_explicit_layout = OpTypePointer Uniform %u_block_std140_tint_explicit_layout
%1 = OpVariable %_ptr_Uniform_u_block_std140_tint_explicit_layout Uniform
%mat2v2half = OpTypeMatrix %v2half 2
-%S_tint_explicit_layout = OpTypeStruct %int %mat2v2half %int
-%_arr_S_tint_explicit_layout_uint_4 = OpTypeArray %S_tint_explicit_layout %uint_4
-%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_tint_explicit_layout_uint_4
+ %S = OpTypeStruct %int %mat2v2half %int
+%_arr_S_uint_4 = OpTypeArray %S %uint_4
+%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_s_block_tint_explicit_layout = OpTypePointer StorageBuffer %s_block_tint_explicit_layout
%11 = OpVariable %_ptr_StorageBuffer_s_block_tint_explicit_layout StorageBuffer
%void = OpTypeVoid
@@ -80,10 +76,9 @@
%uint_0 = OpConstant %uint 0
%_arr_S_std140_uint_4_0 = OpTypeArray %S_std140 %uint_4
%_ptr_Function__arr_S_std140_uint_4_0 = OpTypePointer Function %_arr_S_std140_uint_4_0
- %S = OpTypeStruct %int %mat2v2half %int
-%_arr_S_uint_4 = OpTypeArray %S %uint_4
-%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
- %34 = OpConstantNull %_arr_S_uint_4
+%_arr_S_uint_4_0 = OpTypeArray %S %uint_4
+%_ptr_Function__arr_S_uint_4_0 = OpTypePointer Function %_arr_S_uint_4_0
+ %33 = OpConstantNull %_arr_S_uint_4_0
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%uint_2 = OpConstant %uint 2
%uint_1 = OpConstant %uint 1
@@ -95,152 +90,152 @@
%bool = OpTypeBool
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
- %81 = OpTypeFunction %void %_arr_S_uint_4
- %100 = OpTypeFunction %void %_arr_uint_uint_1 %S
+ %80 = OpTypeFunction %void %_arr_S_uint_4_0
+ %99 = OpTypeFunction %void %_arr_uint_uint_1 %S
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
- %111 = OpTypeFunction %S %S_std140
- %120 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
+ %110 = OpTypeFunction %S %S_std140
+ %119 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
- %125 = OpConstantNull %_arr_S_std140_uint_4_0
+ %124 = OpConstantNull %_arr_S_std140_uint_4_0
%f = OpFunction %void None %19
%20 = OpLabel
%28 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function
- %30 = OpVariable %_ptr_Function__arr_S_uint_4 Function %34
+ %30 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function %33
%21 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %1 %uint_0
%24 = OpLoad %_arr_S_std140_uint_4 %21 None
%25 = OpFunctionCall %_arr_S_std140_uint_4_0 %tint_convert_explicit_layout %24
OpStore %28 %25
- OpBranch %35
- %35 = OpLabel
- OpBranch %38
- %38 = OpLabel
- %40 = OpPhi %uint %uint_0 %35 %41 %37
- OpLoopMerge %39 %37 None
- OpBranch %36
- %36 = OpLabel
- %70 = OpUGreaterThanEqual %bool %40 %uint_4
- OpSelectionMerge %72 None
- OpBranchConditional %70 %73 %72
- %73 = OpLabel
- OpBranch %39
- %72 = OpLabel
- %74 = OpAccessChain %_ptr_Function_S %30 %40
- %76 = OpAccessChain %_ptr_Function_S_std140 %28 %40
- %78 = OpLoad %S_std140 %76 None
- %79 = OpFunctionCall %S %tint_convert_S %78
- OpStore %74 %79 None
+ OpBranch %34
+ %34 = OpLabel
OpBranch %37
%37 = OpLabel
- %41 = OpIAdd %uint %40 %uint_1
+ %39 = OpPhi %uint %uint_0 %34 %40 %36
+ OpLoopMerge %38 %36 None
+ OpBranch %35
+ %35 = OpLabel
+ %69 = OpUGreaterThanEqual %bool %39 %uint_4
+ OpSelectionMerge %71 None
+ OpBranchConditional %69 %72 %71
+ %72 = OpLabel
OpBranch %38
- %39 = OpLabel
- %42 = OpLoad %_arr_S_uint_4 %30 None
- %43 = OpFunctionCall %void %tint_store_and_preserve_padding %42
- %45 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
- %48 = OpLoad %S_std140 %45 None
- %49 = OpFunctionCall %S %tint_convert_S %48
- %53 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
- %54 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %53 %49
- %56 = OpAccessChain %_ptr_StorageBuffer_mat2v2half %11 %uint_0 %uint_3 %uint_1
- %59 = OpAccessChain %_ptr_Uniform_v2half %1 %uint_0 %uint_2 %uint_1
- %61 = OpLoad %v2half %59 None
- %62 = OpAccessChain %_ptr_Uniform_v2half %1 %uint_0 %uint_2 %uint_2
- %63 = OpLoad %v2half %62 None
- %64 = OpCompositeConstruct %mat2v2half %61 %63
- OpStore %56 %64 None
- %65 = OpAccessChain %_ptr_StorageBuffer_v2half %11 %uint_0 %uint_1 %uint_1 %uint_0
- %67 = OpAccessChain %_ptr_Uniform_v2half %1 %uint_0 %uint_0 %uint_2
- %68 = OpLoad %v2half %67 None
- %69 = OpVectorShuffle %v2half %68 %68 1 0
- OpStore %65 %69 None
+ %71 = OpLabel
+ %73 = OpAccessChain %_ptr_Function_S %30 %39
+ %75 = OpAccessChain %_ptr_Function_S_std140 %28 %39
+ %77 = OpLoad %S_std140 %75 None
+ %78 = OpFunctionCall %S %tint_convert_S %77
+ OpStore %73 %78 None
+ OpBranch %36
+ %36 = OpLabel
+ %40 = OpIAdd %uint %39 %uint_1
+ OpBranch %37
+ %38 = OpLabel
+ %41 = OpLoad %_arr_S_uint_4_0 %30 None
+ %42 = OpFunctionCall %void %tint_store_and_preserve_padding %41
+ %44 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
+ %47 = OpLoad %S_std140 %44 None
+ %48 = OpFunctionCall %S %tint_convert_S %47
+ %52 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
+ %53 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %52 %48
+ %55 = OpAccessChain %_ptr_StorageBuffer_mat2v2half %11 %uint_0 %uint_3 %uint_1
+ %58 = OpAccessChain %_ptr_Uniform_v2half %1 %uint_0 %uint_2 %uint_1
+ %60 = OpLoad %v2half %58 None
+ %61 = OpAccessChain %_ptr_Uniform_v2half %1 %uint_0 %uint_2 %uint_2
+ %62 = OpLoad %v2half %61 None
+ %63 = OpCompositeConstruct %mat2v2half %60 %62
+ OpStore %55 %63 None
+ %64 = OpAccessChain %_ptr_StorageBuffer_v2half %11 %uint_0 %uint_1 %uint_1 %uint_0
+ %66 = OpAccessChain %_ptr_Uniform_v2half %1 %uint_0 %uint_0 %uint_2
+ %67 = OpLoad %v2half %66 None
+ %68 = OpVectorShuffle %v2half %67 %67 1 0
+ OpStore %64 %68 None
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding = OpFunction %void None %81
-%value_param = OpFunctionParameter %_arr_S_uint_4
- %82 = OpLabel
- %83 = OpVariable %_ptr_Function__arr_S_uint_4 Function
- OpStore %83 %value_param
- OpBranch %84
- %84 = OpLabel
- OpBranch %87
- %87 = OpLabel
- %89 = OpPhi %uint %uint_0 %84 %90 %86
- OpLoopMerge %88 %86 None
- OpBranch %85
- %85 = OpLabel
- %91 = OpUGreaterThanEqual %bool %89 %uint_4
- OpSelectionMerge %92 None
- OpBranchConditional %91 %93 %92
- %93 = OpLabel
- OpBranch %88
- %92 = OpLabel
- %94 = OpAccessChain %_ptr_Function_S %83 %89
- %95 = OpLoad %S %94 None
- %96 = OpCompositeConstruct %_arr_uint_uint_1 %89
- %97 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %96 %95
+%tint_store_and_preserve_padding = OpFunction %void None %80
+%value_param = OpFunctionParameter %_arr_S_uint_4_0
+ %81 = OpLabel
+ %82 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function
+ OpStore %82 %value_param
+ OpBranch %83
+ %83 = OpLabel
OpBranch %86
%86 = OpLabel
- %90 = OpIAdd %uint %89 %uint_1
+ %88 = OpPhi %uint %uint_0 %83 %89 %85
+ OpLoopMerge %87 %85 None
+ OpBranch %84
+ %84 = OpLabel
+ %90 = OpUGreaterThanEqual %bool %88 %uint_4
+ OpSelectionMerge %91 None
+ OpBranchConditional %90 %92 %91
+ %92 = OpLabel
OpBranch %87
- %88 = OpLabel
+ %91 = OpLabel
+ %93 = OpAccessChain %_ptr_Function_S %82 %88
+ %94 = OpLoad %S %93 None
+ %95 = OpCompositeConstruct %_arr_uint_uint_1 %88
+ %96 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %95 %94
+ OpBranch %85
+ %85 = OpLabel
+ %89 = OpIAdd %uint %88 %uint_1
+ OpBranch %86
+ %87 = OpLabel
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding_0 = OpFunction %void None %100
+%tint_store_and_preserve_padding_0 = OpFunction %void None %99
%target_indices = OpFunctionParameter %_arr_uint_uint_1
%value_param_0 = OpFunctionParameter %S
- %101 = OpLabel
- %102 = OpCompositeExtract %uint %target_indices 0
- %103 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %102 %uint_0
- %105 = OpCompositeExtract %int %value_param_0 0
- OpStore %103 %105 None
- %106 = OpAccessChain %_ptr_StorageBuffer_mat2v2half %11 %uint_0 %102 %uint_1
- %107 = OpCompositeExtract %mat2v2half %value_param_0 1
- OpStore %106 %107 None
- %108 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %102 %uint_2
- %109 = OpCompositeExtract %int %value_param_0 2
- OpStore %108 %109 None
+ %100 = OpLabel
+ %101 = OpCompositeExtract %uint %target_indices 0
+ %102 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %101 %uint_0
+ %104 = OpCompositeExtract %int %value_param_0 0
+ OpStore %102 %104 None
+ %105 = OpAccessChain %_ptr_StorageBuffer_mat2v2half %11 %uint_0 %101 %uint_1
+ %106 = OpCompositeExtract %mat2v2half %value_param_0 1
+ OpStore %105 %106 None
+ %107 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %101 %uint_2
+ %108 = OpCompositeExtract %int %value_param_0 2
+ OpStore %107 %108 None
OpReturn
OpFunctionEnd
-%tint_convert_S = OpFunction %S None %111
+%tint_convert_S = OpFunction %S None %110
%tint_input = OpFunctionParameter %S_std140
- %112 = OpLabel
- %113 = OpCompositeExtract %int %tint_input 0
- %114 = OpCompositeExtract %v2half %tint_input 1
- %115 = OpCompositeExtract %v2half %tint_input 2
- %116 = OpCompositeConstruct %mat2v2half %114 %115
- %117 = OpCompositeExtract %int %tint_input 3
- %118 = OpCompositeConstruct %S %113 %116 %117
- OpReturnValue %118
+ %111 = OpLabel
+ %112 = OpCompositeExtract %int %tint_input 0
+ %113 = OpCompositeExtract %v2half %tint_input 1
+ %114 = OpCompositeExtract %v2half %tint_input 2
+ %115 = OpCompositeConstruct %mat2v2half %113 %114
+ %116 = OpCompositeExtract %int %tint_input 3
+ %117 = OpCompositeConstruct %S %112 %115 %116
+ OpReturnValue %117
OpFunctionEnd
-%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %120
+%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %119
%tint_source = OpFunctionParameter %_arr_S_std140_uint_4
- %121 = OpLabel
- %122 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
- %124 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %125
- OpStore %122 %tint_source
- OpBranch %126
- %126 = OpLabel
- OpBranch %129
- %129 = OpLabel
- %131 = OpPhi %uint %uint_0 %126 %132 %128
- OpLoopMerge %130 %128 None
- OpBranch %127
- %127 = OpLabel
- %134 = OpUGreaterThanEqual %bool %131 %uint_4
- OpSelectionMerge %135 None
- OpBranchConditional %134 %136 %135
- %136 = OpLabel
- OpBranch %130
- %135 = OpLabel
- %137 = OpAccessChain %_ptr_Function_S_std140 %122 %131
- %138 = OpLoad %S_std140 %137 None
- %139 = OpAccessChain %_ptr_Function_S_std140 %124 %131
- OpStore %139 %138 None
+ %120 = OpLabel
+ %121 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
+ %123 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %124
+ OpStore %121 %tint_source
+ OpBranch %125
+ %125 = OpLabel
OpBranch %128
%128 = OpLabel
- %132 = OpIAdd %uint %131 %uint_1
+ %130 = OpPhi %uint %uint_0 %125 %131 %127
+ OpLoopMerge %129 %127 None
+ OpBranch %126
+ %126 = OpLabel
+ %133 = OpUGreaterThanEqual %bool %130 %uint_4
+ OpSelectionMerge %134 None
+ OpBranchConditional %133 %135 %134
+ %135 = OpLabel
OpBranch %129
- %130 = OpLabel
- %133 = OpLoad %_arr_S_std140_uint_4_0 %124 None
- OpReturnValue %133
+ %134 = OpLabel
+ %136 = OpAccessChain %_ptr_Function_S_std140 %121 %130
+ %137 = OpLoad %S_std140 %136 None
+ %138 = OpAccessChain %_ptr_Function_S_std140 %123 %130
+ OpStore %138 %137 None
+ OpBranch %127
+ %127 = OpLabel
+ %131 = OpIAdd %uint %130 %uint_1
+ OpBranch %128
+ %129 = OpLabel
+ %132 = OpLoad %_arr_S_std140_uint_4_0 %123 None
+ OpReturnValue %132
OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/struct/mat2x2_f32/to_storage.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/struct/mat2x2_f32/to_storage.wgsl.expected.spvasm
index 1afb00e..a9cab1d 100644
--- a/test/tint/buffer/uniform/std140/struct/mat2x2_f32/to_storage.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/struct/mat2x2_f32/to_storage.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 140
+; Bound: 139
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -14,17 +14,13 @@
OpName %S_std140 "S_std140"
OpMemberName %u_block_std140_tint_explicit_layout 0 "inner"
OpName %u_block_std140_tint_explicit_layout "u_block_std140_tint_explicit_layout"
- OpMemberName %S_tint_explicit_layout 0 "before"
- OpMemberName %S_tint_explicit_layout 1 "m"
- OpMemberName %S_tint_explicit_layout 2 "after"
- OpName %S_tint_explicit_layout "S_tint_explicit_layout"
- OpMemberName %s_block_tint_explicit_layout 0 "inner"
- OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
- OpName %f "f"
OpMemberName %S 0 "before"
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %S "S"
+ OpMemberName %s_block_tint_explicit_layout 0 "inner"
+ OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
+ OpName %f "f"
OpName %tint_store_and_preserve_padding "tint_store_and_preserve_padding"
OpName %value_param "value_param"
OpName %tint_store_and_preserve_padding_0 "tint_store_and_preserve_padding"
@@ -44,12 +40,12 @@
OpDecorate %1 DescriptorSet 0
OpDecorate %1 Binding 0
OpDecorate %1 NonWritable
- OpMemberDecorate %S_tint_explicit_layout 0 Offset 0
- OpMemberDecorate %S_tint_explicit_layout 1 Offset 8
- OpMemberDecorate %S_tint_explicit_layout 1 ColMajor
- OpMemberDecorate %S_tint_explicit_layout 1 MatrixStride 8
- OpMemberDecorate %S_tint_explicit_layout 2 Offset 64
- OpDecorate %_arr_S_tint_explicit_layout_uint_4 ArrayStride 128
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 8
+ OpMemberDecorate %S 1 ColMajor
+ OpMemberDecorate %S 1 MatrixStride 8
+ OpMemberDecorate %S 2 Offset 64
+ OpDecorate %_arr_S_uint_4 ArrayStride 128
OpMemberDecorate %s_block_tint_explicit_layout 0 Offset 0
OpDecorate %s_block_tint_explicit_layout Block
OpDecorate %11 DescriptorSet 0
@@ -66,9 +62,9 @@
%_ptr_Uniform_u_block_std140_tint_explicit_layout = OpTypePointer Uniform %u_block_std140_tint_explicit_layout
%1 = OpVariable %_ptr_Uniform_u_block_std140_tint_explicit_layout Uniform
%mat2v2float = OpTypeMatrix %v2float 2
-%S_tint_explicit_layout = OpTypeStruct %int %mat2v2float %int
-%_arr_S_tint_explicit_layout_uint_4 = OpTypeArray %S_tint_explicit_layout %uint_4
-%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_tint_explicit_layout_uint_4
+ %S = OpTypeStruct %int %mat2v2float %int
+%_arr_S_uint_4 = OpTypeArray %S %uint_4
+%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_s_block_tint_explicit_layout = OpTypePointer StorageBuffer %s_block_tint_explicit_layout
%11 = OpVariable %_ptr_StorageBuffer_s_block_tint_explicit_layout StorageBuffer
%void = OpTypeVoid
@@ -77,10 +73,9 @@
%uint_0 = OpConstant %uint 0
%_arr_S_std140_uint_4_0 = OpTypeArray %S_std140 %uint_4
%_ptr_Function__arr_S_std140_uint_4_0 = OpTypePointer Function %_arr_S_std140_uint_4_0
- %S = OpTypeStruct %int %mat2v2float %int
-%_arr_S_uint_4 = OpTypeArray %S %uint_4
-%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
- %34 = OpConstantNull %_arr_S_uint_4
+%_arr_S_uint_4_0 = OpTypeArray %S %uint_4
+%_ptr_Function__arr_S_uint_4_0 = OpTypePointer Function %_arr_S_uint_4_0
+ %33 = OpConstantNull %_arr_S_uint_4_0
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%uint_2 = OpConstant %uint 2
%uint_1 = OpConstant %uint 1
@@ -92,152 +87,152 @@
%bool = OpTypeBool
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
- %81 = OpTypeFunction %void %_arr_S_uint_4
- %100 = OpTypeFunction %void %_arr_uint_uint_1 %S
+ %80 = OpTypeFunction %void %_arr_S_uint_4_0
+ %99 = OpTypeFunction %void %_arr_uint_uint_1 %S
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
- %111 = OpTypeFunction %S %S_std140
- %120 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
+ %110 = OpTypeFunction %S %S_std140
+ %119 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
- %125 = OpConstantNull %_arr_S_std140_uint_4_0
+ %124 = OpConstantNull %_arr_S_std140_uint_4_0
%f = OpFunction %void None %19
%20 = OpLabel
%28 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function
- %30 = OpVariable %_ptr_Function__arr_S_uint_4 Function %34
+ %30 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function %33
%21 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %1 %uint_0
%24 = OpLoad %_arr_S_std140_uint_4 %21 None
%25 = OpFunctionCall %_arr_S_std140_uint_4_0 %tint_convert_explicit_layout %24
OpStore %28 %25
- OpBranch %35
- %35 = OpLabel
- OpBranch %38
- %38 = OpLabel
- %40 = OpPhi %uint %uint_0 %35 %41 %37
- OpLoopMerge %39 %37 None
- OpBranch %36
- %36 = OpLabel
- %70 = OpUGreaterThanEqual %bool %40 %uint_4
- OpSelectionMerge %72 None
- OpBranchConditional %70 %73 %72
- %73 = OpLabel
- OpBranch %39
- %72 = OpLabel
- %74 = OpAccessChain %_ptr_Function_S %30 %40
- %76 = OpAccessChain %_ptr_Function_S_std140 %28 %40
- %78 = OpLoad %S_std140 %76 None
- %79 = OpFunctionCall %S %tint_convert_S %78
- OpStore %74 %79 None
+ OpBranch %34
+ %34 = OpLabel
OpBranch %37
%37 = OpLabel
- %41 = OpIAdd %uint %40 %uint_1
+ %39 = OpPhi %uint %uint_0 %34 %40 %36
+ OpLoopMerge %38 %36 None
+ OpBranch %35
+ %35 = OpLabel
+ %69 = OpUGreaterThanEqual %bool %39 %uint_4
+ OpSelectionMerge %71 None
+ OpBranchConditional %69 %72 %71
+ %72 = OpLabel
OpBranch %38
- %39 = OpLabel
- %42 = OpLoad %_arr_S_uint_4 %30 None
- %43 = OpFunctionCall %void %tint_store_and_preserve_padding %42
- %45 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
- %48 = OpLoad %S_std140 %45 None
- %49 = OpFunctionCall %S %tint_convert_S %48
- %53 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
- %54 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %53 %49
- %56 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %11 %uint_0 %uint_3 %uint_1
- %59 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_2 %uint_1
- %61 = OpLoad %v2float %59 None
- %62 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_2 %uint_2
- %63 = OpLoad %v2float %62 None
- %64 = OpCompositeConstruct %mat2v2float %61 %63
- OpStore %56 %64 None
- %65 = OpAccessChain %_ptr_StorageBuffer_v2float %11 %uint_0 %uint_1 %uint_1 %uint_0
- %67 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_0 %uint_2
- %68 = OpLoad %v2float %67 None
- %69 = OpVectorShuffle %v2float %68 %68 1 0
- OpStore %65 %69 None
+ %71 = OpLabel
+ %73 = OpAccessChain %_ptr_Function_S %30 %39
+ %75 = OpAccessChain %_ptr_Function_S_std140 %28 %39
+ %77 = OpLoad %S_std140 %75 None
+ %78 = OpFunctionCall %S %tint_convert_S %77
+ OpStore %73 %78 None
+ OpBranch %36
+ %36 = OpLabel
+ %40 = OpIAdd %uint %39 %uint_1
+ OpBranch %37
+ %38 = OpLabel
+ %41 = OpLoad %_arr_S_uint_4_0 %30 None
+ %42 = OpFunctionCall %void %tint_store_and_preserve_padding %41
+ %44 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
+ %47 = OpLoad %S_std140 %44 None
+ %48 = OpFunctionCall %S %tint_convert_S %47
+ %52 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
+ %53 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %52 %48
+ %55 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %11 %uint_0 %uint_3 %uint_1
+ %58 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_2 %uint_1
+ %60 = OpLoad %v2float %58 None
+ %61 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_2 %uint_2
+ %62 = OpLoad %v2float %61 None
+ %63 = OpCompositeConstruct %mat2v2float %60 %62
+ OpStore %55 %63 None
+ %64 = OpAccessChain %_ptr_StorageBuffer_v2float %11 %uint_0 %uint_1 %uint_1 %uint_0
+ %66 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_0 %uint_2
+ %67 = OpLoad %v2float %66 None
+ %68 = OpVectorShuffle %v2float %67 %67 1 0
+ OpStore %64 %68 None
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding = OpFunction %void None %81
-%value_param = OpFunctionParameter %_arr_S_uint_4
- %82 = OpLabel
- %83 = OpVariable %_ptr_Function__arr_S_uint_4 Function
- OpStore %83 %value_param
- OpBranch %84
- %84 = OpLabel
- OpBranch %87
- %87 = OpLabel
- %89 = OpPhi %uint %uint_0 %84 %90 %86
- OpLoopMerge %88 %86 None
- OpBranch %85
- %85 = OpLabel
- %91 = OpUGreaterThanEqual %bool %89 %uint_4
- OpSelectionMerge %92 None
- OpBranchConditional %91 %93 %92
- %93 = OpLabel
- OpBranch %88
- %92 = OpLabel
- %94 = OpAccessChain %_ptr_Function_S %83 %89
- %95 = OpLoad %S %94 None
- %96 = OpCompositeConstruct %_arr_uint_uint_1 %89
- %97 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %96 %95
+%tint_store_and_preserve_padding = OpFunction %void None %80
+%value_param = OpFunctionParameter %_arr_S_uint_4_0
+ %81 = OpLabel
+ %82 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function
+ OpStore %82 %value_param
+ OpBranch %83
+ %83 = OpLabel
OpBranch %86
%86 = OpLabel
- %90 = OpIAdd %uint %89 %uint_1
+ %88 = OpPhi %uint %uint_0 %83 %89 %85
+ OpLoopMerge %87 %85 None
+ OpBranch %84
+ %84 = OpLabel
+ %90 = OpUGreaterThanEqual %bool %88 %uint_4
+ OpSelectionMerge %91 None
+ OpBranchConditional %90 %92 %91
+ %92 = OpLabel
OpBranch %87
- %88 = OpLabel
+ %91 = OpLabel
+ %93 = OpAccessChain %_ptr_Function_S %82 %88
+ %94 = OpLoad %S %93 None
+ %95 = OpCompositeConstruct %_arr_uint_uint_1 %88
+ %96 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %95 %94
+ OpBranch %85
+ %85 = OpLabel
+ %89 = OpIAdd %uint %88 %uint_1
+ OpBranch %86
+ %87 = OpLabel
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding_0 = OpFunction %void None %100
+%tint_store_and_preserve_padding_0 = OpFunction %void None %99
%target_indices = OpFunctionParameter %_arr_uint_uint_1
%value_param_0 = OpFunctionParameter %S
- %101 = OpLabel
- %102 = OpCompositeExtract %uint %target_indices 0
- %103 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %102 %uint_0
- %105 = OpCompositeExtract %int %value_param_0 0
- OpStore %103 %105 None
- %106 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %11 %uint_0 %102 %uint_1
- %107 = OpCompositeExtract %mat2v2float %value_param_0 1
- OpStore %106 %107 None
- %108 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %102 %uint_2
- %109 = OpCompositeExtract %int %value_param_0 2
- OpStore %108 %109 None
+ %100 = OpLabel
+ %101 = OpCompositeExtract %uint %target_indices 0
+ %102 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %101 %uint_0
+ %104 = OpCompositeExtract %int %value_param_0 0
+ OpStore %102 %104 None
+ %105 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %11 %uint_0 %101 %uint_1
+ %106 = OpCompositeExtract %mat2v2float %value_param_0 1
+ OpStore %105 %106 None
+ %107 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %101 %uint_2
+ %108 = OpCompositeExtract %int %value_param_0 2
+ OpStore %107 %108 None
OpReturn
OpFunctionEnd
-%tint_convert_S = OpFunction %S None %111
+%tint_convert_S = OpFunction %S None %110
%tint_input = OpFunctionParameter %S_std140
- %112 = OpLabel
- %113 = OpCompositeExtract %int %tint_input 0
- %114 = OpCompositeExtract %v2float %tint_input 1
- %115 = OpCompositeExtract %v2float %tint_input 2
- %116 = OpCompositeConstruct %mat2v2float %114 %115
- %117 = OpCompositeExtract %int %tint_input 3
- %118 = OpCompositeConstruct %S %113 %116 %117
- OpReturnValue %118
+ %111 = OpLabel
+ %112 = OpCompositeExtract %int %tint_input 0
+ %113 = OpCompositeExtract %v2float %tint_input 1
+ %114 = OpCompositeExtract %v2float %tint_input 2
+ %115 = OpCompositeConstruct %mat2v2float %113 %114
+ %116 = OpCompositeExtract %int %tint_input 3
+ %117 = OpCompositeConstruct %S %112 %115 %116
+ OpReturnValue %117
OpFunctionEnd
-%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %120
+%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %119
%tint_source = OpFunctionParameter %_arr_S_std140_uint_4
- %121 = OpLabel
- %122 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
- %124 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %125
- OpStore %122 %tint_source
- OpBranch %126
- %126 = OpLabel
- OpBranch %129
- %129 = OpLabel
- %131 = OpPhi %uint %uint_0 %126 %132 %128
- OpLoopMerge %130 %128 None
- OpBranch %127
- %127 = OpLabel
- %134 = OpUGreaterThanEqual %bool %131 %uint_4
- OpSelectionMerge %135 None
- OpBranchConditional %134 %136 %135
- %136 = OpLabel
- OpBranch %130
- %135 = OpLabel
- %137 = OpAccessChain %_ptr_Function_S_std140 %122 %131
- %138 = OpLoad %S_std140 %137 None
- %139 = OpAccessChain %_ptr_Function_S_std140 %124 %131
- OpStore %139 %138 None
+ %120 = OpLabel
+ %121 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
+ %123 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %124
+ OpStore %121 %tint_source
+ OpBranch %125
+ %125 = OpLabel
OpBranch %128
%128 = OpLabel
- %132 = OpIAdd %uint %131 %uint_1
+ %130 = OpPhi %uint %uint_0 %125 %131 %127
+ OpLoopMerge %129 %127 None
+ OpBranch %126
+ %126 = OpLabel
+ %133 = OpUGreaterThanEqual %bool %130 %uint_4
+ OpSelectionMerge %134 None
+ OpBranchConditional %133 %135 %134
+ %135 = OpLabel
OpBranch %129
- %130 = OpLabel
- %133 = OpLoad %_arr_S_std140_uint_4_0 %124 None
- OpReturnValue %133
+ %134 = OpLabel
+ %136 = OpAccessChain %_ptr_Function_S_std140 %121 %130
+ %137 = OpLoad %S_std140 %136 None
+ %138 = OpAccessChain %_ptr_Function_S_std140 %123 %130
+ OpStore %138 %137 None
+ OpBranch %127
+ %127 = OpLabel
+ %131 = OpIAdd %uint %130 %uint_1
+ OpBranch %128
+ %129 = OpLabel
+ %132 = OpLoad %_arr_S_std140_uint_4_0 %123 None
+ OpReturnValue %132
OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/struct/mat2x3_f16/to_storage.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/struct/mat2x3_f16/to_storage.wgsl.expected.spvasm
index 2cb921b..5165252 100644
--- a/test/tint/buffer/uniform/std140/struct/mat2x3_f16/to_storage.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/struct/mat2x3_f16/to_storage.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 151
+; Bound: 150
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -17,17 +17,13 @@
OpName %S_std140 "S_std140"
OpMemberName %u_block_std140_tint_explicit_layout 0 "inner"
OpName %u_block_std140_tint_explicit_layout "u_block_std140_tint_explicit_layout"
- OpMemberName %S_tint_explicit_layout 0 "before"
- OpMemberName %S_tint_explicit_layout 1 "m"
- OpMemberName %S_tint_explicit_layout 2 "after"
- OpName %S_tint_explicit_layout "S_tint_explicit_layout"
- OpMemberName %s_block_tint_explicit_layout 0 "inner"
- OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
- OpName %f "f"
OpMemberName %S 0 "before"
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %S "S"
+ OpMemberName %s_block_tint_explicit_layout 0 "inner"
+ OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
+ OpName %f "f"
OpName %tint_store_and_preserve_padding "tint_store_and_preserve_padding"
OpName %value_param "value_param"
OpName %tint_store_and_preserve_padding_0 "tint_store_and_preserve_padding"
@@ -50,12 +46,12 @@
OpDecorate %1 DescriptorSet 0
OpDecorate %1 Binding 0
OpDecorate %1 NonWritable
- OpMemberDecorate %S_tint_explicit_layout 0 Offset 0
- OpMemberDecorate %S_tint_explicit_layout 1 Offset 8
- OpMemberDecorate %S_tint_explicit_layout 1 ColMajor
- OpMemberDecorate %S_tint_explicit_layout 1 MatrixStride 8
- OpMemberDecorate %S_tint_explicit_layout 2 Offset 64
- OpDecorate %_arr_S_tint_explicit_layout_uint_4 ArrayStride 128
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 8
+ OpMemberDecorate %S 1 ColMajor
+ OpMemberDecorate %S 1 MatrixStride 8
+ OpMemberDecorate %S 2 Offset 64
+ OpDecorate %_arr_S_uint_4 ArrayStride 128
OpMemberDecorate %s_block_tint_explicit_layout 0 Offset 0
OpDecorate %s_block_tint_explicit_layout Block
OpDecorate %11 DescriptorSet 0
@@ -72,9 +68,9 @@
%_ptr_Uniform_u_block_std140_tint_explicit_layout = OpTypePointer Uniform %u_block_std140_tint_explicit_layout
%1 = OpVariable %_ptr_Uniform_u_block_std140_tint_explicit_layout Uniform
%mat2v3half = OpTypeMatrix %v3half 2
-%S_tint_explicit_layout = OpTypeStruct %int %mat2v3half %int
-%_arr_S_tint_explicit_layout_uint_4 = OpTypeArray %S_tint_explicit_layout %uint_4
-%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_tint_explicit_layout_uint_4
+ %S = OpTypeStruct %int %mat2v3half %int
+%_arr_S_uint_4 = OpTypeArray %S %uint_4
+%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_s_block_tint_explicit_layout = OpTypePointer StorageBuffer %s_block_tint_explicit_layout
%11 = OpVariable %_ptr_StorageBuffer_s_block_tint_explicit_layout StorageBuffer
%void = OpTypeVoid
@@ -83,10 +79,9 @@
%uint_0 = OpConstant %uint 0
%_arr_S_std140_uint_4_0 = OpTypeArray %S_std140 %uint_4
%_ptr_Function__arr_S_std140_uint_4_0 = OpTypePointer Function %_arr_S_std140_uint_4_0
- %S = OpTypeStruct %int %mat2v3half %int
-%_arr_S_uint_4 = OpTypeArray %S %uint_4
-%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
- %34 = OpConstantNull %_arr_S_uint_4
+%_arr_S_uint_4_0 = OpTypeArray %S %uint_4
+%_ptr_Function__arr_S_uint_4_0 = OpTypePointer Function %_arr_S_uint_4_0
+ %33 = OpConstantNull %_arr_S_uint_4_0
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%uint_2 = OpConstant %uint 2
%uint_1 = OpConstant %uint 1
@@ -97,166 +92,166 @@
%bool = OpTypeBool
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
- %82 = OpTypeFunction %void %_arr_S_uint_4
- %101 = OpTypeFunction %void %_arr_uint_uint_1 %S
+ %81 = OpTypeFunction %void %_arr_S_uint_4_0
+ %100 = OpTypeFunction %void %_arr_uint_uint_1 %S
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
- %114 = OpTypeFunction %void %_arr_uint_uint_1 %mat2v3half
- %122 = OpTypeFunction %S %S_std140
- %131 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
+ %113 = OpTypeFunction %void %_arr_uint_uint_1 %mat2v3half
+ %121 = OpTypeFunction %S %S_std140
+ %130 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
- %136 = OpConstantNull %_arr_S_std140_uint_4_0
+ %135 = OpConstantNull %_arr_S_std140_uint_4_0
%f = OpFunction %void None %19
%20 = OpLabel
%28 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function
- %30 = OpVariable %_ptr_Function__arr_S_uint_4 Function %34
+ %30 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function %33
%21 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %1 %uint_0
%24 = OpLoad %_arr_S_std140_uint_4 %21 None
%25 = OpFunctionCall %_arr_S_std140_uint_4_0 %tint_convert_explicit_layout %24
OpStore %28 %25
- OpBranch %35
- %35 = OpLabel
- OpBranch %38
- %38 = OpLabel
- %40 = OpPhi %uint %uint_0 %35 %41 %37
- OpLoopMerge %39 %37 None
- OpBranch %36
- %36 = OpLabel
- %71 = OpUGreaterThanEqual %bool %40 %uint_4
- OpSelectionMerge %73 None
- OpBranchConditional %71 %74 %73
- %74 = OpLabel
- OpBranch %39
- %73 = OpLabel
- %75 = OpAccessChain %_ptr_Function_S %30 %40
- %77 = OpAccessChain %_ptr_Function_S_std140 %28 %40
- %79 = OpLoad %S_std140 %77 None
- %80 = OpFunctionCall %S %tint_convert_S %79
- OpStore %75 %80 None
+ OpBranch %34
+ %34 = OpLabel
OpBranch %37
%37 = OpLabel
- %41 = OpIAdd %uint %40 %uint_1
+ %39 = OpPhi %uint %uint_0 %34 %40 %36
+ OpLoopMerge %38 %36 None
+ OpBranch %35
+ %35 = OpLabel
+ %70 = OpUGreaterThanEqual %bool %39 %uint_4
+ OpSelectionMerge %72 None
+ OpBranchConditional %70 %73 %72
+ %73 = OpLabel
OpBranch %38
- %39 = OpLabel
- %42 = OpLoad %_arr_S_uint_4 %30 None
- %43 = OpFunctionCall %void %tint_store_and_preserve_padding %42
- %45 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
- %48 = OpLoad %S_std140 %45 None
- %49 = OpFunctionCall %S %tint_convert_S %48
- %53 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
- %54 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %53 %49
- %56 = OpAccessChain %_ptr_Uniform_v3half %1 %uint_0 %uint_2 %uint_1
- %58 = OpLoad %v3half %56 None
- %59 = OpAccessChain %_ptr_Uniform_v3half %1 %uint_0 %uint_2 %uint_2
- %60 = OpLoad %v3half %59 None
- %61 = OpCompositeConstruct %mat2v3half %58 %60
- %62 = OpCompositeConstruct %_arr_uint_uint_1 %uint_3
- %64 = OpFunctionCall %void %tint_store_and_preserve_padding_1 %62 %61
- %66 = OpAccessChain %_ptr_StorageBuffer_v3half %11 %uint_0 %uint_1 %uint_1 %uint_0
- %68 = OpAccessChain %_ptr_Uniform_v3half %1 %uint_0 %uint_0 %uint_2
- %69 = OpLoad %v3half %68 None
- %70 = OpVectorShuffle %v3half %69 %69 2 0 1
- OpStore %66 %70 None
+ %72 = OpLabel
+ %74 = OpAccessChain %_ptr_Function_S %30 %39
+ %76 = OpAccessChain %_ptr_Function_S_std140 %28 %39
+ %78 = OpLoad %S_std140 %76 None
+ %79 = OpFunctionCall %S %tint_convert_S %78
+ OpStore %74 %79 None
+ OpBranch %36
+ %36 = OpLabel
+ %40 = OpIAdd %uint %39 %uint_1
+ OpBranch %37
+ %38 = OpLabel
+ %41 = OpLoad %_arr_S_uint_4_0 %30 None
+ %42 = OpFunctionCall %void %tint_store_and_preserve_padding %41
+ %44 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
+ %47 = OpLoad %S_std140 %44 None
+ %48 = OpFunctionCall %S %tint_convert_S %47
+ %52 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
+ %53 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %52 %48
+ %55 = OpAccessChain %_ptr_Uniform_v3half %1 %uint_0 %uint_2 %uint_1
+ %57 = OpLoad %v3half %55 None
+ %58 = OpAccessChain %_ptr_Uniform_v3half %1 %uint_0 %uint_2 %uint_2
+ %59 = OpLoad %v3half %58 None
+ %60 = OpCompositeConstruct %mat2v3half %57 %59
+ %61 = OpCompositeConstruct %_arr_uint_uint_1 %uint_3
+ %63 = OpFunctionCall %void %tint_store_and_preserve_padding_1 %61 %60
+ %65 = OpAccessChain %_ptr_StorageBuffer_v3half %11 %uint_0 %uint_1 %uint_1 %uint_0
+ %67 = OpAccessChain %_ptr_Uniform_v3half %1 %uint_0 %uint_0 %uint_2
+ %68 = OpLoad %v3half %67 None
+ %69 = OpVectorShuffle %v3half %68 %68 2 0 1
+ OpStore %65 %69 None
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding = OpFunction %void None %82
-%value_param = OpFunctionParameter %_arr_S_uint_4
- %83 = OpLabel
- %84 = OpVariable %_ptr_Function__arr_S_uint_4 Function
- OpStore %84 %value_param
- OpBranch %85
- %85 = OpLabel
- OpBranch %88
- %88 = OpLabel
- %90 = OpPhi %uint %uint_0 %85 %91 %87
- OpLoopMerge %89 %87 None
- OpBranch %86
- %86 = OpLabel
- %92 = OpUGreaterThanEqual %bool %90 %uint_4
- OpSelectionMerge %93 None
- OpBranchConditional %92 %94 %93
- %94 = OpLabel
- OpBranch %89
- %93 = OpLabel
- %95 = OpAccessChain %_ptr_Function_S %84 %90
- %96 = OpLoad %S %95 None
- %97 = OpCompositeConstruct %_arr_uint_uint_1 %90
- %98 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %97 %96
+%tint_store_and_preserve_padding = OpFunction %void None %81
+%value_param = OpFunctionParameter %_arr_S_uint_4_0
+ %82 = OpLabel
+ %83 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function
+ OpStore %83 %value_param
+ OpBranch %84
+ %84 = OpLabel
OpBranch %87
%87 = OpLabel
- %91 = OpIAdd %uint %90 %uint_1
+ %89 = OpPhi %uint %uint_0 %84 %90 %86
+ OpLoopMerge %88 %86 None
+ OpBranch %85
+ %85 = OpLabel
+ %91 = OpUGreaterThanEqual %bool %89 %uint_4
+ OpSelectionMerge %92 None
+ OpBranchConditional %91 %93 %92
+ %93 = OpLabel
OpBranch %88
- %89 = OpLabel
+ %92 = OpLabel
+ %94 = OpAccessChain %_ptr_Function_S %83 %89
+ %95 = OpLoad %S %94 None
+ %96 = OpCompositeConstruct %_arr_uint_uint_1 %89
+ %97 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %96 %95
+ OpBranch %86
+ %86 = OpLabel
+ %90 = OpIAdd %uint %89 %uint_1
+ OpBranch %87
+ %88 = OpLabel
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding_0 = OpFunction %void None %101
+%tint_store_and_preserve_padding_0 = OpFunction %void None %100
%target_indices = OpFunctionParameter %_arr_uint_uint_1
%value_param_0 = OpFunctionParameter %S
- %102 = OpLabel
- %103 = OpCompositeExtract %uint %target_indices 0
- %104 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %103 %uint_0
- %106 = OpCompositeExtract %int %value_param_0 0
- OpStore %104 %106 None
- %107 = OpCompositeExtract %mat2v3half %value_param_0 1
- %108 = OpCompositeConstruct %_arr_uint_uint_1 %103
- %109 = OpFunctionCall %void %tint_store_and_preserve_padding_1 %108 %107
- %110 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %103 %uint_2
- %111 = OpCompositeExtract %int %value_param_0 2
- OpStore %110 %111 None
+ %101 = OpLabel
+ %102 = OpCompositeExtract %uint %target_indices 0
+ %103 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %102 %uint_0
+ %105 = OpCompositeExtract %int %value_param_0 0
+ OpStore %103 %105 None
+ %106 = OpCompositeExtract %mat2v3half %value_param_0 1
+ %107 = OpCompositeConstruct %_arr_uint_uint_1 %102
+ %108 = OpFunctionCall %void %tint_store_and_preserve_padding_1 %107 %106
+ %109 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %102 %uint_2
+ %110 = OpCompositeExtract %int %value_param_0 2
+ OpStore %109 %110 None
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding_1 = OpFunction %void None %114
+%tint_store_and_preserve_padding_1 = OpFunction %void None %113
%target_indices_0 = OpFunctionParameter %_arr_uint_uint_1
%value_param_1 = OpFunctionParameter %mat2v3half
- %115 = OpLabel
- %116 = OpCompositeExtract %uint %target_indices_0 0
- %117 = OpAccessChain %_ptr_StorageBuffer_v3half %11 %uint_0 %116 %uint_1 %uint_0
- %118 = OpCompositeExtract %v3half %value_param_1 0
- OpStore %117 %118 None
- %119 = OpAccessChain %_ptr_StorageBuffer_v3half %11 %uint_0 %116 %uint_1 %uint_1
- %120 = OpCompositeExtract %v3half %value_param_1 1
- OpStore %119 %120 None
+ %114 = OpLabel
+ %115 = OpCompositeExtract %uint %target_indices_0 0
+ %116 = OpAccessChain %_ptr_StorageBuffer_v3half %11 %uint_0 %115 %uint_1 %uint_0
+ %117 = OpCompositeExtract %v3half %value_param_1 0
+ OpStore %116 %117 None
+ %118 = OpAccessChain %_ptr_StorageBuffer_v3half %11 %uint_0 %115 %uint_1 %uint_1
+ %119 = OpCompositeExtract %v3half %value_param_1 1
+ OpStore %118 %119 None
OpReturn
OpFunctionEnd
-%tint_convert_S = OpFunction %S None %122
+%tint_convert_S = OpFunction %S None %121
%tint_input = OpFunctionParameter %S_std140
- %123 = OpLabel
- %124 = OpCompositeExtract %int %tint_input 0
- %125 = OpCompositeExtract %v3half %tint_input 1
- %126 = OpCompositeExtract %v3half %tint_input 2
- %127 = OpCompositeConstruct %mat2v3half %125 %126
- %128 = OpCompositeExtract %int %tint_input 3
- %129 = OpCompositeConstruct %S %124 %127 %128
- OpReturnValue %129
+ %122 = OpLabel
+ %123 = OpCompositeExtract %int %tint_input 0
+ %124 = OpCompositeExtract %v3half %tint_input 1
+ %125 = OpCompositeExtract %v3half %tint_input 2
+ %126 = OpCompositeConstruct %mat2v3half %124 %125
+ %127 = OpCompositeExtract %int %tint_input 3
+ %128 = OpCompositeConstruct %S %123 %126 %127
+ OpReturnValue %128
OpFunctionEnd
-%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %131
+%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %130
%tint_source = OpFunctionParameter %_arr_S_std140_uint_4
- %132 = OpLabel
- %133 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
- %135 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %136
- OpStore %133 %tint_source
- OpBranch %137
- %137 = OpLabel
- OpBranch %140
- %140 = OpLabel
- %142 = OpPhi %uint %uint_0 %137 %143 %139
- OpLoopMerge %141 %139 None
- OpBranch %138
- %138 = OpLabel
- %145 = OpUGreaterThanEqual %bool %142 %uint_4
- OpSelectionMerge %146 None
- OpBranchConditional %145 %147 %146
- %147 = OpLabel
- OpBranch %141
- %146 = OpLabel
- %148 = OpAccessChain %_ptr_Function_S_std140 %133 %142
- %149 = OpLoad %S_std140 %148 None
- %150 = OpAccessChain %_ptr_Function_S_std140 %135 %142
- OpStore %150 %149 None
+ %131 = OpLabel
+ %132 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
+ %134 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %135
+ OpStore %132 %tint_source
+ OpBranch %136
+ %136 = OpLabel
OpBranch %139
%139 = OpLabel
- %143 = OpIAdd %uint %142 %uint_1
+ %141 = OpPhi %uint %uint_0 %136 %142 %138
+ OpLoopMerge %140 %138 None
+ OpBranch %137
+ %137 = OpLabel
+ %144 = OpUGreaterThanEqual %bool %141 %uint_4
+ OpSelectionMerge %145 None
+ OpBranchConditional %144 %146 %145
+ %146 = OpLabel
OpBranch %140
- %141 = OpLabel
- %144 = OpLoad %_arr_S_std140_uint_4_0 %135 None
- OpReturnValue %144
+ %145 = OpLabel
+ %147 = OpAccessChain %_ptr_Function_S_std140 %132 %141
+ %148 = OpLoad %S_std140 %147 None
+ %149 = OpAccessChain %_ptr_Function_S_std140 %134 %141
+ OpStore %149 %148 None
+ OpBranch %138
+ %138 = OpLabel
+ %142 = OpIAdd %uint %141 %uint_1
+ OpBranch %139
+ %140 = OpLabel
+ %143 = OpLoad %_arr_S_std140_uint_4_0 %134 None
+ OpReturnValue %143
OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/struct/mat2x3_f32/to_storage.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/struct/mat2x3_f32/to_storage.wgsl.expected.spvasm
index c78ee38..9351f52 100644
--- a/test/tint/buffer/uniform/std140/struct/mat2x3_f32/to_storage.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/struct/mat2x3_f32/to_storage.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 151
+; Bound: 150
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -14,17 +14,13 @@
OpName %S_std140 "S_std140"
OpMemberName %u_block_std140_tint_explicit_layout 0 "inner"
OpName %u_block_std140_tint_explicit_layout "u_block_std140_tint_explicit_layout"
- OpMemberName %S_tint_explicit_layout 0 "before"
- OpMemberName %S_tint_explicit_layout 1 "m"
- OpMemberName %S_tint_explicit_layout 2 "after"
- OpName %S_tint_explicit_layout "S_tint_explicit_layout"
- OpMemberName %s_block_tint_explicit_layout 0 "inner"
- OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
- OpName %f "f"
OpMemberName %S 0 "before"
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %S "S"
+ OpMemberName %s_block_tint_explicit_layout 0 "inner"
+ OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
+ OpName %f "f"
OpName %tint_store_and_preserve_padding "tint_store_and_preserve_padding"
OpName %value_param "value_param"
OpName %tint_store_and_preserve_padding_0 "tint_store_and_preserve_padding"
@@ -47,12 +43,12 @@
OpDecorate %1 DescriptorSet 0
OpDecorate %1 Binding 0
OpDecorate %1 NonWritable
- OpMemberDecorate %S_tint_explicit_layout 0 Offset 0
- OpMemberDecorate %S_tint_explicit_layout 1 Offset 16
- OpMemberDecorate %S_tint_explicit_layout 1 ColMajor
- OpMemberDecorate %S_tint_explicit_layout 1 MatrixStride 16
- OpMemberDecorate %S_tint_explicit_layout 2 Offset 64
- OpDecorate %_arr_S_tint_explicit_layout_uint_4 ArrayStride 128
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 16
+ OpMemberDecorate %S 1 ColMajor
+ OpMemberDecorate %S 1 MatrixStride 16
+ OpMemberDecorate %S 2 Offset 64
+ OpDecorate %_arr_S_uint_4 ArrayStride 128
OpMemberDecorate %s_block_tint_explicit_layout 0 Offset 0
OpDecorate %s_block_tint_explicit_layout Block
OpDecorate %11 DescriptorSet 0
@@ -69,9 +65,9 @@
%_ptr_Uniform_u_block_std140_tint_explicit_layout = OpTypePointer Uniform %u_block_std140_tint_explicit_layout
%1 = OpVariable %_ptr_Uniform_u_block_std140_tint_explicit_layout Uniform
%mat2v3float = OpTypeMatrix %v3float 2
-%S_tint_explicit_layout = OpTypeStruct %int %mat2v3float %int
-%_arr_S_tint_explicit_layout_uint_4 = OpTypeArray %S_tint_explicit_layout %uint_4
-%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_tint_explicit_layout_uint_4
+ %S = OpTypeStruct %int %mat2v3float %int
+%_arr_S_uint_4 = OpTypeArray %S %uint_4
+%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_s_block_tint_explicit_layout = OpTypePointer StorageBuffer %s_block_tint_explicit_layout
%11 = OpVariable %_ptr_StorageBuffer_s_block_tint_explicit_layout StorageBuffer
%void = OpTypeVoid
@@ -80,10 +76,9 @@
%uint_0 = OpConstant %uint 0
%_arr_S_std140_uint_4_0 = OpTypeArray %S_std140 %uint_4
%_ptr_Function__arr_S_std140_uint_4_0 = OpTypePointer Function %_arr_S_std140_uint_4_0
- %S = OpTypeStruct %int %mat2v3float %int
-%_arr_S_uint_4 = OpTypeArray %S %uint_4
-%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
- %34 = OpConstantNull %_arr_S_uint_4
+%_arr_S_uint_4_0 = OpTypeArray %S %uint_4
+%_ptr_Function__arr_S_uint_4_0 = OpTypePointer Function %_arr_S_uint_4_0
+ %33 = OpConstantNull %_arr_S_uint_4_0
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%uint_2 = OpConstant %uint 2
%uint_1 = OpConstant %uint 1
@@ -94,166 +89,166 @@
%bool = OpTypeBool
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
- %82 = OpTypeFunction %void %_arr_S_uint_4
- %101 = OpTypeFunction %void %_arr_uint_uint_1 %S
+ %81 = OpTypeFunction %void %_arr_S_uint_4_0
+ %100 = OpTypeFunction %void %_arr_uint_uint_1 %S
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
- %114 = OpTypeFunction %void %_arr_uint_uint_1 %mat2v3float
- %122 = OpTypeFunction %S %S_std140
- %131 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
+ %113 = OpTypeFunction %void %_arr_uint_uint_1 %mat2v3float
+ %121 = OpTypeFunction %S %S_std140
+ %130 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
- %136 = OpConstantNull %_arr_S_std140_uint_4_0
+ %135 = OpConstantNull %_arr_S_std140_uint_4_0
%f = OpFunction %void None %19
%20 = OpLabel
%28 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function
- %30 = OpVariable %_ptr_Function__arr_S_uint_4 Function %34
+ %30 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function %33
%21 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %1 %uint_0
%24 = OpLoad %_arr_S_std140_uint_4 %21 None
%25 = OpFunctionCall %_arr_S_std140_uint_4_0 %tint_convert_explicit_layout %24
OpStore %28 %25
- OpBranch %35
- %35 = OpLabel
- OpBranch %38
- %38 = OpLabel
- %40 = OpPhi %uint %uint_0 %35 %41 %37
- OpLoopMerge %39 %37 None
- OpBranch %36
- %36 = OpLabel
- %71 = OpUGreaterThanEqual %bool %40 %uint_4
- OpSelectionMerge %73 None
- OpBranchConditional %71 %74 %73
- %74 = OpLabel
- OpBranch %39
- %73 = OpLabel
- %75 = OpAccessChain %_ptr_Function_S %30 %40
- %77 = OpAccessChain %_ptr_Function_S_std140 %28 %40
- %79 = OpLoad %S_std140 %77 None
- %80 = OpFunctionCall %S %tint_convert_S %79
- OpStore %75 %80 None
+ OpBranch %34
+ %34 = OpLabel
OpBranch %37
%37 = OpLabel
- %41 = OpIAdd %uint %40 %uint_1
+ %39 = OpPhi %uint %uint_0 %34 %40 %36
+ OpLoopMerge %38 %36 None
+ OpBranch %35
+ %35 = OpLabel
+ %70 = OpUGreaterThanEqual %bool %39 %uint_4
+ OpSelectionMerge %72 None
+ OpBranchConditional %70 %73 %72
+ %73 = OpLabel
OpBranch %38
- %39 = OpLabel
- %42 = OpLoad %_arr_S_uint_4 %30 None
- %43 = OpFunctionCall %void %tint_store_and_preserve_padding %42
- %45 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
- %48 = OpLoad %S_std140 %45 None
- %49 = OpFunctionCall %S %tint_convert_S %48
- %53 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
- %54 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %53 %49
- %56 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_0 %uint_2 %uint_1
- %58 = OpLoad %v3float %56 None
- %59 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_0 %uint_2 %uint_2
- %60 = OpLoad %v3float %59 None
- %61 = OpCompositeConstruct %mat2v3float %58 %60
- %62 = OpCompositeConstruct %_arr_uint_uint_1 %uint_3
- %64 = OpFunctionCall %void %tint_store_and_preserve_padding_1 %62 %61
- %66 = OpAccessChain %_ptr_StorageBuffer_v3float %11 %uint_0 %uint_1 %uint_1 %uint_0
- %68 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_0 %uint_0 %uint_2
- %69 = OpLoad %v3float %68 None
- %70 = OpVectorShuffle %v3float %69 %69 2 0 1
- OpStore %66 %70 None
+ %72 = OpLabel
+ %74 = OpAccessChain %_ptr_Function_S %30 %39
+ %76 = OpAccessChain %_ptr_Function_S_std140 %28 %39
+ %78 = OpLoad %S_std140 %76 None
+ %79 = OpFunctionCall %S %tint_convert_S %78
+ OpStore %74 %79 None
+ OpBranch %36
+ %36 = OpLabel
+ %40 = OpIAdd %uint %39 %uint_1
+ OpBranch %37
+ %38 = OpLabel
+ %41 = OpLoad %_arr_S_uint_4_0 %30 None
+ %42 = OpFunctionCall %void %tint_store_and_preserve_padding %41
+ %44 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
+ %47 = OpLoad %S_std140 %44 None
+ %48 = OpFunctionCall %S %tint_convert_S %47
+ %52 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
+ %53 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %52 %48
+ %55 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_0 %uint_2 %uint_1
+ %57 = OpLoad %v3float %55 None
+ %58 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_0 %uint_2 %uint_2
+ %59 = OpLoad %v3float %58 None
+ %60 = OpCompositeConstruct %mat2v3float %57 %59
+ %61 = OpCompositeConstruct %_arr_uint_uint_1 %uint_3
+ %63 = OpFunctionCall %void %tint_store_and_preserve_padding_1 %61 %60
+ %65 = OpAccessChain %_ptr_StorageBuffer_v3float %11 %uint_0 %uint_1 %uint_1 %uint_0
+ %67 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_0 %uint_0 %uint_2
+ %68 = OpLoad %v3float %67 None
+ %69 = OpVectorShuffle %v3float %68 %68 2 0 1
+ OpStore %65 %69 None
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding = OpFunction %void None %82
-%value_param = OpFunctionParameter %_arr_S_uint_4
- %83 = OpLabel
- %84 = OpVariable %_ptr_Function__arr_S_uint_4 Function
- OpStore %84 %value_param
- OpBranch %85
- %85 = OpLabel
- OpBranch %88
- %88 = OpLabel
- %90 = OpPhi %uint %uint_0 %85 %91 %87
- OpLoopMerge %89 %87 None
- OpBranch %86
- %86 = OpLabel
- %92 = OpUGreaterThanEqual %bool %90 %uint_4
- OpSelectionMerge %93 None
- OpBranchConditional %92 %94 %93
- %94 = OpLabel
- OpBranch %89
- %93 = OpLabel
- %95 = OpAccessChain %_ptr_Function_S %84 %90
- %96 = OpLoad %S %95 None
- %97 = OpCompositeConstruct %_arr_uint_uint_1 %90
- %98 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %97 %96
+%tint_store_and_preserve_padding = OpFunction %void None %81
+%value_param = OpFunctionParameter %_arr_S_uint_4_0
+ %82 = OpLabel
+ %83 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function
+ OpStore %83 %value_param
+ OpBranch %84
+ %84 = OpLabel
OpBranch %87
%87 = OpLabel
- %91 = OpIAdd %uint %90 %uint_1
+ %89 = OpPhi %uint %uint_0 %84 %90 %86
+ OpLoopMerge %88 %86 None
+ OpBranch %85
+ %85 = OpLabel
+ %91 = OpUGreaterThanEqual %bool %89 %uint_4
+ OpSelectionMerge %92 None
+ OpBranchConditional %91 %93 %92
+ %93 = OpLabel
OpBranch %88
- %89 = OpLabel
+ %92 = OpLabel
+ %94 = OpAccessChain %_ptr_Function_S %83 %89
+ %95 = OpLoad %S %94 None
+ %96 = OpCompositeConstruct %_arr_uint_uint_1 %89
+ %97 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %96 %95
+ OpBranch %86
+ %86 = OpLabel
+ %90 = OpIAdd %uint %89 %uint_1
+ OpBranch %87
+ %88 = OpLabel
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding_0 = OpFunction %void None %101
+%tint_store_and_preserve_padding_0 = OpFunction %void None %100
%target_indices = OpFunctionParameter %_arr_uint_uint_1
%value_param_0 = OpFunctionParameter %S
- %102 = OpLabel
- %103 = OpCompositeExtract %uint %target_indices 0
- %104 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %103 %uint_0
- %106 = OpCompositeExtract %int %value_param_0 0
- OpStore %104 %106 None
- %107 = OpCompositeExtract %mat2v3float %value_param_0 1
- %108 = OpCompositeConstruct %_arr_uint_uint_1 %103
- %109 = OpFunctionCall %void %tint_store_and_preserve_padding_1 %108 %107
- %110 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %103 %uint_2
- %111 = OpCompositeExtract %int %value_param_0 2
- OpStore %110 %111 None
+ %101 = OpLabel
+ %102 = OpCompositeExtract %uint %target_indices 0
+ %103 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %102 %uint_0
+ %105 = OpCompositeExtract %int %value_param_0 0
+ OpStore %103 %105 None
+ %106 = OpCompositeExtract %mat2v3float %value_param_0 1
+ %107 = OpCompositeConstruct %_arr_uint_uint_1 %102
+ %108 = OpFunctionCall %void %tint_store_and_preserve_padding_1 %107 %106
+ %109 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %102 %uint_2
+ %110 = OpCompositeExtract %int %value_param_0 2
+ OpStore %109 %110 None
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding_1 = OpFunction %void None %114
+%tint_store_and_preserve_padding_1 = OpFunction %void None %113
%target_indices_0 = OpFunctionParameter %_arr_uint_uint_1
%value_param_1 = OpFunctionParameter %mat2v3float
- %115 = OpLabel
- %116 = OpCompositeExtract %uint %target_indices_0 0
- %117 = OpAccessChain %_ptr_StorageBuffer_v3float %11 %uint_0 %116 %uint_1 %uint_0
- %118 = OpCompositeExtract %v3float %value_param_1 0
- OpStore %117 %118 None
- %119 = OpAccessChain %_ptr_StorageBuffer_v3float %11 %uint_0 %116 %uint_1 %uint_1
- %120 = OpCompositeExtract %v3float %value_param_1 1
- OpStore %119 %120 None
+ %114 = OpLabel
+ %115 = OpCompositeExtract %uint %target_indices_0 0
+ %116 = OpAccessChain %_ptr_StorageBuffer_v3float %11 %uint_0 %115 %uint_1 %uint_0
+ %117 = OpCompositeExtract %v3float %value_param_1 0
+ OpStore %116 %117 None
+ %118 = OpAccessChain %_ptr_StorageBuffer_v3float %11 %uint_0 %115 %uint_1 %uint_1
+ %119 = OpCompositeExtract %v3float %value_param_1 1
+ OpStore %118 %119 None
OpReturn
OpFunctionEnd
-%tint_convert_S = OpFunction %S None %122
+%tint_convert_S = OpFunction %S None %121
%tint_input = OpFunctionParameter %S_std140
- %123 = OpLabel
- %124 = OpCompositeExtract %int %tint_input 0
- %125 = OpCompositeExtract %v3float %tint_input 1
- %126 = OpCompositeExtract %v3float %tint_input 2
- %127 = OpCompositeConstruct %mat2v3float %125 %126
- %128 = OpCompositeExtract %int %tint_input 3
- %129 = OpCompositeConstruct %S %124 %127 %128
- OpReturnValue %129
+ %122 = OpLabel
+ %123 = OpCompositeExtract %int %tint_input 0
+ %124 = OpCompositeExtract %v3float %tint_input 1
+ %125 = OpCompositeExtract %v3float %tint_input 2
+ %126 = OpCompositeConstruct %mat2v3float %124 %125
+ %127 = OpCompositeExtract %int %tint_input 3
+ %128 = OpCompositeConstruct %S %123 %126 %127
+ OpReturnValue %128
OpFunctionEnd
-%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %131
+%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %130
%tint_source = OpFunctionParameter %_arr_S_std140_uint_4
- %132 = OpLabel
- %133 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
- %135 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %136
- OpStore %133 %tint_source
- OpBranch %137
- %137 = OpLabel
- OpBranch %140
- %140 = OpLabel
- %142 = OpPhi %uint %uint_0 %137 %143 %139
- OpLoopMerge %141 %139 None
- OpBranch %138
- %138 = OpLabel
- %145 = OpUGreaterThanEqual %bool %142 %uint_4
- OpSelectionMerge %146 None
- OpBranchConditional %145 %147 %146
- %147 = OpLabel
- OpBranch %141
- %146 = OpLabel
- %148 = OpAccessChain %_ptr_Function_S_std140 %133 %142
- %149 = OpLoad %S_std140 %148 None
- %150 = OpAccessChain %_ptr_Function_S_std140 %135 %142
- OpStore %150 %149 None
+ %131 = OpLabel
+ %132 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
+ %134 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %135
+ OpStore %132 %tint_source
+ OpBranch %136
+ %136 = OpLabel
OpBranch %139
%139 = OpLabel
- %143 = OpIAdd %uint %142 %uint_1
+ %141 = OpPhi %uint %uint_0 %136 %142 %138
+ OpLoopMerge %140 %138 None
+ OpBranch %137
+ %137 = OpLabel
+ %144 = OpUGreaterThanEqual %bool %141 %uint_4
+ OpSelectionMerge %145 None
+ OpBranchConditional %144 %146 %145
+ %146 = OpLabel
OpBranch %140
- %141 = OpLabel
- %144 = OpLoad %_arr_S_std140_uint_4_0 %135 None
- OpReturnValue %144
+ %145 = OpLabel
+ %147 = OpAccessChain %_ptr_Function_S_std140 %132 %141
+ %148 = OpLoad %S_std140 %147 None
+ %149 = OpAccessChain %_ptr_Function_S_std140 %134 %141
+ OpStore %149 %148 None
+ OpBranch %138
+ %138 = OpLabel
+ %142 = OpIAdd %uint %141 %uint_1
+ OpBranch %139
+ %140 = OpLabel
+ %143 = OpLoad %_arr_S_std140_uint_4_0 %134 None
+ OpReturnValue %143
OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/struct/mat2x4_f16/to_storage.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/struct/mat2x4_f16/to_storage.wgsl.expected.spvasm
index 839c5dc..d88adcf 100644
--- a/test/tint/buffer/uniform/std140/struct/mat2x4_f16/to_storage.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/struct/mat2x4_f16/to_storage.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 140
+; Bound: 139
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -17,17 +17,13 @@
OpName %S_std140 "S_std140"
OpMemberName %u_block_std140_tint_explicit_layout 0 "inner"
OpName %u_block_std140_tint_explicit_layout "u_block_std140_tint_explicit_layout"
- OpMemberName %S_tint_explicit_layout 0 "before"
- OpMemberName %S_tint_explicit_layout 1 "m"
- OpMemberName %S_tint_explicit_layout 2 "after"
- OpName %S_tint_explicit_layout "S_tint_explicit_layout"
- OpMemberName %s_block_tint_explicit_layout 0 "inner"
- OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
- OpName %f "f"
OpMemberName %S 0 "before"
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %S "S"
+ OpMemberName %s_block_tint_explicit_layout 0 "inner"
+ OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
+ OpName %f "f"
OpName %tint_store_and_preserve_padding "tint_store_and_preserve_padding"
OpName %value_param "value_param"
OpName %tint_store_and_preserve_padding_0 "tint_store_and_preserve_padding"
@@ -47,12 +43,12 @@
OpDecorate %1 DescriptorSet 0
OpDecorate %1 Binding 0
OpDecorate %1 NonWritable
- OpMemberDecorate %S_tint_explicit_layout 0 Offset 0
- OpMemberDecorate %S_tint_explicit_layout 1 Offset 8
- OpMemberDecorate %S_tint_explicit_layout 1 ColMajor
- OpMemberDecorate %S_tint_explicit_layout 1 MatrixStride 8
- OpMemberDecorate %S_tint_explicit_layout 2 Offset 64
- OpDecorate %_arr_S_tint_explicit_layout_uint_4 ArrayStride 128
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 8
+ OpMemberDecorate %S 1 ColMajor
+ OpMemberDecorate %S 1 MatrixStride 8
+ OpMemberDecorate %S 2 Offset 64
+ OpDecorate %_arr_S_uint_4 ArrayStride 128
OpMemberDecorate %s_block_tint_explicit_layout 0 Offset 0
OpDecorate %s_block_tint_explicit_layout Block
OpDecorate %11 DescriptorSet 0
@@ -69,9 +65,9 @@
%_ptr_Uniform_u_block_std140_tint_explicit_layout = OpTypePointer Uniform %u_block_std140_tint_explicit_layout
%1 = OpVariable %_ptr_Uniform_u_block_std140_tint_explicit_layout Uniform
%mat2v4half = OpTypeMatrix %v4half 2
-%S_tint_explicit_layout = OpTypeStruct %int %mat2v4half %int
-%_arr_S_tint_explicit_layout_uint_4 = OpTypeArray %S_tint_explicit_layout %uint_4
-%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_tint_explicit_layout_uint_4
+ %S = OpTypeStruct %int %mat2v4half %int
+%_arr_S_uint_4 = OpTypeArray %S %uint_4
+%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_s_block_tint_explicit_layout = OpTypePointer StorageBuffer %s_block_tint_explicit_layout
%11 = OpVariable %_ptr_StorageBuffer_s_block_tint_explicit_layout StorageBuffer
%void = OpTypeVoid
@@ -80,10 +76,9 @@
%uint_0 = OpConstant %uint 0
%_arr_S_std140_uint_4_0 = OpTypeArray %S_std140 %uint_4
%_ptr_Function__arr_S_std140_uint_4_0 = OpTypePointer Function %_arr_S_std140_uint_4_0
- %S = OpTypeStruct %int %mat2v4half %int
-%_arr_S_uint_4 = OpTypeArray %S %uint_4
-%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
- %34 = OpConstantNull %_arr_S_uint_4
+%_arr_S_uint_4_0 = OpTypeArray %S %uint_4
+%_ptr_Function__arr_S_uint_4_0 = OpTypePointer Function %_arr_S_uint_4_0
+ %33 = OpConstantNull %_arr_S_uint_4_0
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%uint_2 = OpConstant %uint 2
%uint_1 = OpConstant %uint 1
@@ -95,152 +90,152 @@
%bool = OpTypeBool
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
- %81 = OpTypeFunction %void %_arr_S_uint_4
- %100 = OpTypeFunction %void %_arr_uint_uint_1 %S
+ %80 = OpTypeFunction %void %_arr_S_uint_4_0
+ %99 = OpTypeFunction %void %_arr_uint_uint_1 %S
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
- %111 = OpTypeFunction %S %S_std140
- %120 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
+ %110 = OpTypeFunction %S %S_std140
+ %119 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
- %125 = OpConstantNull %_arr_S_std140_uint_4_0
+ %124 = OpConstantNull %_arr_S_std140_uint_4_0
%f = OpFunction %void None %19
%20 = OpLabel
%28 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function
- %30 = OpVariable %_ptr_Function__arr_S_uint_4 Function %34
+ %30 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function %33
%21 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %1 %uint_0
%24 = OpLoad %_arr_S_std140_uint_4 %21 None
%25 = OpFunctionCall %_arr_S_std140_uint_4_0 %tint_convert_explicit_layout %24
OpStore %28 %25
- OpBranch %35
- %35 = OpLabel
- OpBranch %38
- %38 = OpLabel
- %40 = OpPhi %uint %uint_0 %35 %41 %37
- OpLoopMerge %39 %37 None
- OpBranch %36
- %36 = OpLabel
- %70 = OpUGreaterThanEqual %bool %40 %uint_4
- OpSelectionMerge %72 None
- OpBranchConditional %70 %73 %72
- %73 = OpLabel
- OpBranch %39
- %72 = OpLabel
- %74 = OpAccessChain %_ptr_Function_S %30 %40
- %76 = OpAccessChain %_ptr_Function_S_std140 %28 %40
- %78 = OpLoad %S_std140 %76 None
- %79 = OpFunctionCall %S %tint_convert_S %78
- OpStore %74 %79 None
+ OpBranch %34
+ %34 = OpLabel
OpBranch %37
%37 = OpLabel
- %41 = OpIAdd %uint %40 %uint_1
+ %39 = OpPhi %uint %uint_0 %34 %40 %36
+ OpLoopMerge %38 %36 None
+ OpBranch %35
+ %35 = OpLabel
+ %69 = OpUGreaterThanEqual %bool %39 %uint_4
+ OpSelectionMerge %71 None
+ OpBranchConditional %69 %72 %71
+ %72 = OpLabel
OpBranch %38
- %39 = OpLabel
- %42 = OpLoad %_arr_S_uint_4 %30 None
- %43 = OpFunctionCall %void %tint_store_and_preserve_padding %42
- %45 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
- %48 = OpLoad %S_std140 %45 None
- %49 = OpFunctionCall %S %tint_convert_S %48
- %53 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
- %54 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %53 %49
- %56 = OpAccessChain %_ptr_StorageBuffer_mat2v4half %11 %uint_0 %uint_3 %uint_1
- %59 = OpAccessChain %_ptr_Uniform_v4half %1 %uint_0 %uint_2 %uint_1
- %61 = OpLoad %v4half %59 None
- %62 = OpAccessChain %_ptr_Uniform_v4half %1 %uint_0 %uint_2 %uint_2
- %63 = OpLoad %v4half %62 None
- %64 = OpCompositeConstruct %mat2v4half %61 %63
- OpStore %56 %64 None
- %65 = OpAccessChain %_ptr_StorageBuffer_v4half %11 %uint_0 %uint_1 %uint_1 %uint_0
- %67 = OpAccessChain %_ptr_Uniform_v4half %1 %uint_0 %uint_0 %uint_2
- %68 = OpLoad %v4half %67 None
- %69 = OpVectorShuffle %v4half %68 %68 1 3 0 2
- OpStore %65 %69 None
+ %71 = OpLabel
+ %73 = OpAccessChain %_ptr_Function_S %30 %39
+ %75 = OpAccessChain %_ptr_Function_S_std140 %28 %39
+ %77 = OpLoad %S_std140 %75 None
+ %78 = OpFunctionCall %S %tint_convert_S %77
+ OpStore %73 %78 None
+ OpBranch %36
+ %36 = OpLabel
+ %40 = OpIAdd %uint %39 %uint_1
+ OpBranch %37
+ %38 = OpLabel
+ %41 = OpLoad %_arr_S_uint_4_0 %30 None
+ %42 = OpFunctionCall %void %tint_store_and_preserve_padding %41
+ %44 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
+ %47 = OpLoad %S_std140 %44 None
+ %48 = OpFunctionCall %S %tint_convert_S %47
+ %52 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
+ %53 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %52 %48
+ %55 = OpAccessChain %_ptr_StorageBuffer_mat2v4half %11 %uint_0 %uint_3 %uint_1
+ %58 = OpAccessChain %_ptr_Uniform_v4half %1 %uint_0 %uint_2 %uint_1
+ %60 = OpLoad %v4half %58 None
+ %61 = OpAccessChain %_ptr_Uniform_v4half %1 %uint_0 %uint_2 %uint_2
+ %62 = OpLoad %v4half %61 None
+ %63 = OpCompositeConstruct %mat2v4half %60 %62
+ OpStore %55 %63 None
+ %64 = OpAccessChain %_ptr_StorageBuffer_v4half %11 %uint_0 %uint_1 %uint_1 %uint_0
+ %66 = OpAccessChain %_ptr_Uniform_v4half %1 %uint_0 %uint_0 %uint_2
+ %67 = OpLoad %v4half %66 None
+ %68 = OpVectorShuffle %v4half %67 %67 1 3 0 2
+ OpStore %64 %68 None
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding = OpFunction %void None %81
-%value_param = OpFunctionParameter %_arr_S_uint_4
- %82 = OpLabel
- %83 = OpVariable %_ptr_Function__arr_S_uint_4 Function
- OpStore %83 %value_param
- OpBranch %84
- %84 = OpLabel
- OpBranch %87
- %87 = OpLabel
- %89 = OpPhi %uint %uint_0 %84 %90 %86
- OpLoopMerge %88 %86 None
- OpBranch %85
- %85 = OpLabel
- %91 = OpUGreaterThanEqual %bool %89 %uint_4
- OpSelectionMerge %92 None
- OpBranchConditional %91 %93 %92
- %93 = OpLabel
- OpBranch %88
- %92 = OpLabel
- %94 = OpAccessChain %_ptr_Function_S %83 %89
- %95 = OpLoad %S %94 None
- %96 = OpCompositeConstruct %_arr_uint_uint_1 %89
- %97 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %96 %95
+%tint_store_and_preserve_padding = OpFunction %void None %80
+%value_param = OpFunctionParameter %_arr_S_uint_4_0
+ %81 = OpLabel
+ %82 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function
+ OpStore %82 %value_param
+ OpBranch %83
+ %83 = OpLabel
OpBranch %86
%86 = OpLabel
- %90 = OpIAdd %uint %89 %uint_1
+ %88 = OpPhi %uint %uint_0 %83 %89 %85
+ OpLoopMerge %87 %85 None
+ OpBranch %84
+ %84 = OpLabel
+ %90 = OpUGreaterThanEqual %bool %88 %uint_4
+ OpSelectionMerge %91 None
+ OpBranchConditional %90 %92 %91
+ %92 = OpLabel
OpBranch %87
- %88 = OpLabel
+ %91 = OpLabel
+ %93 = OpAccessChain %_ptr_Function_S %82 %88
+ %94 = OpLoad %S %93 None
+ %95 = OpCompositeConstruct %_arr_uint_uint_1 %88
+ %96 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %95 %94
+ OpBranch %85
+ %85 = OpLabel
+ %89 = OpIAdd %uint %88 %uint_1
+ OpBranch %86
+ %87 = OpLabel
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding_0 = OpFunction %void None %100
+%tint_store_and_preserve_padding_0 = OpFunction %void None %99
%target_indices = OpFunctionParameter %_arr_uint_uint_1
%value_param_0 = OpFunctionParameter %S
- %101 = OpLabel
- %102 = OpCompositeExtract %uint %target_indices 0
- %103 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %102 %uint_0
- %105 = OpCompositeExtract %int %value_param_0 0
- OpStore %103 %105 None
- %106 = OpAccessChain %_ptr_StorageBuffer_mat2v4half %11 %uint_0 %102 %uint_1
- %107 = OpCompositeExtract %mat2v4half %value_param_0 1
- OpStore %106 %107 None
- %108 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %102 %uint_2
- %109 = OpCompositeExtract %int %value_param_0 2
- OpStore %108 %109 None
+ %100 = OpLabel
+ %101 = OpCompositeExtract %uint %target_indices 0
+ %102 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %101 %uint_0
+ %104 = OpCompositeExtract %int %value_param_0 0
+ OpStore %102 %104 None
+ %105 = OpAccessChain %_ptr_StorageBuffer_mat2v4half %11 %uint_0 %101 %uint_1
+ %106 = OpCompositeExtract %mat2v4half %value_param_0 1
+ OpStore %105 %106 None
+ %107 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %101 %uint_2
+ %108 = OpCompositeExtract %int %value_param_0 2
+ OpStore %107 %108 None
OpReturn
OpFunctionEnd
-%tint_convert_S = OpFunction %S None %111
+%tint_convert_S = OpFunction %S None %110
%tint_input = OpFunctionParameter %S_std140
- %112 = OpLabel
- %113 = OpCompositeExtract %int %tint_input 0
- %114 = OpCompositeExtract %v4half %tint_input 1
- %115 = OpCompositeExtract %v4half %tint_input 2
- %116 = OpCompositeConstruct %mat2v4half %114 %115
- %117 = OpCompositeExtract %int %tint_input 3
- %118 = OpCompositeConstruct %S %113 %116 %117
- OpReturnValue %118
+ %111 = OpLabel
+ %112 = OpCompositeExtract %int %tint_input 0
+ %113 = OpCompositeExtract %v4half %tint_input 1
+ %114 = OpCompositeExtract %v4half %tint_input 2
+ %115 = OpCompositeConstruct %mat2v4half %113 %114
+ %116 = OpCompositeExtract %int %tint_input 3
+ %117 = OpCompositeConstruct %S %112 %115 %116
+ OpReturnValue %117
OpFunctionEnd
-%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %120
+%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %119
%tint_source = OpFunctionParameter %_arr_S_std140_uint_4
- %121 = OpLabel
- %122 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
- %124 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %125
- OpStore %122 %tint_source
- OpBranch %126
- %126 = OpLabel
- OpBranch %129
- %129 = OpLabel
- %131 = OpPhi %uint %uint_0 %126 %132 %128
- OpLoopMerge %130 %128 None
- OpBranch %127
- %127 = OpLabel
- %134 = OpUGreaterThanEqual %bool %131 %uint_4
- OpSelectionMerge %135 None
- OpBranchConditional %134 %136 %135
- %136 = OpLabel
- OpBranch %130
- %135 = OpLabel
- %137 = OpAccessChain %_ptr_Function_S_std140 %122 %131
- %138 = OpLoad %S_std140 %137 None
- %139 = OpAccessChain %_ptr_Function_S_std140 %124 %131
- OpStore %139 %138 None
+ %120 = OpLabel
+ %121 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
+ %123 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %124
+ OpStore %121 %tint_source
+ OpBranch %125
+ %125 = OpLabel
OpBranch %128
%128 = OpLabel
- %132 = OpIAdd %uint %131 %uint_1
+ %130 = OpPhi %uint %uint_0 %125 %131 %127
+ OpLoopMerge %129 %127 None
+ OpBranch %126
+ %126 = OpLabel
+ %133 = OpUGreaterThanEqual %bool %130 %uint_4
+ OpSelectionMerge %134 None
+ OpBranchConditional %133 %135 %134
+ %135 = OpLabel
OpBranch %129
- %130 = OpLabel
- %133 = OpLoad %_arr_S_std140_uint_4_0 %124 None
- OpReturnValue %133
+ %134 = OpLabel
+ %136 = OpAccessChain %_ptr_Function_S_std140 %121 %130
+ %137 = OpLoad %S_std140 %136 None
+ %138 = OpAccessChain %_ptr_Function_S_std140 %123 %130
+ OpStore %138 %137 None
+ OpBranch %127
+ %127 = OpLabel
+ %131 = OpIAdd %uint %130 %uint_1
+ OpBranch %128
+ %129 = OpLabel
+ %132 = OpLoad %_arr_S_std140_uint_4_0 %123 None
+ OpReturnValue %132
OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/struct/mat2x4_f32/to_private.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/struct/mat2x4_f32/to_private.wgsl.expected.spvasm
index cb538a7..91b184a 100644
--- a/test/tint/buffer/uniform/std140/struct/mat2x4_f32/to_private.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/struct/mat2x4_f32/to_private.wgsl.expected.spvasm
@@ -1,34 +1,28 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 80
+; Bound: 68
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
- OpMemberName %S_tint_explicit_layout 0 "before"
- OpMemberName %S_tint_explicit_layout 1 "m"
- OpMemberName %S_tint_explicit_layout 2 "after"
- OpName %S_tint_explicit_layout "S_tint_explicit_layout"
- OpMemberName %u_block_tint_explicit_layout 0 "inner"
- OpName %u_block_tint_explicit_layout "u_block_tint_explicit_layout"
OpMemberName %S 0 "before"
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %S "S"
+ OpMemberName %u_block_tint_explicit_layout 0 "inner"
+ OpName %u_block_tint_explicit_layout "u_block_tint_explicit_layout"
OpName %p "p"
OpName %f "f"
OpName %tint_convert_explicit_layout "tint_convert_explicit_layout"
OpName %tint_source "tint_source"
- OpName %tint_convert_explicit_layout_0 "tint_convert_explicit_layout"
- OpName %tint_source_0 "tint_source"
- OpMemberDecorate %S_tint_explicit_layout 0 Offset 0
- OpMemberDecorate %S_tint_explicit_layout 1 Offset 16
- OpMemberDecorate %S_tint_explicit_layout 1 ColMajor
- OpMemberDecorate %S_tint_explicit_layout 1 MatrixStride 16
- OpMemberDecorate %S_tint_explicit_layout 2 Offset 64
- OpDecorate %_arr_S_tint_explicit_layout_uint_4 ArrayStride 128
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 16
+ OpMemberDecorate %S 1 ColMajor
+ OpMemberDecorate %S 1 MatrixStride 16
+ OpMemberDecorate %S 2 Offset 64
+ OpDecorate %_arr_S_uint_4 ArrayStride 128
OpMemberDecorate %u_block_tint_explicit_layout 0 Offset 0
OpDecorate %u_block_tint_explicit_layout Block
OpDecorate %1 DescriptorSet 0
@@ -38,99 +32,85 @@
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat2v4float = OpTypeMatrix %v4float 2
-%S_tint_explicit_layout = OpTypeStruct %int %mat2v4float %int
+ %S = OpTypeStruct %int %mat2v4float %int
%uint = OpTypeInt 32 0
%uint_4 = OpConstant %uint 4
-%_arr_S_tint_explicit_layout_uint_4 = OpTypeArray %S_tint_explicit_layout %uint_4
-%u_block_tint_explicit_layout = OpTypeStruct %_arr_S_tint_explicit_layout_uint_4
+%_arr_S_uint_4 = OpTypeArray %S %uint_4
+%u_block_tint_explicit_layout = OpTypeStruct %_arr_S_uint_4
%_ptr_Uniform_u_block_tint_explicit_layout = OpTypePointer Uniform %u_block_tint_explicit_layout
%1 = OpVariable %_ptr_Uniform_u_block_tint_explicit_layout Uniform
- %S = OpTypeStruct %int %mat2v4float %int
-%_arr_S_uint_4 = OpTypeArray %S %uint_4
-%_ptr_Private__arr_S_uint_4 = OpTypePointer Private %_arr_S_uint_4
- %16 = OpConstantNull %_arr_S_uint_4
- %p = OpVariable %_ptr_Private__arr_S_uint_4 Private %16
+%_arr_S_uint_4_0 = OpTypeArray %S %uint_4
+%_ptr_Private__arr_S_uint_4_0 = OpTypePointer Private %_arr_S_uint_4_0
+ %15 = OpConstantNull %_arr_S_uint_4_0
+ %p = OpVariable %_ptr_Private__arr_S_uint_4_0 Private %15
%void = OpTypeVoid
- %19 = OpTypeFunction %void
-%_ptr_Uniform__arr_S_tint_explicit_layout_uint_4 = OpTypePointer Uniform %_arr_S_tint_explicit_layout_uint_4
+ %18 = OpTypeFunction %void
+%_ptr_Uniform__arr_S_uint_4 = OpTypePointer Uniform %_arr_S_uint_4
%uint_0 = OpConstant %uint 0
%_ptr_Private_S = OpTypePointer Private %S
%uint_1 = OpConstant %uint 1
-%_ptr_Uniform_S_tint_explicit_layout = OpTypePointer Uniform %S_tint_explicit_layout
+%_ptr_Uniform_S = OpTypePointer Uniform %S
%uint_2 = OpConstant %uint 2
%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float
%uint_3 = OpConstant %uint 3
%_ptr_Uniform_mat2v4float = OpTypePointer Uniform %mat2v4float
%_ptr_Private_v4float = OpTypePointer Private %v4float
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
- %49 = OpTypeFunction %S %S_tint_explicit_layout
- %56 = OpTypeFunction %_arr_S_uint_4 %_arr_S_tint_explicit_layout_uint_4
-%_ptr_Function__arr_S_tint_explicit_layout_uint_4 = OpTypePointer Function %_arr_S_tint_explicit_layout_uint_4
+ %46 = OpTypeFunction %_arr_S_uint_4_0 %_arr_S_uint_4
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
+%_ptr_Function__arr_S_uint_4_0 = OpTypePointer Function %_arr_S_uint_4_0
%bool = OpTypeBool
-%_ptr_Function_S_tint_explicit_layout = OpTypePointer Function %S_tint_explicit_layout
%_ptr_Function_S = OpTypePointer Function %S
- %f = OpFunction %void None %19
- %20 = OpLabel
- %21 = OpAccessChain %_ptr_Uniform__arr_S_tint_explicit_layout_uint_4 %1 %uint_0
- %24 = OpLoad %_arr_S_tint_explicit_layout_uint_4 %21 None
- %25 = OpFunctionCall %_arr_S_uint_4 %tint_convert_explicit_layout_0 %24
- OpStore %p %25 None
- %27 = OpAccessChain %_ptr_Private_S %p %uint_1
- %30 = OpAccessChain %_ptr_Uniform_S_tint_explicit_layout %1 %uint_0 %uint_2
- %33 = OpLoad %S_tint_explicit_layout %30 None
- %34 = OpFunctionCall %S %tint_convert_explicit_layout %33
- OpStore %27 %34 None
- %36 = OpAccessChain %_ptr_Private_mat2v4float %p %uint_3 %uint_1
- %39 = OpAccessChain %_ptr_Uniform_mat2v4float %1 %uint_0 %uint_2 %uint_1
- %41 = OpLoad %mat2v4float %39 None
- OpStore %36 %41 None
- %42 = OpAccessChain %_ptr_Private_v4float %p %uint_1 %uint_1 %uint_0
- %44 = OpAccessChain %_ptr_Uniform_v4float %1 %uint_0 %uint_0 %uint_1 %uint_1
- %46 = OpLoad %v4float %44 None
- %47 = OpVectorShuffle %v4float %46 %46 1 3 0 2
- OpStore %42 %47 None
+ %f = OpFunction %void None %18
+ %19 = OpLabel
+ %20 = OpAccessChain %_ptr_Uniform__arr_S_uint_4 %1 %uint_0
+ %23 = OpLoad %_arr_S_uint_4 %20 None
+ %24 = OpFunctionCall %_arr_S_uint_4_0 %tint_convert_explicit_layout %23
+ OpStore %p %24 None
+ %26 = OpAccessChain %_ptr_Private_S %p %uint_1
+ %29 = OpAccessChain %_ptr_Uniform_S %1 %uint_0 %uint_2
+ %32 = OpLoad %S %29 None
+ OpStore %26 %32 None
+ %33 = OpAccessChain %_ptr_Private_mat2v4float %p %uint_3 %uint_1
+ %36 = OpAccessChain %_ptr_Uniform_mat2v4float %1 %uint_0 %uint_2 %uint_1
+ %38 = OpLoad %mat2v4float %36 None
+ OpStore %33 %38 None
+ %39 = OpAccessChain %_ptr_Private_v4float %p %uint_1 %uint_1 %uint_0
+ %41 = OpAccessChain %_ptr_Uniform_v4float %1 %uint_0 %uint_0 %uint_1 %uint_1
+ %43 = OpLoad %v4float %41 None
+ %44 = OpVectorShuffle %v4float %43 %43 1 3 0 2
+ OpStore %39 %44 None
OpReturn
OpFunctionEnd
-%tint_convert_explicit_layout = OpFunction %S None %49
-%tint_source = OpFunctionParameter %S_tint_explicit_layout
- %50 = OpLabel
- %51 = OpCompositeExtract %int %tint_source 0
- %52 = OpCompositeExtract %mat2v4float %tint_source 1
- %53 = OpCompositeExtract %int %tint_source 2
- %54 = OpCompositeConstruct %S %51 %52 %53
- OpReturnValue %54
- OpFunctionEnd
-%tint_convert_explicit_layout_0 = OpFunction %_arr_S_uint_4 None %56
-%tint_source_0 = OpFunctionParameter %_arr_S_tint_explicit_layout_uint_4
- %57 = OpLabel
- %58 = OpVariable %_ptr_Function__arr_S_tint_explicit_layout_uint_4 Function
- %60 = OpVariable %_ptr_Function__arr_S_uint_4 Function %16
- OpStore %58 %tint_source_0
- OpBranch %62
- %62 = OpLabel
- OpBranch %65
- %65 = OpLabel
- %67 = OpPhi %uint %uint_0 %62 %68 %64
- OpLoopMerge %66 %64 None
- OpBranch %63
+%tint_convert_explicit_layout = OpFunction %_arr_S_uint_4_0 None %46
+%tint_source = OpFunctionParameter %_arr_S_uint_4
+ %47 = OpLabel
+ %48 = OpVariable %_ptr_Function__arr_S_uint_4 Function
+ %50 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function %15
+ OpStore %48 %tint_source
+ OpBranch %52
+ %52 = OpLabel
+ OpBranch %55
+ %55 = OpLabel
+ %57 = OpPhi %uint %uint_0 %52 %58 %54
+ OpLoopMerge %56 %54 None
+ OpBranch %53
+ %53 = OpLabel
+ %60 = OpUGreaterThanEqual %bool %57 %uint_4
+ OpSelectionMerge %62 None
+ OpBranchConditional %60 %63 %62
%63 = OpLabel
- %70 = OpUGreaterThanEqual %bool %67 %uint_4
- OpSelectionMerge %72 None
- OpBranchConditional %70 %73 %72
- %73 = OpLabel
- OpBranch %66
- %72 = OpLabel
- %74 = OpAccessChain %_ptr_Function_S_tint_explicit_layout %58 %67
- %76 = OpLoad %S_tint_explicit_layout %74 None
- %77 = OpFunctionCall %S %tint_convert_explicit_layout %76
- %78 = OpAccessChain %_ptr_Function_S %60 %67
- OpStore %78 %77 None
- OpBranch %64
- %64 = OpLabel
- %68 = OpIAdd %uint %67 %uint_1
- OpBranch %65
- %66 = OpLabel
- %69 = OpLoad %_arr_S_uint_4 %60 None
- OpReturnValue %69
+ OpBranch %56
+ %62 = OpLabel
+ %64 = OpAccessChain %_ptr_Function_S %48 %57
+ %66 = OpLoad %S %64 None
+ %67 = OpAccessChain %_ptr_Function_S %50 %57
+ OpStore %67 %66 None
+ OpBranch %54
+ %54 = OpLabel
+ %58 = OpIAdd %uint %57 %uint_1
+ OpBranch %55
+ %56 = OpLabel
+ %59 = OpLoad %_arr_S_uint_4_0 %50 None
+ OpReturnValue %59
OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/struct/mat3x2_f16/to_storage.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/struct/mat3x2_f16/to_storage.wgsl.expected.spvasm
index 581de25..d20036e 100644
--- a/test/tint/buffer/uniform/std140/struct/mat3x2_f16/to_storage.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/struct/mat3x2_f16/to_storage.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 143
+; Bound: 142
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -18,17 +18,13 @@
OpName %S_std140 "S_std140"
OpMemberName %u_block_std140_tint_explicit_layout 0 "inner"
OpName %u_block_std140_tint_explicit_layout "u_block_std140_tint_explicit_layout"
- OpMemberName %S_tint_explicit_layout 0 "before"
- OpMemberName %S_tint_explicit_layout 1 "m"
- OpMemberName %S_tint_explicit_layout 2 "after"
- OpName %S_tint_explicit_layout "S_tint_explicit_layout"
- OpMemberName %s_block_tint_explicit_layout 0 "inner"
- OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
- OpName %f "f"
OpMemberName %S 0 "before"
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %S "S"
+ OpMemberName %s_block_tint_explicit_layout 0 "inner"
+ OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
+ OpName %f "f"
OpName %tint_store_and_preserve_padding "tint_store_and_preserve_padding"
OpName %value_param "value_param"
OpName %tint_store_and_preserve_padding_0 "tint_store_and_preserve_padding"
@@ -49,12 +45,12 @@
OpDecorate %1 DescriptorSet 0
OpDecorate %1 Binding 0
OpDecorate %1 NonWritable
- OpMemberDecorate %S_tint_explicit_layout 0 Offset 0
- OpMemberDecorate %S_tint_explicit_layout 1 Offset 4
- OpMemberDecorate %S_tint_explicit_layout 1 ColMajor
- OpMemberDecorate %S_tint_explicit_layout 1 MatrixStride 4
- OpMemberDecorate %S_tint_explicit_layout 2 Offset 64
- OpDecorate %_arr_S_tint_explicit_layout_uint_4 ArrayStride 128
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 4
+ OpMemberDecorate %S 1 ColMajor
+ OpMemberDecorate %S 1 MatrixStride 4
+ OpMemberDecorate %S 2 Offset 64
+ OpDecorate %_arr_S_uint_4 ArrayStride 128
OpMemberDecorate %s_block_tint_explicit_layout 0 Offset 0
OpDecorate %s_block_tint_explicit_layout Block
OpDecorate %11 DescriptorSet 0
@@ -71,9 +67,9 @@
%_ptr_Uniform_u_block_std140_tint_explicit_layout = OpTypePointer Uniform %u_block_std140_tint_explicit_layout
%1 = OpVariable %_ptr_Uniform_u_block_std140_tint_explicit_layout Uniform
%mat3v2half = OpTypeMatrix %v2half 3
-%S_tint_explicit_layout = OpTypeStruct %int %mat3v2half %int
-%_arr_S_tint_explicit_layout_uint_4 = OpTypeArray %S_tint_explicit_layout %uint_4
-%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_tint_explicit_layout_uint_4
+ %S = OpTypeStruct %int %mat3v2half %int
+%_arr_S_uint_4 = OpTypeArray %S %uint_4
+%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_s_block_tint_explicit_layout = OpTypePointer StorageBuffer %s_block_tint_explicit_layout
%11 = OpVariable %_ptr_StorageBuffer_s_block_tint_explicit_layout StorageBuffer
%void = OpTypeVoid
@@ -82,10 +78,9 @@
%uint_0 = OpConstant %uint 0
%_arr_S_std140_uint_4_0 = OpTypeArray %S_std140 %uint_4
%_ptr_Function__arr_S_std140_uint_4_0 = OpTypePointer Function %_arr_S_std140_uint_4_0
- %S = OpTypeStruct %int %mat3v2half %int
-%_arr_S_uint_4 = OpTypeArray %S %uint_4
-%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
- %34 = OpConstantNull %_arr_S_uint_4
+%_arr_S_uint_4_0 = OpTypeArray %S %uint_4
+%_ptr_Function__arr_S_uint_4_0 = OpTypePointer Function %_arr_S_uint_4_0
+ %33 = OpConstantNull %_arr_S_uint_4_0
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%uint_2 = OpConstant %uint 2
%uint_1 = OpConstant %uint 1
@@ -97,155 +92,155 @@
%bool = OpTypeBool
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
- %83 = OpTypeFunction %void %_arr_S_uint_4
- %102 = OpTypeFunction %void %_arr_uint_uint_1 %S
+ %82 = OpTypeFunction %void %_arr_S_uint_4_0
+ %101 = OpTypeFunction %void %_arr_uint_uint_1 %S
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
- %113 = OpTypeFunction %S %S_std140
- %123 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
+ %112 = OpTypeFunction %S %S_std140
+ %122 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
- %128 = OpConstantNull %_arr_S_std140_uint_4_0
+ %127 = OpConstantNull %_arr_S_std140_uint_4_0
%f = OpFunction %void None %19
%20 = OpLabel
%28 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function
- %30 = OpVariable %_ptr_Function__arr_S_uint_4 Function %34
+ %30 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function %33
%21 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %1 %uint_0
%24 = OpLoad %_arr_S_std140_uint_4 %21 None
%25 = OpFunctionCall %_arr_S_std140_uint_4_0 %tint_convert_explicit_layout %24
OpStore %28 %25
- OpBranch %35
- %35 = OpLabel
- OpBranch %38
- %38 = OpLabel
- %40 = OpPhi %uint %uint_0 %35 %41 %37
- OpLoopMerge %39 %37 None
- OpBranch %36
- %36 = OpLabel
- %72 = OpUGreaterThanEqual %bool %40 %uint_4
- OpSelectionMerge %74 None
- OpBranchConditional %72 %75 %74
- %75 = OpLabel
- OpBranch %39
- %74 = OpLabel
- %76 = OpAccessChain %_ptr_Function_S %30 %40
- %78 = OpAccessChain %_ptr_Function_S_std140 %28 %40
- %80 = OpLoad %S_std140 %78 None
- %81 = OpFunctionCall %S %tint_convert_S %80
- OpStore %76 %81 None
+ OpBranch %34
+ %34 = OpLabel
OpBranch %37
%37 = OpLabel
- %41 = OpIAdd %uint %40 %uint_1
+ %39 = OpPhi %uint %uint_0 %34 %40 %36
+ OpLoopMerge %38 %36 None
+ OpBranch %35
+ %35 = OpLabel
+ %71 = OpUGreaterThanEqual %bool %39 %uint_4
+ OpSelectionMerge %73 None
+ OpBranchConditional %71 %74 %73
+ %74 = OpLabel
OpBranch %38
- %39 = OpLabel
- %42 = OpLoad %_arr_S_uint_4 %30 None
- %43 = OpFunctionCall %void %tint_store_and_preserve_padding %42
- %45 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
- %48 = OpLoad %S_std140 %45 None
- %49 = OpFunctionCall %S %tint_convert_S %48
- %53 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
- %54 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %53 %49
- %56 = OpAccessChain %_ptr_StorageBuffer_mat3v2half %11 %uint_0 %uint_3 %uint_1
- %59 = OpAccessChain %_ptr_Uniform_v2half %1 %uint_0 %uint_2 %uint_1
- %61 = OpLoad %v2half %59 None
- %62 = OpAccessChain %_ptr_Uniform_v2half %1 %uint_0 %uint_2 %uint_2
- %63 = OpLoad %v2half %62 None
- %64 = OpAccessChain %_ptr_Uniform_v2half %1 %uint_0 %uint_2 %uint_3
- %65 = OpLoad %v2half %64 None
- %66 = OpCompositeConstruct %mat3v2half %61 %63 %65
- OpStore %56 %66 None
- %67 = OpAccessChain %_ptr_StorageBuffer_v2half %11 %uint_0 %uint_1 %uint_1 %uint_0
- %69 = OpAccessChain %_ptr_Uniform_v2half %1 %uint_0 %uint_0 %uint_2
- %70 = OpLoad %v2half %69 None
- %71 = OpVectorShuffle %v2half %70 %70 1 0
- OpStore %67 %71 None
+ %73 = OpLabel
+ %75 = OpAccessChain %_ptr_Function_S %30 %39
+ %77 = OpAccessChain %_ptr_Function_S_std140 %28 %39
+ %79 = OpLoad %S_std140 %77 None
+ %80 = OpFunctionCall %S %tint_convert_S %79
+ OpStore %75 %80 None
+ OpBranch %36
+ %36 = OpLabel
+ %40 = OpIAdd %uint %39 %uint_1
+ OpBranch %37
+ %38 = OpLabel
+ %41 = OpLoad %_arr_S_uint_4_0 %30 None
+ %42 = OpFunctionCall %void %tint_store_and_preserve_padding %41
+ %44 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
+ %47 = OpLoad %S_std140 %44 None
+ %48 = OpFunctionCall %S %tint_convert_S %47
+ %52 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
+ %53 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %52 %48
+ %55 = OpAccessChain %_ptr_StorageBuffer_mat3v2half %11 %uint_0 %uint_3 %uint_1
+ %58 = OpAccessChain %_ptr_Uniform_v2half %1 %uint_0 %uint_2 %uint_1
+ %60 = OpLoad %v2half %58 None
+ %61 = OpAccessChain %_ptr_Uniform_v2half %1 %uint_0 %uint_2 %uint_2
+ %62 = OpLoad %v2half %61 None
+ %63 = OpAccessChain %_ptr_Uniform_v2half %1 %uint_0 %uint_2 %uint_3
+ %64 = OpLoad %v2half %63 None
+ %65 = OpCompositeConstruct %mat3v2half %60 %62 %64
+ OpStore %55 %65 None
+ %66 = OpAccessChain %_ptr_StorageBuffer_v2half %11 %uint_0 %uint_1 %uint_1 %uint_0
+ %68 = OpAccessChain %_ptr_Uniform_v2half %1 %uint_0 %uint_0 %uint_2
+ %69 = OpLoad %v2half %68 None
+ %70 = OpVectorShuffle %v2half %69 %69 1 0
+ OpStore %66 %70 None
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding = OpFunction %void None %83
-%value_param = OpFunctionParameter %_arr_S_uint_4
- %84 = OpLabel
- %85 = OpVariable %_ptr_Function__arr_S_uint_4 Function
- OpStore %85 %value_param
- OpBranch %86
- %86 = OpLabel
- OpBranch %89
- %89 = OpLabel
- %91 = OpPhi %uint %uint_0 %86 %92 %88
- OpLoopMerge %90 %88 None
- OpBranch %87
- %87 = OpLabel
- %93 = OpUGreaterThanEqual %bool %91 %uint_4
- OpSelectionMerge %94 None
- OpBranchConditional %93 %95 %94
- %95 = OpLabel
- OpBranch %90
- %94 = OpLabel
- %96 = OpAccessChain %_ptr_Function_S %85 %91
- %97 = OpLoad %S %96 None
- %98 = OpCompositeConstruct %_arr_uint_uint_1 %91
- %99 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %98 %97
+%tint_store_and_preserve_padding = OpFunction %void None %82
+%value_param = OpFunctionParameter %_arr_S_uint_4_0
+ %83 = OpLabel
+ %84 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function
+ OpStore %84 %value_param
+ OpBranch %85
+ %85 = OpLabel
OpBranch %88
%88 = OpLabel
- %92 = OpIAdd %uint %91 %uint_1
+ %90 = OpPhi %uint %uint_0 %85 %91 %87
+ OpLoopMerge %89 %87 None
+ OpBranch %86
+ %86 = OpLabel
+ %92 = OpUGreaterThanEqual %bool %90 %uint_4
+ OpSelectionMerge %93 None
+ OpBranchConditional %92 %94 %93
+ %94 = OpLabel
OpBranch %89
- %90 = OpLabel
+ %93 = OpLabel
+ %95 = OpAccessChain %_ptr_Function_S %84 %90
+ %96 = OpLoad %S %95 None
+ %97 = OpCompositeConstruct %_arr_uint_uint_1 %90
+ %98 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %97 %96
+ OpBranch %87
+ %87 = OpLabel
+ %91 = OpIAdd %uint %90 %uint_1
+ OpBranch %88
+ %89 = OpLabel
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding_0 = OpFunction %void None %102
+%tint_store_and_preserve_padding_0 = OpFunction %void None %101
%target_indices = OpFunctionParameter %_arr_uint_uint_1
%value_param_0 = OpFunctionParameter %S
- %103 = OpLabel
- %104 = OpCompositeExtract %uint %target_indices 0
- %105 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %104 %uint_0
- %107 = OpCompositeExtract %int %value_param_0 0
- OpStore %105 %107 None
- %108 = OpAccessChain %_ptr_StorageBuffer_mat3v2half %11 %uint_0 %104 %uint_1
- %109 = OpCompositeExtract %mat3v2half %value_param_0 1
- OpStore %108 %109 None
- %110 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %104 %uint_2
- %111 = OpCompositeExtract %int %value_param_0 2
- OpStore %110 %111 None
+ %102 = OpLabel
+ %103 = OpCompositeExtract %uint %target_indices 0
+ %104 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %103 %uint_0
+ %106 = OpCompositeExtract %int %value_param_0 0
+ OpStore %104 %106 None
+ %107 = OpAccessChain %_ptr_StorageBuffer_mat3v2half %11 %uint_0 %103 %uint_1
+ %108 = OpCompositeExtract %mat3v2half %value_param_0 1
+ OpStore %107 %108 None
+ %109 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %103 %uint_2
+ %110 = OpCompositeExtract %int %value_param_0 2
+ OpStore %109 %110 None
OpReturn
OpFunctionEnd
-%tint_convert_S = OpFunction %S None %113
+%tint_convert_S = OpFunction %S None %112
%tint_input = OpFunctionParameter %S_std140
- %114 = OpLabel
- %115 = OpCompositeExtract %int %tint_input 0
- %116 = OpCompositeExtract %v2half %tint_input 1
- %117 = OpCompositeExtract %v2half %tint_input 2
- %118 = OpCompositeExtract %v2half %tint_input 3
- %119 = OpCompositeConstruct %mat3v2half %116 %117 %118
- %120 = OpCompositeExtract %int %tint_input 4
- %121 = OpCompositeConstruct %S %115 %119 %120
- OpReturnValue %121
+ %113 = OpLabel
+ %114 = OpCompositeExtract %int %tint_input 0
+ %115 = OpCompositeExtract %v2half %tint_input 1
+ %116 = OpCompositeExtract %v2half %tint_input 2
+ %117 = OpCompositeExtract %v2half %tint_input 3
+ %118 = OpCompositeConstruct %mat3v2half %115 %116 %117
+ %119 = OpCompositeExtract %int %tint_input 4
+ %120 = OpCompositeConstruct %S %114 %118 %119
+ OpReturnValue %120
OpFunctionEnd
-%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %123
+%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %122
%tint_source = OpFunctionParameter %_arr_S_std140_uint_4
- %124 = OpLabel
- %125 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
- %127 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %128
- OpStore %125 %tint_source
- OpBranch %129
- %129 = OpLabel
- OpBranch %132
- %132 = OpLabel
- %134 = OpPhi %uint %uint_0 %129 %135 %131
- OpLoopMerge %133 %131 None
- OpBranch %130
- %130 = OpLabel
- %137 = OpUGreaterThanEqual %bool %134 %uint_4
- OpSelectionMerge %138 None
- OpBranchConditional %137 %139 %138
- %139 = OpLabel
- OpBranch %133
- %138 = OpLabel
- %140 = OpAccessChain %_ptr_Function_S_std140 %125 %134
- %141 = OpLoad %S_std140 %140 None
- %142 = OpAccessChain %_ptr_Function_S_std140 %127 %134
- OpStore %142 %141 None
+ %123 = OpLabel
+ %124 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
+ %126 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %127
+ OpStore %124 %tint_source
+ OpBranch %128
+ %128 = OpLabel
OpBranch %131
%131 = OpLabel
- %135 = OpIAdd %uint %134 %uint_1
+ %133 = OpPhi %uint %uint_0 %128 %134 %130
+ OpLoopMerge %132 %130 None
+ OpBranch %129
+ %129 = OpLabel
+ %136 = OpUGreaterThanEqual %bool %133 %uint_4
+ OpSelectionMerge %137 None
+ OpBranchConditional %136 %138 %137
+ %138 = OpLabel
OpBranch %132
- %133 = OpLabel
- %136 = OpLoad %_arr_S_std140_uint_4_0 %127 None
- OpReturnValue %136
+ %137 = OpLabel
+ %139 = OpAccessChain %_ptr_Function_S_std140 %124 %133
+ %140 = OpLoad %S_std140 %139 None
+ %141 = OpAccessChain %_ptr_Function_S_std140 %126 %133
+ OpStore %141 %140 None
+ OpBranch %130
+ %130 = OpLabel
+ %134 = OpIAdd %uint %133 %uint_1
+ OpBranch %131
+ %132 = OpLabel
+ %135 = OpLoad %_arr_S_std140_uint_4_0 %126 None
+ OpReturnValue %135
OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/struct/mat3x2_f32/to_storage.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/struct/mat3x2_f32/to_storage.wgsl.expected.spvasm
index 6878844..6466148 100644
--- a/test/tint/buffer/uniform/std140/struct/mat3x2_f32/to_storage.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/struct/mat3x2_f32/to_storage.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 143
+; Bound: 142
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -15,17 +15,13 @@
OpName %S_std140 "S_std140"
OpMemberName %u_block_std140_tint_explicit_layout 0 "inner"
OpName %u_block_std140_tint_explicit_layout "u_block_std140_tint_explicit_layout"
- OpMemberName %S_tint_explicit_layout 0 "before"
- OpMemberName %S_tint_explicit_layout 1 "m"
- OpMemberName %S_tint_explicit_layout 2 "after"
- OpName %S_tint_explicit_layout "S_tint_explicit_layout"
- OpMemberName %s_block_tint_explicit_layout 0 "inner"
- OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
- OpName %f "f"
OpMemberName %S 0 "before"
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %S "S"
+ OpMemberName %s_block_tint_explicit_layout 0 "inner"
+ OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
+ OpName %f "f"
OpName %tint_store_and_preserve_padding "tint_store_and_preserve_padding"
OpName %value_param "value_param"
OpName %tint_store_and_preserve_padding_0 "tint_store_and_preserve_padding"
@@ -46,12 +42,12 @@
OpDecorate %1 DescriptorSet 0
OpDecorate %1 Binding 0
OpDecorate %1 NonWritable
- OpMemberDecorate %S_tint_explicit_layout 0 Offset 0
- OpMemberDecorate %S_tint_explicit_layout 1 Offset 8
- OpMemberDecorate %S_tint_explicit_layout 1 ColMajor
- OpMemberDecorate %S_tint_explicit_layout 1 MatrixStride 8
- OpMemberDecorate %S_tint_explicit_layout 2 Offset 64
- OpDecorate %_arr_S_tint_explicit_layout_uint_4 ArrayStride 128
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 8
+ OpMemberDecorate %S 1 ColMajor
+ OpMemberDecorate %S 1 MatrixStride 8
+ OpMemberDecorate %S 2 Offset 64
+ OpDecorate %_arr_S_uint_4 ArrayStride 128
OpMemberDecorate %s_block_tint_explicit_layout 0 Offset 0
OpDecorate %s_block_tint_explicit_layout Block
OpDecorate %11 DescriptorSet 0
@@ -68,9 +64,9 @@
%_ptr_Uniform_u_block_std140_tint_explicit_layout = OpTypePointer Uniform %u_block_std140_tint_explicit_layout
%1 = OpVariable %_ptr_Uniform_u_block_std140_tint_explicit_layout Uniform
%mat3v2float = OpTypeMatrix %v2float 3
-%S_tint_explicit_layout = OpTypeStruct %int %mat3v2float %int
-%_arr_S_tint_explicit_layout_uint_4 = OpTypeArray %S_tint_explicit_layout %uint_4
-%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_tint_explicit_layout_uint_4
+ %S = OpTypeStruct %int %mat3v2float %int
+%_arr_S_uint_4 = OpTypeArray %S %uint_4
+%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_s_block_tint_explicit_layout = OpTypePointer StorageBuffer %s_block_tint_explicit_layout
%11 = OpVariable %_ptr_StorageBuffer_s_block_tint_explicit_layout StorageBuffer
%void = OpTypeVoid
@@ -79,10 +75,9 @@
%uint_0 = OpConstant %uint 0
%_arr_S_std140_uint_4_0 = OpTypeArray %S_std140 %uint_4
%_ptr_Function__arr_S_std140_uint_4_0 = OpTypePointer Function %_arr_S_std140_uint_4_0
- %S = OpTypeStruct %int %mat3v2float %int
-%_arr_S_uint_4 = OpTypeArray %S %uint_4
-%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
- %34 = OpConstantNull %_arr_S_uint_4
+%_arr_S_uint_4_0 = OpTypeArray %S %uint_4
+%_ptr_Function__arr_S_uint_4_0 = OpTypePointer Function %_arr_S_uint_4_0
+ %33 = OpConstantNull %_arr_S_uint_4_0
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%uint_2 = OpConstant %uint 2
%uint_1 = OpConstant %uint 1
@@ -94,155 +89,155 @@
%bool = OpTypeBool
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
- %83 = OpTypeFunction %void %_arr_S_uint_4
- %102 = OpTypeFunction %void %_arr_uint_uint_1 %S
+ %82 = OpTypeFunction %void %_arr_S_uint_4_0
+ %101 = OpTypeFunction %void %_arr_uint_uint_1 %S
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
- %113 = OpTypeFunction %S %S_std140
- %123 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
+ %112 = OpTypeFunction %S %S_std140
+ %122 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
- %128 = OpConstantNull %_arr_S_std140_uint_4_0
+ %127 = OpConstantNull %_arr_S_std140_uint_4_0
%f = OpFunction %void None %19
%20 = OpLabel
%28 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function
- %30 = OpVariable %_ptr_Function__arr_S_uint_4 Function %34
+ %30 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function %33
%21 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %1 %uint_0
%24 = OpLoad %_arr_S_std140_uint_4 %21 None
%25 = OpFunctionCall %_arr_S_std140_uint_4_0 %tint_convert_explicit_layout %24
OpStore %28 %25
- OpBranch %35
- %35 = OpLabel
- OpBranch %38
- %38 = OpLabel
- %40 = OpPhi %uint %uint_0 %35 %41 %37
- OpLoopMerge %39 %37 None
- OpBranch %36
- %36 = OpLabel
- %72 = OpUGreaterThanEqual %bool %40 %uint_4
- OpSelectionMerge %74 None
- OpBranchConditional %72 %75 %74
- %75 = OpLabel
- OpBranch %39
- %74 = OpLabel
- %76 = OpAccessChain %_ptr_Function_S %30 %40
- %78 = OpAccessChain %_ptr_Function_S_std140 %28 %40
- %80 = OpLoad %S_std140 %78 None
- %81 = OpFunctionCall %S %tint_convert_S %80
- OpStore %76 %81 None
+ OpBranch %34
+ %34 = OpLabel
OpBranch %37
%37 = OpLabel
- %41 = OpIAdd %uint %40 %uint_1
+ %39 = OpPhi %uint %uint_0 %34 %40 %36
+ OpLoopMerge %38 %36 None
+ OpBranch %35
+ %35 = OpLabel
+ %71 = OpUGreaterThanEqual %bool %39 %uint_4
+ OpSelectionMerge %73 None
+ OpBranchConditional %71 %74 %73
+ %74 = OpLabel
OpBranch %38
- %39 = OpLabel
- %42 = OpLoad %_arr_S_uint_4 %30 None
- %43 = OpFunctionCall %void %tint_store_and_preserve_padding %42
- %45 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
- %48 = OpLoad %S_std140 %45 None
- %49 = OpFunctionCall %S %tint_convert_S %48
- %53 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
- %54 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %53 %49
- %56 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %11 %uint_0 %uint_3 %uint_1
- %59 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_2 %uint_1
- %61 = OpLoad %v2float %59 None
- %62 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_2 %uint_2
- %63 = OpLoad %v2float %62 None
- %64 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_2 %uint_3
- %65 = OpLoad %v2float %64 None
- %66 = OpCompositeConstruct %mat3v2float %61 %63 %65
- OpStore %56 %66 None
- %67 = OpAccessChain %_ptr_StorageBuffer_v2float %11 %uint_0 %uint_1 %uint_1 %uint_0
- %69 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_0 %uint_2
- %70 = OpLoad %v2float %69 None
- %71 = OpVectorShuffle %v2float %70 %70 1 0
- OpStore %67 %71 None
+ %73 = OpLabel
+ %75 = OpAccessChain %_ptr_Function_S %30 %39
+ %77 = OpAccessChain %_ptr_Function_S_std140 %28 %39
+ %79 = OpLoad %S_std140 %77 None
+ %80 = OpFunctionCall %S %tint_convert_S %79
+ OpStore %75 %80 None
+ OpBranch %36
+ %36 = OpLabel
+ %40 = OpIAdd %uint %39 %uint_1
+ OpBranch %37
+ %38 = OpLabel
+ %41 = OpLoad %_arr_S_uint_4_0 %30 None
+ %42 = OpFunctionCall %void %tint_store_and_preserve_padding %41
+ %44 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
+ %47 = OpLoad %S_std140 %44 None
+ %48 = OpFunctionCall %S %tint_convert_S %47
+ %52 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
+ %53 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %52 %48
+ %55 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %11 %uint_0 %uint_3 %uint_1
+ %58 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_2 %uint_1
+ %60 = OpLoad %v2float %58 None
+ %61 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_2 %uint_2
+ %62 = OpLoad %v2float %61 None
+ %63 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_2 %uint_3
+ %64 = OpLoad %v2float %63 None
+ %65 = OpCompositeConstruct %mat3v2float %60 %62 %64
+ OpStore %55 %65 None
+ %66 = OpAccessChain %_ptr_StorageBuffer_v2float %11 %uint_0 %uint_1 %uint_1 %uint_0
+ %68 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_0 %uint_2
+ %69 = OpLoad %v2float %68 None
+ %70 = OpVectorShuffle %v2float %69 %69 1 0
+ OpStore %66 %70 None
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding = OpFunction %void None %83
-%value_param = OpFunctionParameter %_arr_S_uint_4
- %84 = OpLabel
- %85 = OpVariable %_ptr_Function__arr_S_uint_4 Function
- OpStore %85 %value_param
- OpBranch %86
- %86 = OpLabel
- OpBranch %89
- %89 = OpLabel
- %91 = OpPhi %uint %uint_0 %86 %92 %88
- OpLoopMerge %90 %88 None
- OpBranch %87
- %87 = OpLabel
- %93 = OpUGreaterThanEqual %bool %91 %uint_4
- OpSelectionMerge %94 None
- OpBranchConditional %93 %95 %94
- %95 = OpLabel
- OpBranch %90
- %94 = OpLabel
- %96 = OpAccessChain %_ptr_Function_S %85 %91
- %97 = OpLoad %S %96 None
- %98 = OpCompositeConstruct %_arr_uint_uint_1 %91
- %99 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %98 %97
+%tint_store_and_preserve_padding = OpFunction %void None %82
+%value_param = OpFunctionParameter %_arr_S_uint_4_0
+ %83 = OpLabel
+ %84 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function
+ OpStore %84 %value_param
+ OpBranch %85
+ %85 = OpLabel
OpBranch %88
%88 = OpLabel
- %92 = OpIAdd %uint %91 %uint_1
+ %90 = OpPhi %uint %uint_0 %85 %91 %87
+ OpLoopMerge %89 %87 None
+ OpBranch %86
+ %86 = OpLabel
+ %92 = OpUGreaterThanEqual %bool %90 %uint_4
+ OpSelectionMerge %93 None
+ OpBranchConditional %92 %94 %93
+ %94 = OpLabel
OpBranch %89
- %90 = OpLabel
+ %93 = OpLabel
+ %95 = OpAccessChain %_ptr_Function_S %84 %90
+ %96 = OpLoad %S %95 None
+ %97 = OpCompositeConstruct %_arr_uint_uint_1 %90
+ %98 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %97 %96
+ OpBranch %87
+ %87 = OpLabel
+ %91 = OpIAdd %uint %90 %uint_1
+ OpBranch %88
+ %89 = OpLabel
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding_0 = OpFunction %void None %102
+%tint_store_and_preserve_padding_0 = OpFunction %void None %101
%target_indices = OpFunctionParameter %_arr_uint_uint_1
%value_param_0 = OpFunctionParameter %S
- %103 = OpLabel
- %104 = OpCompositeExtract %uint %target_indices 0
- %105 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %104 %uint_0
- %107 = OpCompositeExtract %int %value_param_0 0
- OpStore %105 %107 None
- %108 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %11 %uint_0 %104 %uint_1
- %109 = OpCompositeExtract %mat3v2float %value_param_0 1
- OpStore %108 %109 None
- %110 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %104 %uint_2
- %111 = OpCompositeExtract %int %value_param_0 2
- OpStore %110 %111 None
+ %102 = OpLabel
+ %103 = OpCompositeExtract %uint %target_indices 0
+ %104 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %103 %uint_0
+ %106 = OpCompositeExtract %int %value_param_0 0
+ OpStore %104 %106 None
+ %107 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %11 %uint_0 %103 %uint_1
+ %108 = OpCompositeExtract %mat3v2float %value_param_0 1
+ OpStore %107 %108 None
+ %109 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %103 %uint_2
+ %110 = OpCompositeExtract %int %value_param_0 2
+ OpStore %109 %110 None
OpReturn
OpFunctionEnd
-%tint_convert_S = OpFunction %S None %113
+%tint_convert_S = OpFunction %S None %112
%tint_input = OpFunctionParameter %S_std140
- %114 = OpLabel
- %115 = OpCompositeExtract %int %tint_input 0
- %116 = OpCompositeExtract %v2float %tint_input 1
- %117 = OpCompositeExtract %v2float %tint_input 2
- %118 = OpCompositeExtract %v2float %tint_input 3
- %119 = OpCompositeConstruct %mat3v2float %116 %117 %118
- %120 = OpCompositeExtract %int %tint_input 4
- %121 = OpCompositeConstruct %S %115 %119 %120
- OpReturnValue %121
+ %113 = OpLabel
+ %114 = OpCompositeExtract %int %tint_input 0
+ %115 = OpCompositeExtract %v2float %tint_input 1
+ %116 = OpCompositeExtract %v2float %tint_input 2
+ %117 = OpCompositeExtract %v2float %tint_input 3
+ %118 = OpCompositeConstruct %mat3v2float %115 %116 %117
+ %119 = OpCompositeExtract %int %tint_input 4
+ %120 = OpCompositeConstruct %S %114 %118 %119
+ OpReturnValue %120
OpFunctionEnd
-%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %123
+%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %122
%tint_source = OpFunctionParameter %_arr_S_std140_uint_4
- %124 = OpLabel
- %125 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
- %127 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %128
- OpStore %125 %tint_source
- OpBranch %129
- %129 = OpLabel
- OpBranch %132
- %132 = OpLabel
- %134 = OpPhi %uint %uint_0 %129 %135 %131
- OpLoopMerge %133 %131 None
- OpBranch %130
- %130 = OpLabel
- %137 = OpUGreaterThanEqual %bool %134 %uint_4
- OpSelectionMerge %138 None
- OpBranchConditional %137 %139 %138
- %139 = OpLabel
- OpBranch %133
- %138 = OpLabel
- %140 = OpAccessChain %_ptr_Function_S_std140 %125 %134
- %141 = OpLoad %S_std140 %140 None
- %142 = OpAccessChain %_ptr_Function_S_std140 %127 %134
- OpStore %142 %141 None
+ %123 = OpLabel
+ %124 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
+ %126 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %127
+ OpStore %124 %tint_source
+ OpBranch %128
+ %128 = OpLabel
OpBranch %131
%131 = OpLabel
- %135 = OpIAdd %uint %134 %uint_1
+ %133 = OpPhi %uint %uint_0 %128 %134 %130
+ OpLoopMerge %132 %130 None
+ OpBranch %129
+ %129 = OpLabel
+ %136 = OpUGreaterThanEqual %bool %133 %uint_4
+ OpSelectionMerge %137 None
+ OpBranchConditional %136 %138 %137
+ %138 = OpLabel
OpBranch %132
- %133 = OpLabel
- %136 = OpLoad %_arr_S_std140_uint_4_0 %127 None
- OpReturnValue %136
+ %137 = OpLabel
+ %139 = OpAccessChain %_ptr_Function_S_std140 %124 %133
+ %140 = OpLoad %S_std140 %139 None
+ %141 = OpAccessChain %_ptr_Function_S_std140 %126 %133
+ OpStore %141 %140 None
+ OpBranch %130
+ %130 = OpLabel
+ %134 = OpIAdd %uint %133 %uint_1
+ OpBranch %131
+ %132 = OpLabel
+ %135 = OpLoad %_arr_S_std140_uint_4_0 %126 None
+ OpReturnValue %135
OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/struct/mat3x3_f16/to_storage.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/struct/mat3x3_f16/to_storage.wgsl.expected.spvasm
index 543cd05..f94e85e9 100644
--- a/test/tint/buffer/uniform/std140/struct/mat3x3_f16/to_storage.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/struct/mat3x3_f16/to_storage.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 156
+; Bound: 155
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -18,17 +18,13 @@
OpName %S_std140 "S_std140"
OpMemberName %u_block_std140_tint_explicit_layout 0 "inner"
OpName %u_block_std140_tint_explicit_layout "u_block_std140_tint_explicit_layout"
- OpMemberName %S_tint_explicit_layout 0 "before"
- OpMemberName %S_tint_explicit_layout 1 "m"
- OpMemberName %S_tint_explicit_layout 2 "after"
- OpName %S_tint_explicit_layout "S_tint_explicit_layout"
- OpMemberName %s_block_tint_explicit_layout 0 "inner"
- OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
- OpName %f "f"
OpMemberName %S 0 "before"
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %S "S"
+ OpMemberName %s_block_tint_explicit_layout 0 "inner"
+ OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
+ OpName %f "f"
OpName %tint_store_and_preserve_padding "tint_store_and_preserve_padding"
OpName %value_param "value_param"
OpName %tint_store_and_preserve_padding_0 "tint_store_and_preserve_padding"
@@ -52,12 +48,12 @@
OpDecorate %1 DescriptorSet 0
OpDecorate %1 Binding 0
OpDecorate %1 NonWritable
- OpMemberDecorate %S_tint_explicit_layout 0 Offset 0
- OpMemberDecorate %S_tint_explicit_layout 1 Offset 8
- OpMemberDecorate %S_tint_explicit_layout 1 ColMajor
- OpMemberDecorate %S_tint_explicit_layout 1 MatrixStride 8
- OpMemberDecorate %S_tint_explicit_layout 2 Offset 64
- OpDecorate %_arr_S_tint_explicit_layout_uint_4 ArrayStride 128
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 8
+ OpMemberDecorate %S 1 ColMajor
+ OpMemberDecorate %S 1 MatrixStride 8
+ OpMemberDecorate %S 2 Offset 64
+ OpDecorate %_arr_S_uint_4 ArrayStride 128
OpMemberDecorate %s_block_tint_explicit_layout 0 Offset 0
OpDecorate %s_block_tint_explicit_layout Block
OpDecorate %11 DescriptorSet 0
@@ -74,9 +70,9 @@
%_ptr_Uniform_u_block_std140_tint_explicit_layout = OpTypePointer Uniform %u_block_std140_tint_explicit_layout
%1 = OpVariable %_ptr_Uniform_u_block_std140_tint_explicit_layout Uniform
%mat3v3half = OpTypeMatrix %v3half 3
-%S_tint_explicit_layout = OpTypeStruct %int %mat3v3half %int
-%_arr_S_tint_explicit_layout_uint_4 = OpTypeArray %S_tint_explicit_layout %uint_4
-%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_tint_explicit_layout_uint_4
+ %S = OpTypeStruct %int %mat3v3half %int
+%_arr_S_uint_4 = OpTypeArray %S %uint_4
+%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_s_block_tint_explicit_layout = OpTypePointer StorageBuffer %s_block_tint_explicit_layout
%11 = OpVariable %_ptr_StorageBuffer_s_block_tint_explicit_layout StorageBuffer
%void = OpTypeVoid
@@ -85,10 +81,9 @@
%uint_0 = OpConstant %uint 0
%_arr_S_std140_uint_4_0 = OpTypeArray %S_std140 %uint_4
%_ptr_Function__arr_S_std140_uint_4_0 = OpTypePointer Function %_arr_S_std140_uint_4_0
- %S = OpTypeStruct %int %mat3v3half %int
-%_arr_S_uint_4 = OpTypeArray %S %uint_4
-%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
- %34 = OpConstantNull %_arr_S_uint_4
+%_arr_S_uint_4_0 = OpTypeArray %S %uint_4
+%_ptr_Function__arr_S_uint_4_0 = OpTypePointer Function %_arr_S_uint_4_0
+ %33 = OpConstantNull %_arr_S_uint_4_0
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%uint_2 = OpConstant %uint 2
%uint_1 = OpConstant %uint 1
@@ -99,172 +94,172 @@
%bool = OpTypeBool
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
- %84 = OpTypeFunction %void %_arr_S_uint_4
- %103 = OpTypeFunction %void %_arr_uint_uint_1 %S
+ %83 = OpTypeFunction %void %_arr_S_uint_4_0
+ %102 = OpTypeFunction %void %_arr_uint_uint_1 %S
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
- %116 = OpTypeFunction %void %_arr_uint_uint_1 %mat3v3half
- %126 = OpTypeFunction %S %S_std140
- %136 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
+ %115 = OpTypeFunction %void %_arr_uint_uint_1 %mat3v3half
+ %125 = OpTypeFunction %S %S_std140
+ %135 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
- %141 = OpConstantNull %_arr_S_std140_uint_4_0
+ %140 = OpConstantNull %_arr_S_std140_uint_4_0
%f = OpFunction %void None %19
%20 = OpLabel
%28 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function
- %30 = OpVariable %_ptr_Function__arr_S_uint_4 Function %34
+ %30 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function %33
%21 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %1 %uint_0
%24 = OpLoad %_arr_S_std140_uint_4 %21 None
%25 = OpFunctionCall %_arr_S_std140_uint_4_0 %tint_convert_explicit_layout %24
OpStore %28 %25
- OpBranch %35
- %35 = OpLabel
- OpBranch %38
- %38 = OpLabel
- %40 = OpPhi %uint %uint_0 %35 %41 %37
- OpLoopMerge %39 %37 None
- OpBranch %36
- %36 = OpLabel
- %73 = OpUGreaterThanEqual %bool %40 %uint_4
- OpSelectionMerge %75 None
- OpBranchConditional %73 %76 %75
- %76 = OpLabel
- OpBranch %39
- %75 = OpLabel
- %77 = OpAccessChain %_ptr_Function_S %30 %40
- %79 = OpAccessChain %_ptr_Function_S_std140 %28 %40
- %81 = OpLoad %S_std140 %79 None
- %82 = OpFunctionCall %S %tint_convert_S %81
- OpStore %77 %82 None
+ OpBranch %34
+ %34 = OpLabel
OpBranch %37
%37 = OpLabel
- %41 = OpIAdd %uint %40 %uint_1
+ %39 = OpPhi %uint %uint_0 %34 %40 %36
+ OpLoopMerge %38 %36 None
+ OpBranch %35
+ %35 = OpLabel
+ %72 = OpUGreaterThanEqual %bool %39 %uint_4
+ OpSelectionMerge %74 None
+ OpBranchConditional %72 %75 %74
+ %75 = OpLabel
OpBranch %38
- %39 = OpLabel
- %42 = OpLoad %_arr_S_uint_4 %30 None
- %43 = OpFunctionCall %void %tint_store_and_preserve_padding %42
- %45 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
- %48 = OpLoad %S_std140 %45 None
- %49 = OpFunctionCall %S %tint_convert_S %48
- %53 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
- %54 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %53 %49
- %56 = OpAccessChain %_ptr_Uniform_v3half %1 %uint_0 %uint_2 %uint_1
- %58 = OpLoad %v3half %56 None
- %59 = OpAccessChain %_ptr_Uniform_v3half %1 %uint_0 %uint_2 %uint_2
- %60 = OpLoad %v3half %59 None
- %61 = OpAccessChain %_ptr_Uniform_v3half %1 %uint_0 %uint_2 %uint_3
- %63 = OpLoad %v3half %61 None
- %64 = OpCompositeConstruct %mat3v3half %58 %60 %63
- %65 = OpCompositeConstruct %_arr_uint_uint_1 %uint_3
- %66 = OpFunctionCall %void %tint_store_and_preserve_padding_1 %65 %64
- %68 = OpAccessChain %_ptr_StorageBuffer_v3half %11 %uint_0 %uint_1 %uint_1 %uint_0
- %70 = OpAccessChain %_ptr_Uniform_v3half %1 %uint_0 %uint_0 %uint_2
- %71 = OpLoad %v3half %70 None
- %72 = OpVectorShuffle %v3half %71 %71 2 0 1
- OpStore %68 %72 None
+ %74 = OpLabel
+ %76 = OpAccessChain %_ptr_Function_S %30 %39
+ %78 = OpAccessChain %_ptr_Function_S_std140 %28 %39
+ %80 = OpLoad %S_std140 %78 None
+ %81 = OpFunctionCall %S %tint_convert_S %80
+ OpStore %76 %81 None
+ OpBranch %36
+ %36 = OpLabel
+ %40 = OpIAdd %uint %39 %uint_1
+ OpBranch %37
+ %38 = OpLabel
+ %41 = OpLoad %_arr_S_uint_4_0 %30 None
+ %42 = OpFunctionCall %void %tint_store_and_preserve_padding %41
+ %44 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
+ %47 = OpLoad %S_std140 %44 None
+ %48 = OpFunctionCall %S %tint_convert_S %47
+ %52 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
+ %53 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %52 %48
+ %55 = OpAccessChain %_ptr_Uniform_v3half %1 %uint_0 %uint_2 %uint_1
+ %57 = OpLoad %v3half %55 None
+ %58 = OpAccessChain %_ptr_Uniform_v3half %1 %uint_0 %uint_2 %uint_2
+ %59 = OpLoad %v3half %58 None
+ %60 = OpAccessChain %_ptr_Uniform_v3half %1 %uint_0 %uint_2 %uint_3
+ %62 = OpLoad %v3half %60 None
+ %63 = OpCompositeConstruct %mat3v3half %57 %59 %62
+ %64 = OpCompositeConstruct %_arr_uint_uint_1 %uint_3
+ %65 = OpFunctionCall %void %tint_store_and_preserve_padding_1 %64 %63
+ %67 = OpAccessChain %_ptr_StorageBuffer_v3half %11 %uint_0 %uint_1 %uint_1 %uint_0
+ %69 = OpAccessChain %_ptr_Uniform_v3half %1 %uint_0 %uint_0 %uint_2
+ %70 = OpLoad %v3half %69 None
+ %71 = OpVectorShuffle %v3half %70 %70 2 0 1
+ OpStore %67 %71 None
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding = OpFunction %void None %84
-%value_param = OpFunctionParameter %_arr_S_uint_4
- %85 = OpLabel
- %86 = OpVariable %_ptr_Function__arr_S_uint_4 Function
- OpStore %86 %value_param
- OpBranch %87
- %87 = OpLabel
- OpBranch %90
- %90 = OpLabel
- %92 = OpPhi %uint %uint_0 %87 %93 %89
- OpLoopMerge %91 %89 None
- OpBranch %88
- %88 = OpLabel
- %94 = OpUGreaterThanEqual %bool %92 %uint_4
- OpSelectionMerge %95 None
- OpBranchConditional %94 %96 %95
- %96 = OpLabel
- OpBranch %91
- %95 = OpLabel
- %97 = OpAccessChain %_ptr_Function_S %86 %92
- %98 = OpLoad %S %97 None
- %99 = OpCompositeConstruct %_arr_uint_uint_1 %92
- %100 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %99 %98
+%tint_store_and_preserve_padding = OpFunction %void None %83
+%value_param = OpFunctionParameter %_arr_S_uint_4_0
+ %84 = OpLabel
+ %85 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function
+ OpStore %85 %value_param
+ OpBranch %86
+ %86 = OpLabel
OpBranch %89
%89 = OpLabel
- %93 = OpIAdd %uint %92 %uint_1
+ %91 = OpPhi %uint %uint_0 %86 %92 %88
+ OpLoopMerge %90 %88 None
+ OpBranch %87
+ %87 = OpLabel
+ %93 = OpUGreaterThanEqual %bool %91 %uint_4
+ OpSelectionMerge %94 None
+ OpBranchConditional %93 %95 %94
+ %95 = OpLabel
OpBranch %90
- %91 = OpLabel
+ %94 = OpLabel
+ %96 = OpAccessChain %_ptr_Function_S %85 %91
+ %97 = OpLoad %S %96 None
+ %98 = OpCompositeConstruct %_arr_uint_uint_1 %91
+ %99 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %98 %97
+ OpBranch %88
+ %88 = OpLabel
+ %92 = OpIAdd %uint %91 %uint_1
+ OpBranch %89
+ %90 = OpLabel
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding_0 = OpFunction %void None %103
+%tint_store_and_preserve_padding_0 = OpFunction %void None %102
%target_indices = OpFunctionParameter %_arr_uint_uint_1
%value_param_0 = OpFunctionParameter %S
- %104 = OpLabel
- %105 = OpCompositeExtract %uint %target_indices 0
- %106 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %105 %uint_0
- %108 = OpCompositeExtract %int %value_param_0 0
- OpStore %106 %108 None
- %109 = OpCompositeExtract %mat3v3half %value_param_0 1
- %110 = OpCompositeConstruct %_arr_uint_uint_1 %105
- %111 = OpFunctionCall %void %tint_store_and_preserve_padding_1 %110 %109
- %112 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %105 %uint_2
- %113 = OpCompositeExtract %int %value_param_0 2
- OpStore %112 %113 None
+ %103 = OpLabel
+ %104 = OpCompositeExtract %uint %target_indices 0
+ %105 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %104 %uint_0
+ %107 = OpCompositeExtract %int %value_param_0 0
+ OpStore %105 %107 None
+ %108 = OpCompositeExtract %mat3v3half %value_param_0 1
+ %109 = OpCompositeConstruct %_arr_uint_uint_1 %104
+ %110 = OpFunctionCall %void %tint_store_and_preserve_padding_1 %109 %108
+ %111 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %104 %uint_2
+ %112 = OpCompositeExtract %int %value_param_0 2
+ OpStore %111 %112 None
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding_1 = OpFunction %void None %116
+%tint_store_and_preserve_padding_1 = OpFunction %void None %115
%target_indices_0 = OpFunctionParameter %_arr_uint_uint_1
%value_param_1 = OpFunctionParameter %mat3v3half
- %117 = OpLabel
- %118 = OpCompositeExtract %uint %target_indices_0 0
- %119 = OpAccessChain %_ptr_StorageBuffer_v3half %11 %uint_0 %118 %uint_1 %uint_0
- %120 = OpCompositeExtract %v3half %value_param_1 0
- OpStore %119 %120 None
- %121 = OpAccessChain %_ptr_StorageBuffer_v3half %11 %uint_0 %118 %uint_1 %uint_1
- %122 = OpCompositeExtract %v3half %value_param_1 1
- OpStore %121 %122 None
- %123 = OpAccessChain %_ptr_StorageBuffer_v3half %11 %uint_0 %118 %uint_1 %uint_2
- %124 = OpCompositeExtract %v3half %value_param_1 2
- OpStore %123 %124 None
+ %116 = OpLabel
+ %117 = OpCompositeExtract %uint %target_indices_0 0
+ %118 = OpAccessChain %_ptr_StorageBuffer_v3half %11 %uint_0 %117 %uint_1 %uint_0
+ %119 = OpCompositeExtract %v3half %value_param_1 0
+ OpStore %118 %119 None
+ %120 = OpAccessChain %_ptr_StorageBuffer_v3half %11 %uint_0 %117 %uint_1 %uint_1
+ %121 = OpCompositeExtract %v3half %value_param_1 1
+ OpStore %120 %121 None
+ %122 = OpAccessChain %_ptr_StorageBuffer_v3half %11 %uint_0 %117 %uint_1 %uint_2
+ %123 = OpCompositeExtract %v3half %value_param_1 2
+ OpStore %122 %123 None
OpReturn
OpFunctionEnd
-%tint_convert_S = OpFunction %S None %126
+%tint_convert_S = OpFunction %S None %125
%tint_input = OpFunctionParameter %S_std140
- %127 = OpLabel
- %128 = OpCompositeExtract %int %tint_input 0
- %129 = OpCompositeExtract %v3half %tint_input 1
- %130 = OpCompositeExtract %v3half %tint_input 2
- %131 = OpCompositeExtract %v3half %tint_input 3
- %132 = OpCompositeConstruct %mat3v3half %129 %130 %131
- %133 = OpCompositeExtract %int %tint_input 4
- %134 = OpCompositeConstruct %S %128 %132 %133
- OpReturnValue %134
+ %126 = OpLabel
+ %127 = OpCompositeExtract %int %tint_input 0
+ %128 = OpCompositeExtract %v3half %tint_input 1
+ %129 = OpCompositeExtract %v3half %tint_input 2
+ %130 = OpCompositeExtract %v3half %tint_input 3
+ %131 = OpCompositeConstruct %mat3v3half %128 %129 %130
+ %132 = OpCompositeExtract %int %tint_input 4
+ %133 = OpCompositeConstruct %S %127 %131 %132
+ OpReturnValue %133
OpFunctionEnd
-%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %136
+%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %135
%tint_source = OpFunctionParameter %_arr_S_std140_uint_4
- %137 = OpLabel
- %138 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
- %140 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %141
- OpStore %138 %tint_source
- OpBranch %142
- %142 = OpLabel
- OpBranch %145
- %145 = OpLabel
- %147 = OpPhi %uint %uint_0 %142 %148 %144
- OpLoopMerge %146 %144 None
- OpBranch %143
- %143 = OpLabel
- %150 = OpUGreaterThanEqual %bool %147 %uint_4
- OpSelectionMerge %151 None
- OpBranchConditional %150 %152 %151
- %152 = OpLabel
- OpBranch %146
- %151 = OpLabel
- %153 = OpAccessChain %_ptr_Function_S_std140 %138 %147
- %154 = OpLoad %S_std140 %153 None
- %155 = OpAccessChain %_ptr_Function_S_std140 %140 %147
- OpStore %155 %154 None
+ %136 = OpLabel
+ %137 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
+ %139 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %140
+ OpStore %137 %tint_source
+ OpBranch %141
+ %141 = OpLabel
OpBranch %144
%144 = OpLabel
- %148 = OpIAdd %uint %147 %uint_1
+ %146 = OpPhi %uint %uint_0 %141 %147 %143
+ OpLoopMerge %145 %143 None
+ OpBranch %142
+ %142 = OpLabel
+ %149 = OpUGreaterThanEqual %bool %146 %uint_4
+ OpSelectionMerge %150 None
+ OpBranchConditional %149 %151 %150
+ %151 = OpLabel
OpBranch %145
- %146 = OpLabel
- %149 = OpLoad %_arr_S_std140_uint_4_0 %140 None
- OpReturnValue %149
+ %150 = OpLabel
+ %152 = OpAccessChain %_ptr_Function_S_std140 %137 %146
+ %153 = OpLoad %S_std140 %152 None
+ %154 = OpAccessChain %_ptr_Function_S_std140 %139 %146
+ OpStore %154 %153 None
+ OpBranch %143
+ %143 = OpLabel
+ %147 = OpIAdd %uint %146 %uint_1
+ OpBranch %144
+ %145 = OpLabel
+ %148 = OpLoad %_arr_S_std140_uint_4_0 %139 None
+ OpReturnValue %148
OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/struct/mat3x3_f32/to_storage.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/struct/mat3x3_f32/to_storage.wgsl.expected.spvasm
index f8903eb..ef75fc1 100644
--- a/test/tint/buffer/uniform/std140/struct/mat3x3_f32/to_storage.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/struct/mat3x3_f32/to_storage.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 156
+; Bound: 155
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -15,17 +15,13 @@
OpName %S_std140 "S_std140"
OpMemberName %u_block_std140_tint_explicit_layout 0 "inner"
OpName %u_block_std140_tint_explicit_layout "u_block_std140_tint_explicit_layout"
- OpMemberName %S_tint_explicit_layout 0 "before"
- OpMemberName %S_tint_explicit_layout 1 "m"
- OpMemberName %S_tint_explicit_layout 2 "after"
- OpName %S_tint_explicit_layout "S_tint_explicit_layout"
- OpMemberName %s_block_tint_explicit_layout 0 "inner"
- OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
- OpName %f "f"
OpMemberName %S 0 "before"
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %S "S"
+ OpMemberName %s_block_tint_explicit_layout 0 "inner"
+ OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
+ OpName %f "f"
OpName %tint_store_and_preserve_padding "tint_store_and_preserve_padding"
OpName %value_param "value_param"
OpName %tint_store_and_preserve_padding_0 "tint_store_and_preserve_padding"
@@ -49,12 +45,12 @@
OpDecorate %1 DescriptorSet 0
OpDecorate %1 Binding 0
OpDecorate %1 NonWritable
- OpMemberDecorate %S_tint_explicit_layout 0 Offset 0
- OpMemberDecorate %S_tint_explicit_layout 1 Offset 16
- OpMemberDecorate %S_tint_explicit_layout 1 ColMajor
- OpMemberDecorate %S_tint_explicit_layout 1 MatrixStride 16
- OpMemberDecorate %S_tint_explicit_layout 2 Offset 64
- OpDecorate %_arr_S_tint_explicit_layout_uint_4 ArrayStride 128
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 16
+ OpMemberDecorate %S 1 ColMajor
+ OpMemberDecorate %S 1 MatrixStride 16
+ OpMemberDecorate %S 2 Offset 64
+ OpDecorate %_arr_S_uint_4 ArrayStride 128
OpMemberDecorate %s_block_tint_explicit_layout 0 Offset 0
OpDecorate %s_block_tint_explicit_layout Block
OpDecorate %11 DescriptorSet 0
@@ -71,9 +67,9 @@
%_ptr_Uniform_u_block_std140_tint_explicit_layout = OpTypePointer Uniform %u_block_std140_tint_explicit_layout
%1 = OpVariable %_ptr_Uniform_u_block_std140_tint_explicit_layout Uniform
%mat3v3float = OpTypeMatrix %v3float 3
-%S_tint_explicit_layout = OpTypeStruct %int %mat3v3float %int
-%_arr_S_tint_explicit_layout_uint_4 = OpTypeArray %S_tint_explicit_layout %uint_4
-%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_tint_explicit_layout_uint_4
+ %S = OpTypeStruct %int %mat3v3float %int
+%_arr_S_uint_4 = OpTypeArray %S %uint_4
+%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_s_block_tint_explicit_layout = OpTypePointer StorageBuffer %s_block_tint_explicit_layout
%11 = OpVariable %_ptr_StorageBuffer_s_block_tint_explicit_layout StorageBuffer
%void = OpTypeVoid
@@ -82,10 +78,9 @@
%uint_0 = OpConstant %uint 0
%_arr_S_std140_uint_4_0 = OpTypeArray %S_std140 %uint_4
%_ptr_Function__arr_S_std140_uint_4_0 = OpTypePointer Function %_arr_S_std140_uint_4_0
- %S = OpTypeStruct %int %mat3v3float %int
-%_arr_S_uint_4 = OpTypeArray %S %uint_4
-%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
- %34 = OpConstantNull %_arr_S_uint_4
+%_arr_S_uint_4_0 = OpTypeArray %S %uint_4
+%_ptr_Function__arr_S_uint_4_0 = OpTypePointer Function %_arr_S_uint_4_0
+ %33 = OpConstantNull %_arr_S_uint_4_0
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%uint_2 = OpConstant %uint 2
%uint_1 = OpConstant %uint 1
@@ -96,172 +91,172 @@
%bool = OpTypeBool
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
- %84 = OpTypeFunction %void %_arr_S_uint_4
- %103 = OpTypeFunction %void %_arr_uint_uint_1 %S
+ %83 = OpTypeFunction %void %_arr_S_uint_4_0
+ %102 = OpTypeFunction %void %_arr_uint_uint_1 %S
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
- %116 = OpTypeFunction %void %_arr_uint_uint_1 %mat3v3float
- %126 = OpTypeFunction %S %S_std140
- %136 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
+ %115 = OpTypeFunction %void %_arr_uint_uint_1 %mat3v3float
+ %125 = OpTypeFunction %S %S_std140
+ %135 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
- %141 = OpConstantNull %_arr_S_std140_uint_4_0
+ %140 = OpConstantNull %_arr_S_std140_uint_4_0
%f = OpFunction %void None %19
%20 = OpLabel
%28 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function
- %30 = OpVariable %_ptr_Function__arr_S_uint_4 Function %34
+ %30 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function %33
%21 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %1 %uint_0
%24 = OpLoad %_arr_S_std140_uint_4 %21 None
%25 = OpFunctionCall %_arr_S_std140_uint_4_0 %tint_convert_explicit_layout %24
OpStore %28 %25
- OpBranch %35
- %35 = OpLabel
- OpBranch %38
- %38 = OpLabel
- %40 = OpPhi %uint %uint_0 %35 %41 %37
- OpLoopMerge %39 %37 None
- OpBranch %36
- %36 = OpLabel
- %73 = OpUGreaterThanEqual %bool %40 %uint_4
- OpSelectionMerge %75 None
- OpBranchConditional %73 %76 %75
- %76 = OpLabel
- OpBranch %39
- %75 = OpLabel
- %77 = OpAccessChain %_ptr_Function_S %30 %40
- %79 = OpAccessChain %_ptr_Function_S_std140 %28 %40
- %81 = OpLoad %S_std140 %79 None
- %82 = OpFunctionCall %S %tint_convert_S %81
- OpStore %77 %82 None
+ OpBranch %34
+ %34 = OpLabel
OpBranch %37
%37 = OpLabel
- %41 = OpIAdd %uint %40 %uint_1
+ %39 = OpPhi %uint %uint_0 %34 %40 %36
+ OpLoopMerge %38 %36 None
+ OpBranch %35
+ %35 = OpLabel
+ %72 = OpUGreaterThanEqual %bool %39 %uint_4
+ OpSelectionMerge %74 None
+ OpBranchConditional %72 %75 %74
+ %75 = OpLabel
OpBranch %38
- %39 = OpLabel
- %42 = OpLoad %_arr_S_uint_4 %30 None
- %43 = OpFunctionCall %void %tint_store_and_preserve_padding %42
- %45 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
- %48 = OpLoad %S_std140 %45 None
- %49 = OpFunctionCall %S %tint_convert_S %48
- %53 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
- %54 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %53 %49
- %56 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_0 %uint_2 %uint_1
- %58 = OpLoad %v3float %56 None
- %59 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_0 %uint_2 %uint_2
- %60 = OpLoad %v3float %59 None
- %61 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_0 %uint_2 %uint_3
- %63 = OpLoad %v3float %61 None
- %64 = OpCompositeConstruct %mat3v3float %58 %60 %63
- %65 = OpCompositeConstruct %_arr_uint_uint_1 %uint_3
- %66 = OpFunctionCall %void %tint_store_and_preserve_padding_1 %65 %64
- %68 = OpAccessChain %_ptr_StorageBuffer_v3float %11 %uint_0 %uint_1 %uint_1 %uint_0
- %70 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_0 %uint_0 %uint_2
- %71 = OpLoad %v3float %70 None
- %72 = OpVectorShuffle %v3float %71 %71 2 0 1
- OpStore %68 %72 None
+ %74 = OpLabel
+ %76 = OpAccessChain %_ptr_Function_S %30 %39
+ %78 = OpAccessChain %_ptr_Function_S_std140 %28 %39
+ %80 = OpLoad %S_std140 %78 None
+ %81 = OpFunctionCall %S %tint_convert_S %80
+ OpStore %76 %81 None
+ OpBranch %36
+ %36 = OpLabel
+ %40 = OpIAdd %uint %39 %uint_1
+ OpBranch %37
+ %38 = OpLabel
+ %41 = OpLoad %_arr_S_uint_4_0 %30 None
+ %42 = OpFunctionCall %void %tint_store_and_preserve_padding %41
+ %44 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
+ %47 = OpLoad %S_std140 %44 None
+ %48 = OpFunctionCall %S %tint_convert_S %47
+ %52 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
+ %53 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %52 %48
+ %55 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_0 %uint_2 %uint_1
+ %57 = OpLoad %v3float %55 None
+ %58 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_0 %uint_2 %uint_2
+ %59 = OpLoad %v3float %58 None
+ %60 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_0 %uint_2 %uint_3
+ %62 = OpLoad %v3float %60 None
+ %63 = OpCompositeConstruct %mat3v3float %57 %59 %62
+ %64 = OpCompositeConstruct %_arr_uint_uint_1 %uint_3
+ %65 = OpFunctionCall %void %tint_store_and_preserve_padding_1 %64 %63
+ %67 = OpAccessChain %_ptr_StorageBuffer_v3float %11 %uint_0 %uint_1 %uint_1 %uint_0
+ %69 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_0 %uint_0 %uint_2
+ %70 = OpLoad %v3float %69 None
+ %71 = OpVectorShuffle %v3float %70 %70 2 0 1
+ OpStore %67 %71 None
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding = OpFunction %void None %84
-%value_param = OpFunctionParameter %_arr_S_uint_4
- %85 = OpLabel
- %86 = OpVariable %_ptr_Function__arr_S_uint_4 Function
- OpStore %86 %value_param
- OpBranch %87
- %87 = OpLabel
- OpBranch %90
- %90 = OpLabel
- %92 = OpPhi %uint %uint_0 %87 %93 %89
- OpLoopMerge %91 %89 None
- OpBranch %88
- %88 = OpLabel
- %94 = OpUGreaterThanEqual %bool %92 %uint_4
- OpSelectionMerge %95 None
- OpBranchConditional %94 %96 %95
- %96 = OpLabel
- OpBranch %91
- %95 = OpLabel
- %97 = OpAccessChain %_ptr_Function_S %86 %92
- %98 = OpLoad %S %97 None
- %99 = OpCompositeConstruct %_arr_uint_uint_1 %92
- %100 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %99 %98
+%tint_store_and_preserve_padding = OpFunction %void None %83
+%value_param = OpFunctionParameter %_arr_S_uint_4_0
+ %84 = OpLabel
+ %85 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function
+ OpStore %85 %value_param
+ OpBranch %86
+ %86 = OpLabel
OpBranch %89
%89 = OpLabel
- %93 = OpIAdd %uint %92 %uint_1
+ %91 = OpPhi %uint %uint_0 %86 %92 %88
+ OpLoopMerge %90 %88 None
+ OpBranch %87
+ %87 = OpLabel
+ %93 = OpUGreaterThanEqual %bool %91 %uint_4
+ OpSelectionMerge %94 None
+ OpBranchConditional %93 %95 %94
+ %95 = OpLabel
OpBranch %90
- %91 = OpLabel
+ %94 = OpLabel
+ %96 = OpAccessChain %_ptr_Function_S %85 %91
+ %97 = OpLoad %S %96 None
+ %98 = OpCompositeConstruct %_arr_uint_uint_1 %91
+ %99 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %98 %97
+ OpBranch %88
+ %88 = OpLabel
+ %92 = OpIAdd %uint %91 %uint_1
+ OpBranch %89
+ %90 = OpLabel
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding_0 = OpFunction %void None %103
+%tint_store_and_preserve_padding_0 = OpFunction %void None %102
%target_indices = OpFunctionParameter %_arr_uint_uint_1
%value_param_0 = OpFunctionParameter %S
- %104 = OpLabel
- %105 = OpCompositeExtract %uint %target_indices 0
- %106 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %105 %uint_0
- %108 = OpCompositeExtract %int %value_param_0 0
- OpStore %106 %108 None
- %109 = OpCompositeExtract %mat3v3float %value_param_0 1
- %110 = OpCompositeConstruct %_arr_uint_uint_1 %105
- %111 = OpFunctionCall %void %tint_store_and_preserve_padding_1 %110 %109
- %112 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %105 %uint_2
- %113 = OpCompositeExtract %int %value_param_0 2
- OpStore %112 %113 None
+ %103 = OpLabel
+ %104 = OpCompositeExtract %uint %target_indices 0
+ %105 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %104 %uint_0
+ %107 = OpCompositeExtract %int %value_param_0 0
+ OpStore %105 %107 None
+ %108 = OpCompositeExtract %mat3v3float %value_param_0 1
+ %109 = OpCompositeConstruct %_arr_uint_uint_1 %104
+ %110 = OpFunctionCall %void %tint_store_and_preserve_padding_1 %109 %108
+ %111 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %104 %uint_2
+ %112 = OpCompositeExtract %int %value_param_0 2
+ OpStore %111 %112 None
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding_1 = OpFunction %void None %116
+%tint_store_and_preserve_padding_1 = OpFunction %void None %115
%target_indices_0 = OpFunctionParameter %_arr_uint_uint_1
%value_param_1 = OpFunctionParameter %mat3v3float
- %117 = OpLabel
- %118 = OpCompositeExtract %uint %target_indices_0 0
- %119 = OpAccessChain %_ptr_StorageBuffer_v3float %11 %uint_0 %118 %uint_1 %uint_0
- %120 = OpCompositeExtract %v3float %value_param_1 0
- OpStore %119 %120 None
- %121 = OpAccessChain %_ptr_StorageBuffer_v3float %11 %uint_0 %118 %uint_1 %uint_1
- %122 = OpCompositeExtract %v3float %value_param_1 1
- OpStore %121 %122 None
- %123 = OpAccessChain %_ptr_StorageBuffer_v3float %11 %uint_0 %118 %uint_1 %uint_2
- %124 = OpCompositeExtract %v3float %value_param_1 2
- OpStore %123 %124 None
+ %116 = OpLabel
+ %117 = OpCompositeExtract %uint %target_indices_0 0
+ %118 = OpAccessChain %_ptr_StorageBuffer_v3float %11 %uint_0 %117 %uint_1 %uint_0
+ %119 = OpCompositeExtract %v3float %value_param_1 0
+ OpStore %118 %119 None
+ %120 = OpAccessChain %_ptr_StorageBuffer_v3float %11 %uint_0 %117 %uint_1 %uint_1
+ %121 = OpCompositeExtract %v3float %value_param_1 1
+ OpStore %120 %121 None
+ %122 = OpAccessChain %_ptr_StorageBuffer_v3float %11 %uint_0 %117 %uint_1 %uint_2
+ %123 = OpCompositeExtract %v3float %value_param_1 2
+ OpStore %122 %123 None
OpReturn
OpFunctionEnd
-%tint_convert_S = OpFunction %S None %126
+%tint_convert_S = OpFunction %S None %125
%tint_input = OpFunctionParameter %S_std140
- %127 = OpLabel
- %128 = OpCompositeExtract %int %tint_input 0
- %129 = OpCompositeExtract %v3float %tint_input 1
- %130 = OpCompositeExtract %v3float %tint_input 2
- %131 = OpCompositeExtract %v3float %tint_input 3
- %132 = OpCompositeConstruct %mat3v3float %129 %130 %131
- %133 = OpCompositeExtract %int %tint_input 4
- %134 = OpCompositeConstruct %S %128 %132 %133
- OpReturnValue %134
+ %126 = OpLabel
+ %127 = OpCompositeExtract %int %tint_input 0
+ %128 = OpCompositeExtract %v3float %tint_input 1
+ %129 = OpCompositeExtract %v3float %tint_input 2
+ %130 = OpCompositeExtract %v3float %tint_input 3
+ %131 = OpCompositeConstruct %mat3v3float %128 %129 %130
+ %132 = OpCompositeExtract %int %tint_input 4
+ %133 = OpCompositeConstruct %S %127 %131 %132
+ OpReturnValue %133
OpFunctionEnd
-%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %136
+%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %135
%tint_source = OpFunctionParameter %_arr_S_std140_uint_4
- %137 = OpLabel
- %138 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
- %140 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %141
- OpStore %138 %tint_source
- OpBranch %142
- %142 = OpLabel
- OpBranch %145
- %145 = OpLabel
- %147 = OpPhi %uint %uint_0 %142 %148 %144
- OpLoopMerge %146 %144 None
- OpBranch %143
- %143 = OpLabel
- %150 = OpUGreaterThanEqual %bool %147 %uint_4
- OpSelectionMerge %151 None
- OpBranchConditional %150 %152 %151
- %152 = OpLabel
- OpBranch %146
- %151 = OpLabel
- %153 = OpAccessChain %_ptr_Function_S_std140 %138 %147
- %154 = OpLoad %S_std140 %153 None
- %155 = OpAccessChain %_ptr_Function_S_std140 %140 %147
- OpStore %155 %154 None
+ %136 = OpLabel
+ %137 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
+ %139 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %140
+ OpStore %137 %tint_source
+ OpBranch %141
+ %141 = OpLabel
OpBranch %144
%144 = OpLabel
- %148 = OpIAdd %uint %147 %uint_1
+ %146 = OpPhi %uint %uint_0 %141 %147 %143
+ OpLoopMerge %145 %143 None
+ OpBranch %142
+ %142 = OpLabel
+ %149 = OpUGreaterThanEqual %bool %146 %uint_4
+ OpSelectionMerge %150 None
+ OpBranchConditional %149 %151 %150
+ %151 = OpLabel
OpBranch %145
- %146 = OpLabel
- %149 = OpLoad %_arr_S_std140_uint_4_0 %140 None
- OpReturnValue %149
+ %150 = OpLabel
+ %152 = OpAccessChain %_ptr_Function_S_std140 %137 %146
+ %153 = OpLoad %S_std140 %152 None
+ %154 = OpAccessChain %_ptr_Function_S_std140 %139 %146
+ OpStore %154 %153 None
+ OpBranch %143
+ %143 = OpLabel
+ %147 = OpIAdd %uint %146 %uint_1
+ OpBranch %144
+ %145 = OpLabel
+ %148 = OpLoad %_arr_S_std140_uint_4_0 %139 None
+ OpReturnValue %148
OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/struct/mat3x4_f16/to_storage.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/struct/mat3x4_f16/to_storage.wgsl.expected.spvasm
index 6dd3628..36bbad3 100644
--- a/test/tint/buffer/uniform/std140/struct/mat3x4_f16/to_storage.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/struct/mat3x4_f16/to_storage.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 143
+; Bound: 142
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -18,17 +18,13 @@
OpName %S_std140 "S_std140"
OpMemberName %u_block_std140_tint_explicit_layout 0 "inner"
OpName %u_block_std140_tint_explicit_layout "u_block_std140_tint_explicit_layout"
- OpMemberName %S_tint_explicit_layout 0 "before"
- OpMemberName %S_tint_explicit_layout 1 "m"
- OpMemberName %S_tint_explicit_layout 2 "after"
- OpName %S_tint_explicit_layout "S_tint_explicit_layout"
- OpMemberName %s_block_tint_explicit_layout 0 "inner"
- OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
- OpName %f "f"
OpMemberName %S 0 "before"
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %S "S"
+ OpMemberName %s_block_tint_explicit_layout 0 "inner"
+ OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
+ OpName %f "f"
OpName %tint_store_and_preserve_padding "tint_store_and_preserve_padding"
OpName %value_param "value_param"
OpName %tint_store_and_preserve_padding_0 "tint_store_and_preserve_padding"
@@ -49,12 +45,12 @@
OpDecorate %1 DescriptorSet 0
OpDecorate %1 Binding 0
OpDecorate %1 NonWritable
- OpMemberDecorate %S_tint_explicit_layout 0 Offset 0
- OpMemberDecorate %S_tint_explicit_layout 1 Offset 8
- OpMemberDecorate %S_tint_explicit_layout 1 ColMajor
- OpMemberDecorate %S_tint_explicit_layout 1 MatrixStride 8
- OpMemberDecorate %S_tint_explicit_layout 2 Offset 64
- OpDecorate %_arr_S_tint_explicit_layout_uint_4 ArrayStride 128
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 8
+ OpMemberDecorate %S 1 ColMajor
+ OpMemberDecorate %S 1 MatrixStride 8
+ OpMemberDecorate %S 2 Offset 64
+ OpDecorate %_arr_S_uint_4 ArrayStride 128
OpMemberDecorate %s_block_tint_explicit_layout 0 Offset 0
OpDecorate %s_block_tint_explicit_layout Block
OpDecorate %11 DescriptorSet 0
@@ -71,9 +67,9 @@
%_ptr_Uniform_u_block_std140_tint_explicit_layout = OpTypePointer Uniform %u_block_std140_tint_explicit_layout
%1 = OpVariable %_ptr_Uniform_u_block_std140_tint_explicit_layout Uniform
%mat3v4half = OpTypeMatrix %v4half 3
-%S_tint_explicit_layout = OpTypeStruct %int %mat3v4half %int
-%_arr_S_tint_explicit_layout_uint_4 = OpTypeArray %S_tint_explicit_layout %uint_4
-%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_tint_explicit_layout_uint_4
+ %S = OpTypeStruct %int %mat3v4half %int
+%_arr_S_uint_4 = OpTypeArray %S %uint_4
+%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_s_block_tint_explicit_layout = OpTypePointer StorageBuffer %s_block_tint_explicit_layout
%11 = OpVariable %_ptr_StorageBuffer_s_block_tint_explicit_layout StorageBuffer
%void = OpTypeVoid
@@ -82,10 +78,9 @@
%uint_0 = OpConstant %uint 0
%_arr_S_std140_uint_4_0 = OpTypeArray %S_std140 %uint_4
%_ptr_Function__arr_S_std140_uint_4_0 = OpTypePointer Function %_arr_S_std140_uint_4_0
- %S = OpTypeStruct %int %mat3v4half %int
-%_arr_S_uint_4 = OpTypeArray %S %uint_4
-%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
- %34 = OpConstantNull %_arr_S_uint_4
+%_arr_S_uint_4_0 = OpTypeArray %S %uint_4
+%_ptr_Function__arr_S_uint_4_0 = OpTypePointer Function %_arr_S_uint_4_0
+ %33 = OpConstantNull %_arr_S_uint_4_0
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%uint_2 = OpConstant %uint 2
%uint_1 = OpConstant %uint 1
@@ -97,155 +92,155 @@
%bool = OpTypeBool
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
- %83 = OpTypeFunction %void %_arr_S_uint_4
- %102 = OpTypeFunction %void %_arr_uint_uint_1 %S
+ %82 = OpTypeFunction %void %_arr_S_uint_4_0
+ %101 = OpTypeFunction %void %_arr_uint_uint_1 %S
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
- %113 = OpTypeFunction %S %S_std140
- %123 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
+ %112 = OpTypeFunction %S %S_std140
+ %122 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
- %128 = OpConstantNull %_arr_S_std140_uint_4_0
+ %127 = OpConstantNull %_arr_S_std140_uint_4_0
%f = OpFunction %void None %19
%20 = OpLabel
%28 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function
- %30 = OpVariable %_ptr_Function__arr_S_uint_4 Function %34
+ %30 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function %33
%21 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %1 %uint_0
%24 = OpLoad %_arr_S_std140_uint_4 %21 None
%25 = OpFunctionCall %_arr_S_std140_uint_4_0 %tint_convert_explicit_layout %24
OpStore %28 %25
- OpBranch %35
- %35 = OpLabel
- OpBranch %38
- %38 = OpLabel
- %40 = OpPhi %uint %uint_0 %35 %41 %37
- OpLoopMerge %39 %37 None
- OpBranch %36
- %36 = OpLabel
- %72 = OpUGreaterThanEqual %bool %40 %uint_4
- OpSelectionMerge %74 None
- OpBranchConditional %72 %75 %74
- %75 = OpLabel
- OpBranch %39
- %74 = OpLabel
- %76 = OpAccessChain %_ptr_Function_S %30 %40
- %78 = OpAccessChain %_ptr_Function_S_std140 %28 %40
- %80 = OpLoad %S_std140 %78 None
- %81 = OpFunctionCall %S %tint_convert_S %80
- OpStore %76 %81 None
+ OpBranch %34
+ %34 = OpLabel
OpBranch %37
%37 = OpLabel
- %41 = OpIAdd %uint %40 %uint_1
+ %39 = OpPhi %uint %uint_0 %34 %40 %36
+ OpLoopMerge %38 %36 None
+ OpBranch %35
+ %35 = OpLabel
+ %71 = OpUGreaterThanEqual %bool %39 %uint_4
+ OpSelectionMerge %73 None
+ OpBranchConditional %71 %74 %73
+ %74 = OpLabel
OpBranch %38
- %39 = OpLabel
- %42 = OpLoad %_arr_S_uint_4 %30 None
- %43 = OpFunctionCall %void %tint_store_and_preserve_padding %42
- %45 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
- %48 = OpLoad %S_std140 %45 None
- %49 = OpFunctionCall %S %tint_convert_S %48
- %53 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
- %54 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %53 %49
- %56 = OpAccessChain %_ptr_StorageBuffer_mat3v4half %11 %uint_0 %uint_3 %uint_1
- %59 = OpAccessChain %_ptr_Uniform_v4half %1 %uint_0 %uint_2 %uint_1
- %61 = OpLoad %v4half %59 None
- %62 = OpAccessChain %_ptr_Uniform_v4half %1 %uint_0 %uint_2 %uint_2
- %63 = OpLoad %v4half %62 None
- %64 = OpAccessChain %_ptr_Uniform_v4half %1 %uint_0 %uint_2 %uint_3
- %65 = OpLoad %v4half %64 None
- %66 = OpCompositeConstruct %mat3v4half %61 %63 %65
- OpStore %56 %66 None
- %67 = OpAccessChain %_ptr_StorageBuffer_v4half %11 %uint_0 %uint_1 %uint_1 %uint_0
- %69 = OpAccessChain %_ptr_Uniform_v4half %1 %uint_0 %uint_0 %uint_2
- %70 = OpLoad %v4half %69 None
- %71 = OpVectorShuffle %v4half %70 %70 1 3 0 2
- OpStore %67 %71 None
+ %73 = OpLabel
+ %75 = OpAccessChain %_ptr_Function_S %30 %39
+ %77 = OpAccessChain %_ptr_Function_S_std140 %28 %39
+ %79 = OpLoad %S_std140 %77 None
+ %80 = OpFunctionCall %S %tint_convert_S %79
+ OpStore %75 %80 None
+ OpBranch %36
+ %36 = OpLabel
+ %40 = OpIAdd %uint %39 %uint_1
+ OpBranch %37
+ %38 = OpLabel
+ %41 = OpLoad %_arr_S_uint_4_0 %30 None
+ %42 = OpFunctionCall %void %tint_store_and_preserve_padding %41
+ %44 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
+ %47 = OpLoad %S_std140 %44 None
+ %48 = OpFunctionCall %S %tint_convert_S %47
+ %52 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
+ %53 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %52 %48
+ %55 = OpAccessChain %_ptr_StorageBuffer_mat3v4half %11 %uint_0 %uint_3 %uint_1
+ %58 = OpAccessChain %_ptr_Uniform_v4half %1 %uint_0 %uint_2 %uint_1
+ %60 = OpLoad %v4half %58 None
+ %61 = OpAccessChain %_ptr_Uniform_v4half %1 %uint_0 %uint_2 %uint_2
+ %62 = OpLoad %v4half %61 None
+ %63 = OpAccessChain %_ptr_Uniform_v4half %1 %uint_0 %uint_2 %uint_3
+ %64 = OpLoad %v4half %63 None
+ %65 = OpCompositeConstruct %mat3v4half %60 %62 %64
+ OpStore %55 %65 None
+ %66 = OpAccessChain %_ptr_StorageBuffer_v4half %11 %uint_0 %uint_1 %uint_1 %uint_0
+ %68 = OpAccessChain %_ptr_Uniform_v4half %1 %uint_0 %uint_0 %uint_2
+ %69 = OpLoad %v4half %68 None
+ %70 = OpVectorShuffle %v4half %69 %69 1 3 0 2
+ OpStore %66 %70 None
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding = OpFunction %void None %83
-%value_param = OpFunctionParameter %_arr_S_uint_4
- %84 = OpLabel
- %85 = OpVariable %_ptr_Function__arr_S_uint_4 Function
- OpStore %85 %value_param
- OpBranch %86
- %86 = OpLabel
- OpBranch %89
- %89 = OpLabel
- %91 = OpPhi %uint %uint_0 %86 %92 %88
- OpLoopMerge %90 %88 None
- OpBranch %87
- %87 = OpLabel
- %93 = OpUGreaterThanEqual %bool %91 %uint_4
- OpSelectionMerge %94 None
- OpBranchConditional %93 %95 %94
- %95 = OpLabel
- OpBranch %90
- %94 = OpLabel
- %96 = OpAccessChain %_ptr_Function_S %85 %91
- %97 = OpLoad %S %96 None
- %98 = OpCompositeConstruct %_arr_uint_uint_1 %91
- %99 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %98 %97
+%tint_store_and_preserve_padding = OpFunction %void None %82
+%value_param = OpFunctionParameter %_arr_S_uint_4_0
+ %83 = OpLabel
+ %84 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function
+ OpStore %84 %value_param
+ OpBranch %85
+ %85 = OpLabel
OpBranch %88
%88 = OpLabel
- %92 = OpIAdd %uint %91 %uint_1
+ %90 = OpPhi %uint %uint_0 %85 %91 %87
+ OpLoopMerge %89 %87 None
+ OpBranch %86
+ %86 = OpLabel
+ %92 = OpUGreaterThanEqual %bool %90 %uint_4
+ OpSelectionMerge %93 None
+ OpBranchConditional %92 %94 %93
+ %94 = OpLabel
OpBranch %89
- %90 = OpLabel
+ %93 = OpLabel
+ %95 = OpAccessChain %_ptr_Function_S %84 %90
+ %96 = OpLoad %S %95 None
+ %97 = OpCompositeConstruct %_arr_uint_uint_1 %90
+ %98 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %97 %96
+ OpBranch %87
+ %87 = OpLabel
+ %91 = OpIAdd %uint %90 %uint_1
+ OpBranch %88
+ %89 = OpLabel
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding_0 = OpFunction %void None %102
+%tint_store_and_preserve_padding_0 = OpFunction %void None %101
%target_indices = OpFunctionParameter %_arr_uint_uint_1
%value_param_0 = OpFunctionParameter %S
- %103 = OpLabel
- %104 = OpCompositeExtract %uint %target_indices 0
- %105 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %104 %uint_0
- %107 = OpCompositeExtract %int %value_param_0 0
- OpStore %105 %107 None
- %108 = OpAccessChain %_ptr_StorageBuffer_mat3v4half %11 %uint_0 %104 %uint_1
- %109 = OpCompositeExtract %mat3v4half %value_param_0 1
- OpStore %108 %109 None
- %110 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %104 %uint_2
- %111 = OpCompositeExtract %int %value_param_0 2
- OpStore %110 %111 None
+ %102 = OpLabel
+ %103 = OpCompositeExtract %uint %target_indices 0
+ %104 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %103 %uint_0
+ %106 = OpCompositeExtract %int %value_param_0 0
+ OpStore %104 %106 None
+ %107 = OpAccessChain %_ptr_StorageBuffer_mat3v4half %11 %uint_0 %103 %uint_1
+ %108 = OpCompositeExtract %mat3v4half %value_param_0 1
+ OpStore %107 %108 None
+ %109 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %103 %uint_2
+ %110 = OpCompositeExtract %int %value_param_0 2
+ OpStore %109 %110 None
OpReturn
OpFunctionEnd
-%tint_convert_S = OpFunction %S None %113
+%tint_convert_S = OpFunction %S None %112
%tint_input = OpFunctionParameter %S_std140
- %114 = OpLabel
- %115 = OpCompositeExtract %int %tint_input 0
- %116 = OpCompositeExtract %v4half %tint_input 1
- %117 = OpCompositeExtract %v4half %tint_input 2
- %118 = OpCompositeExtract %v4half %tint_input 3
- %119 = OpCompositeConstruct %mat3v4half %116 %117 %118
- %120 = OpCompositeExtract %int %tint_input 4
- %121 = OpCompositeConstruct %S %115 %119 %120
- OpReturnValue %121
+ %113 = OpLabel
+ %114 = OpCompositeExtract %int %tint_input 0
+ %115 = OpCompositeExtract %v4half %tint_input 1
+ %116 = OpCompositeExtract %v4half %tint_input 2
+ %117 = OpCompositeExtract %v4half %tint_input 3
+ %118 = OpCompositeConstruct %mat3v4half %115 %116 %117
+ %119 = OpCompositeExtract %int %tint_input 4
+ %120 = OpCompositeConstruct %S %114 %118 %119
+ OpReturnValue %120
OpFunctionEnd
-%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %123
+%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %122
%tint_source = OpFunctionParameter %_arr_S_std140_uint_4
- %124 = OpLabel
- %125 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
- %127 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %128
- OpStore %125 %tint_source
- OpBranch %129
- %129 = OpLabel
- OpBranch %132
- %132 = OpLabel
- %134 = OpPhi %uint %uint_0 %129 %135 %131
- OpLoopMerge %133 %131 None
- OpBranch %130
- %130 = OpLabel
- %137 = OpUGreaterThanEqual %bool %134 %uint_4
- OpSelectionMerge %138 None
- OpBranchConditional %137 %139 %138
- %139 = OpLabel
- OpBranch %133
- %138 = OpLabel
- %140 = OpAccessChain %_ptr_Function_S_std140 %125 %134
- %141 = OpLoad %S_std140 %140 None
- %142 = OpAccessChain %_ptr_Function_S_std140 %127 %134
- OpStore %142 %141 None
+ %123 = OpLabel
+ %124 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
+ %126 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %127
+ OpStore %124 %tint_source
+ OpBranch %128
+ %128 = OpLabel
OpBranch %131
%131 = OpLabel
- %135 = OpIAdd %uint %134 %uint_1
+ %133 = OpPhi %uint %uint_0 %128 %134 %130
+ OpLoopMerge %132 %130 None
+ OpBranch %129
+ %129 = OpLabel
+ %136 = OpUGreaterThanEqual %bool %133 %uint_4
+ OpSelectionMerge %137 None
+ OpBranchConditional %136 %138 %137
+ %138 = OpLabel
OpBranch %132
- %133 = OpLabel
- %136 = OpLoad %_arr_S_std140_uint_4_0 %127 None
- OpReturnValue %136
+ %137 = OpLabel
+ %139 = OpAccessChain %_ptr_Function_S_std140 %124 %133
+ %140 = OpLoad %S_std140 %139 None
+ %141 = OpAccessChain %_ptr_Function_S_std140 %126 %133
+ OpStore %141 %140 None
+ OpBranch %130
+ %130 = OpLabel
+ %134 = OpIAdd %uint %133 %uint_1
+ OpBranch %131
+ %132 = OpLabel
+ %135 = OpLoad %_arr_S_std140_uint_4_0 %126 None
+ OpReturnValue %135
OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/struct/mat3x4_f32/to_private.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/struct/mat3x4_f32/to_private.wgsl.expected.spvasm
index a5bccb4..b7782f4 100644
--- a/test/tint/buffer/uniform/std140/struct/mat3x4_f32/to_private.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/struct/mat3x4_f32/to_private.wgsl.expected.spvasm
@@ -1,34 +1,28 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 80
+; Bound: 68
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
- OpMemberName %S_tint_explicit_layout 0 "before"
- OpMemberName %S_tint_explicit_layout 1 "m"
- OpMemberName %S_tint_explicit_layout 2 "after"
- OpName %S_tint_explicit_layout "S_tint_explicit_layout"
- OpMemberName %u_block_tint_explicit_layout 0 "inner"
- OpName %u_block_tint_explicit_layout "u_block_tint_explicit_layout"
OpMemberName %S 0 "before"
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %S "S"
+ OpMemberName %u_block_tint_explicit_layout 0 "inner"
+ OpName %u_block_tint_explicit_layout "u_block_tint_explicit_layout"
OpName %p "p"
OpName %f "f"
OpName %tint_convert_explicit_layout "tint_convert_explicit_layout"
OpName %tint_source "tint_source"
- OpName %tint_convert_explicit_layout_0 "tint_convert_explicit_layout"
- OpName %tint_source_0 "tint_source"
- OpMemberDecorate %S_tint_explicit_layout 0 Offset 0
- OpMemberDecorate %S_tint_explicit_layout 1 Offset 16
- OpMemberDecorate %S_tint_explicit_layout 1 ColMajor
- OpMemberDecorate %S_tint_explicit_layout 1 MatrixStride 16
- OpMemberDecorate %S_tint_explicit_layout 2 Offset 64
- OpDecorate %_arr_S_tint_explicit_layout_uint_4 ArrayStride 128
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 16
+ OpMemberDecorate %S 1 ColMajor
+ OpMemberDecorate %S 1 MatrixStride 16
+ OpMemberDecorate %S 2 Offset 64
+ OpDecorate %_arr_S_uint_4 ArrayStride 128
OpMemberDecorate %u_block_tint_explicit_layout 0 Offset 0
OpDecorate %u_block_tint_explicit_layout Block
OpDecorate %1 DescriptorSet 0
@@ -38,99 +32,85 @@
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat3v4float = OpTypeMatrix %v4float 3
-%S_tint_explicit_layout = OpTypeStruct %int %mat3v4float %int
+ %S = OpTypeStruct %int %mat3v4float %int
%uint = OpTypeInt 32 0
%uint_4 = OpConstant %uint 4
-%_arr_S_tint_explicit_layout_uint_4 = OpTypeArray %S_tint_explicit_layout %uint_4
-%u_block_tint_explicit_layout = OpTypeStruct %_arr_S_tint_explicit_layout_uint_4
+%_arr_S_uint_4 = OpTypeArray %S %uint_4
+%u_block_tint_explicit_layout = OpTypeStruct %_arr_S_uint_4
%_ptr_Uniform_u_block_tint_explicit_layout = OpTypePointer Uniform %u_block_tint_explicit_layout
%1 = OpVariable %_ptr_Uniform_u_block_tint_explicit_layout Uniform
- %S = OpTypeStruct %int %mat3v4float %int
-%_arr_S_uint_4 = OpTypeArray %S %uint_4
-%_ptr_Private__arr_S_uint_4 = OpTypePointer Private %_arr_S_uint_4
- %16 = OpConstantNull %_arr_S_uint_4
- %p = OpVariable %_ptr_Private__arr_S_uint_4 Private %16
+%_arr_S_uint_4_0 = OpTypeArray %S %uint_4
+%_ptr_Private__arr_S_uint_4_0 = OpTypePointer Private %_arr_S_uint_4_0
+ %15 = OpConstantNull %_arr_S_uint_4_0
+ %p = OpVariable %_ptr_Private__arr_S_uint_4_0 Private %15
%void = OpTypeVoid
- %19 = OpTypeFunction %void
-%_ptr_Uniform__arr_S_tint_explicit_layout_uint_4 = OpTypePointer Uniform %_arr_S_tint_explicit_layout_uint_4
+ %18 = OpTypeFunction %void
+%_ptr_Uniform__arr_S_uint_4 = OpTypePointer Uniform %_arr_S_uint_4
%uint_0 = OpConstant %uint 0
%_ptr_Private_S = OpTypePointer Private %S
%uint_1 = OpConstant %uint 1
-%_ptr_Uniform_S_tint_explicit_layout = OpTypePointer Uniform %S_tint_explicit_layout
+%_ptr_Uniform_S = OpTypePointer Uniform %S
%uint_2 = OpConstant %uint 2
%_ptr_Private_mat3v4float = OpTypePointer Private %mat3v4float
%uint_3 = OpConstant %uint 3
%_ptr_Uniform_mat3v4float = OpTypePointer Uniform %mat3v4float
%_ptr_Private_v4float = OpTypePointer Private %v4float
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
- %49 = OpTypeFunction %S %S_tint_explicit_layout
- %56 = OpTypeFunction %_arr_S_uint_4 %_arr_S_tint_explicit_layout_uint_4
-%_ptr_Function__arr_S_tint_explicit_layout_uint_4 = OpTypePointer Function %_arr_S_tint_explicit_layout_uint_4
+ %46 = OpTypeFunction %_arr_S_uint_4_0 %_arr_S_uint_4
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
+%_ptr_Function__arr_S_uint_4_0 = OpTypePointer Function %_arr_S_uint_4_0
%bool = OpTypeBool
-%_ptr_Function_S_tint_explicit_layout = OpTypePointer Function %S_tint_explicit_layout
%_ptr_Function_S = OpTypePointer Function %S
- %f = OpFunction %void None %19
- %20 = OpLabel
- %21 = OpAccessChain %_ptr_Uniform__arr_S_tint_explicit_layout_uint_4 %1 %uint_0
- %24 = OpLoad %_arr_S_tint_explicit_layout_uint_4 %21 None
- %25 = OpFunctionCall %_arr_S_uint_4 %tint_convert_explicit_layout_0 %24
- OpStore %p %25 None
- %27 = OpAccessChain %_ptr_Private_S %p %uint_1
- %30 = OpAccessChain %_ptr_Uniform_S_tint_explicit_layout %1 %uint_0 %uint_2
- %33 = OpLoad %S_tint_explicit_layout %30 None
- %34 = OpFunctionCall %S %tint_convert_explicit_layout %33
- OpStore %27 %34 None
- %36 = OpAccessChain %_ptr_Private_mat3v4float %p %uint_3 %uint_1
- %39 = OpAccessChain %_ptr_Uniform_mat3v4float %1 %uint_0 %uint_2 %uint_1
- %41 = OpLoad %mat3v4float %39 None
- OpStore %36 %41 None
- %42 = OpAccessChain %_ptr_Private_v4float %p %uint_1 %uint_1 %uint_0
- %44 = OpAccessChain %_ptr_Uniform_v4float %1 %uint_0 %uint_0 %uint_1 %uint_1
- %46 = OpLoad %v4float %44 None
- %47 = OpVectorShuffle %v4float %46 %46 1 3 0 2
- OpStore %42 %47 None
+ %f = OpFunction %void None %18
+ %19 = OpLabel
+ %20 = OpAccessChain %_ptr_Uniform__arr_S_uint_4 %1 %uint_0
+ %23 = OpLoad %_arr_S_uint_4 %20 None
+ %24 = OpFunctionCall %_arr_S_uint_4_0 %tint_convert_explicit_layout %23
+ OpStore %p %24 None
+ %26 = OpAccessChain %_ptr_Private_S %p %uint_1
+ %29 = OpAccessChain %_ptr_Uniform_S %1 %uint_0 %uint_2
+ %32 = OpLoad %S %29 None
+ OpStore %26 %32 None
+ %33 = OpAccessChain %_ptr_Private_mat3v4float %p %uint_3 %uint_1
+ %36 = OpAccessChain %_ptr_Uniform_mat3v4float %1 %uint_0 %uint_2 %uint_1
+ %38 = OpLoad %mat3v4float %36 None
+ OpStore %33 %38 None
+ %39 = OpAccessChain %_ptr_Private_v4float %p %uint_1 %uint_1 %uint_0
+ %41 = OpAccessChain %_ptr_Uniform_v4float %1 %uint_0 %uint_0 %uint_1 %uint_1
+ %43 = OpLoad %v4float %41 None
+ %44 = OpVectorShuffle %v4float %43 %43 1 3 0 2
+ OpStore %39 %44 None
OpReturn
OpFunctionEnd
-%tint_convert_explicit_layout = OpFunction %S None %49
-%tint_source = OpFunctionParameter %S_tint_explicit_layout
- %50 = OpLabel
- %51 = OpCompositeExtract %int %tint_source 0
- %52 = OpCompositeExtract %mat3v4float %tint_source 1
- %53 = OpCompositeExtract %int %tint_source 2
- %54 = OpCompositeConstruct %S %51 %52 %53
- OpReturnValue %54
- OpFunctionEnd
-%tint_convert_explicit_layout_0 = OpFunction %_arr_S_uint_4 None %56
-%tint_source_0 = OpFunctionParameter %_arr_S_tint_explicit_layout_uint_4
- %57 = OpLabel
- %58 = OpVariable %_ptr_Function__arr_S_tint_explicit_layout_uint_4 Function
- %60 = OpVariable %_ptr_Function__arr_S_uint_4 Function %16
- OpStore %58 %tint_source_0
- OpBranch %62
- %62 = OpLabel
- OpBranch %65
- %65 = OpLabel
- %67 = OpPhi %uint %uint_0 %62 %68 %64
- OpLoopMerge %66 %64 None
- OpBranch %63
+%tint_convert_explicit_layout = OpFunction %_arr_S_uint_4_0 None %46
+%tint_source = OpFunctionParameter %_arr_S_uint_4
+ %47 = OpLabel
+ %48 = OpVariable %_ptr_Function__arr_S_uint_4 Function
+ %50 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function %15
+ OpStore %48 %tint_source
+ OpBranch %52
+ %52 = OpLabel
+ OpBranch %55
+ %55 = OpLabel
+ %57 = OpPhi %uint %uint_0 %52 %58 %54
+ OpLoopMerge %56 %54 None
+ OpBranch %53
+ %53 = OpLabel
+ %60 = OpUGreaterThanEqual %bool %57 %uint_4
+ OpSelectionMerge %62 None
+ OpBranchConditional %60 %63 %62
%63 = OpLabel
- %70 = OpUGreaterThanEqual %bool %67 %uint_4
- OpSelectionMerge %72 None
- OpBranchConditional %70 %73 %72
- %73 = OpLabel
- OpBranch %66
- %72 = OpLabel
- %74 = OpAccessChain %_ptr_Function_S_tint_explicit_layout %58 %67
- %76 = OpLoad %S_tint_explicit_layout %74 None
- %77 = OpFunctionCall %S %tint_convert_explicit_layout %76
- %78 = OpAccessChain %_ptr_Function_S %60 %67
- OpStore %78 %77 None
- OpBranch %64
- %64 = OpLabel
- %68 = OpIAdd %uint %67 %uint_1
- OpBranch %65
- %66 = OpLabel
- %69 = OpLoad %_arr_S_uint_4 %60 None
- OpReturnValue %69
+ OpBranch %56
+ %62 = OpLabel
+ %64 = OpAccessChain %_ptr_Function_S %48 %57
+ %66 = OpLoad %S %64 None
+ %67 = OpAccessChain %_ptr_Function_S %50 %57
+ OpStore %67 %66 None
+ OpBranch %54
+ %54 = OpLabel
+ %58 = OpIAdd %uint %57 %uint_1
+ OpBranch %55
+ %56 = OpLabel
+ %59 = OpLoad %_arr_S_uint_4_0 %50 None
+ OpReturnValue %59
OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/struct/mat4x2_f16/to_storage.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/struct/mat4x2_f16/to_storage.wgsl.expected.spvasm
index 57ce09e..0353136 100644
--- a/test/tint/buffer/uniform/std140/struct/mat4x2_f16/to_storage.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/struct/mat4x2_f16/to_storage.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 146
+; Bound: 145
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -19,17 +19,13 @@
OpName %S_std140 "S_std140"
OpMemberName %u_block_std140_tint_explicit_layout 0 "inner"
OpName %u_block_std140_tint_explicit_layout "u_block_std140_tint_explicit_layout"
- OpMemberName %S_tint_explicit_layout 0 "before"
- OpMemberName %S_tint_explicit_layout 1 "m"
- OpMemberName %S_tint_explicit_layout 2 "after"
- OpName %S_tint_explicit_layout "S_tint_explicit_layout"
- OpMemberName %s_block_tint_explicit_layout 0 "inner"
- OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
- OpName %f "f"
OpMemberName %S 0 "before"
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %S "S"
+ OpMemberName %s_block_tint_explicit_layout 0 "inner"
+ OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
+ OpName %f "f"
OpName %tint_store_and_preserve_padding "tint_store_and_preserve_padding"
OpName %value_param "value_param"
OpName %tint_store_and_preserve_padding_0 "tint_store_and_preserve_padding"
@@ -51,12 +47,12 @@
OpDecorate %1 DescriptorSet 0
OpDecorate %1 Binding 0
OpDecorate %1 NonWritable
- OpMemberDecorate %S_tint_explicit_layout 0 Offset 0
- OpMemberDecorate %S_tint_explicit_layout 1 Offset 4
- OpMemberDecorate %S_tint_explicit_layout 1 ColMajor
- OpMemberDecorate %S_tint_explicit_layout 1 MatrixStride 4
- OpMemberDecorate %S_tint_explicit_layout 2 Offset 64
- OpDecorate %_arr_S_tint_explicit_layout_uint_4 ArrayStride 128
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 4
+ OpMemberDecorate %S 1 ColMajor
+ OpMemberDecorate %S 1 MatrixStride 4
+ OpMemberDecorate %S 2 Offset 64
+ OpDecorate %_arr_S_uint_4 ArrayStride 128
OpMemberDecorate %s_block_tint_explicit_layout 0 Offset 0
OpDecorate %s_block_tint_explicit_layout Block
OpDecorate %11 DescriptorSet 0
@@ -73,9 +69,9 @@
%_ptr_Uniform_u_block_std140_tint_explicit_layout = OpTypePointer Uniform %u_block_std140_tint_explicit_layout
%1 = OpVariable %_ptr_Uniform_u_block_std140_tint_explicit_layout Uniform
%mat4v2half = OpTypeMatrix %v2half 4
-%S_tint_explicit_layout = OpTypeStruct %int %mat4v2half %int
-%_arr_S_tint_explicit_layout_uint_4 = OpTypeArray %S_tint_explicit_layout %uint_4
-%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_tint_explicit_layout_uint_4
+ %S = OpTypeStruct %int %mat4v2half %int
+%_arr_S_uint_4 = OpTypeArray %S %uint_4
+%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_s_block_tint_explicit_layout = OpTypePointer StorageBuffer %s_block_tint_explicit_layout
%11 = OpVariable %_ptr_StorageBuffer_s_block_tint_explicit_layout StorageBuffer
%void = OpTypeVoid
@@ -84,10 +80,9 @@
%uint_0 = OpConstant %uint 0
%_arr_S_std140_uint_4_0 = OpTypeArray %S_std140 %uint_4
%_ptr_Function__arr_S_std140_uint_4_0 = OpTypePointer Function %_arr_S_std140_uint_4_0
- %S = OpTypeStruct %int %mat4v2half %int
-%_arr_S_uint_4 = OpTypeArray %S %uint_4
-%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
- %34 = OpConstantNull %_arr_S_uint_4
+%_arr_S_uint_4_0 = OpTypeArray %S %uint_4
+%_ptr_Function__arr_S_uint_4_0 = OpTypePointer Function %_arr_S_uint_4_0
+ %33 = OpConstantNull %_arr_S_uint_4_0
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%uint_2 = OpConstant %uint 2
%uint_1 = OpConstant %uint 1
@@ -99,158 +94,158 @@
%bool = OpTypeBool
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
- %85 = OpTypeFunction %void %_arr_S_uint_4
- %104 = OpTypeFunction %void %_arr_uint_uint_1 %S
+ %84 = OpTypeFunction %void %_arr_S_uint_4_0
+ %103 = OpTypeFunction %void %_arr_uint_uint_1 %S
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
- %115 = OpTypeFunction %S %S_std140
- %126 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
+ %114 = OpTypeFunction %S %S_std140
+ %125 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
- %131 = OpConstantNull %_arr_S_std140_uint_4_0
+ %130 = OpConstantNull %_arr_S_std140_uint_4_0
%f = OpFunction %void None %19
%20 = OpLabel
%28 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function
- %30 = OpVariable %_ptr_Function__arr_S_uint_4 Function %34
+ %30 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function %33
%21 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %1 %uint_0
%24 = OpLoad %_arr_S_std140_uint_4 %21 None
%25 = OpFunctionCall %_arr_S_std140_uint_4_0 %tint_convert_explicit_layout %24
OpStore %28 %25
- OpBranch %35
- %35 = OpLabel
- OpBranch %38
- %38 = OpLabel
- %40 = OpPhi %uint %uint_0 %35 %41 %37
- OpLoopMerge %39 %37 None
- OpBranch %36
- %36 = OpLabel
- %74 = OpUGreaterThanEqual %bool %40 %uint_4
- OpSelectionMerge %76 None
- OpBranchConditional %74 %77 %76
- %77 = OpLabel
- OpBranch %39
- %76 = OpLabel
- %78 = OpAccessChain %_ptr_Function_S %30 %40
- %80 = OpAccessChain %_ptr_Function_S_std140 %28 %40
- %82 = OpLoad %S_std140 %80 None
- %83 = OpFunctionCall %S %tint_convert_S %82
- OpStore %78 %83 None
+ OpBranch %34
+ %34 = OpLabel
OpBranch %37
%37 = OpLabel
- %41 = OpIAdd %uint %40 %uint_1
+ %39 = OpPhi %uint %uint_0 %34 %40 %36
+ OpLoopMerge %38 %36 None
+ OpBranch %35
+ %35 = OpLabel
+ %73 = OpUGreaterThanEqual %bool %39 %uint_4
+ OpSelectionMerge %75 None
+ OpBranchConditional %73 %76 %75
+ %76 = OpLabel
OpBranch %38
- %39 = OpLabel
- %42 = OpLoad %_arr_S_uint_4 %30 None
- %43 = OpFunctionCall %void %tint_store_and_preserve_padding %42
- %45 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
- %48 = OpLoad %S_std140 %45 None
- %49 = OpFunctionCall %S %tint_convert_S %48
- %53 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
- %54 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %53 %49
- %56 = OpAccessChain %_ptr_StorageBuffer_mat4v2half %11 %uint_0 %uint_3 %uint_1
- %59 = OpAccessChain %_ptr_Uniform_v2half %1 %uint_0 %uint_2 %uint_1
- %61 = OpLoad %v2half %59 None
- %62 = OpAccessChain %_ptr_Uniform_v2half %1 %uint_0 %uint_2 %uint_2
- %63 = OpLoad %v2half %62 None
- %64 = OpAccessChain %_ptr_Uniform_v2half %1 %uint_0 %uint_2 %uint_3
- %65 = OpLoad %v2half %64 None
- %66 = OpAccessChain %_ptr_Uniform_v2half %1 %uint_0 %uint_2 %uint_4
- %67 = OpLoad %v2half %66 None
- %68 = OpCompositeConstruct %mat4v2half %61 %63 %65 %67
- OpStore %56 %68 None
- %69 = OpAccessChain %_ptr_StorageBuffer_v2half %11 %uint_0 %uint_1 %uint_1 %uint_0
- %71 = OpAccessChain %_ptr_Uniform_v2half %1 %uint_0 %uint_0 %uint_2
- %72 = OpLoad %v2half %71 None
- %73 = OpVectorShuffle %v2half %72 %72 1 0
- OpStore %69 %73 None
+ %75 = OpLabel
+ %77 = OpAccessChain %_ptr_Function_S %30 %39
+ %79 = OpAccessChain %_ptr_Function_S_std140 %28 %39
+ %81 = OpLoad %S_std140 %79 None
+ %82 = OpFunctionCall %S %tint_convert_S %81
+ OpStore %77 %82 None
+ OpBranch %36
+ %36 = OpLabel
+ %40 = OpIAdd %uint %39 %uint_1
+ OpBranch %37
+ %38 = OpLabel
+ %41 = OpLoad %_arr_S_uint_4_0 %30 None
+ %42 = OpFunctionCall %void %tint_store_and_preserve_padding %41
+ %44 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
+ %47 = OpLoad %S_std140 %44 None
+ %48 = OpFunctionCall %S %tint_convert_S %47
+ %52 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
+ %53 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %52 %48
+ %55 = OpAccessChain %_ptr_StorageBuffer_mat4v2half %11 %uint_0 %uint_3 %uint_1
+ %58 = OpAccessChain %_ptr_Uniform_v2half %1 %uint_0 %uint_2 %uint_1
+ %60 = OpLoad %v2half %58 None
+ %61 = OpAccessChain %_ptr_Uniform_v2half %1 %uint_0 %uint_2 %uint_2
+ %62 = OpLoad %v2half %61 None
+ %63 = OpAccessChain %_ptr_Uniform_v2half %1 %uint_0 %uint_2 %uint_3
+ %64 = OpLoad %v2half %63 None
+ %65 = OpAccessChain %_ptr_Uniform_v2half %1 %uint_0 %uint_2 %uint_4
+ %66 = OpLoad %v2half %65 None
+ %67 = OpCompositeConstruct %mat4v2half %60 %62 %64 %66
+ OpStore %55 %67 None
+ %68 = OpAccessChain %_ptr_StorageBuffer_v2half %11 %uint_0 %uint_1 %uint_1 %uint_0
+ %70 = OpAccessChain %_ptr_Uniform_v2half %1 %uint_0 %uint_0 %uint_2
+ %71 = OpLoad %v2half %70 None
+ %72 = OpVectorShuffle %v2half %71 %71 1 0
+ OpStore %68 %72 None
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding = OpFunction %void None %85
-%value_param = OpFunctionParameter %_arr_S_uint_4
- %86 = OpLabel
- %87 = OpVariable %_ptr_Function__arr_S_uint_4 Function
- OpStore %87 %value_param
- OpBranch %88
- %88 = OpLabel
- OpBranch %91
- %91 = OpLabel
- %93 = OpPhi %uint %uint_0 %88 %94 %90
- OpLoopMerge %92 %90 None
- OpBranch %89
- %89 = OpLabel
- %95 = OpUGreaterThanEqual %bool %93 %uint_4
- OpSelectionMerge %96 None
- OpBranchConditional %95 %97 %96
- %97 = OpLabel
- OpBranch %92
- %96 = OpLabel
- %98 = OpAccessChain %_ptr_Function_S %87 %93
- %99 = OpLoad %S %98 None
- %100 = OpCompositeConstruct %_arr_uint_uint_1 %93
- %101 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %100 %99
+%tint_store_and_preserve_padding = OpFunction %void None %84
+%value_param = OpFunctionParameter %_arr_S_uint_4_0
+ %85 = OpLabel
+ %86 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function
+ OpStore %86 %value_param
+ OpBranch %87
+ %87 = OpLabel
OpBranch %90
%90 = OpLabel
- %94 = OpIAdd %uint %93 %uint_1
+ %92 = OpPhi %uint %uint_0 %87 %93 %89
+ OpLoopMerge %91 %89 None
+ OpBranch %88
+ %88 = OpLabel
+ %94 = OpUGreaterThanEqual %bool %92 %uint_4
+ OpSelectionMerge %95 None
+ OpBranchConditional %94 %96 %95
+ %96 = OpLabel
OpBranch %91
- %92 = OpLabel
+ %95 = OpLabel
+ %97 = OpAccessChain %_ptr_Function_S %86 %92
+ %98 = OpLoad %S %97 None
+ %99 = OpCompositeConstruct %_arr_uint_uint_1 %92
+ %100 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %99 %98
+ OpBranch %89
+ %89 = OpLabel
+ %93 = OpIAdd %uint %92 %uint_1
+ OpBranch %90
+ %91 = OpLabel
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding_0 = OpFunction %void None %104
+%tint_store_and_preserve_padding_0 = OpFunction %void None %103
%target_indices = OpFunctionParameter %_arr_uint_uint_1
%value_param_0 = OpFunctionParameter %S
- %105 = OpLabel
- %106 = OpCompositeExtract %uint %target_indices 0
- %107 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %106 %uint_0
- %109 = OpCompositeExtract %int %value_param_0 0
- OpStore %107 %109 None
- %110 = OpAccessChain %_ptr_StorageBuffer_mat4v2half %11 %uint_0 %106 %uint_1
- %111 = OpCompositeExtract %mat4v2half %value_param_0 1
- OpStore %110 %111 None
- %112 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %106 %uint_2
- %113 = OpCompositeExtract %int %value_param_0 2
- OpStore %112 %113 None
+ %104 = OpLabel
+ %105 = OpCompositeExtract %uint %target_indices 0
+ %106 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %105 %uint_0
+ %108 = OpCompositeExtract %int %value_param_0 0
+ OpStore %106 %108 None
+ %109 = OpAccessChain %_ptr_StorageBuffer_mat4v2half %11 %uint_0 %105 %uint_1
+ %110 = OpCompositeExtract %mat4v2half %value_param_0 1
+ OpStore %109 %110 None
+ %111 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %105 %uint_2
+ %112 = OpCompositeExtract %int %value_param_0 2
+ OpStore %111 %112 None
OpReturn
OpFunctionEnd
-%tint_convert_S = OpFunction %S None %115
+%tint_convert_S = OpFunction %S None %114
%tint_input = OpFunctionParameter %S_std140
- %116 = OpLabel
- %117 = OpCompositeExtract %int %tint_input 0
- %118 = OpCompositeExtract %v2half %tint_input 1
- %119 = OpCompositeExtract %v2half %tint_input 2
- %120 = OpCompositeExtract %v2half %tint_input 3
- %121 = OpCompositeExtract %v2half %tint_input 4
- %122 = OpCompositeConstruct %mat4v2half %118 %119 %120 %121
- %123 = OpCompositeExtract %int %tint_input 5
- %124 = OpCompositeConstruct %S %117 %122 %123
- OpReturnValue %124
+ %115 = OpLabel
+ %116 = OpCompositeExtract %int %tint_input 0
+ %117 = OpCompositeExtract %v2half %tint_input 1
+ %118 = OpCompositeExtract %v2half %tint_input 2
+ %119 = OpCompositeExtract %v2half %tint_input 3
+ %120 = OpCompositeExtract %v2half %tint_input 4
+ %121 = OpCompositeConstruct %mat4v2half %117 %118 %119 %120
+ %122 = OpCompositeExtract %int %tint_input 5
+ %123 = OpCompositeConstruct %S %116 %121 %122
+ OpReturnValue %123
OpFunctionEnd
-%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %126
+%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %125
%tint_source = OpFunctionParameter %_arr_S_std140_uint_4
- %127 = OpLabel
- %128 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
- %130 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %131
- OpStore %128 %tint_source
- OpBranch %132
- %132 = OpLabel
- OpBranch %135
- %135 = OpLabel
- %137 = OpPhi %uint %uint_0 %132 %138 %134
- OpLoopMerge %136 %134 None
- OpBranch %133
- %133 = OpLabel
- %140 = OpUGreaterThanEqual %bool %137 %uint_4
- OpSelectionMerge %141 None
- OpBranchConditional %140 %142 %141
- %142 = OpLabel
- OpBranch %136
- %141 = OpLabel
- %143 = OpAccessChain %_ptr_Function_S_std140 %128 %137
- %144 = OpLoad %S_std140 %143 None
- %145 = OpAccessChain %_ptr_Function_S_std140 %130 %137
- OpStore %145 %144 None
+ %126 = OpLabel
+ %127 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
+ %129 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %130
+ OpStore %127 %tint_source
+ OpBranch %131
+ %131 = OpLabel
OpBranch %134
%134 = OpLabel
- %138 = OpIAdd %uint %137 %uint_1
+ %136 = OpPhi %uint %uint_0 %131 %137 %133
+ OpLoopMerge %135 %133 None
+ OpBranch %132
+ %132 = OpLabel
+ %139 = OpUGreaterThanEqual %bool %136 %uint_4
+ OpSelectionMerge %140 None
+ OpBranchConditional %139 %141 %140
+ %141 = OpLabel
OpBranch %135
- %136 = OpLabel
- %139 = OpLoad %_arr_S_std140_uint_4_0 %130 None
- OpReturnValue %139
+ %140 = OpLabel
+ %142 = OpAccessChain %_ptr_Function_S_std140 %127 %136
+ %143 = OpLoad %S_std140 %142 None
+ %144 = OpAccessChain %_ptr_Function_S_std140 %129 %136
+ OpStore %144 %143 None
+ OpBranch %133
+ %133 = OpLabel
+ %137 = OpIAdd %uint %136 %uint_1
+ OpBranch %134
+ %135 = OpLabel
+ %138 = OpLoad %_arr_S_std140_uint_4_0 %129 None
+ OpReturnValue %138
OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/struct/mat4x2_f32/to_storage.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/struct/mat4x2_f32/to_storage.wgsl.expected.spvasm
index 18544ed..959279c 100644
--- a/test/tint/buffer/uniform/std140/struct/mat4x2_f32/to_storage.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/struct/mat4x2_f32/to_storage.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 146
+; Bound: 145
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -16,17 +16,13 @@
OpName %S_std140 "S_std140"
OpMemberName %u_block_std140_tint_explicit_layout 0 "inner"
OpName %u_block_std140_tint_explicit_layout "u_block_std140_tint_explicit_layout"
- OpMemberName %S_tint_explicit_layout 0 "before"
- OpMemberName %S_tint_explicit_layout 1 "m"
- OpMemberName %S_tint_explicit_layout 2 "after"
- OpName %S_tint_explicit_layout "S_tint_explicit_layout"
- OpMemberName %s_block_tint_explicit_layout 0 "inner"
- OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
- OpName %f "f"
OpMemberName %S 0 "before"
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %S "S"
+ OpMemberName %s_block_tint_explicit_layout 0 "inner"
+ OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
+ OpName %f "f"
OpName %tint_store_and_preserve_padding "tint_store_and_preserve_padding"
OpName %value_param "value_param"
OpName %tint_store_and_preserve_padding_0 "tint_store_and_preserve_padding"
@@ -48,12 +44,12 @@
OpDecorate %1 DescriptorSet 0
OpDecorate %1 Binding 0
OpDecorate %1 NonWritable
- OpMemberDecorate %S_tint_explicit_layout 0 Offset 0
- OpMemberDecorate %S_tint_explicit_layout 1 Offset 8
- OpMemberDecorate %S_tint_explicit_layout 1 ColMajor
- OpMemberDecorate %S_tint_explicit_layout 1 MatrixStride 8
- OpMemberDecorate %S_tint_explicit_layout 2 Offset 64
- OpDecorate %_arr_S_tint_explicit_layout_uint_4 ArrayStride 128
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 8
+ OpMemberDecorate %S 1 ColMajor
+ OpMemberDecorate %S 1 MatrixStride 8
+ OpMemberDecorate %S 2 Offset 64
+ OpDecorate %_arr_S_uint_4 ArrayStride 128
OpMemberDecorate %s_block_tint_explicit_layout 0 Offset 0
OpDecorate %s_block_tint_explicit_layout Block
OpDecorate %11 DescriptorSet 0
@@ -70,9 +66,9 @@
%_ptr_Uniform_u_block_std140_tint_explicit_layout = OpTypePointer Uniform %u_block_std140_tint_explicit_layout
%1 = OpVariable %_ptr_Uniform_u_block_std140_tint_explicit_layout Uniform
%mat4v2float = OpTypeMatrix %v2float 4
-%S_tint_explicit_layout = OpTypeStruct %int %mat4v2float %int
-%_arr_S_tint_explicit_layout_uint_4 = OpTypeArray %S_tint_explicit_layout %uint_4
-%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_tint_explicit_layout_uint_4
+ %S = OpTypeStruct %int %mat4v2float %int
+%_arr_S_uint_4 = OpTypeArray %S %uint_4
+%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_s_block_tint_explicit_layout = OpTypePointer StorageBuffer %s_block_tint_explicit_layout
%11 = OpVariable %_ptr_StorageBuffer_s_block_tint_explicit_layout StorageBuffer
%void = OpTypeVoid
@@ -81,10 +77,9 @@
%uint_0 = OpConstant %uint 0
%_arr_S_std140_uint_4_0 = OpTypeArray %S_std140 %uint_4
%_ptr_Function__arr_S_std140_uint_4_0 = OpTypePointer Function %_arr_S_std140_uint_4_0
- %S = OpTypeStruct %int %mat4v2float %int
-%_arr_S_uint_4 = OpTypeArray %S %uint_4
-%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
- %34 = OpConstantNull %_arr_S_uint_4
+%_arr_S_uint_4_0 = OpTypeArray %S %uint_4
+%_ptr_Function__arr_S_uint_4_0 = OpTypePointer Function %_arr_S_uint_4_0
+ %33 = OpConstantNull %_arr_S_uint_4_0
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%uint_2 = OpConstant %uint 2
%uint_1 = OpConstant %uint 1
@@ -96,158 +91,158 @@
%bool = OpTypeBool
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
- %85 = OpTypeFunction %void %_arr_S_uint_4
- %104 = OpTypeFunction %void %_arr_uint_uint_1 %S
+ %84 = OpTypeFunction %void %_arr_S_uint_4_0
+ %103 = OpTypeFunction %void %_arr_uint_uint_1 %S
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
- %115 = OpTypeFunction %S %S_std140
- %126 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
+ %114 = OpTypeFunction %S %S_std140
+ %125 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
- %131 = OpConstantNull %_arr_S_std140_uint_4_0
+ %130 = OpConstantNull %_arr_S_std140_uint_4_0
%f = OpFunction %void None %19
%20 = OpLabel
%28 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function
- %30 = OpVariable %_ptr_Function__arr_S_uint_4 Function %34
+ %30 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function %33
%21 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %1 %uint_0
%24 = OpLoad %_arr_S_std140_uint_4 %21 None
%25 = OpFunctionCall %_arr_S_std140_uint_4_0 %tint_convert_explicit_layout %24
OpStore %28 %25
- OpBranch %35
- %35 = OpLabel
- OpBranch %38
- %38 = OpLabel
- %40 = OpPhi %uint %uint_0 %35 %41 %37
- OpLoopMerge %39 %37 None
- OpBranch %36
- %36 = OpLabel
- %74 = OpUGreaterThanEqual %bool %40 %uint_4
- OpSelectionMerge %76 None
- OpBranchConditional %74 %77 %76
- %77 = OpLabel
- OpBranch %39
- %76 = OpLabel
- %78 = OpAccessChain %_ptr_Function_S %30 %40
- %80 = OpAccessChain %_ptr_Function_S_std140 %28 %40
- %82 = OpLoad %S_std140 %80 None
- %83 = OpFunctionCall %S %tint_convert_S %82
- OpStore %78 %83 None
+ OpBranch %34
+ %34 = OpLabel
OpBranch %37
%37 = OpLabel
- %41 = OpIAdd %uint %40 %uint_1
+ %39 = OpPhi %uint %uint_0 %34 %40 %36
+ OpLoopMerge %38 %36 None
+ OpBranch %35
+ %35 = OpLabel
+ %73 = OpUGreaterThanEqual %bool %39 %uint_4
+ OpSelectionMerge %75 None
+ OpBranchConditional %73 %76 %75
+ %76 = OpLabel
OpBranch %38
- %39 = OpLabel
- %42 = OpLoad %_arr_S_uint_4 %30 None
- %43 = OpFunctionCall %void %tint_store_and_preserve_padding %42
- %45 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
- %48 = OpLoad %S_std140 %45 None
- %49 = OpFunctionCall %S %tint_convert_S %48
- %53 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
- %54 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %53 %49
- %56 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %11 %uint_0 %uint_3 %uint_1
- %59 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_2 %uint_1
- %61 = OpLoad %v2float %59 None
- %62 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_2 %uint_2
- %63 = OpLoad %v2float %62 None
- %64 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_2 %uint_3
- %65 = OpLoad %v2float %64 None
- %66 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_2 %uint_4
- %67 = OpLoad %v2float %66 None
- %68 = OpCompositeConstruct %mat4v2float %61 %63 %65 %67
- OpStore %56 %68 None
- %69 = OpAccessChain %_ptr_StorageBuffer_v2float %11 %uint_0 %uint_1 %uint_1 %uint_0
- %71 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_0 %uint_2
- %72 = OpLoad %v2float %71 None
- %73 = OpVectorShuffle %v2float %72 %72 1 0
- OpStore %69 %73 None
+ %75 = OpLabel
+ %77 = OpAccessChain %_ptr_Function_S %30 %39
+ %79 = OpAccessChain %_ptr_Function_S_std140 %28 %39
+ %81 = OpLoad %S_std140 %79 None
+ %82 = OpFunctionCall %S %tint_convert_S %81
+ OpStore %77 %82 None
+ OpBranch %36
+ %36 = OpLabel
+ %40 = OpIAdd %uint %39 %uint_1
+ OpBranch %37
+ %38 = OpLabel
+ %41 = OpLoad %_arr_S_uint_4_0 %30 None
+ %42 = OpFunctionCall %void %tint_store_and_preserve_padding %41
+ %44 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
+ %47 = OpLoad %S_std140 %44 None
+ %48 = OpFunctionCall %S %tint_convert_S %47
+ %52 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
+ %53 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %52 %48
+ %55 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %11 %uint_0 %uint_3 %uint_1
+ %58 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_2 %uint_1
+ %60 = OpLoad %v2float %58 None
+ %61 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_2 %uint_2
+ %62 = OpLoad %v2float %61 None
+ %63 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_2 %uint_3
+ %64 = OpLoad %v2float %63 None
+ %65 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_2 %uint_4
+ %66 = OpLoad %v2float %65 None
+ %67 = OpCompositeConstruct %mat4v2float %60 %62 %64 %66
+ OpStore %55 %67 None
+ %68 = OpAccessChain %_ptr_StorageBuffer_v2float %11 %uint_0 %uint_1 %uint_1 %uint_0
+ %70 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_0 %uint_2
+ %71 = OpLoad %v2float %70 None
+ %72 = OpVectorShuffle %v2float %71 %71 1 0
+ OpStore %68 %72 None
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding = OpFunction %void None %85
-%value_param = OpFunctionParameter %_arr_S_uint_4
- %86 = OpLabel
- %87 = OpVariable %_ptr_Function__arr_S_uint_4 Function
- OpStore %87 %value_param
- OpBranch %88
- %88 = OpLabel
- OpBranch %91
- %91 = OpLabel
- %93 = OpPhi %uint %uint_0 %88 %94 %90
- OpLoopMerge %92 %90 None
- OpBranch %89
- %89 = OpLabel
- %95 = OpUGreaterThanEqual %bool %93 %uint_4
- OpSelectionMerge %96 None
- OpBranchConditional %95 %97 %96
- %97 = OpLabel
- OpBranch %92
- %96 = OpLabel
- %98 = OpAccessChain %_ptr_Function_S %87 %93
- %99 = OpLoad %S %98 None
- %100 = OpCompositeConstruct %_arr_uint_uint_1 %93
- %101 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %100 %99
+%tint_store_and_preserve_padding = OpFunction %void None %84
+%value_param = OpFunctionParameter %_arr_S_uint_4_0
+ %85 = OpLabel
+ %86 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function
+ OpStore %86 %value_param
+ OpBranch %87
+ %87 = OpLabel
OpBranch %90
%90 = OpLabel
- %94 = OpIAdd %uint %93 %uint_1
+ %92 = OpPhi %uint %uint_0 %87 %93 %89
+ OpLoopMerge %91 %89 None
+ OpBranch %88
+ %88 = OpLabel
+ %94 = OpUGreaterThanEqual %bool %92 %uint_4
+ OpSelectionMerge %95 None
+ OpBranchConditional %94 %96 %95
+ %96 = OpLabel
OpBranch %91
- %92 = OpLabel
+ %95 = OpLabel
+ %97 = OpAccessChain %_ptr_Function_S %86 %92
+ %98 = OpLoad %S %97 None
+ %99 = OpCompositeConstruct %_arr_uint_uint_1 %92
+ %100 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %99 %98
+ OpBranch %89
+ %89 = OpLabel
+ %93 = OpIAdd %uint %92 %uint_1
+ OpBranch %90
+ %91 = OpLabel
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding_0 = OpFunction %void None %104
+%tint_store_and_preserve_padding_0 = OpFunction %void None %103
%target_indices = OpFunctionParameter %_arr_uint_uint_1
%value_param_0 = OpFunctionParameter %S
- %105 = OpLabel
- %106 = OpCompositeExtract %uint %target_indices 0
- %107 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %106 %uint_0
- %109 = OpCompositeExtract %int %value_param_0 0
- OpStore %107 %109 None
- %110 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %11 %uint_0 %106 %uint_1
- %111 = OpCompositeExtract %mat4v2float %value_param_0 1
- OpStore %110 %111 None
- %112 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %106 %uint_2
- %113 = OpCompositeExtract %int %value_param_0 2
- OpStore %112 %113 None
+ %104 = OpLabel
+ %105 = OpCompositeExtract %uint %target_indices 0
+ %106 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %105 %uint_0
+ %108 = OpCompositeExtract %int %value_param_0 0
+ OpStore %106 %108 None
+ %109 = OpAccessChain %_ptr_StorageBuffer_mat4v2float %11 %uint_0 %105 %uint_1
+ %110 = OpCompositeExtract %mat4v2float %value_param_0 1
+ OpStore %109 %110 None
+ %111 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %105 %uint_2
+ %112 = OpCompositeExtract %int %value_param_0 2
+ OpStore %111 %112 None
OpReturn
OpFunctionEnd
-%tint_convert_S = OpFunction %S None %115
+%tint_convert_S = OpFunction %S None %114
%tint_input = OpFunctionParameter %S_std140
- %116 = OpLabel
- %117 = OpCompositeExtract %int %tint_input 0
- %118 = OpCompositeExtract %v2float %tint_input 1
- %119 = OpCompositeExtract %v2float %tint_input 2
- %120 = OpCompositeExtract %v2float %tint_input 3
- %121 = OpCompositeExtract %v2float %tint_input 4
- %122 = OpCompositeConstruct %mat4v2float %118 %119 %120 %121
- %123 = OpCompositeExtract %int %tint_input 5
- %124 = OpCompositeConstruct %S %117 %122 %123
- OpReturnValue %124
+ %115 = OpLabel
+ %116 = OpCompositeExtract %int %tint_input 0
+ %117 = OpCompositeExtract %v2float %tint_input 1
+ %118 = OpCompositeExtract %v2float %tint_input 2
+ %119 = OpCompositeExtract %v2float %tint_input 3
+ %120 = OpCompositeExtract %v2float %tint_input 4
+ %121 = OpCompositeConstruct %mat4v2float %117 %118 %119 %120
+ %122 = OpCompositeExtract %int %tint_input 5
+ %123 = OpCompositeConstruct %S %116 %121 %122
+ OpReturnValue %123
OpFunctionEnd
-%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %126
+%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %125
%tint_source = OpFunctionParameter %_arr_S_std140_uint_4
- %127 = OpLabel
- %128 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
- %130 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %131
- OpStore %128 %tint_source
- OpBranch %132
- %132 = OpLabel
- OpBranch %135
- %135 = OpLabel
- %137 = OpPhi %uint %uint_0 %132 %138 %134
- OpLoopMerge %136 %134 None
- OpBranch %133
- %133 = OpLabel
- %140 = OpUGreaterThanEqual %bool %137 %uint_4
- OpSelectionMerge %141 None
- OpBranchConditional %140 %142 %141
- %142 = OpLabel
- OpBranch %136
- %141 = OpLabel
- %143 = OpAccessChain %_ptr_Function_S_std140 %128 %137
- %144 = OpLoad %S_std140 %143 None
- %145 = OpAccessChain %_ptr_Function_S_std140 %130 %137
- OpStore %145 %144 None
+ %126 = OpLabel
+ %127 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
+ %129 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %130
+ OpStore %127 %tint_source
+ OpBranch %131
+ %131 = OpLabel
OpBranch %134
%134 = OpLabel
- %138 = OpIAdd %uint %137 %uint_1
+ %136 = OpPhi %uint %uint_0 %131 %137 %133
+ OpLoopMerge %135 %133 None
+ OpBranch %132
+ %132 = OpLabel
+ %139 = OpUGreaterThanEqual %bool %136 %uint_4
+ OpSelectionMerge %140 None
+ OpBranchConditional %139 %141 %140
+ %141 = OpLabel
OpBranch %135
- %136 = OpLabel
- %139 = OpLoad %_arr_S_std140_uint_4_0 %130 None
- OpReturnValue %139
+ %140 = OpLabel
+ %142 = OpAccessChain %_ptr_Function_S_std140 %127 %136
+ %143 = OpLoad %S_std140 %142 None
+ %144 = OpAccessChain %_ptr_Function_S_std140 %129 %136
+ OpStore %144 %143 None
+ OpBranch %133
+ %133 = OpLabel
+ %137 = OpIAdd %uint %136 %uint_1
+ OpBranch %134
+ %135 = OpLabel
+ %138 = OpLoad %_arr_S_std140_uint_4_0 %129 None
+ OpReturnValue %138
OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/struct/mat4x3_f16/to_storage.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/struct/mat4x3_f16/to_storage.wgsl.expected.spvasm
index f12bdd1..4905fc7 100644
--- a/test/tint/buffer/uniform/std140/struct/mat4x3_f16/to_storage.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/struct/mat4x3_f16/to_storage.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 161
+; Bound: 160
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -19,17 +19,13 @@
OpName %S_std140 "S_std140"
OpMemberName %u_block_std140_tint_explicit_layout 0 "inner"
OpName %u_block_std140_tint_explicit_layout "u_block_std140_tint_explicit_layout"
- OpMemberName %S_tint_explicit_layout 0 "before"
- OpMemberName %S_tint_explicit_layout 1 "m"
- OpMemberName %S_tint_explicit_layout 2 "after"
- OpName %S_tint_explicit_layout "S_tint_explicit_layout"
- OpMemberName %s_block_tint_explicit_layout 0 "inner"
- OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
- OpName %f "f"
OpMemberName %S 0 "before"
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %S "S"
+ OpMemberName %s_block_tint_explicit_layout 0 "inner"
+ OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
+ OpName %f "f"
OpName %tint_store_and_preserve_padding "tint_store_and_preserve_padding"
OpName %value_param "value_param"
OpName %tint_store_and_preserve_padding_0 "tint_store_and_preserve_padding"
@@ -54,12 +50,12 @@
OpDecorate %1 DescriptorSet 0
OpDecorate %1 Binding 0
OpDecorate %1 NonWritable
- OpMemberDecorate %S_tint_explicit_layout 0 Offset 0
- OpMemberDecorate %S_tint_explicit_layout 1 Offset 8
- OpMemberDecorate %S_tint_explicit_layout 1 ColMajor
- OpMemberDecorate %S_tint_explicit_layout 1 MatrixStride 8
- OpMemberDecorate %S_tint_explicit_layout 2 Offset 64
- OpDecorate %_arr_S_tint_explicit_layout_uint_4 ArrayStride 128
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 8
+ OpMemberDecorate %S 1 ColMajor
+ OpMemberDecorate %S 1 MatrixStride 8
+ OpMemberDecorate %S 2 Offset 64
+ OpDecorate %_arr_S_uint_4 ArrayStride 128
OpMemberDecorate %s_block_tint_explicit_layout 0 Offset 0
OpDecorate %s_block_tint_explicit_layout Block
OpDecorate %11 DescriptorSet 0
@@ -76,9 +72,9 @@
%_ptr_Uniform_u_block_std140_tint_explicit_layout = OpTypePointer Uniform %u_block_std140_tint_explicit_layout
%1 = OpVariable %_ptr_Uniform_u_block_std140_tint_explicit_layout Uniform
%mat4v3half = OpTypeMatrix %v3half 4
-%S_tint_explicit_layout = OpTypeStruct %int %mat4v3half %int
-%_arr_S_tint_explicit_layout_uint_4 = OpTypeArray %S_tint_explicit_layout %uint_4
-%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_tint_explicit_layout_uint_4
+ %S = OpTypeStruct %int %mat4v3half %int
+%_arr_S_uint_4 = OpTypeArray %S %uint_4
+%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_s_block_tint_explicit_layout = OpTypePointer StorageBuffer %s_block_tint_explicit_layout
%11 = OpVariable %_ptr_StorageBuffer_s_block_tint_explicit_layout StorageBuffer
%void = OpTypeVoid
@@ -87,10 +83,9 @@
%uint_0 = OpConstant %uint 0
%_arr_S_std140_uint_4_0 = OpTypeArray %S_std140 %uint_4
%_ptr_Function__arr_S_std140_uint_4_0 = OpTypePointer Function %_arr_S_std140_uint_4_0
- %S = OpTypeStruct %int %mat4v3half %int
-%_arr_S_uint_4 = OpTypeArray %S %uint_4
-%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
- %34 = OpConstantNull %_arr_S_uint_4
+%_arr_S_uint_4_0 = OpTypeArray %S %uint_4
+%_ptr_Function__arr_S_uint_4_0 = OpTypePointer Function %_arr_S_uint_4_0
+ %33 = OpConstantNull %_arr_S_uint_4_0
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%uint_2 = OpConstant %uint 2
%uint_1 = OpConstant %uint 1
@@ -101,178 +96,178 @@
%bool = OpTypeBool
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
- %86 = OpTypeFunction %void %_arr_S_uint_4
- %105 = OpTypeFunction %void %_arr_uint_uint_1 %S
+ %85 = OpTypeFunction %void %_arr_S_uint_4_0
+ %104 = OpTypeFunction %void %_arr_uint_uint_1 %S
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
- %118 = OpTypeFunction %void %_arr_uint_uint_1 %mat4v3half
- %130 = OpTypeFunction %S %S_std140
- %141 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
+ %117 = OpTypeFunction %void %_arr_uint_uint_1 %mat4v3half
+ %129 = OpTypeFunction %S %S_std140
+ %140 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
- %146 = OpConstantNull %_arr_S_std140_uint_4_0
+ %145 = OpConstantNull %_arr_S_std140_uint_4_0
%f = OpFunction %void None %19
%20 = OpLabel
%28 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function
- %30 = OpVariable %_ptr_Function__arr_S_uint_4 Function %34
+ %30 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function %33
%21 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %1 %uint_0
%24 = OpLoad %_arr_S_std140_uint_4 %21 None
%25 = OpFunctionCall %_arr_S_std140_uint_4_0 %tint_convert_explicit_layout %24
OpStore %28 %25
- OpBranch %35
- %35 = OpLabel
- OpBranch %38
- %38 = OpLabel
- %40 = OpPhi %uint %uint_0 %35 %41 %37
- OpLoopMerge %39 %37 None
- OpBranch %36
- %36 = OpLabel
- %75 = OpUGreaterThanEqual %bool %40 %uint_4
- OpSelectionMerge %77 None
- OpBranchConditional %75 %78 %77
- %78 = OpLabel
- OpBranch %39
- %77 = OpLabel
- %79 = OpAccessChain %_ptr_Function_S %30 %40
- %81 = OpAccessChain %_ptr_Function_S_std140 %28 %40
- %83 = OpLoad %S_std140 %81 None
- %84 = OpFunctionCall %S %tint_convert_S %83
- OpStore %79 %84 None
+ OpBranch %34
+ %34 = OpLabel
OpBranch %37
%37 = OpLabel
- %41 = OpIAdd %uint %40 %uint_1
+ %39 = OpPhi %uint %uint_0 %34 %40 %36
+ OpLoopMerge %38 %36 None
+ OpBranch %35
+ %35 = OpLabel
+ %74 = OpUGreaterThanEqual %bool %39 %uint_4
+ OpSelectionMerge %76 None
+ OpBranchConditional %74 %77 %76
+ %77 = OpLabel
OpBranch %38
- %39 = OpLabel
- %42 = OpLoad %_arr_S_uint_4 %30 None
- %43 = OpFunctionCall %void %tint_store_and_preserve_padding %42
- %45 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
- %48 = OpLoad %S_std140 %45 None
- %49 = OpFunctionCall %S %tint_convert_S %48
- %53 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
- %54 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %53 %49
- %56 = OpAccessChain %_ptr_Uniform_v3half %1 %uint_0 %uint_2 %uint_1
- %58 = OpLoad %v3half %56 None
- %59 = OpAccessChain %_ptr_Uniform_v3half %1 %uint_0 %uint_2 %uint_2
- %60 = OpLoad %v3half %59 None
- %61 = OpAccessChain %_ptr_Uniform_v3half %1 %uint_0 %uint_2 %uint_3
- %63 = OpLoad %v3half %61 None
- %64 = OpAccessChain %_ptr_Uniform_v3half %1 %uint_0 %uint_2 %uint_4
- %65 = OpLoad %v3half %64 None
- %66 = OpCompositeConstruct %mat4v3half %58 %60 %63 %65
- %67 = OpCompositeConstruct %_arr_uint_uint_1 %uint_3
- %68 = OpFunctionCall %void %tint_store_and_preserve_padding_1 %67 %66
- %70 = OpAccessChain %_ptr_StorageBuffer_v3half %11 %uint_0 %uint_1 %uint_1 %uint_0
- %72 = OpAccessChain %_ptr_Uniform_v3half %1 %uint_0 %uint_0 %uint_2
- %73 = OpLoad %v3half %72 None
- %74 = OpVectorShuffle %v3half %73 %73 2 0 1
- OpStore %70 %74 None
+ %76 = OpLabel
+ %78 = OpAccessChain %_ptr_Function_S %30 %39
+ %80 = OpAccessChain %_ptr_Function_S_std140 %28 %39
+ %82 = OpLoad %S_std140 %80 None
+ %83 = OpFunctionCall %S %tint_convert_S %82
+ OpStore %78 %83 None
+ OpBranch %36
+ %36 = OpLabel
+ %40 = OpIAdd %uint %39 %uint_1
+ OpBranch %37
+ %38 = OpLabel
+ %41 = OpLoad %_arr_S_uint_4_0 %30 None
+ %42 = OpFunctionCall %void %tint_store_and_preserve_padding %41
+ %44 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
+ %47 = OpLoad %S_std140 %44 None
+ %48 = OpFunctionCall %S %tint_convert_S %47
+ %52 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
+ %53 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %52 %48
+ %55 = OpAccessChain %_ptr_Uniform_v3half %1 %uint_0 %uint_2 %uint_1
+ %57 = OpLoad %v3half %55 None
+ %58 = OpAccessChain %_ptr_Uniform_v3half %1 %uint_0 %uint_2 %uint_2
+ %59 = OpLoad %v3half %58 None
+ %60 = OpAccessChain %_ptr_Uniform_v3half %1 %uint_0 %uint_2 %uint_3
+ %62 = OpLoad %v3half %60 None
+ %63 = OpAccessChain %_ptr_Uniform_v3half %1 %uint_0 %uint_2 %uint_4
+ %64 = OpLoad %v3half %63 None
+ %65 = OpCompositeConstruct %mat4v3half %57 %59 %62 %64
+ %66 = OpCompositeConstruct %_arr_uint_uint_1 %uint_3
+ %67 = OpFunctionCall %void %tint_store_and_preserve_padding_1 %66 %65
+ %69 = OpAccessChain %_ptr_StorageBuffer_v3half %11 %uint_0 %uint_1 %uint_1 %uint_0
+ %71 = OpAccessChain %_ptr_Uniform_v3half %1 %uint_0 %uint_0 %uint_2
+ %72 = OpLoad %v3half %71 None
+ %73 = OpVectorShuffle %v3half %72 %72 2 0 1
+ OpStore %69 %73 None
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding = OpFunction %void None %86
-%value_param = OpFunctionParameter %_arr_S_uint_4
- %87 = OpLabel
- %88 = OpVariable %_ptr_Function__arr_S_uint_4 Function
- OpStore %88 %value_param
- OpBranch %89
- %89 = OpLabel
- OpBranch %92
- %92 = OpLabel
- %94 = OpPhi %uint %uint_0 %89 %95 %91
- OpLoopMerge %93 %91 None
- OpBranch %90
- %90 = OpLabel
- %96 = OpUGreaterThanEqual %bool %94 %uint_4
- OpSelectionMerge %97 None
- OpBranchConditional %96 %98 %97
- %98 = OpLabel
- OpBranch %93
- %97 = OpLabel
- %99 = OpAccessChain %_ptr_Function_S %88 %94
- %100 = OpLoad %S %99 None
- %101 = OpCompositeConstruct %_arr_uint_uint_1 %94
- %102 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %101 %100
+%tint_store_and_preserve_padding = OpFunction %void None %85
+%value_param = OpFunctionParameter %_arr_S_uint_4_0
+ %86 = OpLabel
+ %87 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function
+ OpStore %87 %value_param
+ OpBranch %88
+ %88 = OpLabel
OpBranch %91
%91 = OpLabel
- %95 = OpIAdd %uint %94 %uint_1
+ %93 = OpPhi %uint %uint_0 %88 %94 %90
+ OpLoopMerge %92 %90 None
+ OpBranch %89
+ %89 = OpLabel
+ %95 = OpUGreaterThanEqual %bool %93 %uint_4
+ OpSelectionMerge %96 None
+ OpBranchConditional %95 %97 %96
+ %97 = OpLabel
OpBranch %92
- %93 = OpLabel
+ %96 = OpLabel
+ %98 = OpAccessChain %_ptr_Function_S %87 %93
+ %99 = OpLoad %S %98 None
+ %100 = OpCompositeConstruct %_arr_uint_uint_1 %93
+ %101 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %100 %99
+ OpBranch %90
+ %90 = OpLabel
+ %94 = OpIAdd %uint %93 %uint_1
+ OpBranch %91
+ %92 = OpLabel
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding_0 = OpFunction %void None %105
+%tint_store_and_preserve_padding_0 = OpFunction %void None %104
%target_indices = OpFunctionParameter %_arr_uint_uint_1
%value_param_0 = OpFunctionParameter %S
- %106 = OpLabel
- %107 = OpCompositeExtract %uint %target_indices 0
- %108 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %107 %uint_0
- %110 = OpCompositeExtract %int %value_param_0 0
- OpStore %108 %110 None
- %111 = OpCompositeExtract %mat4v3half %value_param_0 1
- %112 = OpCompositeConstruct %_arr_uint_uint_1 %107
- %113 = OpFunctionCall %void %tint_store_and_preserve_padding_1 %112 %111
- %114 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %107 %uint_2
- %115 = OpCompositeExtract %int %value_param_0 2
- OpStore %114 %115 None
+ %105 = OpLabel
+ %106 = OpCompositeExtract %uint %target_indices 0
+ %107 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %106 %uint_0
+ %109 = OpCompositeExtract %int %value_param_0 0
+ OpStore %107 %109 None
+ %110 = OpCompositeExtract %mat4v3half %value_param_0 1
+ %111 = OpCompositeConstruct %_arr_uint_uint_1 %106
+ %112 = OpFunctionCall %void %tint_store_and_preserve_padding_1 %111 %110
+ %113 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %106 %uint_2
+ %114 = OpCompositeExtract %int %value_param_0 2
+ OpStore %113 %114 None
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding_1 = OpFunction %void None %118
+%tint_store_and_preserve_padding_1 = OpFunction %void None %117
%target_indices_0 = OpFunctionParameter %_arr_uint_uint_1
%value_param_1 = OpFunctionParameter %mat4v3half
- %119 = OpLabel
- %120 = OpCompositeExtract %uint %target_indices_0 0
- %121 = OpAccessChain %_ptr_StorageBuffer_v3half %11 %uint_0 %120 %uint_1 %uint_0
- %122 = OpCompositeExtract %v3half %value_param_1 0
- OpStore %121 %122 None
- %123 = OpAccessChain %_ptr_StorageBuffer_v3half %11 %uint_0 %120 %uint_1 %uint_1
- %124 = OpCompositeExtract %v3half %value_param_1 1
- OpStore %123 %124 None
- %125 = OpAccessChain %_ptr_StorageBuffer_v3half %11 %uint_0 %120 %uint_1 %uint_2
- %126 = OpCompositeExtract %v3half %value_param_1 2
- OpStore %125 %126 None
- %127 = OpAccessChain %_ptr_StorageBuffer_v3half %11 %uint_0 %120 %uint_1 %uint_3
- %128 = OpCompositeExtract %v3half %value_param_1 3
- OpStore %127 %128 None
+ %118 = OpLabel
+ %119 = OpCompositeExtract %uint %target_indices_0 0
+ %120 = OpAccessChain %_ptr_StorageBuffer_v3half %11 %uint_0 %119 %uint_1 %uint_0
+ %121 = OpCompositeExtract %v3half %value_param_1 0
+ OpStore %120 %121 None
+ %122 = OpAccessChain %_ptr_StorageBuffer_v3half %11 %uint_0 %119 %uint_1 %uint_1
+ %123 = OpCompositeExtract %v3half %value_param_1 1
+ OpStore %122 %123 None
+ %124 = OpAccessChain %_ptr_StorageBuffer_v3half %11 %uint_0 %119 %uint_1 %uint_2
+ %125 = OpCompositeExtract %v3half %value_param_1 2
+ OpStore %124 %125 None
+ %126 = OpAccessChain %_ptr_StorageBuffer_v3half %11 %uint_0 %119 %uint_1 %uint_3
+ %127 = OpCompositeExtract %v3half %value_param_1 3
+ OpStore %126 %127 None
OpReturn
OpFunctionEnd
-%tint_convert_S = OpFunction %S None %130
+%tint_convert_S = OpFunction %S None %129
%tint_input = OpFunctionParameter %S_std140
- %131 = OpLabel
- %132 = OpCompositeExtract %int %tint_input 0
- %133 = OpCompositeExtract %v3half %tint_input 1
- %134 = OpCompositeExtract %v3half %tint_input 2
- %135 = OpCompositeExtract %v3half %tint_input 3
- %136 = OpCompositeExtract %v3half %tint_input 4
- %137 = OpCompositeConstruct %mat4v3half %133 %134 %135 %136
- %138 = OpCompositeExtract %int %tint_input 5
- %139 = OpCompositeConstruct %S %132 %137 %138
- OpReturnValue %139
+ %130 = OpLabel
+ %131 = OpCompositeExtract %int %tint_input 0
+ %132 = OpCompositeExtract %v3half %tint_input 1
+ %133 = OpCompositeExtract %v3half %tint_input 2
+ %134 = OpCompositeExtract %v3half %tint_input 3
+ %135 = OpCompositeExtract %v3half %tint_input 4
+ %136 = OpCompositeConstruct %mat4v3half %132 %133 %134 %135
+ %137 = OpCompositeExtract %int %tint_input 5
+ %138 = OpCompositeConstruct %S %131 %136 %137
+ OpReturnValue %138
OpFunctionEnd
-%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %141
+%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %140
%tint_source = OpFunctionParameter %_arr_S_std140_uint_4
- %142 = OpLabel
- %143 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
- %145 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %146
- OpStore %143 %tint_source
- OpBranch %147
- %147 = OpLabel
- OpBranch %150
- %150 = OpLabel
- %152 = OpPhi %uint %uint_0 %147 %153 %149
- OpLoopMerge %151 %149 None
- OpBranch %148
- %148 = OpLabel
- %155 = OpUGreaterThanEqual %bool %152 %uint_4
- OpSelectionMerge %156 None
- OpBranchConditional %155 %157 %156
- %157 = OpLabel
- OpBranch %151
- %156 = OpLabel
- %158 = OpAccessChain %_ptr_Function_S_std140 %143 %152
- %159 = OpLoad %S_std140 %158 None
- %160 = OpAccessChain %_ptr_Function_S_std140 %145 %152
- OpStore %160 %159 None
+ %141 = OpLabel
+ %142 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
+ %144 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %145
+ OpStore %142 %tint_source
+ OpBranch %146
+ %146 = OpLabel
OpBranch %149
%149 = OpLabel
- %153 = OpIAdd %uint %152 %uint_1
+ %151 = OpPhi %uint %uint_0 %146 %152 %148
+ OpLoopMerge %150 %148 None
+ OpBranch %147
+ %147 = OpLabel
+ %154 = OpUGreaterThanEqual %bool %151 %uint_4
+ OpSelectionMerge %155 None
+ OpBranchConditional %154 %156 %155
+ %156 = OpLabel
OpBranch %150
- %151 = OpLabel
- %154 = OpLoad %_arr_S_std140_uint_4_0 %145 None
- OpReturnValue %154
+ %155 = OpLabel
+ %157 = OpAccessChain %_ptr_Function_S_std140 %142 %151
+ %158 = OpLoad %S_std140 %157 None
+ %159 = OpAccessChain %_ptr_Function_S_std140 %144 %151
+ OpStore %159 %158 None
+ OpBranch %148
+ %148 = OpLabel
+ %152 = OpIAdd %uint %151 %uint_1
+ OpBranch %149
+ %150 = OpLabel
+ %153 = OpLoad %_arr_S_std140_uint_4_0 %144 None
+ OpReturnValue %153
OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/struct/mat4x3_f32/to_storage.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/struct/mat4x3_f32/to_storage.wgsl.expected.spvasm
index 08d536b..a96edfb 100644
--- a/test/tint/buffer/uniform/std140/struct/mat4x3_f32/to_storage.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/struct/mat4x3_f32/to_storage.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 161
+; Bound: 160
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -16,17 +16,13 @@
OpName %S_std140 "S_std140"
OpMemberName %u_block_std140_tint_explicit_layout 0 "inner"
OpName %u_block_std140_tint_explicit_layout "u_block_std140_tint_explicit_layout"
- OpMemberName %S_tint_explicit_layout 0 "before"
- OpMemberName %S_tint_explicit_layout 1 "m"
- OpMemberName %S_tint_explicit_layout 2 "after"
- OpName %S_tint_explicit_layout "S_tint_explicit_layout"
- OpMemberName %s_block_tint_explicit_layout 0 "inner"
- OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
- OpName %f "f"
OpMemberName %S 0 "before"
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %S "S"
+ OpMemberName %s_block_tint_explicit_layout 0 "inner"
+ OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
+ OpName %f "f"
OpName %tint_store_and_preserve_padding "tint_store_and_preserve_padding"
OpName %value_param "value_param"
OpName %tint_store_and_preserve_padding_0 "tint_store_and_preserve_padding"
@@ -51,12 +47,12 @@
OpDecorate %1 DescriptorSet 0
OpDecorate %1 Binding 0
OpDecorate %1 NonWritable
- OpMemberDecorate %S_tint_explicit_layout 0 Offset 0
- OpMemberDecorate %S_tint_explicit_layout 1 Offset 16
- OpMemberDecorate %S_tint_explicit_layout 1 ColMajor
- OpMemberDecorate %S_tint_explicit_layout 1 MatrixStride 16
- OpMemberDecorate %S_tint_explicit_layout 2 Offset 128
- OpDecorate %_arr_S_tint_explicit_layout_uint_4 ArrayStride 192
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 16
+ OpMemberDecorate %S 1 ColMajor
+ OpMemberDecorate %S 1 MatrixStride 16
+ OpMemberDecorate %S 2 Offset 128
+ OpDecorate %_arr_S_uint_4 ArrayStride 192
OpMemberDecorate %s_block_tint_explicit_layout 0 Offset 0
OpDecorate %s_block_tint_explicit_layout Block
OpDecorate %11 DescriptorSet 0
@@ -73,9 +69,9 @@
%_ptr_Uniform_u_block_std140_tint_explicit_layout = OpTypePointer Uniform %u_block_std140_tint_explicit_layout
%1 = OpVariable %_ptr_Uniform_u_block_std140_tint_explicit_layout Uniform
%mat4v3float = OpTypeMatrix %v3float 4
-%S_tint_explicit_layout = OpTypeStruct %int %mat4v3float %int
-%_arr_S_tint_explicit_layout_uint_4 = OpTypeArray %S_tint_explicit_layout %uint_4
-%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_tint_explicit_layout_uint_4
+ %S = OpTypeStruct %int %mat4v3float %int
+%_arr_S_uint_4 = OpTypeArray %S %uint_4
+%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_s_block_tint_explicit_layout = OpTypePointer StorageBuffer %s_block_tint_explicit_layout
%11 = OpVariable %_ptr_StorageBuffer_s_block_tint_explicit_layout StorageBuffer
%void = OpTypeVoid
@@ -84,10 +80,9 @@
%uint_0 = OpConstant %uint 0
%_arr_S_std140_uint_4_0 = OpTypeArray %S_std140 %uint_4
%_ptr_Function__arr_S_std140_uint_4_0 = OpTypePointer Function %_arr_S_std140_uint_4_0
- %S = OpTypeStruct %int %mat4v3float %int
-%_arr_S_uint_4 = OpTypeArray %S %uint_4
-%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
- %34 = OpConstantNull %_arr_S_uint_4
+%_arr_S_uint_4_0 = OpTypeArray %S %uint_4
+%_ptr_Function__arr_S_uint_4_0 = OpTypePointer Function %_arr_S_uint_4_0
+ %33 = OpConstantNull %_arr_S_uint_4_0
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%uint_2 = OpConstant %uint 2
%uint_1 = OpConstant %uint 1
@@ -98,178 +93,178 @@
%bool = OpTypeBool
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
- %86 = OpTypeFunction %void %_arr_S_uint_4
- %105 = OpTypeFunction %void %_arr_uint_uint_1 %S
+ %85 = OpTypeFunction %void %_arr_S_uint_4_0
+ %104 = OpTypeFunction %void %_arr_uint_uint_1 %S
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
- %118 = OpTypeFunction %void %_arr_uint_uint_1 %mat4v3float
- %130 = OpTypeFunction %S %S_std140
- %141 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
+ %117 = OpTypeFunction %void %_arr_uint_uint_1 %mat4v3float
+ %129 = OpTypeFunction %S %S_std140
+ %140 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
- %146 = OpConstantNull %_arr_S_std140_uint_4_0
+ %145 = OpConstantNull %_arr_S_std140_uint_4_0
%f = OpFunction %void None %19
%20 = OpLabel
%28 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function
- %30 = OpVariable %_ptr_Function__arr_S_uint_4 Function %34
+ %30 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function %33
%21 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %1 %uint_0
%24 = OpLoad %_arr_S_std140_uint_4 %21 None
%25 = OpFunctionCall %_arr_S_std140_uint_4_0 %tint_convert_explicit_layout %24
OpStore %28 %25
- OpBranch %35
- %35 = OpLabel
- OpBranch %38
- %38 = OpLabel
- %40 = OpPhi %uint %uint_0 %35 %41 %37
- OpLoopMerge %39 %37 None
- OpBranch %36
- %36 = OpLabel
- %75 = OpUGreaterThanEqual %bool %40 %uint_4
- OpSelectionMerge %77 None
- OpBranchConditional %75 %78 %77
- %78 = OpLabel
- OpBranch %39
- %77 = OpLabel
- %79 = OpAccessChain %_ptr_Function_S %30 %40
- %81 = OpAccessChain %_ptr_Function_S_std140 %28 %40
- %83 = OpLoad %S_std140 %81 None
- %84 = OpFunctionCall %S %tint_convert_S %83
- OpStore %79 %84 None
+ OpBranch %34
+ %34 = OpLabel
OpBranch %37
%37 = OpLabel
- %41 = OpIAdd %uint %40 %uint_1
+ %39 = OpPhi %uint %uint_0 %34 %40 %36
+ OpLoopMerge %38 %36 None
+ OpBranch %35
+ %35 = OpLabel
+ %74 = OpUGreaterThanEqual %bool %39 %uint_4
+ OpSelectionMerge %76 None
+ OpBranchConditional %74 %77 %76
+ %77 = OpLabel
OpBranch %38
- %39 = OpLabel
- %42 = OpLoad %_arr_S_uint_4 %30 None
- %43 = OpFunctionCall %void %tint_store_and_preserve_padding %42
- %45 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
- %48 = OpLoad %S_std140 %45 None
- %49 = OpFunctionCall %S %tint_convert_S %48
- %53 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
- %54 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %53 %49
- %56 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_0 %uint_2 %uint_1
- %58 = OpLoad %v3float %56 None
- %59 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_0 %uint_2 %uint_2
- %60 = OpLoad %v3float %59 None
- %61 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_0 %uint_2 %uint_3
- %63 = OpLoad %v3float %61 None
- %64 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_0 %uint_2 %uint_4
- %65 = OpLoad %v3float %64 None
- %66 = OpCompositeConstruct %mat4v3float %58 %60 %63 %65
- %67 = OpCompositeConstruct %_arr_uint_uint_1 %uint_3
- %68 = OpFunctionCall %void %tint_store_and_preserve_padding_1 %67 %66
- %70 = OpAccessChain %_ptr_StorageBuffer_v3float %11 %uint_0 %uint_1 %uint_1 %uint_0
- %72 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_0 %uint_0 %uint_2
- %73 = OpLoad %v3float %72 None
- %74 = OpVectorShuffle %v3float %73 %73 2 0 1
- OpStore %70 %74 None
+ %76 = OpLabel
+ %78 = OpAccessChain %_ptr_Function_S %30 %39
+ %80 = OpAccessChain %_ptr_Function_S_std140 %28 %39
+ %82 = OpLoad %S_std140 %80 None
+ %83 = OpFunctionCall %S %tint_convert_S %82
+ OpStore %78 %83 None
+ OpBranch %36
+ %36 = OpLabel
+ %40 = OpIAdd %uint %39 %uint_1
+ OpBranch %37
+ %38 = OpLabel
+ %41 = OpLoad %_arr_S_uint_4_0 %30 None
+ %42 = OpFunctionCall %void %tint_store_and_preserve_padding %41
+ %44 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
+ %47 = OpLoad %S_std140 %44 None
+ %48 = OpFunctionCall %S %tint_convert_S %47
+ %52 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
+ %53 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %52 %48
+ %55 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_0 %uint_2 %uint_1
+ %57 = OpLoad %v3float %55 None
+ %58 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_0 %uint_2 %uint_2
+ %59 = OpLoad %v3float %58 None
+ %60 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_0 %uint_2 %uint_3
+ %62 = OpLoad %v3float %60 None
+ %63 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_0 %uint_2 %uint_4
+ %64 = OpLoad %v3float %63 None
+ %65 = OpCompositeConstruct %mat4v3float %57 %59 %62 %64
+ %66 = OpCompositeConstruct %_arr_uint_uint_1 %uint_3
+ %67 = OpFunctionCall %void %tint_store_and_preserve_padding_1 %66 %65
+ %69 = OpAccessChain %_ptr_StorageBuffer_v3float %11 %uint_0 %uint_1 %uint_1 %uint_0
+ %71 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_0 %uint_0 %uint_2
+ %72 = OpLoad %v3float %71 None
+ %73 = OpVectorShuffle %v3float %72 %72 2 0 1
+ OpStore %69 %73 None
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding = OpFunction %void None %86
-%value_param = OpFunctionParameter %_arr_S_uint_4
- %87 = OpLabel
- %88 = OpVariable %_ptr_Function__arr_S_uint_4 Function
- OpStore %88 %value_param
- OpBranch %89
- %89 = OpLabel
- OpBranch %92
- %92 = OpLabel
- %94 = OpPhi %uint %uint_0 %89 %95 %91
- OpLoopMerge %93 %91 None
- OpBranch %90
- %90 = OpLabel
- %96 = OpUGreaterThanEqual %bool %94 %uint_4
- OpSelectionMerge %97 None
- OpBranchConditional %96 %98 %97
- %98 = OpLabel
- OpBranch %93
- %97 = OpLabel
- %99 = OpAccessChain %_ptr_Function_S %88 %94
- %100 = OpLoad %S %99 None
- %101 = OpCompositeConstruct %_arr_uint_uint_1 %94
- %102 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %101 %100
+%tint_store_and_preserve_padding = OpFunction %void None %85
+%value_param = OpFunctionParameter %_arr_S_uint_4_0
+ %86 = OpLabel
+ %87 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function
+ OpStore %87 %value_param
+ OpBranch %88
+ %88 = OpLabel
OpBranch %91
%91 = OpLabel
- %95 = OpIAdd %uint %94 %uint_1
+ %93 = OpPhi %uint %uint_0 %88 %94 %90
+ OpLoopMerge %92 %90 None
+ OpBranch %89
+ %89 = OpLabel
+ %95 = OpUGreaterThanEqual %bool %93 %uint_4
+ OpSelectionMerge %96 None
+ OpBranchConditional %95 %97 %96
+ %97 = OpLabel
OpBranch %92
- %93 = OpLabel
+ %96 = OpLabel
+ %98 = OpAccessChain %_ptr_Function_S %87 %93
+ %99 = OpLoad %S %98 None
+ %100 = OpCompositeConstruct %_arr_uint_uint_1 %93
+ %101 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %100 %99
+ OpBranch %90
+ %90 = OpLabel
+ %94 = OpIAdd %uint %93 %uint_1
+ OpBranch %91
+ %92 = OpLabel
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding_0 = OpFunction %void None %105
+%tint_store_and_preserve_padding_0 = OpFunction %void None %104
%target_indices = OpFunctionParameter %_arr_uint_uint_1
%value_param_0 = OpFunctionParameter %S
- %106 = OpLabel
- %107 = OpCompositeExtract %uint %target_indices 0
- %108 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %107 %uint_0
- %110 = OpCompositeExtract %int %value_param_0 0
- OpStore %108 %110 None
- %111 = OpCompositeExtract %mat4v3float %value_param_0 1
- %112 = OpCompositeConstruct %_arr_uint_uint_1 %107
- %113 = OpFunctionCall %void %tint_store_and_preserve_padding_1 %112 %111
- %114 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %107 %uint_2
- %115 = OpCompositeExtract %int %value_param_0 2
- OpStore %114 %115 None
+ %105 = OpLabel
+ %106 = OpCompositeExtract %uint %target_indices 0
+ %107 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %106 %uint_0
+ %109 = OpCompositeExtract %int %value_param_0 0
+ OpStore %107 %109 None
+ %110 = OpCompositeExtract %mat4v3float %value_param_0 1
+ %111 = OpCompositeConstruct %_arr_uint_uint_1 %106
+ %112 = OpFunctionCall %void %tint_store_and_preserve_padding_1 %111 %110
+ %113 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %106 %uint_2
+ %114 = OpCompositeExtract %int %value_param_0 2
+ OpStore %113 %114 None
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding_1 = OpFunction %void None %118
+%tint_store_and_preserve_padding_1 = OpFunction %void None %117
%target_indices_0 = OpFunctionParameter %_arr_uint_uint_1
%value_param_1 = OpFunctionParameter %mat4v3float
- %119 = OpLabel
- %120 = OpCompositeExtract %uint %target_indices_0 0
- %121 = OpAccessChain %_ptr_StorageBuffer_v3float %11 %uint_0 %120 %uint_1 %uint_0
- %122 = OpCompositeExtract %v3float %value_param_1 0
- OpStore %121 %122 None
- %123 = OpAccessChain %_ptr_StorageBuffer_v3float %11 %uint_0 %120 %uint_1 %uint_1
- %124 = OpCompositeExtract %v3float %value_param_1 1
- OpStore %123 %124 None
- %125 = OpAccessChain %_ptr_StorageBuffer_v3float %11 %uint_0 %120 %uint_1 %uint_2
- %126 = OpCompositeExtract %v3float %value_param_1 2
- OpStore %125 %126 None
- %127 = OpAccessChain %_ptr_StorageBuffer_v3float %11 %uint_0 %120 %uint_1 %uint_3
- %128 = OpCompositeExtract %v3float %value_param_1 3
- OpStore %127 %128 None
+ %118 = OpLabel
+ %119 = OpCompositeExtract %uint %target_indices_0 0
+ %120 = OpAccessChain %_ptr_StorageBuffer_v3float %11 %uint_0 %119 %uint_1 %uint_0
+ %121 = OpCompositeExtract %v3float %value_param_1 0
+ OpStore %120 %121 None
+ %122 = OpAccessChain %_ptr_StorageBuffer_v3float %11 %uint_0 %119 %uint_1 %uint_1
+ %123 = OpCompositeExtract %v3float %value_param_1 1
+ OpStore %122 %123 None
+ %124 = OpAccessChain %_ptr_StorageBuffer_v3float %11 %uint_0 %119 %uint_1 %uint_2
+ %125 = OpCompositeExtract %v3float %value_param_1 2
+ OpStore %124 %125 None
+ %126 = OpAccessChain %_ptr_StorageBuffer_v3float %11 %uint_0 %119 %uint_1 %uint_3
+ %127 = OpCompositeExtract %v3float %value_param_1 3
+ OpStore %126 %127 None
OpReturn
OpFunctionEnd
-%tint_convert_S = OpFunction %S None %130
+%tint_convert_S = OpFunction %S None %129
%tint_input = OpFunctionParameter %S_std140
- %131 = OpLabel
- %132 = OpCompositeExtract %int %tint_input 0
- %133 = OpCompositeExtract %v3float %tint_input 1
- %134 = OpCompositeExtract %v3float %tint_input 2
- %135 = OpCompositeExtract %v3float %tint_input 3
- %136 = OpCompositeExtract %v3float %tint_input 4
- %137 = OpCompositeConstruct %mat4v3float %133 %134 %135 %136
- %138 = OpCompositeExtract %int %tint_input 5
- %139 = OpCompositeConstruct %S %132 %137 %138
- OpReturnValue %139
+ %130 = OpLabel
+ %131 = OpCompositeExtract %int %tint_input 0
+ %132 = OpCompositeExtract %v3float %tint_input 1
+ %133 = OpCompositeExtract %v3float %tint_input 2
+ %134 = OpCompositeExtract %v3float %tint_input 3
+ %135 = OpCompositeExtract %v3float %tint_input 4
+ %136 = OpCompositeConstruct %mat4v3float %132 %133 %134 %135
+ %137 = OpCompositeExtract %int %tint_input 5
+ %138 = OpCompositeConstruct %S %131 %136 %137
+ OpReturnValue %138
OpFunctionEnd
-%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %141
+%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %140
%tint_source = OpFunctionParameter %_arr_S_std140_uint_4
- %142 = OpLabel
- %143 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
- %145 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %146
- OpStore %143 %tint_source
- OpBranch %147
- %147 = OpLabel
- OpBranch %150
- %150 = OpLabel
- %152 = OpPhi %uint %uint_0 %147 %153 %149
- OpLoopMerge %151 %149 None
- OpBranch %148
- %148 = OpLabel
- %155 = OpUGreaterThanEqual %bool %152 %uint_4
- OpSelectionMerge %156 None
- OpBranchConditional %155 %157 %156
- %157 = OpLabel
- OpBranch %151
- %156 = OpLabel
- %158 = OpAccessChain %_ptr_Function_S_std140 %143 %152
- %159 = OpLoad %S_std140 %158 None
- %160 = OpAccessChain %_ptr_Function_S_std140 %145 %152
- OpStore %160 %159 None
+ %141 = OpLabel
+ %142 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
+ %144 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %145
+ OpStore %142 %tint_source
+ OpBranch %146
+ %146 = OpLabel
OpBranch %149
%149 = OpLabel
- %153 = OpIAdd %uint %152 %uint_1
+ %151 = OpPhi %uint %uint_0 %146 %152 %148
+ OpLoopMerge %150 %148 None
+ OpBranch %147
+ %147 = OpLabel
+ %154 = OpUGreaterThanEqual %bool %151 %uint_4
+ OpSelectionMerge %155 None
+ OpBranchConditional %154 %156 %155
+ %156 = OpLabel
OpBranch %150
- %151 = OpLabel
- %154 = OpLoad %_arr_S_std140_uint_4_0 %145 None
- OpReturnValue %154
+ %155 = OpLabel
+ %157 = OpAccessChain %_ptr_Function_S_std140 %142 %151
+ %158 = OpLoad %S_std140 %157 None
+ %159 = OpAccessChain %_ptr_Function_S_std140 %144 %151
+ OpStore %159 %158 None
+ OpBranch %148
+ %148 = OpLabel
+ %152 = OpIAdd %uint %151 %uint_1
+ OpBranch %149
+ %150 = OpLabel
+ %153 = OpLoad %_arr_S_std140_uint_4_0 %144 None
+ OpReturnValue %153
OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/struct/mat4x4_f16/to_storage.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/struct/mat4x4_f16/to_storage.wgsl.expected.spvasm
index 523348c..b9ab6e2 100644
--- a/test/tint/buffer/uniform/std140/struct/mat4x4_f16/to_storage.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/struct/mat4x4_f16/to_storage.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 146
+; Bound: 145
; Schema: 0
OpCapability Shader
OpCapability Float16
@@ -19,17 +19,13 @@
OpName %S_std140 "S_std140"
OpMemberName %u_block_std140_tint_explicit_layout 0 "inner"
OpName %u_block_std140_tint_explicit_layout "u_block_std140_tint_explicit_layout"
- OpMemberName %S_tint_explicit_layout 0 "before"
- OpMemberName %S_tint_explicit_layout 1 "m"
- OpMemberName %S_tint_explicit_layout 2 "after"
- OpName %S_tint_explicit_layout "S_tint_explicit_layout"
- OpMemberName %s_block_tint_explicit_layout 0 "inner"
- OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
- OpName %f "f"
OpMemberName %S 0 "before"
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %S "S"
+ OpMemberName %s_block_tint_explicit_layout 0 "inner"
+ OpName %s_block_tint_explicit_layout "s_block_tint_explicit_layout"
+ OpName %f "f"
OpName %tint_store_and_preserve_padding "tint_store_and_preserve_padding"
OpName %value_param "value_param"
OpName %tint_store_and_preserve_padding_0 "tint_store_and_preserve_padding"
@@ -51,12 +47,12 @@
OpDecorate %1 DescriptorSet 0
OpDecorate %1 Binding 0
OpDecorate %1 NonWritable
- OpMemberDecorate %S_tint_explicit_layout 0 Offset 0
- OpMemberDecorate %S_tint_explicit_layout 1 Offset 8
- OpMemberDecorate %S_tint_explicit_layout 1 ColMajor
- OpMemberDecorate %S_tint_explicit_layout 1 MatrixStride 8
- OpMemberDecorate %S_tint_explicit_layout 2 Offset 64
- OpDecorate %_arr_S_tint_explicit_layout_uint_4 ArrayStride 128
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 8
+ OpMemberDecorate %S 1 ColMajor
+ OpMemberDecorate %S 1 MatrixStride 8
+ OpMemberDecorate %S 2 Offset 64
+ OpDecorate %_arr_S_uint_4 ArrayStride 128
OpMemberDecorate %s_block_tint_explicit_layout 0 Offset 0
OpDecorate %s_block_tint_explicit_layout Block
OpDecorate %11 DescriptorSet 0
@@ -73,9 +69,9 @@
%_ptr_Uniform_u_block_std140_tint_explicit_layout = OpTypePointer Uniform %u_block_std140_tint_explicit_layout
%1 = OpVariable %_ptr_Uniform_u_block_std140_tint_explicit_layout Uniform
%mat4v4half = OpTypeMatrix %v4half 4
-%S_tint_explicit_layout = OpTypeStruct %int %mat4v4half %int
-%_arr_S_tint_explicit_layout_uint_4 = OpTypeArray %S_tint_explicit_layout %uint_4
-%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_tint_explicit_layout_uint_4
+ %S = OpTypeStruct %int %mat4v4half %int
+%_arr_S_uint_4 = OpTypeArray %S %uint_4
+%s_block_tint_explicit_layout = OpTypeStruct %_arr_S_uint_4
%_ptr_StorageBuffer_s_block_tint_explicit_layout = OpTypePointer StorageBuffer %s_block_tint_explicit_layout
%11 = OpVariable %_ptr_StorageBuffer_s_block_tint_explicit_layout StorageBuffer
%void = OpTypeVoid
@@ -84,10 +80,9 @@
%uint_0 = OpConstant %uint 0
%_arr_S_std140_uint_4_0 = OpTypeArray %S_std140 %uint_4
%_ptr_Function__arr_S_std140_uint_4_0 = OpTypePointer Function %_arr_S_std140_uint_4_0
- %S = OpTypeStruct %int %mat4v4half %int
-%_arr_S_uint_4 = OpTypeArray %S %uint_4
-%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
- %34 = OpConstantNull %_arr_S_uint_4
+%_arr_S_uint_4_0 = OpTypeArray %S %uint_4
+%_ptr_Function__arr_S_uint_4_0 = OpTypePointer Function %_arr_S_uint_4_0
+ %33 = OpConstantNull %_arr_S_uint_4_0
%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140
%uint_2 = OpConstant %uint 2
%uint_1 = OpConstant %uint 1
@@ -99,158 +94,158 @@
%bool = OpTypeBool
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_S_std140 = OpTypePointer Function %S_std140
- %85 = OpTypeFunction %void %_arr_S_uint_4
- %104 = OpTypeFunction %void %_arr_uint_uint_1 %S
+ %84 = OpTypeFunction %void %_arr_S_uint_4_0
+ %103 = OpTypeFunction %void %_arr_uint_uint_1 %S
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
- %115 = OpTypeFunction %S %S_std140
- %126 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
+ %114 = OpTypeFunction %S %S_std140
+ %125 = OpTypeFunction %_arr_S_std140_uint_4_0 %_arr_S_std140_uint_4
%_ptr_Function__arr_S_std140_uint_4 = OpTypePointer Function %_arr_S_std140_uint_4
- %131 = OpConstantNull %_arr_S_std140_uint_4_0
+ %130 = OpConstantNull %_arr_S_std140_uint_4_0
%f = OpFunction %void None %19
%20 = OpLabel
%28 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function
- %30 = OpVariable %_ptr_Function__arr_S_uint_4 Function %34
+ %30 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function %33
%21 = OpAccessChain %_ptr_Uniform__arr_S_std140_uint_4 %1 %uint_0
%24 = OpLoad %_arr_S_std140_uint_4 %21 None
%25 = OpFunctionCall %_arr_S_std140_uint_4_0 %tint_convert_explicit_layout %24
OpStore %28 %25
- OpBranch %35
- %35 = OpLabel
- OpBranch %38
- %38 = OpLabel
- %40 = OpPhi %uint %uint_0 %35 %41 %37
- OpLoopMerge %39 %37 None
- OpBranch %36
- %36 = OpLabel
- %74 = OpUGreaterThanEqual %bool %40 %uint_4
- OpSelectionMerge %76 None
- OpBranchConditional %74 %77 %76
- %77 = OpLabel
- OpBranch %39
- %76 = OpLabel
- %78 = OpAccessChain %_ptr_Function_S %30 %40
- %80 = OpAccessChain %_ptr_Function_S_std140 %28 %40
- %82 = OpLoad %S_std140 %80 None
- %83 = OpFunctionCall %S %tint_convert_S %82
- OpStore %78 %83 None
+ OpBranch %34
+ %34 = OpLabel
OpBranch %37
%37 = OpLabel
- %41 = OpIAdd %uint %40 %uint_1
+ %39 = OpPhi %uint %uint_0 %34 %40 %36
+ OpLoopMerge %38 %36 None
+ OpBranch %35
+ %35 = OpLabel
+ %73 = OpUGreaterThanEqual %bool %39 %uint_4
+ OpSelectionMerge %75 None
+ OpBranchConditional %73 %76 %75
+ %76 = OpLabel
OpBranch %38
- %39 = OpLabel
- %42 = OpLoad %_arr_S_uint_4 %30 None
- %43 = OpFunctionCall %void %tint_store_and_preserve_padding %42
- %45 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
- %48 = OpLoad %S_std140 %45 None
- %49 = OpFunctionCall %S %tint_convert_S %48
- %53 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
- %54 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %53 %49
- %56 = OpAccessChain %_ptr_StorageBuffer_mat4v4half %11 %uint_0 %uint_3 %uint_1
- %59 = OpAccessChain %_ptr_Uniform_v4half %1 %uint_0 %uint_2 %uint_1
- %61 = OpLoad %v4half %59 None
- %62 = OpAccessChain %_ptr_Uniform_v4half %1 %uint_0 %uint_2 %uint_2
- %63 = OpLoad %v4half %62 None
- %64 = OpAccessChain %_ptr_Uniform_v4half %1 %uint_0 %uint_2 %uint_3
- %65 = OpLoad %v4half %64 None
- %66 = OpAccessChain %_ptr_Uniform_v4half %1 %uint_0 %uint_2 %uint_4
- %67 = OpLoad %v4half %66 None
- %68 = OpCompositeConstruct %mat4v4half %61 %63 %65 %67
- OpStore %56 %68 None
- %69 = OpAccessChain %_ptr_StorageBuffer_v4half %11 %uint_0 %uint_1 %uint_1 %uint_0
- %71 = OpAccessChain %_ptr_Uniform_v4half %1 %uint_0 %uint_0 %uint_2
- %72 = OpLoad %v4half %71 None
- %73 = OpVectorShuffle %v4half %72 %72 1 3 0 2
- OpStore %69 %73 None
+ %75 = OpLabel
+ %77 = OpAccessChain %_ptr_Function_S %30 %39
+ %79 = OpAccessChain %_ptr_Function_S_std140 %28 %39
+ %81 = OpLoad %S_std140 %79 None
+ %82 = OpFunctionCall %S %tint_convert_S %81
+ OpStore %77 %82 None
+ OpBranch %36
+ %36 = OpLabel
+ %40 = OpIAdd %uint %39 %uint_1
+ OpBranch %37
+ %38 = OpLabel
+ %41 = OpLoad %_arr_S_uint_4_0 %30 None
+ %42 = OpFunctionCall %void %tint_store_and_preserve_padding %41
+ %44 = OpAccessChain %_ptr_Uniform_S_std140 %1 %uint_0 %uint_2
+ %47 = OpLoad %S_std140 %44 None
+ %48 = OpFunctionCall %S %tint_convert_S %47
+ %52 = OpCompositeConstruct %_arr_uint_uint_1 %uint_1
+ %53 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %52 %48
+ %55 = OpAccessChain %_ptr_StorageBuffer_mat4v4half %11 %uint_0 %uint_3 %uint_1
+ %58 = OpAccessChain %_ptr_Uniform_v4half %1 %uint_0 %uint_2 %uint_1
+ %60 = OpLoad %v4half %58 None
+ %61 = OpAccessChain %_ptr_Uniform_v4half %1 %uint_0 %uint_2 %uint_2
+ %62 = OpLoad %v4half %61 None
+ %63 = OpAccessChain %_ptr_Uniform_v4half %1 %uint_0 %uint_2 %uint_3
+ %64 = OpLoad %v4half %63 None
+ %65 = OpAccessChain %_ptr_Uniform_v4half %1 %uint_0 %uint_2 %uint_4
+ %66 = OpLoad %v4half %65 None
+ %67 = OpCompositeConstruct %mat4v4half %60 %62 %64 %66
+ OpStore %55 %67 None
+ %68 = OpAccessChain %_ptr_StorageBuffer_v4half %11 %uint_0 %uint_1 %uint_1 %uint_0
+ %70 = OpAccessChain %_ptr_Uniform_v4half %1 %uint_0 %uint_0 %uint_2
+ %71 = OpLoad %v4half %70 None
+ %72 = OpVectorShuffle %v4half %71 %71 1 3 0 2
+ OpStore %68 %72 None
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding = OpFunction %void None %85
-%value_param = OpFunctionParameter %_arr_S_uint_4
- %86 = OpLabel
- %87 = OpVariable %_ptr_Function__arr_S_uint_4 Function
- OpStore %87 %value_param
- OpBranch %88
- %88 = OpLabel
- OpBranch %91
- %91 = OpLabel
- %93 = OpPhi %uint %uint_0 %88 %94 %90
- OpLoopMerge %92 %90 None
- OpBranch %89
- %89 = OpLabel
- %95 = OpUGreaterThanEqual %bool %93 %uint_4
- OpSelectionMerge %96 None
- OpBranchConditional %95 %97 %96
- %97 = OpLabel
- OpBranch %92
- %96 = OpLabel
- %98 = OpAccessChain %_ptr_Function_S %87 %93
- %99 = OpLoad %S %98 None
- %100 = OpCompositeConstruct %_arr_uint_uint_1 %93
- %101 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %100 %99
+%tint_store_and_preserve_padding = OpFunction %void None %84
+%value_param = OpFunctionParameter %_arr_S_uint_4_0
+ %85 = OpLabel
+ %86 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function
+ OpStore %86 %value_param
+ OpBranch %87
+ %87 = OpLabel
OpBranch %90
%90 = OpLabel
- %94 = OpIAdd %uint %93 %uint_1
+ %92 = OpPhi %uint %uint_0 %87 %93 %89
+ OpLoopMerge %91 %89 None
+ OpBranch %88
+ %88 = OpLabel
+ %94 = OpUGreaterThanEqual %bool %92 %uint_4
+ OpSelectionMerge %95 None
+ OpBranchConditional %94 %96 %95
+ %96 = OpLabel
OpBranch %91
- %92 = OpLabel
+ %95 = OpLabel
+ %97 = OpAccessChain %_ptr_Function_S %86 %92
+ %98 = OpLoad %S %97 None
+ %99 = OpCompositeConstruct %_arr_uint_uint_1 %92
+ %100 = OpFunctionCall %void %tint_store_and_preserve_padding_0 %99 %98
+ OpBranch %89
+ %89 = OpLabel
+ %93 = OpIAdd %uint %92 %uint_1
+ OpBranch %90
+ %91 = OpLabel
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding_0 = OpFunction %void None %104
+%tint_store_and_preserve_padding_0 = OpFunction %void None %103
%target_indices = OpFunctionParameter %_arr_uint_uint_1
%value_param_0 = OpFunctionParameter %S
- %105 = OpLabel
- %106 = OpCompositeExtract %uint %target_indices 0
- %107 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %106 %uint_0
- %109 = OpCompositeExtract %int %value_param_0 0
- OpStore %107 %109 None
- %110 = OpAccessChain %_ptr_StorageBuffer_mat4v4half %11 %uint_0 %106 %uint_1
- %111 = OpCompositeExtract %mat4v4half %value_param_0 1
- OpStore %110 %111 None
- %112 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %106 %uint_2
- %113 = OpCompositeExtract %int %value_param_0 2
- OpStore %112 %113 None
+ %104 = OpLabel
+ %105 = OpCompositeExtract %uint %target_indices 0
+ %106 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %105 %uint_0
+ %108 = OpCompositeExtract %int %value_param_0 0
+ OpStore %106 %108 None
+ %109 = OpAccessChain %_ptr_StorageBuffer_mat4v4half %11 %uint_0 %105 %uint_1
+ %110 = OpCompositeExtract %mat4v4half %value_param_0 1
+ OpStore %109 %110 None
+ %111 = OpAccessChain %_ptr_StorageBuffer_int %11 %uint_0 %105 %uint_2
+ %112 = OpCompositeExtract %int %value_param_0 2
+ OpStore %111 %112 None
OpReturn
OpFunctionEnd
-%tint_convert_S = OpFunction %S None %115
+%tint_convert_S = OpFunction %S None %114
%tint_input = OpFunctionParameter %S_std140
- %116 = OpLabel
- %117 = OpCompositeExtract %int %tint_input 0
- %118 = OpCompositeExtract %v4half %tint_input 1
- %119 = OpCompositeExtract %v4half %tint_input 2
- %120 = OpCompositeExtract %v4half %tint_input 3
- %121 = OpCompositeExtract %v4half %tint_input 4
- %122 = OpCompositeConstruct %mat4v4half %118 %119 %120 %121
- %123 = OpCompositeExtract %int %tint_input 5
- %124 = OpCompositeConstruct %S %117 %122 %123
- OpReturnValue %124
+ %115 = OpLabel
+ %116 = OpCompositeExtract %int %tint_input 0
+ %117 = OpCompositeExtract %v4half %tint_input 1
+ %118 = OpCompositeExtract %v4half %tint_input 2
+ %119 = OpCompositeExtract %v4half %tint_input 3
+ %120 = OpCompositeExtract %v4half %tint_input 4
+ %121 = OpCompositeConstruct %mat4v4half %117 %118 %119 %120
+ %122 = OpCompositeExtract %int %tint_input 5
+ %123 = OpCompositeConstruct %S %116 %121 %122
+ OpReturnValue %123
OpFunctionEnd
-%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %126
+%tint_convert_explicit_layout = OpFunction %_arr_S_std140_uint_4_0 None %125
%tint_source = OpFunctionParameter %_arr_S_std140_uint_4
- %127 = OpLabel
- %128 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
- %130 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %131
- OpStore %128 %tint_source
- OpBranch %132
- %132 = OpLabel
- OpBranch %135
- %135 = OpLabel
- %137 = OpPhi %uint %uint_0 %132 %138 %134
- OpLoopMerge %136 %134 None
- OpBranch %133
- %133 = OpLabel
- %140 = OpUGreaterThanEqual %bool %137 %uint_4
- OpSelectionMerge %141 None
- OpBranchConditional %140 %142 %141
- %142 = OpLabel
- OpBranch %136
- %141 = OpLabel
- %143 = OpAccessChain %_ptr_Function_S_std140 %128 %137
- %144 = OpLoad %S_std140 %143 None
- %145 = OpAccessChain %_ptr_Function_S_std140 %130 %137
- OpStore %145 %144 None
+ %126 = OpLabel
+ %127 = OpVariable %_ptr_Function__arr_S_std140_uint_4 Function
+ %129 = OpVariable %_ptr_Function__arr_S_std140_uint_4_0 Function %130
+ OpStore %127 %tint_source
+ OpBranch %131
+ %131 = OpLabel
OpBranch %134
%134 = OpLabel
- %138 = OpIAdd %uint %137 %uint_1
+ %136 = OpPhi %uint %uint_0 %131 %137 %133
+ OpLoopMerge %135 %133 None
+ OpBranch %132
+ %132 = OpLabel
+ %139 = OpUGreaterThanEqual %bool %136 %uint_4
+ OpSelectionMerge %140 None
+ OpBranchConditional %139 %141 %140
+ %141 = OpLabel
OpBranch %135
- %136 = OpLabel
- %139 = OpLoad %_arr_S_std140_uint_4_0 %130 None
- OpReturnValue %139
+ %140 = OpLabel
+ %142 = OpAccessChain %_ptr_Function_S_std140 %127 %136
+ %143 = OpLoad %S_std140 %142 None
+ %144 = OpAccessChain %_ptr_Function_S_std140 %129 %136
+ OpStore %144 %143 None
+ OpBranch %133
+ %133 = OpLabel
+ %137 = OpIAdd %uint %136 %uint_1
+ OpBranch %134
+ %135 = OpLabel
+ %138 = OpLoad %_arr_S_std140_uint_4_0 %129 None
+ OpReturnValue %138
OpFunctionEnd
diff --git a/test/tint/buffer/uniform/std140/struct/mat4x4_f32/to_private.wgsl.expected.spvasm b/test/tint/buffer/uniform/std140/struct/mat4x4_f32/to_private.wgsl.expected.spvasm
index dd14d1c..24be441 100644
--- a/test/tint/buffer/uniform/std140/struct/mat4x4_f32/to_private.wgsl.expected.spvasm
+++ b/test/tint/buffer/uniform/std140/struct/mat4x4_f32/to_private.wgsl.expected.spvasm
@@ -1,34 +1,28 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 80
+; Bound: 68
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
- OpMemberName %S_tint_explicit_layout 0 "before"
- OpMemberName %S_tint_explicit_layout 1 "m"
- OpMemberName %S_tint_explicit_layout 2 "after"
- OpName %S_tint_explicit_layout "S_tint_explicit_layout"
- OpMemberName %u_block_tint_explicit_layout 0 "inner"
- OpName %u_block_tint_explicit_layout "u_block_tint_explicit_layout"
OpMemberName %S 0 "before"
OpMemberName %S 1 "m"
OpMemberName %S 2 "after"
OpName %S "S"
+ OpMemberName %u_block_tint_explicit_layout 0 "inner"
+ OpName %u_block_tint_explicit_layout "u_block_tint_explicit_layout"
OpName %p "p"
OpName %f "f"
OpName %tint_convert_explicit_layout "tint_convert_explicit_layout"
OpName %tint_source "tint_source"
- OpName %tint_convert_explicit_layout_0 "tint_convert_explicit_layout"
- OpName %tint_source_0 "tint_source"
- OpMemberDecorate %S_tint_explicit_layout 0 Offset 0
- OpMemberDecorate %S_tint_explicit_layout 1 Offset 16
- OpMemberDecorate %S_tint_explicit_layout 1 ColMajor
- OpMemberDecorate %S_tint_explicit_layout 1 MatrixStride 16
- OpMemberDecorate %S_tint_explicit_layout 2 Offset 128
- OpDecorate %_arr_S_tint_explicit_layout_uint_4 ArrayStride 192
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 16
+ OpMemberDecorate %S 1 ColMajor
+ OpMemberDecorate %S 1 MatrixStride 16
+ OpMemberDecorate %S 2 Offset 128
+ OpDecorate %_arr_S_uint_4 ArrayStride 192
OpMemberDecorate %u_block_tint_explicit_layout 0 Offset 0
OpDecorate %u_block_tint_explicit_layout Block
OpDecorate %1 DescriptorSet 0
@@ -38,99 +32,85 @@
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat4v4float = OpTypeMatrix %v4float 4
-%S_tint_explicit_layout = OpTypeStruct %int %mat4v4float %int
+ %S = OpTypeStruct %int %mat4v4float %int
%uint = OpTypeInt 32 0
%uint_4 = OpConstant %uint 4
-%_arr_S_tint_explicit_layout_uint_4 = OpTypeArray %S_tint_explicit_layout %uint_4
-%u_block_tint_explicit_layout = OpTypeStruct %_arr_S_tint_explicit_layout_uint_4
+%_arr_S_uint_4 = OpTypeArray %S %uint_4
+%u_block_tint_explicit_layout = OpTypeStruct %_arr_S_uint_4
%_ptr_Uniform_u_block_tint_explicit_layout = OpTypePointer Uniform %u_block_tint_explicit_layout
%1 = OpVariable %_ptr_Uniform_u_block_tint_explicit_layout Uniform
- %S = OpTypeStruct %int %mat4v4float %int
-%_arr_S_uint_4 = OpTypeArray %S %uint_4
-%_ptr_Private__arr_S_uint_4 = OpTypePointer Private %_arr_S_uint_4
- %16 = OpConstantNull %_arr_S_uint_4
- %p = OpVariable %_ptr_Private__arr_S_uint_4 Private %16
+%_arr_S_uint_4_0 = OpTypeArray %S %uint_4
+%_ptr_Private__arr_S_uint_4_0 = OpTypePointer Private %_arr_S_uint_4_0
+ %15 = OpConstantNull %_arr_S_uint_4_0
+ %p = OpVariable %_ptr_Private__arr_S_uint_4_0 Private %15
%void = OpTypeVoid
- %19 = OpTypeFunction %void
-%_ptr_Uniform__arr_S_tint_explicit_layout_uint_4 = OpTypePointer Uniform %_arr_S_tint_explicit_layout_uint_4
+ %18 = OpTypeFunction %void
+%_ptr_Uniform__arr_S_uint_4 = OpTypePointer Uniform %_arr_S_uint_4
%uint_0 = OpConstant %uint 0
%_ptr_Private_S = OpTypePointer Private %S
%uint_1 = OpConstant %uint 1
-%_ptr_Uniform_S_tint_explicit_layout = OpTypePointer Uniform %S_tint_explicit_layout
+%_ptr_Uniform_S = OpTypePointer Uniform %S
%uint_2 = OpConstant %uint 2
%_ptr_Private_mat4v4float = OpTypePointer Private %mat4v4float
%uint_3 = OpConstant %uint 3
%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float
%_ptr_Private_v4float = OpTypePointer Private %v4float
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
- %49 = OpTypeFunction %S %S_tint_explicit_layout
- %56 = OpTypeFunction %_arr_S_uint_4 %_arr_S_tint_explicit_layout_uint_4
-%_ptr_Function__arr_S_tint_explicit_layout_uint_4 = OpTypePointer Function %_arr_S_tint_explicit_layout_uint_4
+ %46 = OpTypeFunction %_arr_S_uint_4_0 %_arr_S_uint_4
%_ptr_Function__arr_S_uint_4 = OpTypePointer Function %_arr_S_uint_4
+%_ptr_Function__arr_S_uint_4_0 = OpTypePointer Function %_arr_S_uint_4_0
%bool = OpTypeBool
-%_ptr_Function_S_tint_explicit_layout = OpTypePointer Function %S_tint_explicit_layout
%_ptr_Function_S = OpTypePointer Function %S
- %f = OpFunction %void None %19
- %20 = OpLabel
- %21 = OpAccessChain %_ptr_Uniform__arr_S_tint_explicit_layout_uint_4 %1 %uint_0
- %24 = OpLoad %_arr_S_tint_explicit_layout_uint_4 %21 None
- %25 = OpFunctionCall %_arr_S_uint_4 %tint_convert_explicit_layout_0 %24
- OpStore %p %25 None
- %27 = OpAccessChain %_ptr_Private_S %p %uint_1
- %30 = OpAccessChain %_ptr_Uniform_S_tint_explicit_layout %1 %uint_0 %uint_2
- %33 = OpLoad %S_tint_explicit_layout %30 None
- %34 = OpFunctionCall %S %tint_convert_explicit_layout %33
- OpStore %27 %34 None
- %36 = OpAccessChain %_ptr_Private_mat4v4float %p %uint_3 %uint_1
- %39 = OpAccessChain %_ptr_Uniform_mat4v4float %1 %uint_0 %uint_2 %uint_1
- %41 = OpLoad %mat4v4float %39 None
- OpStore %36 %41 None
- %42 = OpAccessChain %_ptr_Private_v4float %p %uint_1 %uint_1 %uint_0
- %44 = OpAccessChain %_ptr_Uniform_v4float %1 %uint_0 %uint_0 %uint_1 %uint_1
- %46 = OpLoad %v4float %44 None
- %47 = OpVectorShuffle %v4float %46 %46 1 3 0 2
- OpStore %42 %47 None
+ %f = OpFunction %void None %18
+ %19 = OpLabel
+ %20 = OpAccessChain %_ptr_Uniform__arr_S_uint_4 %1 %uint_0
+ %23 = OpLoad %_arr_S_uint_4 %20 None
+ %24 = OpFunctionCall %_arr_S_uint_4_0 %tint_convert_explicit_layout %23
+ OpStore %p %24 None
+ %26 = OpAccessChain %_ptr_Private_S %p %uint_1
+ %29 = OpAccessChain %_ptr_Uniform_S %1 %uint_0 %uint_2
+ %32 = OpLoad %S %29 None
+ OpStore %26 %32 None
+ %33 = OpAccessChain %_ptr_Private_mat4v4float %p %uint_3 %uint_1
+ %36 = OpAccessChain %_ptr_Uniform_mat4v4float %1 %uint_0 %uint_2 %uint_1
+ %38 = OpLoad %mat4v4float %36 None
+ OpStore %33 %38 None
+ %39 = OpAccessChain %_ptr_Private_v4float %p %uint_1 %uint_1 %uint_0
+ %41 = OpAccessChain %_ptr_Uniform_v4float %1 %uint_0 %uint_0 %uint_1 %uint_1
+ %43 = OpLoad %v4float %41 None
+ %44 = OpVectorShuffle %v4float %43 %43 1 3 0 2
+ OpStore %39 %44 None
OpReturn
OpFunctionEnd
-%tint_convert_explicit_layout = OpFunction %S None %49
-%tint_source = OpFunctionParameter %S_tint_explicit_layout
- %50 = OpLabel
- %51 = OpCompositeExtract %int %tint_source 0
- %52 = OpCompositeExtract %mat4v4float %tint_source 1
- %53 = OpCompositeExtract %int %tint_source 2
- %54 = OpCompositeConstruct %S %51 %52 %53
- OpReturnValue %54
- OpFunctionEnd
-%tint_convert_explicit_layout_0 = OpFunction %_arr_S_uint_4 None %56
-%tint_source_0 = OpFunctionParameter %_arr_S_tint_explicit_layout_uint_4
- %57 = OpLabel
- %58 = OpVariable %_ptr_Function__arr_S_tint_explicit_layout_uint_4 Function
- %60 = OpVariable %_ptr_Function__arr_S_uint_4 Function %16
- OpStore %58 %tint_source_0
- OpBranch %62
- %62 = OpLabel
- OpBranch %65
- %65 = OpLabel
- %67 = OpPhi %uint %uint_0 %62 %68 %64
- OpLoopMerge %66 %64 None
- OpBranch %63
+%tint_convert_explicit_layout = OpFunction %_arr_S_uint_4_0 None %46
+%tint_source = OpFunctionParameter %_arr_S_uint_4
+ %47 = OpLabel
+ %48 = OpVariable %_ptr_Function__arr_S_uint_4 Function
+ %50 = OpVariable %_ptr_Function__arr_S_uint_4_0 Function %15
+ OpStore %48 %tint_source
+ OpBranch %52
+ %52 = OpLabel
+ OpBranch %55
+ %55 = OpLabel
+ %57 = OpPhi %uint %uint_0 %52 %58 %54
+ OpLoopMerge %56 %54 None
+ OpBranch %53
+ %53 = OpLabel
+ %60 = OpUGreaterThanEqual %bool %57 %uint_4
+ OpSelectionMerge %62 None
+ OpBranchConditional %60 %63 %62
%63 = OpLabel
- %70 = OpUGreaterThanEqual %bool %67 %uint_4
- OpSelectionMerge %72 None
- OpBranchConditional %70 %73 %72
- %73 = OpLabel
- OpBranch %66
- %72 = OpLabel
- %74 = OpAccessChain %_ptr_Function_S_tint_explicit_layout %58 %67
- %76 = OpLoad %S_tint_explicit_layout %74 None
- %77 = OpFunctionCall %S %tint_convert_explicit_layout %76
- %78 = OpAccessChain %_ptr_Function_S %60 %67
- OpStore %78 %77 None
- OpBranch %64
- %64 = OpLabel
- %68 = OpIAdd %uint %67 %uint_1
- OpBranch %65
- %66 = OpLabel
- %69 = OpLoad %_arr_S_uint_4 %60 None
- OpReturnValue %69
+ OpBranch %56
+ %62 = OpLabel
+ %64 = OpAccessChain %_ptr_Function_S %48 %57
+ %66 = OpLoad %S %64 None
+ %67 = OpAccessChain %_ptr_Function_S %50 %57
+ OpStore %67 %66 None
+ OpBranch %54
+ %54 = OpLabel
+ %58 = OpIAdd %uint %57 %uint_1
+ OpBranch %55
+ %56 = OpLabel
+ %59 = OpLoad %_arr_S_uint_4_0 %50 None
+ OpReturnValue %59
OpFunctionEnd
diff --git a/test/tint/bug/chromium/1434271.wgsl.expected.spvasm b/test/tint/bug/chromium/1434271.wgsl.expected.spvasm
index b2d3f5f..3880701 100644
--- a/test/tint/bug/chromium/1434271.wgsl.expected.spvasm
+++ b/test/tint/bug/chromium/1434271.wgsl.expected.spvasm
@@ -292,7 +292,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 96
+; Bound: 85
; Schema: 0
OpCapability Shader
%46 = OpExtInstImport "GLSL.std.450"
@@ -305,11 +305,11 @@
OpName %SimulationParams "SimulationParams"
OpMemberName %sim_params_block 0 "inner"
OpName %sim_params_block "sim_params_block"
- OpMemberName %Particle_tint_explicit_layout 0 "position"
- OpMemberName %Particle_tint_explicit_layout 1 "lifetime"
- OpMemberName %Particle_tint_explicit_layout 2 "color"
- OpMemberName %Particle_tint_explicit_layout 3 "velocity"
- OpName %Particle_tint_explicit_layout "Particle_tint_explicit_layout"
+ OpMemberName %Particle 0 "position"
+ OpMemberName %Particle 1 "lifetime"
+ OpMemberName %Particle 2 "color"
+ OpMemberName %Particle 3 "velocity"
+ OpName %Particle "Particle"
OpMemberName %Particles_tint_explicit_layout 0 "particles"
OpName %Particles_tint_explicit_layout "Particles_tint_explicit_layout"
OpName %data "data"
@@ -317,18 +317,11 @@
OpName %simulate_inner "simulate_inner"
OpName %GlobalInvocationID "GlobalInvocationID"
OpName %idx "idx"
- OpMemberName %Particle 0 "position"
- OpMemberName %Particle 1 "lifetime"
- OpMemberName %Particle 2 "color"
- OpMemberName %Particle 3 "velocity"
- OpName %Particle "Particle"
OpName %particle "particle"
OpName %tint_store_and_preserve_padding "tint_store_and_preserve_padding"
OpName %target_indices "target_indices"
OpName %value_param "value_param"
OpName %simulate "simulate"
- OpName %tint_convert_explicit_layout "tint_convert_explicit_layout"
- OpName %tint_source "tint_source"
OpMemberDecorate %SimulationParams 0 Offset 0
OpMemberDecorate %SimulationParams 1 Offset 16
OpMemberDecorate %sim_params_block 0 Offset 0
@@ -336,11 +329,11 @@
OpDecorate %6 DescriptorSet 0
OpDecorate %6 Binding 0
OpDecorate %6 NonWritable
- OpMemberDecorate %Particle_tint_explicit_layout 0 Offset 0
- OpMemberDecorate %Particle_tint_explicit_layout 1 Offset 12
- OpMemberDecorate %Particle_tint_explicit_layout 2 Offset 16
- OpMemberDecorate %Particle_tint_explicit_layout 3 Offset 32
- OpDecorate %_runtimearr_Particle_tint_explicit_layout ArrayStride 48
+ OpMemberDecorate %Particle 0 Offset 0
+ OpMemberDecorate %Particle 1 Offset 12
+ OpMemberDecorate %Particle 2 Offset 16
+ OpMemberDecorate %Particle 3 Offset 32
+ OpDecorate %_runtimearr_Particle ArrayStride 48
OpMemberDecorate %Particles_tint_explicit_layout 0 Offset 0
OpDecorate %Particles_tint_explicit_layout Block
OpDecorate %data DescriptorSet 0
@@ -358,9 +351,9 @@
%_ptr_Uniform_sim_params_block = OpTypePointer Uniform %sim_params_block
%6 = OpVariable %_ptr_Uniform_sim_params_block Uniform
%v3float = OpTypeVector %float 3
-%Particle_tint_explicit_layout = OpTypeStruct %v3float %float %v4float %v2float
-%_runtimearr_Particle_tint_explicit_layout = OpTypeRuntimeArray %Particle_tint_explicit_layout
-%Particles_tint_explicit_layout = OpTypeStruct %_runtimearr_Particle_tint_explicit_layout
+ %Particle = OpTypeStruct %v3float %float %v4float %v2float
+%_runtimearr_Particle = OpTypeRuntimeArray %Particle
+%Particles_tint_explicit_layout = OpTypeStruct %_runtimearr_Particle
%_ptr_StorageBuffer_Particles_tint_explicit_layout = OpTypePointer StorageBuffer %Particles_tint_explicit_layout
%data = OpVariable %_ptr_StorageBuffer_Particles_tint_explicit_layout StorageBuffer
%uint = OpTypeInt 32 0
@@ -373,20 +366,18 @@
%uint_0 = OpConstant %uint 0
%uint_1 = OpConstant %uint 1
%v2uint = OpTypeVector %uint 2
-%_ptr_StorageBuffer__runtimearr_Particle_tint_explicit_layout = OpTypePointer StorageBuffer %_runtimearr_Particle_tint_explicit_layout
-%_ptr_StorageBuffer_Particle_tint_explicit_layout = OpTypePointer StorageBuffer %Particle_tint_explicit_layout
- %Particle = OpTypeStruct %v3float %float %v4float %v2float
+%_ptr_StorageBuffer__runtimearr_Particle = OpTypePointer StorageBuffer %_runtimearr_Particle
+%_ptr_StorageBuffer_Particle = OpTypePointer StorageBuffer %Particle
%_ptr_Function_Particle = OpTypePointer Function %Particle
%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
- %66 = OpTypeFunction %void %_arr_uint_uint_1 %Particle
+ %63 = OpTypeFunction %void %_arr_uint_uint_1 %Particle
%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%uint_2 = OpConstant %uint 2
%_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float
%uint_3 = OpConstant %uint 3
- %84 = OpTypeFunction %void
- %89 = OpTypeFunction %Particle %Particle_tint_explicit_layout
+ %81 = OpTypeFunction %void
%simulate_inner = OpFunction %void None %24
%GlobalInvocationID = OpFunctionParameter %v3uint
%25 = OpLabel
@@ -403,58 +394,47 @@
%39 = OpFMul %v2float %35 %38
OpStore %rand_seed %39 None
%idx = OpCompositeExtract %uint %GlobalInvocationID 0
- %41 = OpAccessChain %_ptr_StorageBuffer__runtimearr_Particle_tint_explicit_layout %data %uint_0
+ %41 = OpAccessChain %_ptr_StorageBuffer__runtimearr_Particle %data %uint_0
%43 = OpArrayLength %uint %data 0
%44 = OpISub %uint %43 %uint_1
%45 = OpExtInst %uint %46 UMin %idx %44
- %47 = OpAccessChain %_ptr_StorageBuffer_Particle_tint_explicit_layout %data %uint_0 %45
- %49 = OpLoad %Particle_tint_explicit_layout %47 None
- %50 = OpFunctionCall %Particle %tint_convert_explicit_layout %49
- OpStore %particle %50
- %55 = OpAccessChain %_ptr_StorageBuffer__runtimearr_Particle_tint_explicit_layout %data %uint_0
- %56 = OpArrayLength %uint %data 0
- %57 = OpISub %uint %56 %uint_1
- %58 = OpExtInst %uint %46 UMin %idx %57
- %59 = OpLoad %Particle %particle None
- %61 = OpCompositeConstruct %_arr_uint_uint_1 %58
- %62 = OpFunctionCall %void %tint_store_and_preserve_padding %61 %59
+ %47 = OpAccessChain %_ptr_StorageBuffer_Particle %data %uint_0 %45
+ %49 = OpLoad %Particle %47 None
+ OpStore %particle %49
+ %52 = OpAccessChain %_ptr_StorageBuffer__runtimearr_Particle %data %uint_0
+ %53 = OpArrayLength %uint %data 0
+ %54 = OpISub %uint %53 %uint_1
+ %55 = OpExtInst %uint %46 UMin %idx %54
+ %56 = OpLoad %Particle %particle None
+ %58 = OpCompositeConstruct %_arr_uint_uint_1 %55
+ %59 = OpFunctionCall %void %tint_store_and_preserve_padding %58 %56
OpReturn
OpFunctionEnd
-%tint_store_and_preserve_padding = OpFunction %void None %66
+%tint_store_and_preserve_padding = OpFunction %void None %63
%target_indices = OpFunctionParameter %_arr_uint_uint_1
%value_param = OpFunctionParameter %Particle
- %67 = OpLabel
- %68 = OpCompositeExtract %uint %target_indices 0
- %69 = OpAccessChain %_ptr_StorageBuffer_v3float %data %uint_0 %68 %uint_0
- %71 = OpCompositeExtract %v3float %value_param 0
+ %64 = OpLabel
+ %65 = OpCompositeExtract %uint %target_indices 0
+ %66 = OpAccessChain %_ptr_StorageBuffer_v3float %data %uint_0 %65 %uint_0
+ %68 = OpCompositeExtract %v3float %value_param 0
+ OpStore %66 %68 None
+ %69 = OpAccessChain %_ptr_StorageBuffer_float %data %uint_0 %65 %uint_1
+ %71 = OpCompositeExtract %float %value_param 1
OpStore %69 %71 None
- %72 = OpAccessChain %_ptr_StorageBuffer_float %data %uint_0 %68 %uint_1
- %74 = OpCompositeExtract %float %value_param 1
- OpStore %72 %74 None
- %75 = OpAccessChain %_ptr_StorageBuffer_v4float %data %uint_0 %68 %uint_2
- %78 = OpCompositeExtract %v4float %value_param 2
- OpStore %75 %78 None
- %79 = OpAccessChain %_ptr_StorageBuffer_v2float %data %uint_0 %68 %uint_3
- %82 = OpCompositeExtract %v2float %value_param 3
- OpStore %79 %82 None
+ %72 = OpAccessChain %_ptr_StorageBuffer_v4float %data %uint_0 %65 %uint_2
+ %75 = OpCompositeExtract %v4float %value_param 2
+ OpStore %72 %75 None
+ %76 = OpAccessChain %_ptr_StorageBuffer_v2float %data %uint_0 %65 %uint_3
+ %79 = OpCompositeExtract %v2float %value_param 3
+ OpStore %76 %79 None
OpReturn
OpFunctionEnd
- %simulate = OpFunction %void None %84
- %85 = OpLabel
- %86 = OpLoad %v3uint %simulate_global_invocation_id_Input None
- %87 = OpFunctionCall %void %simulate_inner %86
+ %simulate = OpFunction %void None %81
+ %82 = OpLabel
+ %83 = OpLoad %v3uint %simulate_global_invocation_id_Input None
+ %84 = OpFunctionCall %void %simulate_inner %83
OpReturn
OpFunctionEnd
-%tint_convert_explicit_layout = OpFunction %Particle None %89
-%tint_source = OpFunctionParameter %Particle_tint_explicit_layout
- %90 = OpLabel
- %91 = OpCompositeExtract %v3float %tint_source 0
- %92 = OpCompositeExtract %float %tint_source 1
- %93 = OpCompositeExtract %v4float %tint_source 2
- %94 = OpCompositeExtract %v2float %tint_source 3
- %95 = OpCompositeConstruct %Particle %91 %92 %93 %94
- OpReturnValue %95
- OpFunctionEnd
;
; export_level
;
diff --git a/test/tint/bug/tint/922.wgsl.expected.spvasm b/test/tint/bug/tint/922.wgsl.expected.spvasm
index bc5ad6e1..e036c35 100644
--- a/test/tint/bug/tint/922.wgsl.expected.spvasm
+++ b/test/tint/bug/tint/922.wgsl.expected.spvasm
@@ -1,33 +1,33 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 278
+; Bound: 247
; Schema: 0
OpCapability Shader
- %162 = OpExtInstImport "GLSL.std.450"
+ %159 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %main "main" %main_loc0_Input %main_loc1_Input %main_loc2_Input %main_loc3_Input %main_loc4_Input %main_loc0_Output %main_loc1_Output %main_position_Output %main___point_size_Output
- OpMemberName %Mat4x4__tint_explicit_layout 0 "mx"
- OpMemberName %Mat4x4__tint_explicit_layout 1 "my"
- OpMemberName %Mat4x4__tint_explicit_layout 2 "mz"
- OpMemberName %Mat4x4__tint_explicit_layout 3 "mw"
- OpName %Mat4x4__tint_explicit_layout "Mat4x4__tint_explicit_layout"
- OpMemberName %ub_SceneParams_tint_explicit_layout 0 "u_Projection"
- OpName %ub_SceneParams_tint_explicit_layout "ub_SceneParams_tint_explicit_layout"
- OpMemberName %global_block_tint_explicit_layout 0 "inner"
- OpName %global_block_tint_explicit_layout "global_block_tint_explicit_layout"
- OpMemberName %Mat4x2__tint_explicit_layout 0 "mx"
- OpMemberName %Mat4x2__tint_explicit_layout 1 "my"
- OpName %Mat4x2__tint_explicit_layout "Mat4x2__tint_explicit_layout"
+ OpMemberName %Mat4x4_ 0 "mx"
+ OpMemberName %Mat4x4_ 1 "my"
+ OpMemberName %Mat4x4_ 2 "mz"
+ OpMemberName %Mat4x4_ 3 "mw"
+ OpName %Mat4x4_ "Mat4x4_"
+ OpMemberName %ub_SceneParams 0 "u_Projection"
+ OpName %ub_SceneParams "ub_SceneParams"
+ OpMemberName %global_block 0 "inner"
+ OpName %global_block "global_block"
+ OpMemberName %Mat4x2_ 0 "mx"
+ OpMemberName %Mat4x2_ 1 "my"
+ OpName %Mat4x2_ "Mat4x2_"
OpMemberName %ub_MaterialParams_tint_explicit_layout 0 "u_TexMtx"
OpMemberName %ub_MaterialParams_tint_explicit_layout 1 "u_Misc0_"
OpName %ub_MaterialParams_tint_explicit_layout "ub_MaterialParams_tint_explicit_layout"
OpMemberName %global1_block_tint_explicit_layout 0 "inner"
OpName %global1_block_tint_explicit_layout "global1_block_tint_explicit_layout"
- OpMemberName %Mat4x3__tint_explicit_layout 0 "mx"
- OpMemberName %Mat4x3__tint_explicit_layout 1 "my"
- OpMemberName %Mat4x3__tint_explicit_layout 2 "mz"
- OpName %Mat4x3__tint_explicit_layout "Mat4x3__tint_explicit_layout"
+ OpMemberName %Mat4x3_ 0 "mx"
+ OpMemberName %Mat4x3_ 1 "my"
+ OpMemberName %Mat4x3_ 2 "mz"
+ OpName %Mat4x3_ "Mat4x3_"
OpMemberName %ub_PacketParams_tint_explicit_layout 0 "u_PosMtx"
OpName %ub_PacketParams_tint_explicit_layout "ub_PacketParams_tint_explicit_layout"
OpMemberName %global2_block_tint_explicit_layout 0 "inner"
@@ -50,11 +50,6 @@
OpName %main_position_Output "main_position_Output"
OpName %main___point_size_Output "main___point_size_Output"
OpName %Mul "Mul"
- OpMemberName %Mat4x4_ 0 "mx"
- OpMemberName %Mat4x4_ 1 "my"
- OpMemberName %Mat4x4_ 2 "mz"
- OpMemberName %Mat4x4_ 3 "mw"
- OpName %Mat4x4_ "Mat4x4_"
OpName %m8 "m8"
OpName %v "v"
OpName %m9 "m9"
@@ -68,9 +63,6 @@
OpName %x_e16 "x_e16"
OpName %x_e18 "x_e18"
OpName %Mul2 "Mul2"
- OpMemberName %Mat4x2_ 0 "mx"
- OpMemberName %Mat4x2_ 1 "my"
- OpName %Mat4x2_ "Mat4x2_"
OpName %m12 "m12"
OpName %v4 "v4"
OpName %m13 "m13"
@@ -89,10 +81,6 @@
OpName %x_e25 "x_e25"
OpName %x_e27 "x_e27"
OpName %x_Mat4x4_1 "x_Mat4x4_1"
- OpMemberName %Mat4x3_ 0 "mx"
- OpMemberName %Mat4x3_ 1 "my"
- OpMemberName %Mat4x3_ 2 "mz"
- OpName %Mat4x3_ "Mat4x3_"
OpName %m16 "m16"
OpName %m17 "m17"
OpName %o1 "o1"
@@ -148,25 +136,19 @@
OpName %tint_f32_to_i32 "tint_f32_to_i32"
OpName %value "value"
OpName %main "main"
- OpName %tint_convert_explicit_layout "tint_convert_explicit_layout"
- OpName %tint_source "tint_source"
- OpName %tint_convert_explicit_layout_0 "tint_convert_explicit_layout"
- OpName %tint_source_0 "tint_source"
- OpName %tint_convert_explicit_layout_1 "tint_convert_explicit_layout"
- OpName %tint_source_1 "tint_source"
- OpMemberDecorate %Mat4x4__tint_explicit_layout 0 Offset 0
- OpMemberDecorate %Mat4x4__tint_explicit_layout 1 Offset 16
- OpMemberDecorate %Mat4x4__tint_explicit_layout 2 Offset 32
- OpMemberDecorate %Mat4x4__tint_explicit_layout 3 Offset 48
- OpMemberDecorate %ub_SceneParams_tint_explicit_layout 0 Offset 0
- OpMemberDecorate %global_block_tint_explicit_layout 0 Offset 0
- OpDecorate %global_block_tint_explicit_layout Block
+ OpMemberDecorate %Mat4x4_ 0 Offset 0
+ OpMemberDecorate %Mat4x4_ 1 Offset 16
+ OpMemberDecorate %Mat4x4_ 2 Offset 32
+ OpMemberDecorate %Mat4x4_ 3 Offset 48
+ OpMemberDecorate %ub_SceneParams 0 Offset 0
+ OpMemberDecorate %global_block 0 Offset 0
+ OpDecorate %global_block Block
OpDecorate %1 DescriptorSet 0
OpDecorate %1 Binding 0
OpDecorate %1 NonWritable
- OpMemberDecorate %Mat4x2__tint_explicit_layout 0 Offset 0
- OpMemberDecorate %Mat4x2__tint_explicit_layout 1 Offset 16
- OpDecorate %_arr_Mat4x2__tint_explicit_layout_uint_1 ArrayStride 32
+ OpMemberDecorate %Mat4x2_ 0 Offset 0
+ OpMemberDecorate %Mat4x2_ 1 Offset 16
+ OpDecorate %_arr_Mat4x2__uint_1 ArrayStride 32
OpMemberDecorate %ub_MaterialParams_tint_explicit_layout 0 Offset 0
OpMemberDecorate %ub_MaterialParams_tint_explicit_layout 1 Offset 32
OpMemberDecorate %global1_block_tint_explicit_layout 0 Offset 0
@@ -174,10 +156,10 @@
OpDecorate %8 DescriptorSet 0
OpDecorate %8 Binding 1
OpDecorate %8 NonWritable
- OpMemberDecorate %Mat4x3__tint_explicit_layout 0 Offset 0
- OpMemberDecorate %Mat4x3__tint_explicit_layout 1 Offset 16
- OpMemberDecorate %Mat4x3__tint_explicit_layout 2 Offset 32
- OpDecorate %_arr_Mat4x3__tint_explicit_layout_uint_32 ArrayStride 48
+ OpMemberDecorate %Mat4x3_ 0 Offset 0
+ OpMemberDecorate %Mat4x3_ 1 Offset 16
+ OpMemberDecorate %Mat4x3_ 2 Offset 32
+ OpDecorate %_arr_Mat4x3__uint_32 ArrayStride 48
OpMemberDecorate %ub_PacketParams_tint_explicit_layout 0 Offset 0
OpMemberDecorate %global2_block_tint_explicit_layout 0 Offset 0
OpDecorate %global2_block_tint_explicit_layout Block
@@ -195,23 +177,23 @@
OpDecorate %main___point_size_Output BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
-%Mat4x4__tint_explicit_layout = OpTypeStruct %v4float %v4float %v4float %v4float
-%ub_SceneParams_tint_explicit_layout = OpTypeStruct %Mat4x4__tint_explicit_layout
-%global_block_tint_explicit_layout = OpTypeStruct %ub_SceneParams_tint_explicit_layout
-%_ptr_Uniform_global_block_tint_explicit_layout = OpTypePointer Uniform %global_block_tint_explicit_layout
- %1 = OpVariable %_ptr_Uniform_global_block_tint_explicit_layout Uniform
-%Mat4x2__tint_explicit_layout = OpTypeStruct %v4float %v4float
+ %Mat4x4_ = OpTypeStruct %v4float %v4float %v4float %v4float
+%ub_SceneParams = OpTypeStruct %Mat4x4_
+%global_block = OpTypeStruct %ub_SceneParams
+%_ptr_Uniform_global_block = OpTypePointer Uniform %global_block
+ %1 = OpVariable %_ptr_Uniform_global_block Uniform
+ %Mat4x2_ = OpTypeStruct %v4float %v4float
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
-%_arr_Mat4x2__tint_explicit_layout_uint_1 = OpTypeArray %Mat4x2__tint_explicit_layout %uint_1
-%ub_MaterialParams_tint_explicit_layout = OpTypeStruct %_arr_Mat4x2__tint_explicit_layout_uint_1 %v4float
+%_arr_Mat4x2__uint_1 = OpTypeArray %Mat4x2_ %uint_1
+%ub_MaterialParams_tint_explicit_layout = OpTypeStruct %_arr_Mat4x2__uint_1 %v4float
%global1_block_tint_explicit_layout = OpTypeStruct %ub_MaterialParams_tint_explicit_layout
%_ptr_Uniform_global1_block_tint_explicit_layout = OpTypePointer Uniform %global1_block_tint_explicit_layout
%8 = OpVariable %_ptr_Uniform_global1_block_tint_explicit_layout Uniform
-%Mat4x3__tint_explicit_layout = OpTypeStruct %v4float %v4float %v4float
+ %Mat4x3_ = OpTypeStruct %v4float %v4float %v4float
%uint_32 = OpConstant %uint 32
-%_arr_Mat4x3__tint_explicit_layout_uint_32 = OpTypeArray %Mat4x3__tint_explicit_layout %uint_32
-%ub_PacketParams_tint_explicit_layout = OpTypeStruct %_arr_Mat4x3__tint_explicit_layout_uint_32
+%_arr_Mat4x3__uint_32 = OpTypeArray %Mat4x3_ %uint_32
+%ub_PacketParams_tint_explicit_layout = OpTypeStruct %_arr_Mat4x3__uint_32
%global2_block_tint_explicit_layout = OpTypeStruct %ub_PacketParams_tint_explicit_layout
%_ptr_Uniform_global2_block_tint_explicit_layout = OpTypePointer Uniform %global2_block_tint_explicit_layout
%16 = OpVariable %_ptr_Uniform_global2_block_tint_explicit_layout Uniform
@@ -249,52 +231,46 @@
%main_position_Output = OpVariable %_ptr_Output_v4float Output
%_ptr_Output_float = OpTypePointer Output %float
%main___point_size_Output = OpVariable %_ptr_Output_float Output
- %Mat4x4_ = OpTypeStruct %v4float %v4float %v4float %v4float
- %61 = OpTypeFunction %v4float %Mat4x4_ %v4float
+ %60 = OpTypeFunction %v4float %Mat4x4_ %v4float
%_ptr_Function_Mat4x4_ = OpTypePointer Function %Mat4x4_
- %65 = OpConstantNull %Mat4x4_
+ %64 = OpConstantNull %Mat4x4_
%_ptr_Function_v4float = OpTypePointer Function %v4float
- %Mat4x2_ = OpTypeStruct %v4float %v4float
- %89 = OpTypeFunction %v2float %Mat4x2_ %v4float
+ %87 = OpTypeFunction %v2float %Mat4x2_ %v4float
%_ptr_Function_Mat4x2_ = OpTypePointer Function %Mat4x2_
- %93 = OpConstantNull %Mat4x2_
- %106 = OpTypeFunction %Mat4x4_ %float
+ %91 = OpConstantNull %Mat4x2_
+ %104 = OpTypeFunction %Mat4x4_ %float
%_ptr_Function_float = OpTypePointer Function %float
%uint_0 = OpConstant %uint 0
%float_0 = OpConstant %float 0
%uint_2 = OpConstant %uint 2
%uint_3 = OpConstant %uint 3
- %Mat4x3_ = OpTypeStruct %v4float %v4float %v4float
- %131 = OpTypeFunction %Mat4x4_ %Mat4x3_
+ %128 = OpTypeFunction %Mat4x4_ %Mat4x3_
%_ptr_Function_Mat4x3_ = OpTypePointer Function %Mat4x3_
- %135 = OpConstantNull %Mat4x3_
+ %132 = OpConstantNull %Mat4x3_
%float_1 = OpConstant %float 1
%void = OpTypeVoid
- %151 = OpTypeFunction %void
+ %148 = OpTypeFunction %void
%_ptr_Function_v2float = OpTypePointer Function %v2float
%int = OpTypeInt 32 1
%uint_31 = OpConstant %uint 31
-%_ptr_Uniform_Mat4x3__tint_explicit_layout = OpTypePointer Uniform %Mat4x3__tint_explicit_layout
-%_ptr_Uniform_Mat4x4__tint_explicit_layout = OpTypePointer Uniform %Mat4x4__tint_explicit_layout
+%_ptr_Uniform_Mat4x3_ = OpTypePointer Uniform %Mat4x3_
+%_ptr_Uniform_Mat4x4_ = OpTypePointer Uniform %Mat4x4_
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%float_2 = OpConstant %float 2
%bool = OpTypeBool
-%_ptr_Uniform_Mat4x2__tint_explicit_layout = OpTypePointer Uniform %Mat4x2__tint_explicit_layout
+%_ptr_Uniform_Mat4x2_ = OpTypePointer Uniform %Mat4x2_
%VertexOutput = OpTypeStruct %v4float %v2float %v4float
- %227 = OpTypeFunction %VertexOutput %v3float %v2float %v4float %v3float %float
- %235 = OpTypeFunction %int %float
+ %217 = OpTypeFunction %VertexOutput %v3float %v2float %v4float %v3float %float
+ %225 = OpTypeFunction %int %float
%float_n2_14748365e_09 = OpConstant %float -2.14748365e+09
%int_n2147483648 = OpConstant %int -2147483648
%float_2_14748352e_09 = OpConstant %float 2.14748352e+09
%int_2147483647 = OpConstant %int 2147483647
- %258 = OpTypeFunction %Mat4x4_ %Mat4x4__tint_explicit_layout
- %266 = OpTypeFunction %Mat4x2_ %Mat4x2__tint_explicit_layout
- %272 = OpTypeFunction %Mat4x3_ %Mat4x3__tint_explicit_layout
- %Mul = OpFunction %v4float None %61
+ %Mul = OpFunction %v4float None %60
%m8 = OpFunctionParameter %Mat4x4_
%v = OpFunctionParameter %v4float
- %62 = OpLabel
- %m9 = OpVariable %_ptr_Function_Mat4x4_ Function %65
+ %61 = OpLabel
+ %m9 = OpVariable %_ptr_Function_Mat4x4_ Function %64
%v1 = OpVariable %_ptr_Function_v4float Function %33
OpStore %m9 %m8 None
OpStore %v1 %v None
@@ -306,22 +282,22 @@
%x_e14 = OpLoad %v4float %v1 None
%x_e16 = OpLoad %Mat4x4_ %m9 None
%x_e18 = OpLoad %v4float %v1 None
- %76 = OpCompositeExtract %v4float %x_e4 0
- %77 = OpDot %float %76 %x_e6
- %78 = OpCompositeExtract %v4float %x_e8 1
- %79 = OpDot %float %78 %x_e10
- %80 = OpCompositeExtract %v4float %x_e12 2
- %81 = OpDot %float %80 %x_e14
- %82 = OpCompositeExtract %v4float %x_e16 3
- %83 = OpDot %float %82 %x_e18
- %84 = OpCompositeConstruct %v4float %77 %79 %81 %83
- OpReturnValue %84
+ %75 = OpCompositeExtract %v4float %x_e4 0
+ %76 = OpDot %float %75 %x_e6
+ %77 = OpCompositeExtract %v4float %x_e8 1
+ %78 = OpDot %float %77 %x_e10
+ %79 = OpCompositeExtract %v4float %x_e12 2
+ %80 = OpDot %float %79 %x_e14
+ %81 = OpCompositeExtract %v4float %x_e16 3
+ %82 = OpDot %float %81 %x_e18
+ %83 = OpCompositeConstruct %v4float %76 %78 %80 %82
+ OpReturnValue %83
OpFunctionEnd
- %Mul2 = OpFunction %v2float None %89
+ %Mul2 = OpFunction %v2float None %87
%m12 = OpFunctionParameter %Mat4x2_
%v4 = OpFunctionParameter %v4float
- %90 = OpLabel
- %m13 = OpVariable %_ptr_Function_Mat4x2_ Function %93
+ %88 = OpLabel
+ %m13 = OpVariable %_ptr_Function_Mat4x2_ Function %91
%v5 = OpVariable %_ptr_Function_v4float Function %33
OpStore %m13 %m12 None
OpStore %v5 %v4 None
@@ -329,72 +305,71 @@
%x_e6_0 = OpLoad %v4float %v5 None
%x_e8_0 = OpLoad %Mat4x2_ %m13 None
%x_e10_0 = OpLoad %v4float %v5 None
- %99 = OpCompositeExtract %v4float %x_e4_0 0
- %100 = OpDot %float %99 %x_e6_0
- %101 = OpCompositeExtract %v4float %x_e8_0 1
- %102 = OpDot %float %101 %x_e10_0
- %103 = OpCompositeConstruct %v2float %100 %102
- OpReturnValue %103
+ %97 = OpCompositeExtract %v4float %x_e4_0 0
+ %98 = OpDot %float %97 %x_e6_0
+ %99 = OpCompositeExtract %v4float %x_e8_0 1
+ %100 = OpDot %float %99 %x_e10_0
+ %101 = OpCompositeConstruct %v2float %98 %100
+ OpReturnValue %101
OpFunctionEnd
- %x_Mat4x4_ = OpFunction %Mat4x4_ None %106
+ %x_Mat4x4_ = OpFunction %Mat4x4_ None %104
%n = OpFunctionParameter %float
- %107 = OpLabel
+ %105 = OpLabel
%n1 = OpVariable %_ptr_Function_float Function %37
- %o = OpVariable %_ptr_Function_Mat4x4_ Function %65
+ %o = OpVariable %_ptr_Function_Mat4x4_ Function %64
OpStore %n1 %n None
%x_e4_1 = OpLoad %float %n1 None
- %112 = OpAccessChain %_ptr_Function_v4float %o %uint_0
- %114 = OpCompositeConstruct %v4float %x_e4_1 %float_0 %float_0 %float_0
- OpStore %112 %114 None
+ %110 = OpAccessChain %_ptr_Function_v4float %o %uint_0
+ %112 = OpCompositeConstruct %v4float %x_e4_1 %float_0 %float_0 %float_0
+ OpStore %110 %112 None
%x_e11 = OpLoad %float %n1 None
- %117 = OpAccessChain %_ptr_Function_v4float %o %uint_1
- %118 = OpCompositeConstruct %v4float %float_0 %x_e11 %float_0 %float_0
- OpStore %117 %118 None
+ %115 = OpAccessChain %_ptr_Function_v4float %o %uint_1
+ %116 = OpCompositeConstruct %v4float %float_0 %x_e11 %float_0 %float_0
+ OpStore %115 %116 None
%x_e18_0 = OpLoad %float %n1 None
- %120 = OpAccessChain %_ptr_Function_v4float %o %uint_2
- %122 = OpCompositeConstruct %v4float %float_0 %float_0 %x_e18_0 %float_0
- OpStore %120 %122 None
+ %118 = OpAccessChain %_ptr_Function_v4float %o %uint_2
+ %120 = OpCompositeConstruct %v4float %float_0 %float_0 %x_e18_0 %float_0
+ OpStore %118 %120 None
%x_e25 = OpLoad %float %n1 None
- %124 = OpAccessChain %_ptr_Function_v4float %o %uint_3
- %126 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %x_e25
- OpStore %124 %126 None
+ %122 = OpAccessChain %_ptr_Function_v4float %o %uint_3
+ %124 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %x_e25
+ OpStore %122 %124 None
%x_e27 = OpLoad %Mat4x4_ %o None
OpReturnValue %x_e27
OpFunctionEnd
- %x_Mat4x4_1 = OpFunction %Mat4x4_ None %131
+ %x_Mat4x4_1 = OpFunction %Mat4x4_ None %128
%m16 = OpFunctionParameter %Mat4x3_
- %132 = OpLabel
- %m17 = OpVariable %_ptr_Function_Mat4x3_ Function %135
- %o1 = OpVariable %_ptr_Function_Mat4x4_ Function %65
+ %129 = OpLabel
+ %m17 = OpVariable %_ptr_Function_Mat4x3_ Function %132
+ %o1 = OpVariable %_ptr_Function_Mat4x4_ Function %64
OpStore %m17 %m16 None
%x_e4_2 = OpFunctionCall %Mat4x4_ %x_Mat4x4_ %float_1
OpStore %o1 %x_e4_2 None
%x_e7 = OpLoad %Mat4x3_ %m17 None
- %140 = OpAccessChain %_ptr_Function_v4float %o1 %uint_0
- %141 = OpCompositeExtract %v4float %x_e7 0
- OpStore %140 %141 None
+ %137 = OpAccessChain %_ptr_Function_v4float %o1 %uint_0
+ %138 = OpCompositeExtract %v4float %x_e7 0
+ OpStore %137 %138 None
%x_e10_1 = OpLoad %Mat4x3_ %m17 None
- %143 = OpAccessChain %_ptr_Function_v4float %o1 %uint_1
- %144 = OpCompositeExtract %v4float %x_e10_1 1
- OpStore %143 %144 None
+ %140 = OpAccessChain %_ptr_Function_v4float %o1 %uint_1
+ %141 = OpCompositeExtract %v4float %x_e10_1 1
+ OpStore %140 %141 None
%x_e13 = OpLoad %Mat4x3_ %m17 None
- %146 = OpAccessChain %_ptr_Function_v4float %o1 %uint_2
- %147 = OpCompositeExtract %v4float %x_e13 2
- OpStore %146 %147 None
+ %143 = OpAccessChain %_ptr_Function_v4float %o1 %uint_2
+ %144 = OpCompositeExtract %v4float %x_e13 2
+ OpStore %143 %144 None
%x_e15 = OpLoad %Mat4x4_ %o1 None
OpReturnValue %x_e15
OpFunctionEnd
- %main1 = OpFunction %void None %151
- %152 = OpLabel
- %t_PosMtx = OpVariable %_ptr_Function_Mat4x3_ Function %135
+ %main1 = OpFunction %void None %148
+ %149 = OpLabel
+ %t_PosMtx = OpVariable %_ptr_Function_Mat4x3_ Function %132
%t_TexSpaceCoord = OpVariable %_ptr_Function_v2float Function %30
%x_e15_0 = OpLoad %float %a_PosMtxIdx1 None
- %157 = OpFunctionCall %int %tint_f32_to_i32 %x_e15_0
- %160 = OpBitcast %uint %157
- %161 = OpExtInst %uint %162 UMin %160 %uint_31
- %164 = OpAccessChain %_ptr_Uniform_Mat4x3__tint_explicit_layout %16 %uint_0 %uint_0 %161
- %166 = OpLoad %Mat4x3__tint_explicit_layout %164 None
- %x_e18_1 = OpFunctionCall %Mat4x3_ %tint_convert_explicit_layout_1 %166
+ %154 = OpFunctionCall %int %tint_f32_to_i32 %x_e15_0
+ %157 = OpBitcast %uint %154
+ %158 = OpExtInst %uint %159 UMin %157 %uint_31
+ %161 = OpAccessChain %_ptr_Uniform_Mat4x3_ %16 %uint_0 %uint_0 %158
+ %x_e18_1 = OpLoad %Mat4x3_ %161 None
OpStore %t_PosMtx %x_e18_1 None
%x_e23 = OpLoad %Mat4x3_ %t_PosMtx None
%x_e24 = OpFunctionCall %Mat4x4_ %x_Mat4x4_1 %x_e23
@@ -402,124 +377,94 @@
%x_e29 = OpLoad %Mat4x3_ %t_PosMtx None
%x_e30 = OpFunctionCall %Mat4x4_ %x_Mat4x4_1 %x_e29
%x_e31 = OpLoad %v3float %a_Position1 None
- %175 = OpCompositeConstruct %v4float %x_e31 %float_1
- %x_e34 = OpFunctionCall %v4float %Mul %x_e30 %175
- %177 = OpAccessChain %_ptr_Uniform_Mat4x4__tint_explicit_layout %1 %uint_0 %uint_0
- %179 = OpLoad %Mat4x4__tint_explicit_layout %177 None
- %x_e35 = OpFunctionCall %Mat4x4_ %tint_convert_explicit_layout %179
+ %170 = OpCompositeConstruct %v4float %x_e31 %float_1
+ %x_e34 = OpFunctionCall %v4float %Mul %x_e30 %170
+ %172 = OpAccessChain %_ptr_Uniform_Mat4x4_ %1 %uint_0 %uint_0
+ %x_e35 = OpLoad %Mat4x4_ %172 None
%x_e37 = OpLoad %Mat4x3_ %t_PosMtx None
%x_e38 = OpFunctionCall %Mat4x4_ %x_Mat4x4_1 %x_e37
%x_e39 = OpLoad %v3float %a_Position1 None
%x_e43 = OpLoad %Mat4x3_ %t_PosMtx None
%x_e44 = OpFunctionCall %Mat4x4_ %x_Mat4x4_1 %x_e43
%x_e45 = OpLoad %v3float %a_Position1 None
- %188 = OpCompositeConstruct %v4float %x_e45 %float_1
- %x_e48 = OpFunctionCall %v4float %Mul %x_e44 %188
+ %181 = OpCompositeConstruct %v4float %x_e45 %float_1
+ %x_e48 = OpFunctionCall %v4float %Mul %x_e44 %181
%x_e49 = OpFunctionCall %v4float %Mul %x_e35 %x_e48
OpStore %gl_Position %x_e49 None
%x_e50 = OpLoad %v4float %a_Color1 None
OpStore %v_Color %x_e50 None
- %192 = OpAccessChain %_ptr_Uniform_v4float %8 %uint_0 %uint_1
- %x_e52 = OpLoad %v4float %192 None
- %195 = OpCompositeExtract %float %x_e52 0
- %196 = OpFOrdEqual %bool %195 %float_2
- OpSelectionMerge %199 None
- OpBranchConditional %196 %200 %201
- %200 = OpLabel
+ %185 = OpAccessChain %_ptr_Uniform_v4float %8 %uint_0 %uint_1
+ %x_e52 = OpLoad %v4float %185 None
+ %188 = OpCompositeExtract %float %x_e52 0
+ %189 = OpFOrdEqual %bool %188 %float_2
+ OpSelectionMerge %192 None
+ OpBranchConditional %189 %193 %194
+ %193 = OpLabel
%x_e59 = OpLoad %v3float %a_Normal1 None
- %203 = OpAccessChain %_ptr_Uniform_Mat4x2__tint_explicit_layout %8 %uint_0 %uint_0 %uint_0
- %205 = OpLoad %Mat4x2__tint_explicit_layout %203 None
- %x_e64 = OpFunctionCall %Mat4x2_ %tint_convert_explicit_layout_0 %205
+ %196 = OpAccessChain %_ptr_Uniform_Mat4x2_ %8 %uint_0 %uint_0 %uint_0
+ %x_e64 = OpLoad %Mat4x2_ %196 None
%x_e65 = OpLoad %v3float %a_Normal1 None
- %209 = OpCompositeConstruct %v4float %x_e65 %float_1
- %x_e68 = OpFunctionCall %v2float %Mul2 %x_e64 %209
- %211 = OpVectorShuffle %v2float %x_e68 %x_e68 0 1
- OpStore %v_TexCoord %211 None
- OpBranch %199
- %201 = OpLabel
+ %200 = OpCompositeConstruct %v4float %x_e65 %float_1
+ %x_e68 = OpFunctionCall %v2float %Mul2 %x_e64 %200
+ %202 = OpVectorShuffle %v2float %x_e68 %x_e68 0 1
+ OpStore %v_TexCoord %202 None
+ OpBranch %192
+ %194 = OpLabel
%x_e73 = OpLoad %v2float %a_UV1 None
- %213 = OpAccessChain %_ptr_Uniform_Mat4x2__tint_explicit_layout %8 %uint_0 %uint_0 %uint_0
- %214 = OpLoad %Mat4x2__tint_explicit_layout %213 None
- %x_e79 = OpFunctionCall %Mat4x2_ %tint_convert_explicit_layout_0 %214
+ %204 = OpAccessChain %_ptr_Uniform_Mat4x2_ %8 %uint_0 %uint_0 %uint_0
+ %x_e79 = OpLoad %Mat4x2_ %204 None
%x_e80 = OpLoad %v2float %a_UV1 None
- %217 = OpCompositeConstruct %v4float %x_e80 %float_1 %float_1
- %x_e84 = OpFunctionCall %v2float %Mul2 %x_e79 %217
- %219 = OpVectorShuffle %v2float %x_e84 %x_e84 0 1
- OpStore %v_TexCoord %219 None
- OpBranch %199
- %199 = OpLabel
+ %207 = OpCompositeConstruct %v4float %x_e80 %float_1 %float_1
+ %x_e84 = OpFunctionCall %v2float %Mul2 %x_e79 %207
+ %209 = OpVectorShuffle %v2float %x_e84 %x_e84 0 1
+ OpStore %v_TexCoord %209 None
+ OpBranch %192
+ %192 = OpLabel
OpReturn
OpFunctionEnd
- %main_inner = OpFunction %VertexOutput None %227
+ %main_inner = OpFunction %VertexOutput None %217
%a_Position = OpFunctionParameter %v3float
%a_UV = OpFunctionParameter %v2float
%a_Color = OpFunctionParameter %v4float
%a_Normal = OpFunctionParameter %v3float
%a_PosMtxIdx = OpFunctionParameter %float
- %228 = OpLabel
+ %218 = OpLabel
OpStore %a_Position1 %a_Position None
OpStore %a_UV1 %a_UV None
OpStore %a_Color1 %a_Color None
OpStore %a_Normal1 %a_Normal None
OpStore %a_PosMtxIdx1 %a_PosMtxIdx None
- %229 = OpFunctionCall %void %main1
+ %219 = OpFunctionCall %void %main1
%x_e11_0 = OpLoad %v4float %v_Color None
%x_e13_0 = OpLoad %v2float %v_TexCoord None
%x_e15_1 = OpLoad %v4float %gl_Position None
- %233 = OpCompositeConstruct %VertexOutput %x_e11_0 %x_e13_0 %x_e15_1
- OpReturnValue %233
+ %223 = OpCompositeConstruct %VertexOutput %x_e11_0 %x_e13_0 %x_e15_1
+ OpReturnValue %223
OpFunctionEnd
-%tint_f32_to_i32 = OpFunction %int None %235
+%tint_f32_to_i32 = OpFunction %int None %225
%value = OpFunctionParameter %float
- %236 = OpLabel
- %237 = OpConvertFToS %int %value
- %238 = OpFOrdGreaterThanEqual %bool %value %float_n2_14748365e_09
- %240 = OpSelect %int %238 %237 %int_n2147483648
- %242 = OpFOrdLessThanEqual %bool %value %float_2_14748352e_09
- %244 = OpSelect %int %242 %240 %int_2147483647
- OpReturnValue %244
+ %226 = OpLabel
+ %227 = OpConvertFToS %int %value
+ %228 = OpFOrdGreaterThanEqual %bool %value %float_n2_14748365e_09
+ %230 = OpSelect %int %228 %227 %int_n2147483648
+ %232 = OpFOrdLessThanEqual %bool %value %float_2_14748352e_09
+ %234 = OpSelect %int %232 %230 %int_2147483647
+ OpReturnValue %234
OpFunctionEnd
- %main = OpFunction %void None %151
- %247 = OpLabel
- %248 = OpLoad %v3float %main_loc0_Input None
- %249 = OpLoad %v2float %main_loc1_Input None
- %250 = OpLoad %v4float %main_loc2_Input None
- %251 = OpLoad %v3float %main_loc3_Input None
- %252 = OpLoad %float %main_loc4_Input None
- %253 = OpFunctionCall %VertexOutput %main_inner %248 %249 %250 %251 %252
- %254 = OpCompositeExtract %v4float %253 0
- OpStore %main_loc0_Output %254 None
- %255 = OpCompositeExtract %v2float %253 1
- OpStore %main_loc1_Output %255 None
- %256 = OpCompositeExtract %v4float %253 2
- OpStore %main_position_Output %256 None
+ %main = OpFunction %void None %148
+ %237 = OpLabel
+ %238 = OpLoad %v3float %main_loc0_Input None
+ %239 = OpLoad %v2float %main_loc1_Input None
+ %240 = OpLoad %v4float %main_loc2_Input None
+ %241 = OpLoad %v3float %main_loc3_Input None
+ %242 = OpLoad %float %main_loc4_Input None
+ %243 = OpFunctionCall %VertexOutput %main_inner %238 %239 %240 %241 %242
+ %244 = OpCompositeExtract %v4float %243 0
+ OpStore %main_loc0_Output %244 None
+ %245 = OpCompositeExtract %v2float %243 1
+ OpStore %main_loc1_Output %245 None
+ %246 = OpCompositeExtract %v4float %243 2
+ OpStore %main_position_Output %246 None
OpStore %main___point_size_Output %float_1 None
OpReturn
OpFunctionEnd
-%tint_convert_explicit_layout = OpFunction %Mat4x4_ None %258
-%tint_source = OpFunctionParameter %Mat4x4__tint_explicit_layout
- %259 = OpLabel
- %260 = OpCompositeExtract %v4float %tint_source 0
- %261 = OpCompositeExtract %v4float %tint_source 1
- %262 = OpCompositeExtract %v4float %tint_source 2
- %263 = OpCompositeExtract %v4float %tint_source 3
- %264 = OpCompositeConstruct %Mat4x4_ %260 %261 %262 %263
- OpReturnValue %264
- OpFunctionEnd
-%tint_convert_explicit_layout_0 = OpFunction %Mat4x2_ None %266
-%tint_source_0 = OpFunctionParameter %Mat4x2__tint_explicit_layout
- %267 = OpLabel
- %268 = OpCompositeExtract %v4float %tint_source_0 0
- %269 = OpCompositeExtract %v4float %tint_source_0 1
- %270 = OpCompositeConstruct %Mat4x2_ %268 %269
- OpReturnValue %270
- OpFunctionEnd
-%tint_convert_explicit_layout_1 = OpFunction %Mat4x3_ None %272
-%tint_source_1 = OpFunctionParameter %Mat4x3__tint_explicit_layout
- %273 = OpLabel
- %274 = OpCompositeExtract %v4float %tint_source_1 0
- %275 = OpCompositeExtract %v4float %tint_source_1 1
- %276 = OpCompositeExtract %v4float %tint_source_1 2
- %277 = OpCompositeConstruct %Mat4x3_ %274 %275 %276
- OpReturnValue %277
- OpFunctionEnd
diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.spvasm b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.spvasm
index 3242700..a3a7127 100644
--- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.spvasm
+++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.spvasm
@@ -1,10 +1,10 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 41
+; Bound: 33
; Schema: 0
OpCapability Shader
- %30 = OpExtInstImport "GLSL.std.450"
+ %29 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
@@ -12,25 +12,21 @@
OpName %Uniforms "Uniforms"
OpMemberName %uniforms_block 0 "inner"
OpName %uniforms_block "uniforms_block"
- OpMemberName %InnerS_tint_explicit_layout 0 "v"
- OpName %InnerS_tint_explicit_layout "InnerS_tint_explicit_layout"
+ OpMemberName %InnerS 0 "v"
+ OpName %InnerS "InnerS"
OpMemberName %OuterS_tint_explicit_layout 0 "a1"
OpName %OuterS_tint_explicit_layout "OuterS_tint_explicit_layout"
OpName %s1 "s1"
OpName %main "main"
- OpMemberName %InnerS 0 "v"
- OpName %InnerS "InnerS"
OpName %v "v"
- OpName %tint_convert_explicit_layout "tint_convert_explicit_layout"
- OpName %tint_source "tint_source"
OpMemberDecorate %Uniforms 0 Offset 0
OpMemberDecorate %uniforms_block 0 Offset 0
OpDecorate %uniforms_block Block
OpDecorate %1 DescriptorSet 1
OpDecorate %1 Binding 4
OpDecorate %1 NonWritable
- OpMemberDecorate %InnerS_tint_explicit_layout 0 Offset 0
- OpDecorate %_runtimearr_InnerS_tint_explicit_layout ArrayStride 4
+ OpMemberDecorate %InnerS 0 Offset 0
+ OpDecorate %_runtimearr_InnerS ArrayStride 4
OpMemberDecorate %OuterS_tint_explicit_layout 0 Offset 0
OpDecorate %OuterS_tint_explicit_layout Block
OpDecorate %s1 DescriptorSet 0
@@ -42,41 +38,31 @@
%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block
%1 = OpVariable %_ptr_Uniform_uniforms_block Uniform
%int = OpTypeInt 32 1
-%InnerS_tint_explicit_layout = OpTypeStruct %int
-%_runtimearr_InnerS_tint_explicit_layout = OpTypeRuntimeArray %InnerS_tint_explicit_layout
-%OuterS_tint_explicit_layout = OpTypeStruct %_runtimearr_InnerS_tint_explicit_layout
+ %InnerS = OpTypeStruct %int
+%_runtimearr_InnerS = OpTypeRuntimeArray %InnerS
+%OuterS_tint_explicit_layout = OpTypeStruct %_runtimearr_InnerS
%_ptr_StorageBuffer_OuterS_tint_explicit_layout = OpTypePointer StorageBuffer %OuterS_tint_explicit_layout
%s1 = OpVariable %_ptr_StorageBuffer_OuterS_tint_explicit_layout StorageBuffer
%void = OpTypeVoid
%14 = OpTypeFunction %void
- %InnerS = OpTypeStruct %int
%_ptr_Function_InnerS = OpTypePointer Function %InnerS
- %19 = OpConstantNull %InnerS
+ %18 = OpConstantNull %InnerS
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
%uint_0 = OpConstant %uint 0
-%_ptr_StorageBuffer__runtimearr_InnerS_tint_explicit_layout = OpTypePointer StorageBuffer %_runtimearr_InnerS_tint_explicit_layout
+%_ptr_StorageBuffer__runtimearr_InnerS = OpTypePointer StorageBuffer %_runtimearr_InnerS
%uint_1 = OpConstant %uint 1
-%_ptr_StorageBuffer_InnerS_tint_explicit_layout = OpTypePointer StorageBuffer %InnerS_tint_explicit_layout
- %37 = OpTypeFunction %InnerS_tint_explicit_layout %InnerS
+%_ptr_StorageBuffer_InnerS = OpTypePointer StorageBuffer %InnerS
%main = OpFunction %void None %14
%15 = OpLabel
- %v = OpVariable %_ptr_Function_InnerS Function %19
- %20 = OpAccessChain %_ptr_Uniform_uint %1 %uint_0 %uint_0
- %23 = OpLoad %uint %20 None
- %24 = OpAccessChain %_ptr_StorageBuffer__runtimearr_InnerS_tint_explicit_layout %s1 %uint_0
- %26 = OpArrayLength %uint %s1 0
- %27 = OpISub %uint %26 %uint_1
- %29 = OpExtInst %uint %30 UMin %23 %27
- %31 = OpAccessChain %_ptr_StorageBuffer_InnerS_tint_explicit_layout %s1 %uint_0 %29
- %33 = OpLoad %InnerS %v None
- %34 = OpFunctionCall %InnerS_tint_explicit_layout %tint_convert_explicit_layout %33
- OpStore %31 %34 None
+ %v = OpVariable %_ptr_Function_InnerS Function %18
+ %19 = OpAccessChain %_ptr_Uniform_uint %1 %uint_0 %uint_0
+ %22 = OpLoad %uint %19 None
+ %23 = OpAccessChain %_ptr_StorageBuffer__runtimearr_InnerS %s1 %uint_0
+ %25 = OpArrayLength %uint %s1 0
+ %26 = OpISub %uint %25 %uint_1
+ %28 = OpExtInst %uint %29 UMin %22 %26
+ %30 = OpAccessChain %_ptr_StorageBuffer_InnerS %s1 %uint_0 %28
+ %32 = OpLoad %InnerS %v None
+ OpStore %30 %32 None
OpReturn
OpFunctionEnd
-%tint_convert_explicit_layout = OpFunction %InnerS_tint_explicit_layout None %37
-%tint_source = OpFunctionParameter %InnerS
- %38 = OpLabel
- %39 = OpCompositeExtract %int %tint_source 0
- %40 = OpCompositeConstruct %InnerS_tint_explicit_layout %39
- OpReturnValue %40
- OpFunctionEnd
diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.spvasm b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.spvasm
index 0eb1b02..3e1c464 100644
--- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.spvasm
+++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.spvasm
@@ -1,10 +1,10 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 48
+; Bound: 40
; Schema: 0
OpCapability Shader
- %35 = OpExtInstImport "GLSL.std.450"
+ %34 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
@@ -13,19 +13,15 @@
OpName %Uniforms "Uniforms"
OpMemberName %uniforms_block 0 "inner"
OpName %uniforms_block "uniforms_block"
- OpMemberName %InnerS_tint_explicit_layout 0 "v"
- OpName %InnerS_tint_explicit_layout "InnerS_tint_explicit_layout"
+ OpMemberName %InnerS 0 "v"
+ OpName %InnerS "InnerS"
OpMemberName %S1_tint_explicit_layout 0 "a2"
OpName %S1_tint_explicit_layout "S1_tint_explicit_layout"
OpMemberName %OuterS_tint_explicit_layout 0 "a1"
OpName %OuterS_tint_explicit_layout "OuterS_tint_explicit_layout"
OpName %s "s"
OpName %main "main"
- OpMemberName %InnerS 0 "v"
- OpName %InnerS "InnerS"
OpName %v "v"
- OpName %tint_convert_explicit_layout "tint_convert_explicit_layout"
- OpName %tint_source "tint_source"
OpMemberDecorate %Uniforms 0 Offset 0
OpMemberDecorate %Uniforms 1 Offset 4
OpMemberDecorate %uniforms_block 0 Offset 0
@@ -33,8 +29,8 @@
OpDecorate %1 DescriptorSet 1
OpDecorate %1 Binding 4
OpDecorate %1 NonWritable
- OpMemberDecorate %InnerS_tint_explicit_layout 0 Offset 0
- OpDecorate %_arr_InnerS_tint_explicit_layout_uint_8 ArrayStride 4
+ OpMemberDecorate %InnerS 0 Offset 0
+ OpDecorate %_arr_InnerS_uint_8 ArrayStride 4
OpMemberDecorate %S1_tint_explicit_layout 0 Offset 0
OpDecorate %_runtimearr_S1_tint_explicit_layout ArrayStride 32
OpMemberDecorate %OuterS_tint_explicit_layout 0 Offset 0
@@ -48,48 +44,38 @@
%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block
%1 = OpVariable %_ptr_Uniform_uniforms_block Uniform
%int = OpTypeInt 32 1
-%InnerS_tint_explicit_layout = OpTypeStruct %int
+ %InnerS = OpTypeStruct %int
%uint_8 = OpConstant %uint 8
-%_arr_InnerS_tint_explicit_layout_uint_8 = OpTypeArray %InnerS_tint_explicit_layout %uint_8
-%S1_tint_explicit_layout = OpTypeStruct %_arr_InnerS_tint_explicit_layout_uint_8
+%_arr_InnerS_uint_8 = OpTypeArray %InnerS %uint_8
+%S1_tint_explicit_layout = OpTypeStruct %_arr_InnerS_uint_8
%_runtimearr_S1_tint_explicit_layout = OpTypeRuntimeArray %S1_tint_explicit_layout
%OuterS_tint_explicit_layout = OpTypeStruct %_runtimearr_S1_tint_explicit_layout
%_ptr_StorageBuffer_OuterS_tint_explicit_layout = OpTypePointer StorageBuffer %OuterS_tint_explicit_layout
%s = OpVariable %_ptr_StorageBuffer_OuterS_tint_explicit_layout StorageBuffer
%void = OpTypeVoid
%17 = OpTypeFunction %void
- %InnerS = OpTypeStruct %int
%_ptr_Function_InnerS = OpTypePointer Function %InnerS
- %22 = OpConstantNull %InnerS
+ %21 = OpConstantNull %InnerS
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
%uint_0 = OpConstant %uint 0
%uint_1 = OpConstant %uint 1
%_ptr_StorageBuffer__runtimearr_S1_tint_explicit_layout = OpTypePointer StorageBuffer %_runtimearr_S1_tint_explicit_layout
%uint_7 = OpConstant %uint 7
-%_ptr_StorageBuffer_InnerS_tint_explicit_layout = OpTypePointer StorageBuffer %InnerS_tint_explicit_layout
- %44 = OpTypeFunction %InnerS_tint_explicit_layout %InnerS
+%_ptr_StorageBuffer_InnerS = OpTypePointer StorageBuffer %InnerS
%main = OpFunction %void None %17
%18 = OpLabel
- %v = OpVariable %_ptr_Function_InnerS Function %22
- %23 = OpAccessChain %_ptr_Uniform_uint %1 %uint_0 %uint_0
- %26 = OpLoad %uint %23 None
- %27 = OpAccessChain %_ptr_Uniform_uint %1 %uint_0 %uint_1
- %29 = OpLoad %uint %27 None
- %30 = OpAccessChain %_ptr_StorageBuffer__runtimearr_S1_tint_explicit_layout %s %uint_0
- %32 = OpArrayLength %uint %s 0
- %33 = OpISub %uint %32 %uint_1
- %34 = OpExtInst %uint %35 UMin %26 %33
- %36 = OpExtInst %uint %35 UMin %29 %uint_7
- %38 = OpAccessChain %_ptr_StorageBuffer_InnerS_tint_explicit_layout %s %uint_0 %34 %uint_0 %36
- %40 = OpLoad %InnerS %v None
- %41 = OpFunctionCall %InnerS_tint_explicit_layout %tint_convert_explicit_layout %40
- OpStore %38 %41 None
+ %v = OpVariable %_ptr_Function_InnerS Function %21
+ %22 = OpAccessChain %_ptr_Uniform_uint %1 %uint_0 %uint_0
+ %25 = OpLoad %uint %22 None
+ %26 = OpAccessChain %_ptr_Uniform_uint %1 %uint_0 %uint_1
+ %28 = OpLoad %uint %26 None
+ %29 = OpAccessChain %_ptr_StorageBuffer__runtimearr_S1_tint_explicit_layout %s %uint_0
+ %31 = OpArrayLength %uint %s 0
+ %32 = OpISub %uint %31 %uint_1
+ %33 = OpExtInst %uint %34 UMin %25 %32
+ %35 = OpExtInst %uint %34 UMin %28 %uint_7
+ %37 = OpAccessChain %_ptr_StorageBuffer_InnerS %s %uint_0 %33 %uint_0 %35
+ %39 = OpLoad %InnerS %v None
+ OpStore %37 %39 None
OpReturn
OpFunctionEnd
-%tint_convert_explicit_layout = OpFunction %InnerS_tint_explicit_layout None %44
-%tint_source = OpFunctionParameter %InnerS
- %45 = OpLabel
- %46 = OpCompositeExtract %int %tint_source 0
- %47 = OpCompositeConstruct %InnerS_tint_explicit_layout %46
- OpReturnValue %47
- OpFunctionEnd