diff --git a/src/tint/transform/add_block_attribute.cc b/src/tint/transform/add_block_attribute.cc index 97c531e764..77d8719ff0 100644 --- a/src/tint/transform/add_block_attribute.cc +++ b/src/tint/transform/add_block_attribute.cc @@ -27,19 +27,6 @@ TINT_INSTANTIATE_TYPEINFO(tint::transform::AddBlockAttribute::BlockAttribute); namespace tint::transform { -namespace { - -bool IsUsedAsNonBuffer(const std::unordered_set& uses) { - for (auto use : uses) { - if (!ast::IsHostShareable(use)) { - return true; - } - } - return false; -} - -} // namespace - AddBlockAttribute::AddBlockAttribute() = default; AddBlockAttribute::~AddBlockAttribute() = default; @@ -47,25 +34,6 @@ AddBlockAttribute::~AddBlockAttribute() = default; void AddBlockAttribute::Run(CloneContext& ctx, const DataMap&, DataMap&) const { auto& sem = ctx.src->Sem(); - // Collect the set of structs that are nested in other types. - utils::Hashset nested_structs; - for (auto* ty : ctx.src->Types()) { - Switch( - ty, - [&](const sem::Array* arr) { - if (auto* nested_str = arr->ElemType()->As()) { - nested_structs.Add(nested_str); - } - }, - [&](const sem::Struct* str) { - for (auto* member : str->Members()) { - if (auto* nested_str = member->Type()->As()) { - nested_structs.Add(nested_str); - } - } - }); - } - // A map from a type in the source program to a block-decorated wrapper that contains it in the // destination program. utils::Hashmap wrapper_structs; @@ -80,16 +48,18 @@ void AddBlockAttribute::Run(CloneContext& ctx, const DataMap&, DataMap&) const { auto* ty = var->Type()->UnwrapRef(); auto* str = ty->As(); - bool needs_wrapping = - !str || // Type is not a structure - nested_structs.Contains(str) || // Structure is nested by another type - IsUsedAsNonBuffer(str->AddressSpaceUsage()); // Structure is used as a non-buffer usage + + // Always try to wrap the buffer type into a struct. We can not do so only if it is a struct + // but without a fixed footprint, i.e. contains a runtime-sized array as its member. Note + // that such struct type can be only used as storage buffer variables' type. Also note that + // any buffer struct type that may be nested by another type must have a fixed footprint, + // therefore will be wrapped. + bool needs_wrapping = !str || // Type is not a structure + str->HasFixedFootprint(); // Struct has a fixed footprint if (needs_wrapping) { const char* kMemberName = "inner"; - // This is a non-struct or a struct that is nested somewhere else, so we - // need to wrap it first. auto* wrapper = wrapper_structs.GetOrCreate(ty, [&] { auto* block = ctx.dst->ASTNodes().Create(ctx.dst->ID(), ctx.dst->AllocateNodeID()); diff --git a/src/tint/transform/add_block_attribute.h b/src/tint/transform/add_block_attribute.h index 69dfab5c9b..2bfd63e750 100644 --- a/src/tint/transform/add_block_attribute.h +++ b/src/tint/transform/add_block_attribute.h @@ -22,11 +22,8 @@ namespace tint::transform { -/// AddBlockAttribute is a transform that adds an -/// `@internal(block)` attribute to any structure that is used as the -/// store type of a buffer. If that structure is nested inside another structure -/// or an array, then it is wrapped inside another structure which gets the -/// `@internal(block)` attribute instead. +/// AddBlockAttribute is a transform that wrap the store type of a buffer into a struct if possible, +/// then adds an `@internal(block)` attribute to the wrapper struct. class AddBlockAttribute final : public Castable { public: /// BlockAttribute is an InternalAttribute that is used to decorate a diff --git a/src/tint/transform/add_block_attribute_test.cc b/src/tint/transform/add_block_attribute_test.cc index 7bb5efc3ae..e4519dd097 100644 --- a/src/tint/transform/add_block_attribute_test.cc +++ b/src/tint/transform/add_block_attribute_test.cc @@ -200,6 +200,85 @@ fn main() { EXPECT_EQ(expect, str(got)); } +TEST_F(AddBlockAttributeTest, BasicStruct_Storage_AccessRoot) { + auto* src = R"( +struct S { + f : f32, +}; + +@group(0) @binding(0) +var s : S; + +@fragment +fn main() { + let f = s; +} +)"; + auto* expect = R"( +struct S { + f : f32, +} + +@internal(block) +struct s_block { + inner : S, +} + +@group(0) @binding(0) var s : s_block; + +@fragment +fn main() { + let f = s.inner; +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(AddBlockAttributeTest, BasicStruct_Storage_TwoUsage_AccessRoot) { + auto* src = R"( +struct S { + f : f32, +}; + +@group(0) @binding(0) +var in : S; + +@group(0) @binding(1) +var out : S; + +@compute @workgroup_size(1) +fn main() { + out = in; +} +)"; + auto* expect = R"( +struct S { + f : f32, +} + +@internal(block) +struct in_block { + inner : S, +} + +@group(0) @binding(0) var in : in_block; + +@group(0) @binding(1) var out : in_block; + +@compute @workgroup_size(1) +fn main() { + out.inner = in.inner; +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + TEST_F(AddBlockAttributeTest, BasicStruct_AccessField) { auto* src = R"( struct S { @@ -215,16 +294,20 @@ fn main() { } )"; auto* expect = R"( -@internal(block) struct S { f : f32, } -@group(0) @binding(0) var u : S; +@internal(block) +struct u_block { + inner : S, +} + +@group(0) @binding(0) var u : u_block; @fragment fn main() { - let f = u.f; + let f = u.inner.f; } )"; @@ -280,16 +363,20 @@ fn main() { auto* expect = R"( enable chromium_experimental_push_constant; -@internal(block) struct S { f : f32, } -var u : S; +@internal(block) +struct u_block { + inner : S, +} + +var u : u_block; @fragment fn main() { - let f = u.f; + let f = u.inner.f; } )"; @@ -321,16 +408,20 @@ struct Inner { f : f32, } -@internal(block) struct Outer { i : Inner, } -@group(0) @binding(0) var u : Outer; +@internal(block) +struct u_block { + inner : Outer, +} + +@group(0) @binding(0) var u : u_block; @fragment fn main() { - let f = u.i.f; + let f = u.inner.i.f; } )"; @@ -366,12 +457,16 @@ struct Inner { f : f32, } -@internal(block) struct Outer { i : Inner, } -@group(0) @binding(0) var u0 : Outer; +@internal(block) +struct u0_block { + inner : Outer, +} + +@group(0) @binding(0) var u0 : u0_block; @internal(block) struct u1_block { @@ -382,7 +477,7 @@ struct u1_block { @fragment fn main() { - let f0 = u0.i.f; + let f0 = u0.inner.i.f; let f1 = u1.inner.f; } )"; @@ -474,12 +569,16 @@ struct Inner { f : f32, } -@internal(block) struct S { i : Inner, } -@group(0) @binding(0) var u0 : S; +@internal(block) +struct u0_block { + inner : S, +} + +@group(0) @binding(0) var u0 : u0_block; @internal(block) struct u1_block { @@ -492,7 +591,7 @@ struct u1_block { @fragment fn main() { - let f0 = u0.i.f; + let f0 = u0.inner.i.f; let f1 = u1.inner.f; let f2 = u2.inner.f; } @@ -621,14 +720,18 @@ struct Inner { type MyInner = Inner; -@internal(block) struct Outer { i : MyInner, } type MyOuter = Outer; -@group(0) @binding(0) var u0 : MyOuter; +@internal(block) +struct u0_block { + inner : Outer, +} + +@group(0) @binding(0) var u0 : u0_block; @internal(block) struct u1_block { @@ -639,7 +742,7 @@ struct u1_block { @fragment fn main() { - let f0 = u0.i.f; + let f0 = u0.inner.i.f; let f1 = u1.inner.f; } )"; @@ -678,7 +781,7 @@ struct Inner { auto* expect = R"( @fragment fn main() { - let f0 = u0.i.f; + let f0 = u0.inner.i.f; let f1 = u1.inner.f; } @@ -691,11 +794,15 @@ struct u1_block { type MyInner = Inner; -@group(0) @binding(0) var u0 : MyOuter; +@internal(block) +struct u0_block { + inner : Outer, +} + +@group(0) @binding(0) var u0 : u0_block; type MyOuter = Outer; -@internal(block) struct Outer { i : MyInner, } @@ -810,18 +917,22 @@ fn main() { } )"; auto* expect = R"( -@internal(block) @internal(block) struct S { f : f32, } -@group(0) @binding(0) var u : S; +@internal(block) +struct u_block { + inner : S, +} -@group(0) @binding(1) var s : S; +@group(0) @binding(0) var u : u_block; + +@group(0) @binding(1) var s : u_block; @fragment fn main() { - s = u; + s.inner = u.inner; } )"; @@ -850,5 +961,65 @@ fn main() { EXPECT_EQ(expect, str(got)); } +TEST_F(AddBlockAttributeTest, StorageBufferWithRuntimeArray) { + auto* src = R"( +struct S { + f : f32, +} + +struct SWithArr { + f : f32, + arr : array, +} + +@group(0) @binding(0) +var in_1 : S; + +@group(0) @binding(1) +var in_2 : SWithArr; + +@group(1) @binding(0) +var out : SWithArr; + +@fragment +fn main() { + out.f = in_1.f; + out.arr[0] = in_2.arr[1]; +} +)"; + auto* expect = R"( +struct S { + f : f32, +} + +@internal(block) @internal(block) +struct SWithArr { + f : f32, + arr : array, +} + +@internal(block) +struct in_1_block { + inner : S, +} + +@group(0) @binding(0) var in_1 : in_1_block; + +@group(0) @binding(1) var in_2 : SWithArr; + +@group(1) @binding(0) var out : SWithArr; + +@fragment +fn main() { + out.f = in_1.inner.f; + out.arr[0] = in_2.arr[1]; +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + } // namespace } // namespace tint::transform diff --git a/src/tint/writer/glsl/generator_impl_function_test.cc b/src/tint/writer/glsl/generator_impl_function_test.cc index 56beefc8f8..0cb72ee607 100644 --- a/src/tint/writer/glsl/generator_impl_function_test.cc +++ b/src/tint/writer/glsl/generator_impl_function_test.cc @@ -462,13 +462,17 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_RW_Storage EXPECT_EQ(gen.result(), R"(#version 310 es precision mediump float; -layout(binding = 0, std430) buffer Data_ssbo { +struct Data { int a; float b; +}; + +layout(binding = 0, std430) buffer coord_block_ssbo { + Data inner; } coord; void frag_main() { - float v = coord.b; + float v = coord.inner.b; return; } @@ -506,13 +510,17 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_RO_Storage R"(#version 310 es precision mediump float; -layout(binding = 0, std430) buffer Data_ssbo { +struct Data { int a; float b; +}; + +layout(binding = 0, std430) buffer coord_block_ssbo { + Data inner; } coord; void frag_main() { - float v = coord.b; + float v = coord.inner.b; return; } @@ -547,13 +555,17 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_WO_Storage EXPECT_EQ(gen.result(), R"(#version 310 es precision mediump float; -layout(binding = 0, std430) buffer Data_ssbo { +struct Data { int a; float b; +}; + +layout(binding = 0, std430) buffer coord_block_ssbo { + Data inner; } coord; void frag_main() { - coord.b = 2.0f; + coord.inner.b = 2.0f; return; } @@ -588,13 +600,17 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_StorageBuf EXPECT_EQ(gen.result(), R"(#version 310 es precision mediump float; -layout(binding = 0, std430) buffer Data_ssbo { +struct Data { int a; float b; +}; + +layout(binding = 0, std430) buffer coord_block_ssbo { + Data inner; } coord; void frag_main() { - coord.b = 2.0f; + coord.inner.b = 2.0f; return; } @@ -678,12 +694,16 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_Called_By_EntryPoint_With_ R"(#version 310 es precision mediump float; -layout(binding = 0, std430) buffer S_ssbo { +struct S { float x; +}; + +layout(binding = 0, std430) buffer coord_block_ssbo { + S inner; } coord; float sub_func(float param) { - return coord.x; + return coord.inner.x; } void frag_main() { @@ -895,12 +915,16 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Multiple_EntryPoint_With_Same_Module ASSERT_TRUE(gen.Generate()) << gen.error(); EXPECT_EQ(gen.result(), R"(#version 310 es -layout(binding = 0, std430) buffer Data_ssbo { +struct Data { float d; +}; + +layout(binding = 0, std430) buffer data_block_ssbo { + Data inner; } data; void a() { - float v = data.d; + float v = data.inner.d; return; } @@ -910,7 +934,7 @@ void main() { return; } void b() { - float v = data.d; + float v = data.inner.d; return; } diff --git a/src/tint/writer/glsl/generator_impl_member_accessor_test.cc b/src/tint/writer/glsl/generator_impl_member_accessor_test.cc index a7392cd8aa..a90639049e 100644 --- a/src/tint/writer/glsl/generator_impl_member_accessor_test.cc +++ b/src/tint/writer/glsl/generator_impl_member_accessor_test.cc @@ -179,27 +179,27 @@ TEST_P(GlslGeneratorImplTest_MemberAccessor_StorageBufferLoad, Test) { INSTANTIATE_TEST_SUITE_P(GlslGeneratorImplTest_MemberAccessor, GlslGeneratorImplTest_MemberAccessor_StorageBufferLoad, - testing::Values(TypeCase{ty_u32, "data.b"}, - TypeCase{ty_f32, "data.b"}, - TypeCase{ty_i32, "data.b"}, - TypeCase{ty_vec2, "data.b"}, - TypeCase{ty_vec2, "data.b"}, - TypeCase{ty_vec2, "data.b"}, - TypeCase{ty_vec3, "data.b"}, - TypeCase{ty_vec3, "data.b"}, - TypeCase{ty_vec3, "data.b"}, - TypeCase{ty_vec4, "data.b"}, - TypeCase{ty_vec4, "data.b"}, - TypeCase{ty_vec4, "data.b"}, - TypeCase{ty_mat2x2, "data.b"}, - TypeCase{ty_mat2x3, "data.b"}, - TypeCase{ty_mat2x4, "data.b"}, - TypeCase{ty_mat3x2, "data.b"}, - TypeCase{ty_mat3x3, "data.b"}, - TypeCase{ty_mat3x4, "data.b"}, - TypeCase{ty_mat4x2, "data.b"}, - TypeCase{ty_mat4x3, "data.b"}, - TypeCase{ty_mat4x4, "data.b"})); + testing::Values(TypeCase{ty_u32, "data.inner.b"}, + TypeCase{ty_f32, "data.inner.b"}, + TypeCase{ty_i32, "data.inner.b"}, + TypeCase{ty_vec2, "data.inner.b"}, + TypeCase{ty_vec2, "data.inner.b"}, + TypeCase{ty_vec2, "data.inner.b"}, + TypeCase{ty_vec3, "data.inner.b"}, + TypeCase{ty_vec3, "data.inner.b"}, + TypeCase{ty_vec3, "data.inner.b"}, + TypeCase{ty_vec4, "data.inner.b"}, + TypeCase{ty_vec4, "data.inner.b"}, + TypeCase{ty_vec4, "data.inner.b"}, + TypeCase{ty_mat2x2, "data.inner.b"}, + TypeCase{ty_mat2x3, "data.inner.b"}, + TypeCase{ty_mat2x4, "data.inner.b"}, + TypeCase{ty_mat3x2, "data.inner.b"}, + TypeCase{ty_mat3x3, "data.inner.b"}, + TypeCase{ty_mat3x4, "data.inner.b"}, + TypeCase{ty_mat4x2, "data.inner.b"}, + TypeCase{ty_mat4x3, "data.inner.b"}, + TypeCase{ty_mat4x4, "data.inner.b"})); using GlslGeneratorImplTest_MemberAccessor_StorageBufferStore = GlslGeneratorImplTest_MemberAccessorWithParam; @@ -231,27 +231,27 @@ TEST_P(GlslGeneratorImplTest_MemberAccessor_StorageBufferStore, Test) { INSTANTIATE_TEST_SUITE_P(GlslGeneratorImplTest_MemberAccessor, GlslGeneratorImplTest_MemberAccessor_StorageBufferStore, - testing::Values(TypeCase{ty_u32, "data.b = value"}, - TypeCase{ty_f32, "data.b = value"}, - TypeCase{ty_i32, "data.b = value"}, - TypeCase{ty_vec2, "data.b = value"}, - TypeCase{ty_vec2, "data.b = value"}, - TypeCase{ty_vec2, "data.b = value"}, - TypeCase{ty_vec3, "data.b = value"}, - TypeCase{ty_vec3, "data.b = value"}, - TypeCase{ty_vec3, "data.b = value"}, - TypeCase{ty_vec4, "data.b = value"}, - TypeCase{ty_vec4, "data.b = value"}, - TypeCase{ty_vec4, "data.b = value"}, - TypeCase{ty_mat2x2, "data.b = value"}, - TypeCase{ty_mat2x3, "data.b = value"}, - TypeCase{ty_mat2x4, "data.b = value"}, - TypeCase{ty_mat3x2, "data.b = value"}, - TypeCase{ty_mat3x3, "data.b = value"}, - TypeCase{ty_mat3x4, "data.b = value"}, - TypeCase{ty_mat4x2, "data.b = value"}, - TypeCase{ty_mat4x3, "data.b = value"}, - TypeCase{ty_mat4x4, "data.b = value"})); + testing::Values(TypeCase{ty_u32, "data.inner.b = value"}, + TypeCase{ty_f32, "data.inner.b = value"}, + TypeCase{ty_i32, "data.inner.b = value"}, + TypeCase{ty_vec2, "data.inner.b = value"}, + TypeCase{ty_vec2, "data.inner.b = value"}, + TypeCase{ty_vec2, "data.inner.b = value"}, + TypeCase{ty_vec3, "data.inner.b = value"}, + TypeCase{ty_vec3, "data.inner.b = value"}, + TypeCase{ty_vec3, "data.inner.b = value"}, + TypeCase{ty_vec4, "data.inner.b = value"}, + TypeCase{ty_vec4, "data.inner.b = value"}, + TypeCase{ty_vec4, "data.inner.b = value"}, + TypeCase{ty_mat2x2, "data.inner.b = value"}, + TypeCase{ty_mat2x3, "data.inner.b = value"}, + TypeCase{ty_mat2x4, "data.inner.b = value"}, + TypeCase{ty_mat3x2, "data.inner.b = value"}, + TypeCase{ty_mat3x3, "data.inner.b = value"}, + TypeCase{ty_mat3x4, "data.inner.b = value"}, + TypeCase{ty_mat4x2, "data.inner.b = value"}, + TypeCase{ty_mat4x3, "data.inner.b = value"}, + TypeCase{ty_mat4x4, "data.inner.b = value"})); TEST_F(GlslGeneratorImplTest_MemberAccessor, StorageBuffer_Store_Matrix_Empty) { // struct Data { @@ -277,16 +277,20 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, StorageBuffer_Store_Matrix_Empty) { R"(#version 310 es precision mediump float; -layout(binding = 0, std430) buffer Data_ssbo { +struct Data { int a; uint pad; uint pad_1; uint pad_2; mat2x3 b; +}; + +layout(binding = 0, std430) buffer data_block_ssbo { + Data inner; } data; void tint_symbol() { - data.b = mat2x3(vec3(0.0f), vec3(0.0f)); + data.inner.b = mat2x3(vec3(0.0f), vec3(0.0f)); } void main() { @@ -321,16 +325,20 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, StorageBuffer_Load_Matrix_Single_El R"(#version 310 es precision mediump float; -layout(binding = 0, std430) buffer Data_ssbo { +struct Data { float z; uint pad; uint pad_1; uint pad_2; mat4x3 a; +}; + +layout(binding = 0, std430) buffer data_block_ssbo { + Data inner; } data; void tint_symbol() { - float x = data.a[2][1]; + float x = data.inner.a[2][1]; } void main() { @@ -365,13 +373,17 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, R"(#version 310 es precision mediump float; -layout(binding = 0, std430) buffer Data_ssbo { +struct Data { float z; int a[5]; +}; + +layout(binding = 0, std430) buffer data_block_ssbo { + Data inner; } data; void tint_symbol() { - int x = data.a[2]; + int x = data.inner.a[2]; } void main() { @@ -409,16 +421,20 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, R"(#version 310 es precision mediump float; -layout(binding = 0, std430) buffer Data_ssbo { +struct Data { float z; int a[5]; +}; + +layout(binding = 0, std430) buffer data_block_ssbo { + Data inner; } data; void tint_symbol() { int a = 2; int b = 4; int c = 3; - int x = data.a[((a + b) - c)]; + int x = data.inner.a[((a + b) - c)]; } void main() { @@ -452,13 +468,17 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, StorageBuffer_Store_ToArray) { R"(#version 310 es precision mediump float; -layout(binding = 0, std430) buffer Data_ssbo { +struct Data { float z; int a[5]; +}; + +layout(binding = 0, std430) buffer data_block_ssbo { + Data inner; } data; void tint_symbol() { - data.a[2] = 2; + data.inner.a[2] = 2; } void main() { @@ -508,12 +528,16 @@ struct Inner { uint pad_1; }; -layout(binding = 0, std430) buffer Data_ssbo { +struct Data { Inner c[4]; +}; + +layout(binding = 0, std430) buffer data_block_ssbo { + Data inner; } data; void tint_symbol() { - vec3 x = data.c[2].b; + vec3 x = data.inner.c[2].b; } void main() { @@ -565,12 +589,16 @@ struct Inner { uint pad_1; }; -layout(binding = 0, std430) buffer Data_ssbo { +struct Data { Inner c[4]; +}; + +layout(binding = 0, std430) buffer data_block_ssbo { + Data inner; } data; void tint_symbol() { - vec2 x = data.c[2].b.xy; + vec2 x = data.inner.c[2].b.xy; } void main() { @@ -623,12 +651,16 @@ struct Inner { uint pad_1; }; -layout(binding = 0, std430) buffer Data_ssbo { +struct Data { Inner c[4]; +}; + +layout(binding = 0, std430) buffer data_block_ssbo { + Data inner; } data; void tint_symbol() { - float x = data.c[2].b.g; + float x = data.inner.c[2].b.g; } void main() { @@ -680,12 +712,16 @@ struct Inner { uint pad_1; }; -layout(binding = 0, std430) buffer Data_ssbo { +struct Data { Inner c[4]; +}; + +layout(binding = 0, std430) buffer data_block_ssbo { + Data inner; } data; void tint_symbol() { - float x = data.c[2].b[1]; + float x = data.inner.c[2].b[1]; } void main() { @@ -736,12 +772,16 @@ struct Inner { uint pad_1; }; -layout(binding = 0, std430) buffer Data_ssbo { +struct Data { Inner c[4]; +}; + +layout(binding = 0, std430) buffer data_block_ssbo { + Data inner; } data; void tint_symbol() { - data.c[2].b = vec3(1.0f, 2.0f, 3.0f); + data.inner.c[2].b = vec3(1.0f, 2.0f, 3.0f); } void main() { @@ -793,12 +833,16 @@ struct Inner { uint pad_1; }; -layout(binding = 0, std430) buffer Data_ssbo { +struct Data { Inner c[4]; +}; + +layout(binding = 0, std430) buffer data_block_ssbo { + Data inner; } data; void tint_symbol() { - data.c[2].b.y = 1.0f; + data.inner.c[2].b.y = 1.0f; } void main() { diff --git a/src/tint/writer/spirv/builder_builtin_test.cc b/src/tint/writer/spirv/builder_builtin_test.cc index 3d060b9eb7..efdc43b25c 100644 --- a/src/tint/writer/spirv/builder_builtin_test.cc +++ b/src/tint/writer/spirv/builder_builtin_test.cc @@ -3340,25 +3340,26 @@ TEST_F(BuiltinBuilderTest, Call_AtomicLoad) { ASSERT_EQ(b.functions().size(), 1_u); - auto* expected_types = R"(%4 = OpTypeInt 32 0 -%5 = OpTypeInt 32 1 -%3 = OpTypeStruct %4 %5 + auto* expected_types = R"(%5 = OpTypeInt 32 0 +%6 = OpTypeInt 32 1 +%4 = OpTypeStruct %5 %6 +%3 = OpTypeStruct %4 %2 = OpTypePointer StorageBuffer %3 %1 = OpVariable %2 StorageBuffer -%7 = OpTypeVoid -%6 = OpTypeFunction %7 -%11 = OpConstant %4 1 -%12 = OpConstant %4 0 -%14 = OpTypePointer StorageBuffer %4 -%18 = OpTypePointer StorageBuffer %5 +%8 = OpTypeVoid +%7 = OpTypeFunction %8 +%12 = OpConstant %5 1 +%13 = OpConstant %5 0 +%15 = OpTypePointer StorageBuffer %5 +%19 = OpTypePointer StorageBuffer %6 )"; auto got_types = DumpInstructions(b.types()); EXPECT_EQ(expected_types, got_types); - auto* expected_instructions = R"(%15 = OpAccessChain %14 %1 %12 -%10 = OpAtomicLoad %4 %15 %11 %12 -%19 = OpAccessChain %18 %1 %11 -%16 = OpAtomicLoad %5 %19 %11 %12 + auto* expected_instructions = R"(%16 = OpAccessChain %15 %1 %13 %13 +%11 = OpAtomicLoad %5 %16 %12 %13 +%20 = OpAccessChain %19 %1 %13 %12 +%17 = OpAtomicLoad %6 %20 %12 %13 OpReturn )"; auto got_instructions = DumpInstructions(b.functions()[0].instructions()); @@ -3405,34 +3406,35 @@ TEST_F(BuiltinBuilderTest, Call_AtomicStore) { ASSERT_EQ(b.functions().size(), 1_u); - auto* expected_types = R"(%4 = OpTypeInt 32 0 -%5 = OpTypeInt 32 1 -%3 = OpTypeStruct %4 %5 + auto* expected_types = R"(%5 = OpTypeInt 32 0 +%6 = OpTypeInt 32 1 +%4 = OpTypeStruct %5 %6 +%3 = OpTypeStruct %4 %2 = OpTypePointer StorageBuffer %3 %1 = OpVariable %2 StorageBuffer -%7 = OpTypeVoid -%6 = OpTypeFunction %7 -%10 = OpConstant %4 1 -%12 = OpTypePointer Function %4 -%13 = OpConstantNull %4 -%14 = OpConstant %5 2 -%16 = OpTypePointer Function %5 -%17 = OpConstantNull %5 -%19 = OpConstant %4 0 -%21 = OpTypePointer StorageBuffer %4 -%26 = OpTypePointer StorageBuffer %5 +%8 = OpTypeVoid +%7 = OpTypeFunction %8 +%11 = OpConstant %5 1 +%13 = OpTypePointer Function %5 +%14 = OpConstantNull %5 +%15 = OpConstant %6 2 +%17 = OpTypePointer Function %6 +%18 = OpConstantNull %6 +%20 = OpConstant %5 0 +%22 = OpTypePointer StorageBuffer %5 +%27 = OpTypePointer StorageBuffer %6 )"; auto got_types = DumpInstructions(b.types()); EXPECT_EQ(expected_types, got_types); - auto* expected_instructions = R"(OpStore %11 %10 -OpStore %15 %14 -%22 = OpAccessChain %21 %1 %19 -%23 = OpLoad %4 %11 -OpAtomicStore %22 %10 %19 %23 -%27 = OpAccessChain %26 %1 %10 -%28 = OpLoad %5 %15 -OpAtomicStore %27 %10 %19 %28 + auto* expected_instructions = R"(OpStore %12 %11 +OpStore %16 %15 +%23 = OpAccessChain %22 %1 %20 %20 +%24 = OpLoad %5 %12 +OpAtomicStore %23 %11 %20 %24 +%28 = OpAccessChain %27 %1 %20 %11 +%29 = OpLoad %6 %16 +OpAtomicStore %28 %11 %20 %29 OpReturn )"; auto got_instructions = DumpInstructions(b.functions()[0].instructions()); @@ -3475,28 +3477,29 @@ TEST_P(Builtin_Builder_AtomicRMW_i32, Test) { ASSERT_EQ(b.functions().size(), 1_u); - std::string expected_types = R"(%4 = OpTypeInt 32 1 + std::string expected_types = R"(%5 = OpTypeInt 32 1 +%4 = OpTypeStruct %5 %3 = OpTypeStruct %4 %2 = OpTypePointer StorageBuffer %3 %1 = OpVariable %2 StorageBuffer -%6 = OpTypeVoid -%5 = OpTypeFunction %6 -%9 = OpConstant %4 10 -%11 = OpTypePointer Function %4 -%12 = OpConstantNull %4 -%14 = OpTypeInt 32 0 -%15 = OpConstant %14 1 -%16 = OpConstant %14 0 -%18 = OpTypePointer StorageBuffer %4 +%7 = OpTypeVoid +%6 = OpTypeFunction %7 +%10 = OpConstant %5 10 +%12 = OpTypePointer Function %5 +%13 = OpConstantNull %5 +%15 = OpTypeInt 32 0 +%16 = OpConstant %15 1 +%17 = OpConstant %15 0 +%19 = OpTypePointer StorageBuffer %5 )"; auto got_types = DumpInstructions(b.types()); EXPECT_EQ(expected_types, got_types); - std::string expected_instructions = R"(OpStore %10 %9 -%19 = OpAccessChain %18 %1 %16 -%20 = OpLoad %4 %10 + std::string expected_instructions = R"(OpStore %11 %10 +%20 = OpAccessChain %19 %1 %17 %17 +%21 = OpLoad %5 %11 )"; - expected_instructions += "%13 = " + GetParam().op + " %4 %19 %15 %16 %20\n"; + expected_instructions += "%14 = " + GetParam().op + " %5 %20 %16 %17 %21\n"; expected_instructions += "OpReturn\n"; auto got_instructions = DumpInstructions(b.functions()[0].instructions()); @@ -3547,27 +3550,28 @@ TEST_P(Builtin_Builder_AtomicRMW_u32, Test) { ASSERT_EQ(b.functions().size(), 1_u); - std::string expected_types = R"(%4 = OpTypeInt 32 0 + std::string expected_types = R"(%5 = OpTypeInt 32 0 +%4 = OpTypeStruct %5 %3 = OpTypeStruct %4 %2 = OpTypePointer StorageBuffer %3 %1 = OpVariable %2 StorageBuffer -%6 = OpTypeVoid -%5 = OpTypeFunction %6 -%9 = OpConstant %4 10 -%11 = OpTypePointer Function %4 -%12 = OpConstantNull %4 -%14 = OpConstant %4 1 -%15 = OpConstant %4 0 -%17 = OpTypePointer StorageBuffer %4 +%7 = OpTypeVoid +%6 = OpTypeFunction %7 +%10 = OpConstant %5 10 +%12 = OpTypePointer Function %5 +%13 = OpConstantNull %5 +%15 = OpConstant %5 1 +%16 = OpConstant %5 0 +%18 = OpTypePointer StorageBuffer %5 )"; auto got_types = DumpInstructions(b.types()); EXPECT_EQ(expected_types, got_types); - std::string expected_instructions = R"(OpStore %10 %9 -%18 = OpAccessChain %17 %1 %15 -%19 = OpLoad %4 %10 + std::string expected_instructions = R"(OpStore %11 %10 +%19 = OpAccessChain %18 %1 %16 %16 +%20 = OpLoad %5 %11 )"; - expected_instructions += "%13 = " + GetParam().op + " %4 %18 %14 %15 %19\n"; + expected_instructions += "%14 = " + GetParam().op + " %5 %19 %15 %16 %20\n"; expected_instructions += "OpReturn\n"; auto got_instructions = DumpInstructions(b.functions()[0].instructions()); @@ -3624,35 +3628,36 @@ TEST_F(BuiltinBuilderTest, Call_AtomicExchange) { ASSERT_EQ(b.functions().size(), 1_u); - auto* expected_types = R"(%4 = OpTypeInt 32 0 -%5 = OpTypeInt 32 1 -%3 = OpTypeStruct %4 %5 + auto* expected_types = R"(%5 = OpTypeInt 32 0 +%6 = OpTypeInt 32 1 +%4 = OpTypeStruct %5 %6 +%3 = OpTypeStruct %4 %2 = OpTypePointer StorageBuffer %3 %1 = OpVariable %2 StorageBuffer -%7 = OpTypeVoid -%6 = OpTypeFunction %7 -%10 = OpConstant %4 10 -%12 = OpTypePointer Function %4 -%13 = OpConstantNull %4 -%14 = OpConstant %5 10 -%16 = OpTypePointer Function %5 -%17 = OpConstantNull %5 -%19 = OpConstant %4 1 -%20 = OpConstant %4 0 -%22 = OpTypePointer StorageBuffer %4 -%27 = OpTypePointer StorageBuffer %5 +%8 = OpTypeVoid +%7 = OpTypeFunction %8 +%11 = OpConstant %5 10 +%13 = OpTypePointer Function %5 +%14 = OpConstantNull %5 +%15 = OpConstant %6 10 +%17 = OpTypePointer Function %6 +%18 = OpConstantNull %6 +%20 = OpConstant %5 1 +%21 = OpConstant %5 0 +%23 = OpTypePointer StorageBuffer %5 +%28 = OpTypePointer StorageBuffer %6 )"; auto got_types = DumpInstructions(b.types()); EXPECT_EQ(expected_types, got_types); - auto* expected_instructions = R"(OpStore %11 %10 -OpStore %15 %14 -%23 = OpAccessChain %22 %1 %20 -%24 = OpLoad %4 %11 -%18 = OpAtomicExchange %4 %23 %19 %20 %24 -%28 = OpAccessChain %27 %1 %19 -%29 = OpLoad %5 %15 -%25 = OpAtomicExchange %5 %28 %19 %20 %29 + auto* expected_instructions = R"(OpStore %12 %11 +OpStore %16 %15 +%24 = OpAccessChain %23 %1 %21 %21 +%25 = OpLoad %5 %12 +%19 = OpAtomicExchange %5 %24 %20 %21 %25 +%29 = OpAccessChain %28 %1 %21 %20 +%30 = OpLoad %6 %16 +%26 = OpAtomicExchange %6 %29 %20 %21 %30 OpReturn )"; auto got_instructions = DumpInstructions(b.functions()[0].instructions()); @@ -3697,36 +3702,37 @@ TEST_F(BuiltinBuilderTest, Call_AtomicCompareExchangeWeak) { ASSERT_EQ(b.functions().size(), 1_u); - auto* expected_types = R"(%4 = OpTypeInt 32 0 -%5 = OpTypeInt 32 1 -%3 = OpTypeStruct %4 %5 + auto* expected_types = R"(%5 = OpTypeInt 32 0 +%6 = OpTypeInt 32 1 +%4 = OpTypeStruct %5 %6 +%3 = OpTypeStruct %4 %2 = OpTypePointer StorageBuffer %3 %1 = OpVariable %2 StorageBuffer -%7 = OpTypeVoid -%6 = OpTypeFunction %7 -%12 = OpTypeBool -%11 = OpTypeStruct %4 %12 -%13 = OpConstant %4 1 -%14 = OpConstant %4 0 -%16 = OpTypePointer StorageBuffer %4 -%18 = OpConstant %4 20 -%19 = OpConstant %4 10 -%23 = OpTypeStruct %5 %12 -%25 = OpTypePointer StorageBuffer %5 -%27 = OpConstant %5 20 -%28 = OpConstant %5 10 +%8 = OpTypeVoid +%7 = OpTypeFunction %8 +%13 = OpTypeBool +%12 = OpTypeStruct %5 %13 +%14 = OpConstant %5 1 +%15 = OpConstant %5 0 +%17 = OpTypePointer StorageBuffer %5 +%19 = OpConstant %5 20 +%20 = OpConstant %5 10 +%24 = OpTypeStruct %6 %13 +%26 = OpTypePointer StorageBuffer %6 +%28 = OpConstant %6 20 +%29 = OpConstant %6 10 )"; auto got_types = DumpInstructions(b.types()); EXPECT_EQ(expected_types, got_types); - auto* expected_instructions = R"(%17 = OpAccessChain %16 %1 %14 -%20 = OpAtomicCompareExchange %4 %17 %13 %14 %14 %18 %19 -%21 = OpIEqual %12 %20 %19 -%10 = OpCompositeConstruct %11 %20 %21 -%26 = OpAccessChain %25 %1 %13 -%29 = OpAtomicCompareExchange %5 %26 %13 %14 %14 %27 %28 -%30 = OpIEqual %12 %29 %28 -%22 = OpCompositeConstruct %23 %29 %30 + auto* expected_instructions = R"(%18 = OpAccessChain %17 %1 %15 %15 +%21 = OpAtomicCompareExchange %5 %18 %14 %15 %15 %19 %20 +%22 = OpIEqual %13 %21 %20 +%11 = OpCompositeConstruct %12 %21 %22 +%27 = OpAccessChain %26 %1 %15 %14 +%30 = OpAtomicCompareExchange %6 %27 %14 %15 %15 %28 %29 +%31 = OpIEqual %13 %30 %29 +%23 = OpCompositeConstruct %24 %30 %31 OpReturn )"; auto got_instructions = DumpInstructions(b.functions()[0].instructions()); diff --git a/src/tint/writer/spirv/builder_function_test.cc b/src/tint/writer/spirv/builder_function_test.cc index b28817c859..efaefed18a 100644 --- a/src/tint/writer/spirv/builder_function_test.cc +++ b/src/tint/writer/spirv/builder_function_test.cc @@ -228,46 +228,50 @@ TEST_F(BuilderTest, Emit_Multiple_EntryPoint_With_Same_ModuleVar) { ASSERT_TRUE(b.Build()); EXPECT_EQ(DumpBuilder(b), R"(OpCapability Shader OpMemoryModel Logical GLSL450 -OpEntryPoint GLCompute %7 "a" -OpEntryPoint GLCompute %17 "b" -OpExecutionMode %7 LocalSize 1 1 1 -OpExecutionMode %17 LocalSize 1 1 1 -OpName %3 "Data" -OpMemberName %3 0 "d" +OpEntryPoint GLCompute %8 "a" +OpEntryPoint GLCompute %18 "b" +OpExecutionMode %8 LocalSize 1 1 1 +OpExecutionMode %18 LocalSize 1 1 1 +OpName %3 "data_block" +OpMemberName %3 0 "inner" +OpName %4 "Data" +OpMemberName %4 0 "d" OpName %1 "data" -OpName %7 "a" -OpName %14 "v" -OpName %17 "b" -OpName %21 "v" +OpName %8 "a" +OpName %15 "v" +OpName %18 "b" +OpName %22 "v" OpDecorate %3 Block OpMemberDecorate %3 0 Offset 0 +OpMemberDecorate %4 0 Offset 0 OpDecorate %1 Binding 0 OpDecorate %1 DescriptorSet 0 -%4 = OpTypeFloat 32 +%5 = OpTypeFloat 32 +%4 = OpTypeStruct %5 %3 = OpTypeStruct %4 %2 = OpTypePointer StorageBuffer %3 %1 = OpVariable %2 StorageBuffer -%6 = OpTypeVoid -%5 = OpTypeFunction %6 -%9 = OpTypeInt 32 0 -%10 = OpConstant %9 0 -%11 = OpTypePointer StorageBuffer %4 -%15 = OpTypePointer Function %4 -%16 = OpConstantNull %4 -%7 = OpFunction %6 None %5 -%8 = OpLabel -%14 = OpVariable %15 Function %16 -%12 = OpAccessChain %11 %1 %10 -%13 = OpLoad %4 %12 -OpStore %14 %13 +%7 = OpTypeVoid +%6 = OpTypeFunction %7 +%10 = OpTypeInt 32 0 +%11 = OpConstant %10 0 +%12 = OpTypePointer StorageBuffer %5 +%16 = OpTypePointer Function %5 +%17 = OpConstantNull %5 +%8 = OpFunction %7 None %6 +%9 = OpLabel +%15 = OpVariable %16 Function %17 +%13 = OpAccessChain %12 %1 %11 %11 +%14 = OpLoad %5 %13 +OpStore %15 %14 OpReturn OpFunctionEnd -%17 = OpFunction %6 None %5 -%18 = OpLabel -%21 = OpVariable %15 Function %16 -%19 = OpAccessChain %11 %1 %10 -%20 = OpLoad %4 %19 -OpStore %21 %20 +%18 = OpFunction %7 None %6 +%19 = OpLabel +%22 = OpVariable %16 Function %17 +%20 = OpAccessChain %12 %1 %11 %11 +%21 = OpLoad %5 %20 +OpStore %22 %21 OpReturn OpFunctionEnd )"); diff --git a/src/tint/writer/spirv/builder_global_variable_test.cc b/src/tint/writer/spirv/builder_global_variable_test.cc index 64eac22e7f..7d3ec59c12 100644 --- a/src/tint/writer/spirv/builder_global_variable_test.cc +++ b/src/tint/writer/spirv/builder_global_variable_test.cc @@ -316,23 +316,27 @@ TEST_F(BuilderTest, GlobalVar_DeclReadOnly) { EXPECT_EQ(DumpInstructions(b.annots()), R"(OpDecorate %3 Block OpMemberDecorate %3 0 Offset 0 -OpMemberDecorate %3 1 Offset 4 +OpMemberDecorate %4 0 Offset 0 +OpMemberDecorate %4 1 Offset 4 OpDecorate %1 NonWritable OpDecorate %1 Binding 0 OpDecorate %1 DescriptorSet 0 )"); - EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %3 "A" -OpMemberName %3 0 "a" -OpMemberName %3 1 "b" + EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %3 "b_block" +OpMemberName %3 0 "inner" +OpName %4 "A" +OpMemberName %4 0 "a" +OpMemberName %4 1 "b" OpName %1 "b" -OpName %7 "unused_entry_point" +OpName %8 "unused_entry_point" )"); - EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeInt 32 1 -%3 = OpTypeStruct %4 %4 + EXPECT_EQ(DumpInstructions(b.types()), R"(%5 = OpTypeInt 32 1 +%4 = OpTypeStruct %5 %5 +%3 = OpTypeStruct %4 %2 = OpTypePointer StorageBuffer %3 %1 = OpVariable %2 StorageBuffer -%6 = OpTypeVoid -%5 = OpTypeFunction %6 +%7 = OpTypeVoid +%6 = OpTypeFunction %7 )"); } @@ -354,21 +358,25 @@ TEST_F(BuilderTest, GlobalVar_TypeAliasDeclReadOnly) { EXPECT_EQ(DumpInstructions(b.annots()), R"(OpDecorate %3 Block OpMemberDecorate %3 0 Offset 0 +OpMemberDecorate %4 0 Offset 0 OpDecorate %1 NonWritable OpDecorate %1 Binding 0 OpDecorate %1 DescriptorSet 0 )"); - EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %3 "A" -OpMemberName %3 0 "a" + EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %3 "b_block" +OpMemberName %3 0 "inner" +OpName %4 "A" +OpMemberName %4 0 "a" OpName %1 "b" -OpName %7 "unused_entry_point" +OpName %8 "unused_entry_point" )"); - EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeInt 32 1 + EXPECT_EQ(DumpInstructions(b.types()), R"(%5 = OpTypeInt 32 1 +%4 = OpTypeStruct %5 %3 = OpTypeStruct %4 %2 = OpTypePointer StorageBuffer %3 %1 = OpVariable %2 StorageBuffer -%6 = OpTypeVoid -%5 = OpTypeFunction %6 +%7 = OpTypeVoid +%6 = OpTypeFunction %7 )"); } @@ -390,21 +398,25 @@ TEST_F(BuilderTest, GlobalVar_TypeAliasAssignReadOnly) { EXPECT_EQ(DumpInstructions(b.annots()), R"(OpDecorate %3 Block OpMemberDecorate %3 0 Offset 0 +OpMemberDecorate %4 0 Offset 0 OpDecorate %1 NonWritable OpDecorate %1 Binding 0 OpDecorate %1 DescriptorSet 0 )"); - EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %3 "A" -OpMemberName %3 0 "a" + EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %3 "b_block" +OpMemberName %3 0 "inner" +OpName %4 "A" +OpMemberName %4 0 "a" OpName %1 "b" -OpName %7 "unused_entry_point" +OpName %8 "unused_entry_point" )"); - EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeInt 32 1 + EXPECT_EQ(DumpInstructions(b.types()), R"(%5 = OpTypeInt 32 1 +%4 = OpTypeStruct %5 %3 = OpTypeStruct %4 %2 = OpTypePointer StorageBuffer %3 %1 = OpVariable %2 StorageBuffer -%6 = OpTypeVoid -%5 = OpTypeFunction %6 +%7 = OpTypeVoid +%6 = OpTypeFunction %7 )"); } @@ -428,25 +440,29 @@ TEST_F(BuilderTest, GlobalVar_TwoVarDeclReadOnly) { EXPECT_EQ(DumpInstructions(b.annots()), R"(OpDecorate %3 Block OpMemberDecorate %3 0 Offset 0 +OpMemberDecorate %4 0 Offset 0 OpDecorate %1 NonWritable OpDecorate %1 DescriptorSet 0 OpDecorate %1 Binding 0 -OpDecorate %5 DescriptorSet 1 -OpDecorate %5 Binding 0 +OpDecorate %6 DescriptorSet 1 +OpDecorate %6 Binding 0 )"); - EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %3 "A" -OpMemberName %3 0 "a" + EXPECT_EQ(DumpInstructions(b.debug()), R"(OpName %3 "b_block" +OpMemberName %3 0 "inner" +OpName %4 "A" +OpMemberName %4 0 "a" OpName %1 "b" -OpName %5 "c" -OpName %8 "unused_entry_point" +OpName %6 "c" +OpName %9 "unused_entry_point" )"); - EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeInt 32 1 + EXPECT_EQ(DumpInstructions(b.types()), R"(%5 = OpTypeInt 32 1 +%4 = OpTypeStruct %5 %3 = OpTypeStruct %4 %2 = OpTypePointer StorageBuffer %3 %1 = OpVariable %2 StorageBuffer -%5 = OpVariable %2 StorageBuffer -%7 = OpTypeVoid -%6 = OpTypeFunction %7 +%6 = OpVariable %2 StorageBuffer +%8 = OpTypeVoid +%7 = OpTypeFunction %8 )"); } diff --git a/test/tint/array/assign_to_storage_var.wgsl.expected.glsl b/test/tint/array/assign_to_storage_var.wgsl.expected.glsl index 2535ca8dbd..3d49ee2056 100644 --- a/test/tint/array/assign_to_storage_var.wgsl.expected.glsl +++ b/test/tint/array/assign_to_storage_var.wgsl.expected.glsl @@ -8,6 +8,10 @@ struct S { ivec4 arr[4]; }; +struct S_nested { + int arr[4][3][2]; +}; + ivec4 src_private[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); shared ivec4 src_workgroup[4]; layout(binding = 0, std140) uniform src_uniform_block_ubo { @@ -22,8 +26,8 @@ layout(binding = 2, std430) buffer src_uniform_block_ssbo_1 { S inner; } dst; -layout(binding = 3, std430) buffer S_nested_ssbo { - int arr[4][3][2]; +layout(binding = 3, std430) buffer dst_nested_block_ssbo { + S_nested inner; } dst_nested; ivec4[4] ret_arr() { @@ -53,6 +57,6 @@ void foo(ivec4 src_param[4]) { dst.inner.arr = src_uniform.inner.arr; dst.inner.arr = src_storage.inner.arr; int src_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0))); - dst_nested.arr = src_nested; + dst_nested.inner.arr = src_nested; } diff --git a/test/tint/array/assign_to_storage_var.wgsl.expected.spvasm b/test/tint/array/assign_to_storage_var.wgsl.expected.spvasm index df207265a8..83ed0dd821 100644 --- a/test/tint/array/assign_to_storage_var.wgsl.expected.spvasm +++ b/test/tint/array/assign_to_storage_var.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 79 +; Bound: 80 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -16,6 +16,8 @@ OpName %src_uniform "src_uniform" OpName %src_storage "src_storage" OpName %dst "dst" + OpName %dst_nested_block "dst_nested_block" + OpMemberName %dst_nested_block 0 "inner" OpName %S_nested "S_nested" OpMemberName %S_nested 0 "arr" OpName %dst_nested "dst_nested" @@ -37,7 +39,8 @@ OpDecorate %src_storage Binding 1 OpDecorate %dst DescriptorSet 0 OpDecorate %dst Binding 2 - OpDecorate %S_nested Block + OpDecorate %dst_nested_block Block + OpMemberDecorate %dst_nested_block 0 Offset 0 OpMemberDecorate %S_nested 0 Offset 0 OpDecorate %_arr_int_uint_2 ArrayStride 4 OpDecorate %_arr__arr_int_uint_2_uint_3 ArrayStride 8 @@ -67,77 +70,78 @@ %_arr__arr_int_uint_2_uint_3 = OpTypeArray %_arr_int_uint_2 %uint_3 %_arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypeArray %_arr__arr_int_uint_2_uint_3 %uint_4 %S_nested = OpTypeStruct %_arr__arr__arr_int_uint_2_uint_3_uint_4 -%_ptr_StorageBuffer_S_nested = OpTypePointer StorageBuffer %S_nested - %dst_nested = OpVariable %_ptr_StorageBuffer_S_nested StorageBuffer +%dst_nested_block = OpTypeStruct %S_nested +%_ptr_StorageBuffer_dst_nested_block = OpTypePointer StorageBuffer %dst_nested_block + %dst_nested = OpVariable %_ptr_StorageBuffer_dst_nested_block StorageBuffer %void = OpTypeVoid - %26 = OpTypeFunction %void - %30 = OpTypeFunction %_arr_v4int_uint_4 - %33 = OpTypeFunction %S - %36 = OpConstantNull %S - %37 = OpTypeFunction %void %_arr_v4int_uint_4 + %27 = OpTypeFunction %void + %31 = OpTypeFunction %_arr_v4int_uint_4 + %34 = OpTypeFunction %S + %37 = OpConstantNull %S + %38 = OpTypeFunction %void %_arr_v4int_uint_4 %_ptr_Function__arr_v4int_uint_4 = OpTypePointer Function %_arr_v4int_uint_4 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer__arr_v4int_uint_4 = OpTypePointer StorageBuffer %_arr_v4int_uint_4 %int_1 = OpConstant %int 1 - %47 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 + %48 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 %int_2 = OpConstant %int 2 - %49 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 + %50 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 %int_3 = OpConstant %int 3 - %51 = OpConstantComposite %v4int %int_3 %int_3 %int_3 %int_3 - %52 = OpConstantComposite %_arr_v4int_uint_4 %47 %49 %51 %51 + %52 = OpConstantComposite %v4int %int_3 %int_3 %int_3 %int_3 + %53 = OpConstantComposite %_arr_v4int_uint_4 %48 %50 %52 %52 %_ptr_Uniform__arr_v4int_uint_4 = OpTypePointer Uniform %_arr_v4int_uint_4 %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer Function %_arr__arr__arr_int_uint_2_uint_3_uint_4 - %75 = OpConstantNull %_arr__arr__arr_int_uint_2_uint_3_uint_4 + %76 = OpConstantNull %_arr__arr__arr_int_uint_2_uint_3_uint_4 %_ptr_StorageBuffer__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer StorageBuffer %_arr__arr__arr_int_uint_2_uint_3_uint_4 -%unused_entry_point = OpFunction %void None %26 - %29 = OpLabel +%unused_entry_point = OpFunction %void None %27 + %30 = OpLabel OpReturn OpFunctionEnd - %ret_arr = OpFunction %_arr_v4int_uint_4 None %30 - %32 = OpLabel + %ret_arr = OpFunction %_arr_v4int_uint_4 None %31 + %33 = OpLabel OpReturnValue %8 OpFunctionEnd -%ret_struct_arr = OpFunction %S None %33 - %35 = OpLabel - OpReturnValue %36 +%ret_struct_arr = OpFunction %S None %34 + %36 = OpLabel + OpReturnValue %37 OpFunctionEnd - %foo = OpFunction %void None %37 + %foo = OpFunction %void None %38 %src_param = OpFunctionParameter %_arr_v4int_uint_4 - %40 = OpLabel + %41 = OpLabel %src_function = OpVariable %_ptr_Function__arr_v4int_uint_4 Function %8 - %src_nested = OpVariable %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 Function %75 - %45 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0 - OpStore %45 %52 - %53 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0 - OpStore %53 %src_param - %54 = OpFunctionCall %_arr_v4int_uint_4 %ret_arr - %55 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0 - OpStore %55 %54 + %src_nested = OpVariable %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 Function %76 + %46 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0 + OpStore %46 %53 + %54 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0 + OpStore %54 %src_param + %55 = OpFunctionCall %_arr_v4int_uint_4 %ret_arr %56 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0 - OpStore %56 %8 + OpStore %56 %55 %57 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0 - %58 = OpLoad %_arr_v4int_uint_4 %src_function - OpStore %57 %58 - %59 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0 - %60 = OpLoad %_arr_v4int_uint_4 %src_private - OpStore %59 %60 - %61 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0 - %62 = OpLoad %_arr_v4int_uint_4 %src_workgroup - OpStore %61 %62 - %63 = OpFunctionCall %S %ret_struct_arr - %64 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0 - %65 = OpCompositeExtract %_arr_v4int_uint_4 %63 0 - OpStore %64 %65 - %66 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0 - %68 = OpAccessChain %_ptr_Uniform__arr_v4int_uint_4 %src_uniform %uint_0 %uint_0 - %69 = OpLoad %_arr_v4int_uint_4 %68 - OpStore %66 %69 - %70 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0 - %71 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %src_storage %uint_0 %uint_0 - %72 = OpLoad %_arr_v4int_uint_4 %71 - OpStore %70 %72 - %77 = OpAccessChain %_ptr_StorageBuffer__arr__arr__arr_int_uint_2_uint_3_uint_4 %dst_nested %uint_0 - %78 = OpLoad %_arr__arr__arr_int_uint_2_uint_3_uint_4 %src_nested - OpStore %77 %78 + OpStore %57 %8 + %58 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0 + %59 = OpLoad %_arr_v4int_uint_4 %src_function + OpStore %58 %59 + %60 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0 + %61 = OpLoad %_arr_v4int_uint_4 %src_private + OpStore %60 %61 + %62 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0 + %63 = OpLoad %_arr_v4int_uint_4 %src_workgroup + OpStore %62 %63 + %64 = OpFunctionCall %S %ret_struct_arr + %65 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0 + %66 = OpCompositeExtract %_arr_v4int_uint_4 %64 0 + OpStore %65 %66 + %67 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0 + %69 = OpAccessChain %_ptr_Uniform__arr_v4int_uint_4 %src_uniform %uint_0 %uint_0 + %70 = OpLoad %_arr_v4int_uint_4 %69 + OpStore %67 %70 + %71 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0 + %72 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %src_storage %uint_0 %uint_0 + %73 = OpLoad %_arr_v4int_uint_4 %72 + OpStore %71 %73 + %78 = OpAccessChain %_ptr_StorageBuffer__arr__arr__arr_int_uint_2_uint_3_uint_4 %dst_nested %uint_0 %uint_0 + %79 = OpLoad %_arr__arr__arr_int_uint_2_uint_3_uint_4 %src_nested + OpStore %78 %79 OpReturn OpFunctionEnd diff --git a/test/tint/array/strides.spvasm.expected.glsl b/test/tint/array/strides.spvasm.expected.glsl index 290bcb49d6..840544a074 100644 --- a/test/tint/array/strides.spvasm.expected.glsl +++ b/test/tint/array/strides.spvasm.expected.glsl @@ -29,18 +29,22 @@ struct strided_arr_1 { uint pad_20; }; -layout(binding = 0, std430) buffer S_ssbo { +struct S { strided_arr_1 a[4]; +}; + +layout(binding = 0, std430) buffer s_block_ssbo { + S inner; } s; void f_1() { - strided_arr_1 x_19[4] = s.a; - strided_arr x_24[3][2] = s.a[3].el; - strided_arr x_28[2] = s.a[3].el[2]; - float x_32 = s.a[3].el[2][1].el; + strided_arr_1 x_19[4] = s.inner.a; + strided_arr x_24[3][2] = s.inner.a[3].el; + strided_arr x_28[2] = s.inner.a[3].el[2]; + float x_32 = s.inner.a[3].el[2][1].el; strided_arr_1 tint_symbol[4] = strided_arr_1[4](strided_arr_1(strided_arr[3][2](strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u)), strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u)), strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u))), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), strided_arr_1(strided_arr[3][2](strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u)), strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u)), strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u))), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), strided_arr_1(strided_arr[3][2](strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u)), strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u)), strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u))), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u), strided_arr_1(strided_arr[3][2](strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u)), strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u)), strided_arr[2](strided_arr(0.0f, 0u), strided_arr(0.0f, 0u))), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u)); - s.a = tint_symbol; - s.a[3].el[2][1].el = 5.0f; + s.inner.a = tint_symbol; + s.inner.a[3].el[2][1].el = 5.0f; return; } diff --git a/test/tint/array/strides.spvasm.expected.spvasm b/test/tint/array/strides.spvasm.expected.spvasm index 3108b19428..ddc27770c1 100644 --- a/test/tint/array/strides.spvasm.expected.spvasm +++ b/test/tint/array/strides.spvasm.expected.spvasm @@ -1,12 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 42 +; Bound: 43 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %f "f" OpExecutionMode %f LocalSize 1 1 1 + OpName %s_block "s_block" + OpMemberName %s_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %strided_arr_1 "strided_arr_1" @@ -16,7 +18,8 @@ OpName %s "s" OpName %f_1 "f_1" OpName %f "f" - OpDecorate %S Block + OpDecorate %s_block Block + OpMemberDecorate %s_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpMemberDecorate %strided_arr_1 0 Offset 0 OpMemberDecorate %strided_arr 0 Offset 0 @@ -36,10 +39,11 @@ %uint_4 = OpConstant %uint 4 %_arr_strided_arr_1_uint_4 = OpTypeArray %strided_arr_1 %uint_4 %S = OpTypeStruct %_arr_strided_arr_1_uint_4 -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %s = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %s_block = OpTypeStruct %S +%_ptr_StorageBuffer_s_block = OpTypePointer StorageBuffer %s_block + %s = OpVariable %_ptr_StorageBuffer_s_block StorageBuffer %void = OpTypeVoid - %14 = OpTypeFunction %void + %15 = OpTypeFunction %void %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer__arr_strided_arr_1_uint_4 = OpTypePointer StorageBuffer %_arr_strided_arr_1_uint_4 %int = OpTypeInt 32 1 @@ -49,26 +53,26 @@ %_ptr_StorageBuffer__arr_strided_arr_uint_2 = OpTypePointer StorageBuffer %_arr_strided_arr_uint_2 %int_1 = OpConstant %int 1 %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float - %36 = OpConstantNull %_arr_strided_arr_1_uint_4 + %37 = OpConstantNull %_arr_strided_arr_1_uint_4 %float_5 = OpConstant %float 5 - %f_1 = OpFunction %void None %14 - %17 = OpLabel - %20 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_1_uint_4 %s %uint_0 - %21 = OpLoad %_arr_strided_arr_1_uint_4 %20 - %25 = OpAccessChain %_ptr_StorageBuffer__arr__arr_strided_arr_uint_2_uint_3 %s %uint_0 %int_3 %uint_0 - %26 = OpLoad %_arr__arr_strided_arr_uint_2_uint_3 %25 - %29 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_uint_2 %s %uint_0 %int_3 %uint_0 %int_2 - %30 = OpLoad %_arr_strided_arr_uint_2 %29 - %33 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %int_3 %uint_0 %int_2 %int_1 %uint_0 - %34 = OpLoad %float %33 - %35 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_1_uint_4 %s %uint_0 - OpStore %35 %36 - %37 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %int_3 %uint_0 %int_2 %int_1 %uint_0 - OpStore %37 %float_5 + %f_1 = OpFunction %void None %15 + %18 = OpLabel + %21 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_1_uint_4 %s %uint_0 %uint_0 + %22 = OpLoad %_arr_strided_arr_1_uint_4 %21 + %26 = OpAccessChain %_ptr_StorageBuffer__arr__arr_strided_arr_uint_2_uint_3 %s %uint_0 %uint_0 %int_3 %uint_0 + %27 = OpLoad %_arr__arr_strided_arr_uint_2_uint_3 %26 + %30 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_uint_2 %s %uint_0 %uint_0 %int_3 %uint_0 %int_2 + %31 = OpLoad %_arr_strided_arr_uint_2 %30 + %34 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %uint_0 %int_3 %uint_0 %int_2 %int_1 %uint_0 + %35 = OpLoad %float %34 + %36 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_1_uint_4 %s %uint_0 %uint_0 + OpStore %36 %37 + %38 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %uint_0 %int_3 %uint_0 %int_2 %int_1 %uint_0 + OpStore %38 %float_5 OpReturn OpFunctionEnd - %f = OpFunction %void None %14 - %40 = OpLabel - %41 = OpFunctionCall %void %f_1 + %f = OpFunction %void None %15 + %41 = OpLabel + %42 = OpFunctionCall %void %f_1 OpReturn OpFunctionEnd diff --git a/test/tint/buffer/storage/static_index/read.wgsl.expected.glsl b/test/tint/buffer/storage/static_index/read.wgsl.expected.glsl index dac902ac38..d2e4eddbfb 100644 --- a/test/tint/buffer/storage/static_index/read.wgsl.expected.glsl +++ b/test/tint/buffer/storage/static_index/read.wgsl.expected.glsl @@ -4,7 +4,7 @@ struct Inner { int x; }; -layout(binding = 0, std430) buffer S_ssbo { +struct S { ivec3 a; int b; uvec3 c; @@ -16,19 +16,23 @@ layout(binding = 0, std430) buffer S_ssbo { Inner i; Inner j[4]; uint pad; +}; + +layout(binding = 0, std430) buffer s_block_ssbo { + S inner; } s; void tint_symbol() { - ivec3 a = s.a; - int b = s.b; - uvec3 c = s.c; - uint d = s.d; - vec3 e = s.e; - float f = s.f; - mat2x3 g = s.g; - mat3x2 h = s.h; - Inner i = s.i; - Inner j[4] = s.j; + ivec3 a = s.inner.a; + int b = s.inner.b; + uvec3 c = s.inner.c; + uint d = s.inner.d; + vec3 e = s.inner.e; + float f = s.inner.f; + mat2x3 g = s.inner.g; + mat3x2 h = s.inner.h; + Inner i = s.inner.i; + Inner j[4] = s.inner.j; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/buffer/storage/static_index/read.wgsl.expected.spvasm b/test/tint/buffer/storage/static_index/read.wgsl.expected.spvasm index 42262ef339..e301a46f87 100644 --- a/test/tint/buffer/storage/static_index/read.wgsl.expected.spvasm +++ b/test/tint/buffer/storage/static_index/read.wgsl.expected.spvasm @@ -1,12 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 59 +; Bound: 60 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %s_block "s_block" + OpMemberName %s_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpMemberName %S 1 "b" @@ -22,7 +24,8 @@ OpMemberName %S 9 "j" OpName %s "s" OpName %main "main" - OpDecorate %S Block + OpDecorate %s_block Block + OpMemberDecorate %s_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpMemberDecorate %S 1 Offset 12 OpMemberDecorate %S 2 Offset 16 @@ -55,10 +58,11 @@ %uint_4 = OpConstant %uint 4 %_arr_Inner_uint_4 = OpTypeArray %Inner %uint_4 %S = OpTypeStruct %v3int %int %v3uint %uint %v3float %float %mat2v3float %mat3v2float %Inner %_arr_Inner_uint_4 -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %s = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %s_block = OpTypeStruct %S +%_ptr_StorageBuffer_s_block = OpTypePointer StorageBuffer %s_block + %s = OpVariable %_ptr_StorageBuffer_s_block StorageBuffer %void = OpTypeVoid - %16 = OpTypeFunction %void + %17 = OpTypeFunction %void %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v3int = OpTypePointer StorageBuffer %v3int %uint_1 = OpConstant %uint 1 @@ -78,27 +82,27 @@ %_ptr_StorageBuffer_Inner = OpTypePointer StorageBuffer %Inner %uint_9 = OpConstant %uint 9 %_ptr_StorageBuffer__arr_Inner_uint_4 = OpTypePointer StorageBuffer %_arr_Inner_uint_4 - %main = OpFunction %void None %16 - %19 = OpLabel - %22 = OpAccessChain %_ptr_StorageBuffer_v3int %s %uint_0 - %23 = OpLoad %v3int %22 - %26 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_1 - %27 = OpLoad %int %26 - %30 = OpAccessChain %_ptr_StorageBuffer_v3uint %s %uint_2 - %31 = OpLoad %v3uint %30 - %34 = OpAccessChain %_ptr_StorageBuffer_uint %s %uint_3 - %35 = OpLoad %uint %34 - %37 = OpAccessChain %_ptr_StorageBuffer_v3float %s %uint_4 - %38 = OpLoad %v3float %37 - %41 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_5 - %42 = OpLoad %float %41 - %45 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %s %uint_6 - %46 = OpLoad %mat2v3float %45 - %49 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %s %uint_7 - %50 = OpLoad %mat3v2float %49 - %53 = OpAccessChain %_ptr_StorageBuffer_Inner %s %uint_8 - %54 = OpLoad %Inner %53 - %57 = OpAccessChain %_ptr_StorageBuffer__arr_Inner_uint_4 %s %uint_9 - %58 = OpLoad %_arr_Inner_uint_4 %57 + %main = OpFunction %void None %17 + %20 = OpLabel + %23 = OpAccessChain %_ptr_StorageBuffer_v3int %s %uint_0 %uint_0 + %24 = OpLoad %v3int %23 + %27 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %uint_1 + %28 = OpLoad %int %27 + %31 = OpAccessChain %_ptr_StorageBuffer_v3uint %s %uint_0 %uint_2 + %32 = OpLoad %v3uint %31 + %35 = OpAccessChain %_ptr_StorageBuffer_uint %s %uint_0 %uint_3 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_StorageBuffer_v3float %s %uint_0 %uint_4 + %39 = OpLoad %v3float %38 + %42 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %uint_5 + %43 = OpLoad %float %42 + %46 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %s %uint_0 %uint_6 + %47 = OpLoad %mat2v3float %46 + %50 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %s %uint_0 %uint_7 + %51 = OpLoad %mat3v2float %50 + %54 = OpAccessChain %_ptr_StorageBuffer_Inner %s %uint_0 %uint_8 + %55 = OpLoad %Inner %54 + %58 = OpAccessChain %_ptr_StorageBuffer__arr_Inner_uint_4 %s %uint_0 %uint_9 + %59 = OpLoad %_arr_Inner_uint_4 %58 OpReturn OpFunctionEnd diff --git a/test/tint/buffer/storage/static_index/write.wgsl.expected.glsl b/test/tint/buffer/storage/static_index/write.wgsl.expected.glsl index 610d6dabb3..d6b3a38fcf 100644 --- a/test/tint/buffer/storage/static_index/write.wgsl.expected.glsl +++ b/test/tint/buffer/storage/static_index/write.wgsl.expected.glsl @@ -4,7 +4,7 @@ struct Inner { int x; }; -layout(binding = 0, std430) buffer S_ssbo { +struct S { ivec3 a; int b; uvec3 c; @@ -16,21 +16,25 @@ layout(binding = 0, std430) buffer S_ssbo { Inner i; Inner j[4]; uint pad; +}; + +layout(binding = 0, std430) buffer s_block_ssbo { + S inner; } s; void tint_symbol() { - s.a = ivec3(0); - s.b = 0; - s.c = uvec3(0u); - s.d = 0u; - s.e = vec3(0.0f); - s.f = 0.0f; - s.g = mat2x3(vec3(0.0f), vec3(0.0f)); - s.h = mat3x2(vec2(0.0f), vec2(0.0f), vec2(0.0f)); + s.inner.a = ivec3(0); + s.inner.b = 0; + s.inner.c = uvec3(0u); + s.inner.d = 0u; + s.inner.e = vec3(0.0f); + s.inner.f = 0.0f; + s.inner.g = mat2x3(vec3(0.0f), vec3(0.0f)); + s.inner.h = mat3x2(vec2(0.0f), vec2(0.0f), vec2(0.0f)); Inner tint_symbol_1 = Inner(0); - s.i = tint_symbol_1; + s.inner.i = tint_symbol_1; Inner tint_symbol_2[4] = Inner[4](Inner(0), Inner(0), Inner(0), Inner(0)); - s.j = tint_symbol_2; + s.inner.j = tint_symbol_2; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/buffer/storage/static_index/write.wgsl.expected.spvasm b/test/tint/buffer/storage/static_index/write.wgsl.expected.spvasm index 5f06f4ef83..aae7630dfd 100644 --- a/test/tint/buffer/storage/static_index/write.wgsl.expected.spvasm +++ b/test/tint/buffer/storage/static_index/write.wgsl.expected.spvasm @@ -1,12 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 59 +; Bound: 60 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %s_block "s_block" + OpMemberName %s_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpMemberName %S 1 "b" @@ -22,7 +24,8 @@ OpMemberName %S 9 "j" OpName %s "s" OpName %main "main" - OpDecorate %S Block + OpDecorate %s_block Block + OpMemberDecorate %s_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpMemberDecorate %S 1 Offset 12 OpMemberDecorate %S 2 Offset 16 @@ -54,60 +57,61 @@ %uint_4 = OpConstant %uint 4 %_arr_Inner_uint_4 = OpTypeArray %Inner %uint_4 %S = OpTypeStruct %v3int %int %v3uint %uint %v3float %float %mat2v3float %mat3v2float %Inner %_arr_Inner_uint_4 -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %s = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %s_block = OpTypeStruct %S +%_ptr_StorageBuffer_s_block = OpTypePointer StorageBuffer %s_block + %s = OpVariable %_ptr_StorageBuffer_s_block StorageBuffer %void = OpTypeVoid - %16 = OpTypeFunction %void + %17 = OpTypeFunction %void %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v3int = OpTypePointer StorageBuffer %v3int - %23 = OpConstantNull %v3int + %24 = OpConstantNull %v3int %uint_1 = OpConstant %uint 1 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int - %27 = OpConstantNull %int + %28 = OpConstantNull %int %uint_2 = OpConstant %uint 2 %_ptr_StorageBuffer_v3uint = OpTypePointer StorageBuffer %v3uint - %31 = OpConstantNull %v3uint + %32 = OpConstantNull %v3uint %uint_3 = OpConstant %uint 3 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint - %35 = OpConstantNull %uint + %36 = OpConstantNull %uint %_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float - %38 = OpConstantNull %v3float + %39 = OpConstantNull %v3float %uint_5 = OpConstant %uint 5 %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float - %42 = OpConstantNull %float + %43 = OpConstantNull %float %uint_6 = OpConstant %uint 6 %_ptr_StorageBuffer_mat2v3float = OpTypePointer StorageBuffer %mat2v3float - %46 = OpConstantNull %mat2v3float + %47 = OpConstantNull %mat2v3float %uint_7 = OpConstant %uint 7 %_ptr_StorageBuffer_mat3v2float = OpTypePointer StorageBuffer %mat3v2float - %50 = OpConstantNull %mat3v2float + %51 = OpConstantNull %mat3v2float %uint_8 = OpConstant %uint 8 %_ptr_StorageBuffer_Inner = OpTypePointer StorageBuffer %Inner - %54 = OpConstantNull %Inner + %55 = OpConstantNull %Inner %uint_9 = OpConstant %uint 9 %_ptr_StorageBuffer__arr_Inner_uint_4 = OpTypePointer StorageBuffer %_arr_Inner_uint_4 - %58 = OpConstantNull %_arr_Inner_uint_4 - %main = OpFunction %void None %16 - %19 = OpLabel - %22 = OpAccessChain %_ptr_StorageBuffer_v3int %s %uint_0 - OpStore %22 %23 - %26 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_1 - OpStore %26 %27 - %30 = OpAccessChain %_ptr_StorageBuffer_v3uint %s %uint_2 - OpStore %30 %31 - %34 = OpAccessChain %_ptr_StorageBuffer_uint %s %uint_3 - OpStore %34 %35 - %37 = OpAccessChain %_ptr_StorageBuffer_v3float %s %uint_4 - OpStore %37 %38 - %41 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_5 - OpStore %41 %42 - %45 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %s %uint_6 - OpStore %45 %46 - %49 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %s %uint_7 - OpStore %49 %50 - %53 = OpAccessChain %_ptr_StorageBuffer_Inner %s %uint_8 - OpStore %53 %54 - %57 = OpAccessChain %_ptr_StorageBuffer__arr_Inner_uint_4 %s %uint_9 - OpStore %57 %58 + %59 = OpConstantNull %_arr_Inner_uint_4 + %main = OpFunction %void None %17 + %20 = OpLabel + %23 = OpAccessChain %_ptr_StorageBuffer_v3int %s %uint_0 %uint_0 + OpStore %23 %24 + %27 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %uint_1 + OpStore %27 %28 + %31 = OpAccessChain %_ptr_StorageBuffer_v3uint %s %uint_0 %uint_2 + OpStore %31 %32 + %35 = OpAccessChain %_ptr_StorageBuffer_uint %s %uint_0 %uint_3 + OpStore %35 %36 + %38 = OpAccessChain %_ptr_StorageBuffer_v3float %s %uint_0 %uint_4 + OpStore %38 %39 + %42 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %uint_5 + OpStore %42 %43 + %46 = OpAccessChain %_ptr_StorageBuffer_mat2v3float %s %uint_0 %uint_6 + OpStore %46 %47 + %50 = OpAccessChain %_ptr_StorageBuffer_mat3v2float %s %uint_0 %uint_7 + OpStore %50 %51 + %54 = OpAccessChain %_ptr_StorageBuffer_Inner %s %uint_0 %uint_8 + OpStore %54 %55 + %58 = OpAccessChain %_ptr_StorageBuffer__arr_Inner_uint_4 %s %uint_0 %uint_9 + OpStore %58 %59 OpReturn OpFunctionEnd diff --git a/test/tint/buffer/storage/types/struct.wgsl.expected.glsl b/test/tint/buffer/storage/types/struct.wgsl.expected.glsl index 0cf63c60ae..7323321e64 100644 --- a/test/tint/buffer/storage/types/struct.wgsl.expected.glsl +++ b/test/tint/buffer/storage/types/struct.wgsl.expected.glsl @@ -1,21 +1,23 @@ -SKIP: FAILED - #version 310 es struct Inner { float f; }; -layout(binding = 0, std430) buffer S_ssbo { +struct S { Inner inner; +}; + +layout(binding = 0, std430) buffer tint_symbol_block_ssbo { + S inner; } tint_symbol; -layout(binding = 1, std430) buffer S_ssbo_1 { - Inner inner; +layout(binding = 1, std430) buffer tint_symbol_block_ssbo_1 { + S inner; } tint_symbol_1; void tint_symbol_2() { - tint_symbol_1 = tint_symbol; + tint_symbol_1.inner = tint_symbol.inner; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; @@ -23,10 +25,3 @@ void main() { tint_symbol_2(); return; } -Error parsing GLSL shader: -ERROR: 0:16: 'assign' : cannot convert from 'layout( binding=0 column_major std430) buffer block{layout( column_major std430 offset=0) buffer structure{ global highp float f} inner}' to 'layout( binding=1 column_major std430) buffer block{layout( column_major std430 offset=0) buffer structure{ global highp float f} inner}' -ERROR: 0:16: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/tint/buffer/storage/types/struct.wgsl.expected.spvasm b/test/tint/buffer/storage/types/struct.wgsl.expected.spvasm index 058a3e5427..1453f073e8 100644 --- a/test/tint/buffer/storage/types/struct.wgsl.expected.spvasm +++ b/test/tint/buffer/storage/types/struct.wgsl.expected.spvasm @@ -1,12 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 12 +; Bound: 18 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %in_block "in_block" + OpMemberName %in_block 0 "inner" OpName %S "S" OpMemberName %S 0 "inner" OpName %Inner "Inner" @@ -14,7 +16,8 @@ OpName %in "in" OpName %out "out" OpName %main "main" - OpDecorate %S Block + OpDecorate %in_block Block + OpMemberDecorate %in_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpMemberDecorate %Inner 0 Offset 0 OpDecorate %in NonWritable @@ -25,14 +28,20 @@ %float = OpTypeFloat 32 %Inner = OpTypeStruct %float %S = OpTypeStruct %Inner -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %in = OpVariable %_ptr_StorageBuffer_S StorageBuffer - %out = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %in_block = OpTypeStruct %S +%_ptr_StorageBuffer_in_block = OpTypePointer StorageBuffer %in_block + %in = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer + %out = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer %void = OpTypeVoid - %7 = OpTypeFunction %void - %main = OpFunction %void None %7 - %10 = OpLabel - %11 = OpLoad %S %in - OpStore %out %11 + %8 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %main = OpFunction %void None %8 + %11 = OpLabel + %15 = OpAccessChain %_ptr_StorageBuffer_S %out %uint_0 + %16 = OpAccessChain %_ptr_StorageBuffer_S %in %uint_0 + %17 = OpLoad %S %16 + OpStore %15 %17 OpReturn OpFunctionEnd diff --git a/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.glsl b/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.glsl index b992d245f1..7c900f4aec 100644 --- a/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.glsl @@ -34,27 +34,35 @@ struct Inner_std140 { ivec4 k[4]; }; -layout(binding = 0, std140) uniform S_std140_ubo { +struct S { + Inner arr[8]; +}; + +struct S_std140 { Inner_std140 arr[8]; +}; + +layout(binding = 0, std140) uniform s_block_std140_ubo { + S_std140 inner; } s; -mat3x2 load_s_arr_p0_j(uint p0) { +mat3x2 load_s_inner_arr_p0_j(uint p0) { uint s_save = p0; - return mat3x2(s.arr[s_save].j_0, s.arr[s_save].j_1, s.arr[s_save].j_2); + return mat3x2(s.inner.arr[s_save].j_0, s.inner.arr[s_save].j_1, s.inner.arr[s_save].j_2); } void tint_symbol(uint idx) { - ivec3 a = s.arr[idx].a; - int b = s.arr[idx].b; - uvec3 c = s.arr[idx].c; - uint d = s.arr[idx].d; - vec3 e = s.arr[idx].e; - float f = s.arr[idx].f; - ivec2 g = s.arr[idx].g; - ivec2 h = s.arr[idx].h; - mat2x3 i = s.arr[idx].i; - mat3x2 j = load_s_arr_p0_j(uint(idx)); - ivec4 k[4] = s.arr[idx].k; + ivec3 a = s.inner.arr[idx].a; + int b = s.inner.arr[idx].b; + uvec3 c = s.inner.arr[idx].c; + uint d = s.inner.arr[idx].d; + vec3 e = s.inner.arr[idx].e; + float f = s.inner.arr[idx].f; + ivec2 g = s.inner.arr[idx].g; + ivec2 h = s.inner.arr[idx].h; + mat2x3 i = s.inner.arr[idx].i; + mat3x2 j = load_s_inner_arr_p0_j(uint(idx)); + ivec4 k[4] = s.inner.arr[idx].k; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.spvasm b/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.spvasm index d2f0b8e109..e8c067c101 100644 --- a/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.spvasm +++ b/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.spvasm @@ -1,13 +1,15 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 92 +; Bound: 93 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" %idx_1 OpExecutionMode %main LocalSize 1 1 1 OpName %idx_1 "idx_1" + OpName %s_block_std140 "s_block_std140" + OpMemberName %s_block_std140 0 "inner" OpName %S_std140 "S_std140" OpMemberName %S_std140 0 "arr" OpName %Inner_std140 "Inner_std140" @@ -25,13 +27,14 @@ OpMemberName %Inner_std140 11 "j_2" OpMemberName %Inner_std140 12 "k" OpName %s "s" - OpName %load_s_arr_p0_j "load_s_arr_p0_j" + OpName %load_s_inner_arr_p0_j "load_s_inner_arr_p0_j" OpName %p0 "p0" OpName %main_inner "main_inner" OpName %idx "idx" OpName %main "main" OpDecorate %idx_1 BuiltIn LocalInvocationIndex - OpDecorate %S_std140 Block + OpDecorate %s_block_std140 Block + OpMemberDecorate %s_block_std140 0 Offset 0 OpMemberDecorate %S_std140 0 Offset 0 OpMemberDecorate %Inner_std140 0 Offset 0 OpMemberDecorate %Inner_std140 1 Offset 12 @@ -71,10 +74,11 @@ %uint_8 = OpConstant %uint 8 %_arr_Inner_std140_uint_8 = OpTypeArray %Inner_std140 %uint_8 %S_std140 = OpTypeStruct %_arr_Inner_std140_uint_8 -%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140 - %s = OpVariable %_ptr_Uniform_S_std140 Uniform +%s_block_std140 = OpTypeStruct %S_std140 +%_ptr_Uniform_s_block_std140 = OpTypePointer Uniform %s_block_std140 + %s = OpVariable %_ptr_Uniform_s_block_std140 Uniform %mat3v2float = OpTypeMatrix %v2float 3 - %21 = OpTypeFunction %mat3v2float %uint + %22 = OpTypeFunction %mat3v2float %uint %uint_0 = OpConstant %uint 0 %_ptr_Uniform_Inner_std140 = OpTypePointer Uniform %Inner_std140 %uint_9 = OpConstant %uint 9 @@ -82,7 +86,7 @@ %uint_10 = OpConstant %uint 10 %uint_11 = OpConstant %uint 11 %void = OpTypeVoid - %44 = OpTypeFunction %void %uint + %45 = OpTypeFunction %void %uint %_ptr_Uniform_v3int = OpTypePointer Uniform %v3int %uint_1 = OpConstant %uint 1 %_ptr_Uniform_int = OpTypePointer Uniform %int @@ -99,49 +103,49 @@ %_ptr_Uniform_mat2v3float = OpTypePointer Uniform %mat2v3float %uint_12 = OpConstant %uint 12 %_ptr_Uniform__arr_v4int_uint_4 = OpTypePointer Uniform %_arr_v4int_uint_4 - %87 = OpTypeFunction %void -%load_s_arr_p0_j = OpFunction %mat3v2float None %21 + %88 = OpTypeFunction %void +%load_s_inner_arr_p0_j = OpFunction %mat3v2float None %22 %p0 = OpFunctionParameter %uint - %25 = OpLabel - %29 = OpAccessChain %_ptr_Uniform_Inner_std140 %s %uint_0 %p0 - %33 = OpAccessChain %_ptr_Uniform_v2float %29 %uint_9 - %34 = OpLoad %v2float %33 - %37 = OpAccessChain %_ptr_Uniform_v2float %29 %uint_10 - %38 = OpLoad %v2float %37 - %41 = OpAccessChain %_ptr_Uniform_v2float %29 %uint_11 - %42 = OpLoad %v2float %41 - %43 = OpCompositeConstruct %mat3v2float %34 %38 %42 - OpReturnValue %43 + %26 = OpLabel + %30 = OpAccessChain %_ptr_Uniform_Inner_std140 %s %uint_0 %uint_0 %p0 + %34 = OpAccessChain %_ptr_Uniform_v2float %30 %uint_9 + %35 = OpLoad %v2float %34 + %38 = OpAccessChain %_ptr_Uniform_v2float %30 %uint_10 + %39 = OpLoad %v2float %38 + %42 = OpAccessChain %_ptr_Uniform_v2float %30 %uint_11 + %43 = OpLoad %v2float %42 + %44 = OpCompositeConstruct %mat3v2float %35 %39 %43 + OpReturnValue %44 OpFunctionEnd - %main_inner = OpFunction %void None %44 + %main_inner = OpFunction %void None %45 %idx = OpFunctionParameter %uint - %48 = OpLabel - %50 = OpAccessChain %_ptr_Uniform_v3int %s %uint_0 %idx %uint_0 - %51 = OpLoad %v3int %50 - %54 = OpAccessChain %_ptr_Uniform_int %s %uint_0 %idx %uint_1 - %55 = OpLoad %int %54 - %58 = OpAccessChain %_ptr_Uniform_v3uint %s %uint_0 %idx %uint_2 - %59 = OpLoad %v3uint %58 - %62 = OpAccessChain %_ptr_Uniform_uint %s %uint_0 %idx %uint_3 - %63 = OpLoad %uint %62 - %65 = OpAccessChain %_ptr_Uniform_v3float %s %uint_0 %idx %uint_4 - %66 = OpLoad %v3float %65 - %69 = OpAccessChain %_ptr_Uniform_float %s %uint_0 %idx %uint_5 - %70 = OpLoad %float %69 - %73 = OpAccessChain %_ptr_Uniform_v2int %s %uint_0 %idx %uint_6 - %74 = OpLoad %v2int %73 - %76 = OpAccessChain %_ptr_Uniform_v2int %s %uint_0 %idx %uint_7 - %77 = OpLoad %v2int %76 - %79 = OpAccessChain %_ptr_Uniform_mat2v3float %s %uint_0 %idx %uint_8 - %80 = OpLoad %mat2v3float %79 - %81 = OpFunctionCall %mat3v2float %load_s_arr_p0_j %idx - %85 = OpAccessChain %_ptr_Uniform__arr_v4int_uint_4 %s %uint_0 %idx %uint_12 - %86 = OpLoad %_arr_v4int_uint_4 %85 + %49 = OpLabel + %51 = OpAccessChain %_ptr_Uniform_v3int %s %uint_0 %uint_0 %idx %uint_0 + %52 = OpLoad %v3int %51 + %55 = OpAccessChain %_ptr_Uniform_int %s %uint_0 %uint_0 %idx %uint_1 + %56 = OpLoad %int %55 + %59 = OpAccessChain %_ptr_Uniform_v3uint %s %uint_0 %uint_0 %idx %uint_2 + %60 = OpLoad %v3uint %59 + %63 = OpAccessChain %_ptr_Uniform_uint %s %uint_0 %uint_0 %idx %uint_3 + %64 = OpLoad %uint %63 + %66 = OpAccessChain %_ptr_Uniform_v3float %s %uint_0 %uint_0 %idx %uint_4 + %67 = OpLoad %v3float %66 + %70 = OpAccessChain %_ptr_Uniform_float %s %uint_0 %uint_0 %idx %uint_5 + %71 = OpLoad %float %70 + %74 = OpAccessChain %_ptr_Uniform_v2int %s %uint_0 %uint_0 %idx %uint_6 + %75 = OpLoad %v2int %74 + %77 = OpAccessChain %_ptr_Uniform_v2int %s %uint_0 %uint_0 %idx %uint_7 + %78 = OpLoad %v2int %77 + %80 = OpAccessChain %_ptr_Uniform_mat2v3float %s %uint_0 %uint_0 %idx %uint_8 + %81 = OpLoad %mat2v3float %80 + %82 = OpFunctionCall %mat3v2float %load_s_inner_arr_p0_j %idx + %86 = OpAccessChain %_ptr_Uniform__arr_v4int_uint_4 %s %uint_0 %uint_0 %idx %uint_12 + %87 = OpLoad %_arr_v4int_uint_4 %86 OpReturn OpFunctionEnd - %main = OpFunction %void None %87 - %89 = OpLabel - %91 = OpLoad %uint %idx_1 - %90 = OpFunctionCall %void %main_inner %91 + %main = OpFunction %void None %88 + %90 = OpLabel + %92 = OpLoad %uint %idx_1 + %91 = OpFunctionCall %void %main_inner %92 OpReturn OpFunctionEnd diff --git a/test/tint/buffer/uniform/static_index/read.wgsl.expected.glsl b/test/tint/buffer/uniform/static_index/read.wgsl.expected.glsl index 233bbf45c6..3315e42565 100644 --- a/test/tint/buffer/uniform/static_index/read.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/static_index/read.wgsl.expected.glsl @@ -7,7 +7,24 @@ struct Inner { uint pad_2; }; -layout(binding = 0, std140) uniform S_std140_ubo { +struct S { + ivec3 a; + int b; + uvec3 c; + uint d; + vec3 e; + float f; + ivec2 g; + ivec2 h; + mat2x3 i; + mat3x2 j; + uint pad_3; + uint pad_4; + Inner k; + Inner l[4]; +}; + +struct S_std140 { ivec3 a; int b; uvec3 c; @@ -24,25 +41,29 @@ layout(binding = 0, std140) uniform S_std140_ubo { uint pad_4; Inner k; Inner l[4]; +}; + +layout(binding = 0, std140) uniform s_block_std140_ubo { + S_std140 inner; } s; -mat3x2 load_s_j() { - return mat3x2(s.j_0, s.j_1, s.j_2); +mat3x2 load_s_inner_j() { + return mat3x2(s.inner.j_0, s.inner.j_1, s.inner.j_2); } void tint_symbol() { - ivec3 a = s.a; - int b = s.b; - uvec3 c = s.c; - uint d = s.d; - vec3 e = s.e; - float f = s.f; - ivec2 g = s.g; - ivec2 h = s.h; - mat2x3 i = s.i; - mat3x2 j = load_s_j(); - Inner k = s.k; - Inner l[4] = s.l; + ivec3 a = s.inner.a; + int b = s.inner.b; + uvec3 c = s.inner.c; + uint d = s.inner.d; + vec3 e = s.inner.e; + float f = s.inner.f; + ivec2 g = s.inner.g; + ivec2 h = s.inner.h; + mat2x3 i = s.inner.i; + mat3x2 j = load_s_inner_j(); + Inner k = s.inner.k; + Inner l[4] = s.inner.l; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/buffer/uniform/static_index/read.wgsl.expected.spvasm b/test/tint/buffer/uniform/static_index/read.wgsl.expected.spvasm index b93631f3d1..11b5abb816 100644 --- a/test/tint/buffer/uniform/static_index/read.wgsl.expected.spvasm +++ b/test/tint/buffer/uniform/static_index/read.wgsl.expected.spvasm @@ -1,12 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 82 +; Bound: 85 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %s_block_std140 "s_block_std140" + OpMemberName %s_block_std140 0 "inner" OpName %S_std140 "S_std140" OpMemberName %S_std140 0 "a" OpMemberName %S_std140 1 "b" @@ -25,9 +27,10 @@ OpMemberName %Inner 0 "x" OpMemberName %S_std140 13 "l" OpName %s "s" - OpName %load_s_j "load_s_j" + OpName %load_s_inner_j "load_s_inner_j" OpName %main "main" - OpDecorate %S_std140 Block + OpDecorate %s_block_std140 Block + OpMemberDecorate %s_block_std140 0 Offset 0 OpMemberDecorate %S_std140 0 Offset 0 OpMemberDecorate %S_std140 1 Offset 12 OpMemberDecorate %S_std140 2 Offset 16 @@ -62,17 +65,19 @@ %uint_4 = OpConstant %uint 4 %_arr_Inner_uint_4 = OpTypeArray %Inner %uint_4 %S_std140 = OpTypeStruct %v3int %int %v3uint %uint %v3float %float %v2int %v2int %mat2v3float %v2float %v2float %v2float %Inner %_arr_Inner_uint_4 -%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140 - %s = OpVariable %_ptr_Uniform_S_std140 Uniform +%s_block_std140 = OpTypeStruct %S_std140 +%_ptr_Uniform_s_block_std140 = OpTypePointer Uniform %s_block_std140 + %s = OpVariable %_ptr_Uniform_s_block_std140 Uniform %mat3v2float = OpTypeMatrix %v2float 3 - %16 = OpTypeFunction %mat3v2float + %17 = OpTypeFunction %mat3v2float + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140 %uint_9 = OpConstant %uint 9 %_ptr_Uniform_v2float = OpTypePointer Uniform %v2float %uint_10 = OpConstant %uint 10 %uint_11 = OpConstant %uint 11 %void = OpTypeVoid - %35 = OpTypeFunction %void - %uint_0 = OpConstant %uint 0 + %39 = OpTypeFunction %void %_ptr_Uniform_v3int = OpTypePointer Uniform %v3int %uint_1 = OpConstant %uint 1 %_ptr_Uniform_int = OpTypePointer Uniform %int @@ -92,41 +97,42 @@ %_ptr_Uniform_Inner = OpTypePointer Uniform %Inner %uint_13 = OpConstant %uint 13 %_ptr_Uniform__arr_Inner_uint_4 = OpTypePointer Uniform %_arr_Inner_uint_4 - %load_s_j = OpFunction %mat3v2float None %16 - %19 = OpLabel - %24 = OpAccessChain %_ptr_Uniform_v2float %s %uint_9 - %25 = OpLoad %v2float %24 - %28 = OpAccessChain %_ptr_Uniform_v2float %s %uint_10 +%load_s_inner_j = OpFunction %mat3v2float None %17 + %20 = OpLabel + %24 = OpAccessChain %_ptr_Uniform_S_std140 %s %uint_0 + %28 = OpAccessChain %_ptr_Uniform_v2float %24 %uint_9 %29 = OpLoad %v2float %28 - %32 = OpAccessChain %_ptr_Uniform_v2float %s %uint_11 + %32 = OpAccessChain %_ptr_Uniform_v2float %24 %uint_10 %33 = OpLoad %v2float %32 - %34 = OpCompositeConstruct %mat3v2float %25 %29 %33 - OpReturnValue %34 + %36 = OpAccessChain %_ptr_Uniform_v2float %24 %uint_11 + %37 = OpLoad %v2float %36 + %38 = OpCompositeConstruct %mat3v2float %29 %33 %37 + OpReturnValue %38 OpFunctionEnd - %main = OpFunction %void None %35 - %38 = OpLabel - %41 = OpAccessChain %_ptr_Uniform_v3int %s %uint_0 - %42 = OpLoad %v3int %41 - %45 = OpAccessChain %_ptr_Uniform_int %s %uint_1 - %46 = OpLoad %int %45 - %49 = OpAccessChain %_ptr_Uniform_v3uint %s %uint_2 - %50 = OpLoad %v3uint %49 - %53 = OpAccessChain %_ptr_Uniform_uint %s %uint_3 - %54 = OpLoad %uint %53 - %56 = OpAccessChain %_ptr_Uniform_v3float %s %uint_4 - %57 = OpLoad %v3float %56 - %60 = OpAccessChain %_ptr_Uniform_float %s %uint_5 - %61 = OpLoad %float %60 - %64 = OpAccessChain %_ptr_Uniform_v2int %s %uint_6 - %65 = OpLoad %v2int %64 - %67 = OpAccessChain %_ptr_Uniform_v2int %s %uint_7 + %main = OpFunction %void None %39 + %42 = OpLabel + %44 = OpAccessChain %_ptr_Uniform_v3int %s %uint_0 %uint_0 + %45 = OpLoad %v3int %44 + %48 = OpAccessChain %_ptr_Uniform_int %s %uint_0 %uint_1 + %49 = OpLoad %int %48 + %52 = OpAccessChain %_ptr_Uniform_v3uint %s %uint_0 %uint_2 + %53 = OpLoad %v3uint %52 + %56 = OpAccessChain %_ptr_Uniform_uint %s %uint_0 %uint_3 + %57 = OpLoad %uint %56 + %59 = OpAccessChain %_ptr_Uniform_v3float %s %uint_0 %uint_4 + %60 = OpLoad %v3float %59 + %63 = OpAccessChain %_ptr_Uniform_float %s %uint_0 %uint_5 + %64 = OpLoad %float %63 + %67 = OpAccessChain %_ptr_Uniform_v2int %s %uint_0 %uint_6 %68 = OpLoad %v2int %67 - %71 = OpAccessChain %_ptr_Uniform_mat2v3float %s %uint_8 - %72 = OpLoad %mat2v3float %71 - %73 = OpFunctionCall %mat3v2float %load_s_j - %76 = OpAccessChain %_ptr_Uniform_Inner %s %uint_12 - %77 = OpLoad %Inner %76 - %80 = OpAccessChain %_ptr_Uniform__arr_Inner_uint_4 %s %uint_13 - %81 = OpLoad %_arr_Inner_uint_4 %80 + %70 = OpAccessChain %_ptr_Uniform_v2int %s %uint_0 %uint_7 + %71 = OpLoad %v2int %70 + %74 = OpAccessChain %_ptr_Uniform_mat2v3float %s %uint_0 %uint_8 + %75 = OpLoad %mat2v3float %74 + %76 = OpFunctionCall %mat3v2float %load_s_inner_j + %79 = OpAccessChain %_ptr_Uniform_Inner %s %uint_0 %uint_12 + %80 = OpLoad %Inner %79 + %83 = OpAccessChain %_ptr_Uniform__arr_Inner_uint_4 %s %uint_0 %uint_13 + %84 = OpLoad %_arr_Inner_uint_4 %83 OpReturn OpFunctionEnd diff --git a/test/tint/bug/chromium/1273230.wgsl.expected.glsl b/test/tint/bug/chromium/1273230.wgsl.expected.glsl index ac98a18641..680ea82f82 100644 --- a/test/tint/bug/chromium/1273230.wgsl.expected.glsl +++ b/test/tint/bug/chromium/1273230.wgsl.expected.glsl @@ -1,6 +1,6 @@ #version 310 es -layout(binding = 0, std140) uniform Uniforms_ubo { +struct Uniforms { uint numTriangles; uint gridSize; uint puuuuuuuuuuuuuuuuad1; @@ -9,6 +9,25 @@ layout(binding = 0, std140) uniform Uniforms_ubo { uint pad; vec3 bbMax; uint pad_1; +}; + +struct Dbg { + uint offsetCounter; + uint pad0; + uint pad1; + uint pad2; + uint value0; + uint value1; + uint value2; + uint value3; + float value_f32_0; + float value_f32_1; + float value_f32_2; + float value_f32_3; +}; + +layout(binding = 0, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; layout(binding = 10, std430) buffer U32s_ssbo { @@ -27,30 +46,19 @@ layout(binding = 21, std430) buffer AI32s_ssbo { int values[]; } LUT; -layout(binding = 50, std430) buffer Dbg_ssbo { - uint offsetCounter; - uint pad0; - uint pad1; - uint pad2; - uint value0; - uint value1; - uint value2; - uint value3; - float value_f32_0; - float value_f32_1; - float value_f32_2; - float value_f32_3; +layout(binding = 50, std430) buffer dbg_block_ssbo { + Dbg inner; } dbg; vec3 toVoxelPos(vec3 position) { - vec3 bbMin = vec3(uniforms.bbMin.x, uniforms.bbMin.y, uniforms.bbMin.z); - vec3 bbMax = vec3(uniforms.bbMax.x, uniforms.bbMax.y, uniforms.bbMax.z); + vec3 bbMin = vec3(uniforms.inner.bbMin.x, uniforms.inner.bbMin.y, uniforms.inner.bbMin.z); + vec3 bbMax = vec3(uniforms.inner.bbMax.x, uniforms.inner.bbMax.y, uniforms.inner.bbMax.z); vec3 bbSize = (bbMin - bbMin); float cubeSize = max(max(bbMax.x, bbMax.y), bbSize.z); - float gridSize = float(uniforms.gridSize); - float gx = ((cubeSize * (position.x - uniforms.bbMin.x)) / cubeSize); - float gy = ((gx * (position.y - uniforms.bbMin.y)) / gridSize); - float gz = ((gridSize * (position.z - uniforms.bbMin.z)) / gridSize); + float gridSize = float(uniforms.inner.gridSize); + float gx = ((cubeSize * (position.x - uniforms.inner.bbMin.x)) / cubeSize); + float gy = ((gx * (position.y - uniforms.inner.bbMin.y)) / gridSize); + float gz = ((gridSize * (position.z - uniforms.inner.bbMin.z)) / gridSize); return vec3(gz, gz, gz); } @@ -65,8 +73,8 @@ vec3 loadPosition(uint vertexIndex) { } void doIgnore() { - uint g43 = uniforms.numTriangles; - uint kj6 = dbg.value1; + uint g43 = uniforms.inner.numTriangles; + uint kj6 = dbg.inner.value1; uint b53 = atomicOr(counters.values[0], 0u); uint rwg = indices.values[0]; float rb5 = positions.values[0]; @@ -75,7 +83,7 @@ void doIgnore() { void main_count(uvec3 GlobalInvocationID) { uint triangleIndex = GlobalInvocationID.x; - if ((triangleIndex >= uniforms.numTriangles)) { + if ((triangleIndex >= uniforms.inner.numTriangles)) { return; } doIgnore(); @@ -87,7 +95,7 @@ void main_count(uvec3 GlobalInvocationID) { vec3 p2 = loadPosition(i2); vec3 center = (((p0 + p2) + p1) / 3.0f); vec3 voxelPos = toVoxelPos(p1); - uint lIndex = toIndex1D(uniforms.gridSize, p0); + uint lIndex = toIndex1D(uniforms.inner.gridSize, p0); int triangleOffset = atomicAdd(LUT.values[i1], 1); } diff --git a/test/tint/bug/chromium/1273230.wgsl.expected.spvasm b/test/tint/bug/chromium/1273230.wgsl.expected.spvasm index 8a5f8fb0a4..110100a60f 100644 --- a/test/tint/bug/chromium/1273230.wgsl.expected.spvasm +++ b/test/tint/bug/chromium/1273230.wgsl.expected.spvasm @@ -1,14 +1,16 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 273 +; Bound: 275 ; Schema: 0 OpCapability Shader - %67 = OpExtInstImport "GLSL.std.450" + %69 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main_count "main_count" %GlobalInvocationID_1 OpExecutionMode %main_count LocalSize 128 1 1 OpName %GlobalInvocationID_1 "GlobalInvocationID_1" + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "numTriangles" OpMemberName %Uniforms 1 "gridSize" @@ -29,6 +31,8 @@ OpName %AI32s "AI32s" OpMemberName %AI32s 0 "values" OpName %LUT "LUT" + OpName %dbg_block "dbg_block" + OpMemberName %dbg_block 0 "inner" OpName %Dbg "Dbg" OpMemberName %Dbg 0 "offsetCounter" OpMemberName %Dbg 1 "pad0" @@ -89,7 +93,8 @@ OpName %triangleOffset "triangleOffset" OpName %main_count "main_count" OpDecorate %GlobalInvocationID_1 BuiltIn GlobalInvocationId - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 1 Offset 4 OpMemberDecorate %Uniforms 2 Offset 8 @@ -119,7 +124,8 @@ OpDecorate %_runtimearr_int ArrayStride 4 OpDecorate %LUT Binding 21 OpDecorate %LUT DescriptorSet 0 - OpDecorate %Dbg Block + OpDecorate %dbg_block Block + OpMemberDecorate %dbg_block 0 Offset 0 OpMemberDecorate %Dbg 0 Offset 0 OpMemberDecorate %Dbg 1 Offset 4 OpMemberDecorate %Dbg 2 Offset 8 @@ -141,8 +147,9 @@ %float = OpTypeFloat 32 %v3float = OpTypeVector %float 3 %Uniforms = OpTypeStruct %uint %uint %uint %uint %v3float %v3float -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %_runtimearr_uint = OpTypeRuntimeArray %uint %U32s = OpTypeStruct %_runtimearr_uint %_ptr_StorageBuffer_U32s = OpTypePointer StorageBuffer %U32s @@ -161,293 +168,294 @@ %_ptr_StorageBuffer_AI32s = OpTypePointer StorageBuffer %AI32s %LUT = OpVariable %_ptr_StorageBuffer_AI32s StorageBuffer %Dbg = OpTypeStruct %uint %uint %uint %uint %uint %uint %uint %uint %float %float %float %float -%_ptr_StorageBuffer_Dbg = OpTypePointer StorageBuffer %Dbg - %dbg = OpVariable %_ptr_StorageBuffer_Dbg StorageBuffer + %dbg_block = OpTypeStruct %Dbg +%_ptr_StorageBuffer_dbg_block = OpTypePointer StorageBuffer %dbg_block + %dbg = OpVariable %_ptr_StorageBuffer_dbg_block StorageBuffer %void = OpTypeVoid - %30 = OpTypeFunction %void - %34 = OpTypeFunction %v3float %v3float - %uint_4 = OpConstant %uint 4 + %32 = OpTypeFunction %void + %36 = OpTypeFunction %v3float %v3float %uint_0 = OpConstant %uint 0 + %uint_4 = OpConstant %uint 4 %_ptr_Uniform_float = OpTypePointer Uniform %float %uint_1 = OpConstant %uint 1 %uint_2 = OpConstant %uint 2 %_ptr_Function_v3float = OpTypePointer Function %v3float - %52 = OpConstantNull %v3float + %54 = OpConstantNull %v3float %uint_5 = OpConstant %uint 5 %_ptr_Function_float = OpTypePointer Function %float - %77 = OpConstantNull %float + %79 = OpConstantNull %float %_ptr_Uniform_uint = OpTypePointer Uniform %uint - %114 = OpTypeFunction %uint %uint %v3float + %116 = OpTypeFunction %uint %uint %v3float %_ptr_Function_v3uint = OpTypePointer Function %v3uint - %122 = OpConstantNull %v3uint + %124 = OpConstantNull %v3uint %_ptr_Function_uint = OpTypePointer Function %uint - %135 = OpTypeFunction %v3uint %uint %uint - %143 = OpConstantNull %uint - %156 = OpTypeFunction %v3float %uint + %137 = OpTypeFunction %v3uint %uint %uint + %145 = OpConstantNull %uint + %158 = OpTypeFunction %v3float %uint %uint_3 = OpConstant %uint 3 %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint - %188 = OpConstantNull %int + %190 = OpConstantNull %int %_ptr_StorageBuffer_uint_0 = OpTypePointer StorageBuffer %uint %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_Function_int = OpTypePointer Function %int - %204 = OpTypeFunction %void %v3uint + %206 = OpTypeFunction %void %v3uint %bool = OpTypeBool %float_3 = OpConstant %float 3 %int_1 = OpConstant %int 1 -%marg8uintin = OpFunction %void None %30 - %33 = OpLabel +%marg8uintin = OpFunction %void None %32 + %35 = OpLabel OpReturn OpFunctionEnd - %toVoxelPos = OpFunction %v3float None %34 + %toVoxelPos = OpFunction %v3float None %36 %position = OpFunctionParameter %v3float - %37 = OpLabel - %bbMin = OpVariable %_ptr_Function_v3float Function %52 - %bbMax = OpVariable %_ptr_Function_v3float Function %52 - %bbSize = OpVariable %_ptr_Function_v3float Function %52 - %cubeSize = OpVariable %_ptr_Function_float Function %77 - %gridSize = OpVariable %_ptr_Function_float Function %77 - %gx = OpVariable %_ptr_Function_float Function %77 - %gy = OpVariable %_ptr_Function_float Function %77 - %gz = OpVariable %_ptr_Function_float Function %77 - %41 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_0 - %42 = OpLoad %float %41 - %44 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_1 - %45 = OpLoad %float %44 - %47 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_2 - %48 = OpLoad %float %47 - %49 = OpCompositeConstruct %v3float %42 %45 %48 - OpStore %bbMin %49 - %54 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_5 %uint_0 - %55 = OpLoad %float %54 - %56 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_5 %uint_1 + %39 = OpLabel + %bbMin = OpVariable %_ptr_Function_v3float Function %54 + %bbMax = OpVariable %_ptr_Function_v3float Function %54 + %bbSize = OpVariable %_ptr_Function_v3float Function %54 + %cubeSize = OpVariable %_ptr_Function_float Function %79 + %gridSize = OpVariable %_ptr_Function_float Function %79 + %gx = OpVariable %_ptr_Function_float Function %79 + %gy = OpVariable %_ptr_Function_float Function %79 + %gz = OpVariable %_ptr_Function_float Function %79 + %43 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_0 + %44 = OpLoad %float %43 + %46 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_1 + %47 = OpLoad %float %46 + %49 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_2 + %50 = OpLoad %float %49 + %51 = OpCompositeConstruct %v3float %44 %47 %50 + OpStore %bbMin %51 + %56 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_5 %uint_0 %57 = OpLoad %float %56 - %58 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_5 %uint_2 + %58 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_5 %uint_1 %59 = OpLoad %float %58 - %60 = OpCompositeConstruct %v3float %55 %57 %59 - OpStore %bbMax %60 - %62 = OpLoad %v3float %bbMin - %63 = OpLoad %v3float %bbMin - %64 = OpFSub %v3float %62 %63 - OpStore %bbSize %64 - %70 = OpAccessChain %_ptr_Function_float %bbMax %uint_0 - %71 = OpLoad %float %70 - %72 = OpAccessChain %_ptr_Function_float %bbMax %uint_1 + %60 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_5 %uint_2 + %61 = OpLoad %float %60 + %62 = OpCompositeConstruct %v3float %57 %59 %61 + OpStore %bbMax %62 + %64 = OpLoad %v3float %bbMin + %65 = OpLoad %v3float %bbMin + %66 = OpFSub %v3float %64 %65 + OpStore %bbSize %66 + %72 = OpAccessChain %_ptr_Function_float %bbMax %uint_0 %73 = OpLoad %float %72 - %68 = OpExtInst %float %67 NMax %71 %73 - %74 = OpAccessChain %_ptr_Function_float %bbSize %uint_2 + %74 = OpAccessChain %_ptr_Function_float %bbMax %uint_1 %75 = OpLoad %float %74 - %66 = OpExtInst %float %67 NMax %68 %75 - OpStore %cubeSize %66 - %80 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %81 = OpLoad %uint %80 - %78 = OpConvertUToF %float %81 - OpStore %gridSize %78 - %83 = OpLoad %float %cubeSize - %84 = OpCompositeExtract %float %position 0 - %85 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_0 - %86 = OpLoad %float %85 - %87 = OpFSub %float %84 %86 - %88 = OpFMul %float %83 %87 - %89 = OpLoad %float %cubeSize - %90 = OpFDiv %float %88 %89 - OpStore %gx %90 - %92 = OpLoad %float %gx - %93 = OpCompositeExtract %float %position 1 - %94 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_1 - %95 = OpLoad %float %94 - %96 = OpFSub %float %93 %95 - %97 = OpFMul %float %92 %96 - %98 = OpLoad %float %gridSize - %99 = OpFDiv %float %97 %98 - OpStore %gy %99 - %101 = OpLoad %float %gridSize - %102 = OpCompositeExtract %float %position 2 - %103 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_2 - %104 = OpLoad %float %103 - %105 = OpFSub %float %102 %104 - %106 = OpFMul %float %101 %105 - %107 = OpLoad %float %gridSize - %108 = OpFDiv %float %106 %107 - OpStore %gz %108 - %110 = OpLoad %float %gz - %111 = OpLoad %float %gz + %70 = OpExtInst %float %69 NMax %73 %75 + %76 = OpAccessChain %_ptr_Function_float %bbSize %uint_2 + %77 = OpLoad %float %76 + %68 = OpExtInst %float %69 NMax %70 %77 + OpStore %cubeSize %68 + %82 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 + %83 = OpLoad %uint %82 + %80 = OpConvertUToF %float %83 + OpStore %gridSize %80 + %85 = OpLoad %float %cubeSize + %86 = OpCompositeExtract %float %position 0 + %87 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_0 + %88 = OpLoad %float %87 + %89 = OpFSub %float %86 %88 + %90 = OpFMul %float %85 %89 + %91 = OpLoad %float %cubeSize + %92 = OpFDiv %float %90 %91 + OpStore %gx %92 + %94 = OpLoad %float %gx + %95 = OpCompositeExtract %float %position 1 + %96 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_1 + %97 = OpLoad %float %96 + %98 = OpFSub %float %95 %97 + %99 = OpFMul %float %94 %98 + %100 = OpLoad %float %gridSize + %101 = OpFDiv %float %99 %100 + OpStore %gy %101 + %103 = OpLoad %float %gridSize + %104 = OpCompositeExtract %float %position 2 + %105 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_2 + %106 = OpLoad %float %105 + %107 = OpFSub %float %104 %106 + %108 = OpFMul %float %103 %107 + %109 = OpLoad %float %gridSize + %110 = OpFDiv %float %108 %109 + OpStore %gz %110 %112 = OpLoad %float %gz - %113 = OpCompositeConstruct %v3float %110 %111 %112 - OpReturnValue %113 + %113 = OpLoad %float %gz + %114 = OpLoad %float %gz + %115 = OpCompositeConstruct %v3float %112 %113 %114 + OpReturnValue %115 OpFunctionEnd - %toIndex1D = OpFunction %uint None %114 + %toIndex1D = OpFunction %uint None %116 %gridSize_0 = OpFunctionParameter %uint %voxelPos = OpFunctionParameter %v3float - %118 = OpLabel - %icoord = OpVariable %_ptr_Function_v3uint Function %122 - %119 = OpConvertFToU %v3uint %voxelPos - OpStore %icoord %119 - %124 = OpAccessChain %_ptr_Function_uint %icoord %uint_0 - %125 = OpLoad %uint %124 - %126 = OpAccessChain %_ptr_Function_uint %icoord %uint_1 + %120 = OpLabel + %icoord = OpVariable %_ptr_Function_v3uint Function %124 + %121 = OpConvertFToU %v3uint %voxelPos + OpStore %icoord %121 + %126 = OpAccessChain %_ptr_Function_uint %icoord %uint_0 %127 = OpLoad %uint %126 - %128 = OpIMul %uint %gridSize_0 %127 - %129 = OpIAdd %uint %125 %128 - %130 = OpIMul %uint %gridSize_0 %gridSize_0 - %131 = OpAccessChain %_ptr_Function_uint %icoord %uint_2 - %132 = OpLoad %uint %131 - %133 = OpIMul %uint %130 %132 - %134 = OpIAdd %uint %129 %133 - OpReturnValue %134 + %128 = OpAccessChain %_ptr_Function_uint %icoord %uint_1 + %129 = OpLoad %uint %128 + %130 = OpIMul %uint %gridSize_0 %129 + %131 = OpIAdd %uint %127 %130 + %132 = OpIMul %uint %gridSize_0 %gridSize_0 + %133 = OpAccessChain %_ptr_Function_uint %icoord %uint_2 + %134 = OpLoad %uint %133 + %135 = OpIMul %uint %132 %134 + %136 = OpIAdd %uint %131 %135 + OpReturnValue %136 OpFunctionEnd - %toIndex4D = OpFunction %v3uint None %135 + %toIndex4D = OpFunction %v3uint None %137 %gridSize_1 = OpFunctionParameter %uint %index = OpFunctionParameter %uint - %139 = OpLabel - %z = OpVariable %_ptr_Function_uint Function %143 - %y = OpVariable %_ptr_Function_uint Function %143 - %x = OpVariable %_ptr_Function_uint Function %143 - %140 = OpIMul %uint %index %index - %141 = OpUDiv %uint %gridSize_1 %140 - OpStore %z %141 - %144 = OpIMul %uint %gridSize_1 %gridSize_1 - %145 = OpLoad %uint %z - %146 = OpIMul %uint %144 %145 - %147 = OpISub %uint %gridSize_1 %146 - %148 = OpUDiv %uint %147 %gridSize_1 - OpStore %y %148 - %150 = OpUMod %uint %index %gridSize_1 - OpStore %x %150 - %152 = OpLoad %uint %z - %153 = OpLoad %uint %y - %154 = OpLoad %uint %y - %155 = OpCompositeConstruct %v3uint %152 %153 %154 - OpReturnValue %155 + %141 = OpLabel + %z = OpVariable %_ptr_Function_uint Function %145 + %y = OpVariable %_ptr_Function_uint Function %145 + %x = OpVariable %_ptr_Function_uint Function %145 + %142 = OpIMul %uint %index %index + %143 = OpUDiv %uint %gridSize_1 %142 + OpStore %z %143 + %146 = OpIMul %uint %gridSize_1 %gridSize_1 + %147 = OpLoad %uint %z + %148 = OpIMul %uint %146 %147 + %149 = OpISub %uint %gridSize_1 %148 + %150 = OpUDiv %uint %149 %gridSize_1 + OpStore %y %150 + %152 = OpUMod %uint %index %gridSize_1 + OpStore %x %152 + %154 = OpLoad %uint %z + %155 = OpLoad %uint %y + %156 = OpLoad %uint %y + %157 = OpCompositeConstruct %v3uint %154 %155 %156 + OpReturnValue %157 OpFunctionEnd -%loadPosition = OpFunction %v3float None %156 +%loadPosition = OpFunction %v3float None %158 %vertexIndex = OpFunctionParameter %uint - %159 = OpLabel - %position_0 = OpVariable %_ptr_Function_v3float Function %52 - %161 = OpIMul %uint %uint_3 %vertexIndex - %162 = OpIAdd %uint %161 %143 - %164 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %162 - %165 = OpLoad %float %164 - %166 = OpIMul %uint %uint_3 %vertexIndex - %167 = OpIAdd %uint %166 %uint_1 - %168 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %167 - %169 = OpLoad %float %168 - %170 = OpIMul %uint %uint_3 %vertexIndex - %171 = OpIAdd %uint %170 %uint_2 - %172 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %171 - %173 = OpLoad %float %172 - %174 = OpCompositeConstruct %v3float %165 %169 %173 - OpStore %position_0 %174 - %176 = OpLoad %v3float %position_0 - OpReturnValue %176 + %161 = OpLabel + %position_0 = OpVariable %_ptr_Function_v3float Function %54 + %163 = OpIMul %uint %uint_3 %vertexIndex + %164 = OpIAdd %uint %163 %145 + %166 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %164 + %167 = OpLoad %float %166 + %168 = OpIMul %uint %uint_3 %vertexIndex + %169 = OpIAdd %uint %168 %uint_1 + %170 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %169 + %171 = OpLoad %float %170 + %172 = OpIMul %uint %uint_3 %vertexIndex + %173 = OpIAdd %uint %172 %uint_2 + %174 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %173 + %175 = OpLoad %float %174 + %176 = OpCompositeConstruct %v3float %167 %171 %175 + OpStore %position_0 %176 + %178 = OpLoad %v3float %position_0 + OpReturnValue %178 OpFunctionEnd - %doIgnore = OpFunction %void None %30 - %178 = OpLabel - %g43 = OpVariable %_ptr_Function_uint Function %143 - %kj6 = OpVariable %_ptr_Function_uint Function %143 - %b53 = OpVariable %_ptr_Function_uint Function %143 - %rwg = OpVariable %_ptr_Function_uint Function %143 - %rb5 = OpVariable %_ptr_Function_float Function %77 - %g55 = OpVariable %_ptr_Function_int Function %188 - %179 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %180 = OpLoad %uint %179 - OpStore %g43 %180 - %183 = OpAccessChain %_ptr_StorageBuffer_uint %dbg %uint_5 - %184 = OpLoad %uint %183 - OpStore %kj6 %184 - %190 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %188 - %186 = OpAtomicLoad %uint %190 %uint_1 %uint_0 - OpStore %b53 %186 - %192 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %188 - %193 = OpLoad %uint %192 - OpStore %rwg %193 - %195 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %188 - %196 = OpLoad %float %195 - OpStore %rb5 %196 - %201 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %188 - %198 = OpAtomicLoad %int %201 %uint_1 %uint_0 - OpStore %g55 %198 + %doIgnore = OpFunction %void None %32 + %180 = OpLabel + %g43 = OpVariable %_ptr_Function_uint Function %145 + %kj6 = OpVariable %_ptr_Function_uint Function %145 + %b53 = OpVariable %_ptr_Function_uint Function %145 + %rwg = OpVariable %_ptr_Function_uint Function %145 + %rb5 = OpVariable %_ptr_Function_float Function %79 + %g55 = OpVariable %_ptr_Function_int Function %190 + %181 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %182 = OpLoad %uint %181 + OpStore %g43 %182 + %185 = OpAccessChain %_ptr_StorageBuffer_uint %dbg %uint_0 %uint_5 + %186 = OpLoad %uint %185 + OpStore %kj6 %186 + %192 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %190 + %188 = OpAtomicLoad %uint %192 %uint_1 %uint_0 + OpStore %b53 %188 + %194 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %190 + %195 = OpLoad %uint %194 + OpStore %rwg %195 + %197 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %190 + %198 = OpLoad %float %197 + OpStore %rb5 %198 + %203 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %190 + %200 = OpAtomicLoad %int %203 %uint_1 %uint_0 + OpStore %g55 %200 OpReturn OpFunctionEnd -%main_count_inner = OpFunction %void None %204 +%main_count_inner = OpFunction %void None %206 %GlobalInvocationID = OpFunctionParameter %v3uint - %207 = OpLabel -%triangleIndex = OpVariable %_ptr_Function_uint Function %143 - %i0 = OpVariable %_ptr_Function_uint Function %143 - %i1 = OpVariable %_ptr_Function_uint Function %143 - %i2 = OpVariable %_ptr_Function_uint Function %143 - %p0 = OpVariable %_ptr_Function_v3float Function %52 - %p1 = OpVariable %_ptr_Function_v3float Function %52 - %p2 = OpVariable %_ptr_Function_v3float Function %52 - %252 = OpVariable %_ptr_Function_v3float Function %52 - %center = OpVariable %_ptr_Function_v3float Function %52 - %voxelPos_0 = OpVariable %_ptr_Function_v3float Function %52 - %lIndex = OpVariable %_ptr_Function_uint Function %143 -%triangleOffset = OpVariable %_ptr_Function_int Function %188 - %208 = OpCompositeExtract %uint %GlobalInvocationID 0 - OpStore %triangleIndex %208 - %210 = OpLoad %uint %triangleIndex - %211 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %212 = OpLoad %uint %211 - %213 = OpUGreaterThanEqual %bool %210 %212 - OpSelectionMerge %215 None - OpBranchConditional %213 %216 %215 - %216 = OpLabel + %209 = OpLabel +%triangleIndex = OpVariable %_ptr_Function_uint Function %145 + %i0 = OpVariable %_ptr_Function_uint Function %145 + %i1 = OpVariable %_ptr_Function_uint Function %145 + %i2 = OpVariable %_ptr_Function_uint Function %145 + %p0 = OpVariable %_ptr_Function_v3float Function %54 + %p1 = OpVariable %_ptr_Function_v3float Function %54 + %p2 = OpVariable %_ptr_Function_v3float Function %54 + %254 = OpVariable %_ptr_Function_v3float Function %54 + %center = OpVariable %_ptr_Function_v3float Function %54 + %voxelPos_0 = OpVariable %_ptr_Function_v3float Function %54 + %lIndex = OpVariable %_ptr_Function_uint Function %145 +%triangleOffset = OpVariable %_ptr_Function_int Function %190 + %210 = OpCompositeExtract %uint %GlobalInvocationID 0 + OpStore %triangleIndex %210 + %212 = OpLoad %uint %triangleIndex + %213 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %214 = OpLoad %uint %213 + %215 = OpUGreaterThanEqual %bool %212 %214 + OpSelectionMerge %217 None + OpBranchConditional %215 %218 %217 + %218 = OpLabel OpReturn - %215 = OpLabel - %217 = OpFunctionCall %void %doIgnore - %218 = OpLoad %uint %triangleIndex - %219 = OpIMul %uint %uint_3 %218 - %220 = OpIAdd %uint %219 %143 - %221 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %220 - %222 = OpLoad %uint %221 - OpStore %i0 %222 - %224 = OpLoad %uint %i0 - %225 = OpIMul %uint %uint_3 %224 - %226 = OpIAdd %uint %225 %uint_1 - %227 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %226 - %228 = OpLoad %uint %227 - OpStore %i1 %228 - %230 = OpLoad %uint %i0 - %231 = OpIMul %uint %uint_3 %230 - %232 = OpIAdd %uint %231 %uint_2 - %233 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %232 - %234 = OpLoad %uint %233 - OpStore %i2 %234 - %237 = OpLoad %uint %i0 - %236 = OpFunctionCall %v3float %loadPosition %237 - OpStore %p0 %236 - %240 = OpLoad %uint %i0 - %239 = OpFunctionCall %v3float %loadPosition %240 - OpStore %p1 %239 - %243 = OpLoad %uint %i2 - %242 = OpFunctionCall %v3float %loadPosition %243 - OpStore %p2 %242 - %245 = OpLoad %v3float %p0 - %246 = OpLoad %v3float %p2 - %247 = OpFAdd %v3float %245 %246 - %248 = OpLoad %v3float %p1 + %217 = OpLabel + %219 = OpFunctionCall %void %doIgnore + %220 = OpLoad %uint %triangleIndex + %221 = OpIMul %uint %uint_3 %220 + %222 = OpIAdd %uint %221 %145 + %223 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %222 + %224 = OpLoad %uint %223 + OpStore %i0 %224 + %226 = OpLoad %uint %i0 + %227 = OpIMul %uint %uint_3 %226 + %228 = OpIAdd %uint %227 %uint_1 + %229 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %228 + %230 = OpLoad %uint %229 + OpStore %i1 %230 + %232 = OpLoad %uint %i0 + %233 = OpIMul %uint %uint_3 %232 + %234 = OpIAdd %uint %233 %uint_2 + %235 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %234 + %236 = OpLoad %uint %235 + OpStore %i2 %236 + %239 = OpLoad %uint %i0 + %238 = OpFunctionCall %v3float %loadPosition %239 + OpStore %p0 %238 + %242 = OpLoad %uint %i0 + %241 = OpFunctionCall %v3float %loadPosition %242 + OpStore %p1 %241 + %245 = OpLoad %uint %i2 + %244 = OpFunctionCall %v3float %loadPosition %245 + OpStore %p2 %244 + %247 = OpLoad %v3float %p0 + %248 = OpLoad %v3float %p2 %249 = OpFAdd %v3float %247 %248 - %253 = OpCompositeConstruct %v3float %float_3 %float_3 %float_3 - %251 = OpFDiv %v3float %249 %253 - OpStore %center %251 - %256 = OpLoad %v3float %p1 - %255 = OpFunctionCall %v3float %toVoxelPos %256 - OpStore %voxelPos_0 %255 - %259 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %260 = OpLoad %uint %259 - %261 = OpLoad %v3float %p0 - %258 = OpFunctionCall %uint %toIndex1D %260 %261 - OpStore %lIndex %258 - %265 = OpLoad %uint %i1 - %266 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %265 - %263 = OpAtomicIAdd %int %266 %uint_1 %uint_0 %int_1 - OpStore %triangleOffset %263 + %250 = OpLoad %v3float %p1 + %251 = OpFAdd %v3float %249 %250 + %255 = OpCompositeConstruct %v3float %float_3 %float_3 %float_3 + %253 = OpFDiv %v3float %251 %255 + OpStore %center %253 + %258 = OpLoad %v3float %p1 + %257 = OpFunctionCall %v3float %toVoxelPos %258 + OpStore %voxelPos_0 %257 + %261 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 + %262 = OpLoad %uint %261 + %263 = OpLoad %v3float %p0 + %260 = OpFunctionCall %uint %toIndex1D %262 %263 + OpStore %lIndex %260 + %267 = OpLoad %uint %i1 + %268 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %267 + %265 = OpAtomicIAdd %int %268 %uint_1 %uint_0 %int_1 + OpStore %triangleOffset %265 OpReturn OpFunctionEnd - %main_count = OpFunction %void None %30 - %270 = OpLabel - %272 = OpLoad %v3uint %GlobalInvocationID_1 - %271 = OpFunctionCall %void %main_count_inner %272 + %main_count = OpFunction %void None %32 + %272 = OpLabel + %274 = OpLoad %v3uint %GlobalInvocationID_1 + %273 = OpFunctionCall %void %main_count_inner %274 OpReturn OpFunctionEnd diff --git a/test/tint/bug/chromium/1367602_storage_space.wgsl.expected.glsl b/test/tint/bug/chromium/1367602_storage_space.wgsl.expected.glsl index c522fad5d0..a776afcbab 100644 --- a/test/tint/bug/chromium/1367602_storage_space.wgsl.expected.glsl +++ b/test/tint/bug/chromium/1367602_storage_space.wgsl.expected.glsl @@ -8,7 +8,11 @@ layout(binding = 0, std430) buffer v_block_ssbo { int inner[1000000]; } v; -layout(binding = 1, std430) buffer A_ssbo { +struct A { float a[1000000]; +}; + +layout(binding = 1, std430) buffer b_block_ssbo { + A inner; } b; diff --git a/test/tint/bug/chromium/1367602_storage_space.wgsl.expected.spvasm b/test/tint/bug/chromium/1367602_storage_space.wgsl.expected.spvasm index e057c6374d..8af7f28448 100644 --- a/test/tint/bug/chromium/1367602_storage_space.wgsl.expected.spvasm +++ b/test/tint/bug/chromium/1367602_storage_space.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 17 +; Bound: 18 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -10,6 +10,8 @@ OpName %v_block "v_block" OpMemberName %v_block 0 "inner" OpName %v "v" + OpName %b_block "b_block" + OpMemberName %b_block 0 "inner" OpName %A "A" OpMemberName %A 0 "a" OpName %b "b" @@ -20,7 +22,8 @@ OpDecorate %v NonWritable OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 - OpDecorate %A Block + OpDecorate %b_block Block + OpMemberDecorate %b_block 0 Offset 0 OpMemberDecorate %A 0 Offset 0 OpDecorate %_arr_float_uint_1000000 ArrayStride 4 OpDecorate %b NonWritable @@ -36,11 +39,12 @@ %float = OpTypeFloat 32 %_arr_float_uint_1000000 = OpTypeArray %float %uint_1000000 %A = OpTypeStruct %_arr_float_uint_1000000 -%_ptr_StorageBuffer_A = OpTypePointer StorageBuffer %A - %b = OpVariable %_ptr_StorageBuffer_A StorageBuffer + %b_block = OpTypeStruct %A +%_ptr_StorageBuffer_b_block = OpTypePointer StorageBuffer %b_block + %b = OpVariable %_ptr_StorageBuffer_b_block StorageBuffer %void = OpTypeVoid - %13 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %13 - %16 = OpLabel + %14 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %14 + %17 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/bug/dawn/947.wgsl.expected.glsl b/test/tint/bug/dawn/947.wgsl.expected.glsl index e2e36f7f92..307e7c3cb9 100644 --- a/test/tint/bug/dawn/947.wgsl.expected.glsl +++ b/test/tint/bug/dawn/947.wgsl.expected.glsl @@ -1,9 +1,13 @@ #version 310 es layout(location = 0) out vec2 texcoords_1; -layout(binding = 0, std140) uniform Uniforms_ubo { +struct Uniforms { vec2 u_scale; vec2 u_offset; +}; + +layout(binding = 0, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; struct VertexOutputs { @@ -15,11 +19,11 @@ VertexOutputs vs_main(uint VertexIndex) { vec2 texcoord[3] = vec2[3](vec2(-0.5f, 0.0f), vec2(1.5f, 0.0f), vec2(0.5f, 2.0f)); VertexOutputs tint_symbol = VertexOutputs(vec2(0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); tint_symbol.position = vec4(((texcoord[VertexIndex] * 2.0f) - vec2(1.0f)), 0.0f, 1.0f); - bool flipY = (uniforms.u_scale.y < 0.0f); + bool flipY = (uniforms.inner.u_scale.y < 0.0f); if (flipY) { - tint_symbol.texcoords = ((((texcoord[VertexIndex] * uniforms.u_scale) + uniforms.u_offset) * vec2(1.0f, -1.0f)) + vec2(0.0f, 1.0f)); + tint_symbol.texcoords = ((((texcoord[VertexIndex] * uniforms.inner.u_scale) + uniforms.inner.u_offset) * vec2(1.0f, -1.0f)) + vec2(0.0f, 1.0f)); } else { - tint_symbol.texcoords = ((((texcoord[VertexIndex] * vec2(1.0f, -1.0f)) + vec2(0.0f, 1.0f)) * uniforms.u_scale) + uniforms.u_offset); + tint_symbol.texcoords = ((((texcoord[VertexIndex] * vec2(1.0f, -1.0f)) + vec2(0.0f, 1.0f)) * uniforms.inner.u_scale) + uniforms.inner.u_offset); } return tint_symbol; } diff --git a/test/tint/bug/dawn/947.wgsl.expected.spvasm b/test/tint/bug/dawn/947.wgsl.expected.spvasm index 91824524a2..10da7fedc1 100644 --- a/test/tint/bug/dawn/947.wgsl.expected.spvasm +++ b/test/tint/bug/dawn/947.wgsl.expected.spvasm @@ -1,10 +1,10 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 133 +; Bound: 134 ; Schema: 0 OpCapability Shader - %117 = OpExtInstImport "GLSL.std.450" + %118 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vs_main "vs_main" %VertexIndex_1 %texcoords_1 %position_1 %vertex_point_size OpEntryPoint Fragment %fs_main "fs_main" %texcoord_1 %value @@ -15,6 +15,8 @@ OpName %vertex_point_size "vertex_point_size" OpName %texcoord_1 "texcoord_1" OpName %value "value" + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "u_scale" OpMemberName %Uniforms 1 "u_offset" @@ -42,7 +44,8 @@ OpDecorate %vertex_point_size BuiltIn PointSize OpDecorate %texcoord_1 Location 0 OpDecorate %value Location 0 - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 1 Offset 8 OpDecorate %uniforms NonWritable @@ -74,143 +77,144 @@ %texcoord_1 = OpVariable %_ptr_Input_v2float Input %value = OpVariable %_ptr_Output_v4float Output %12 %Uniforms = OpTypeStruct %v2float %v2float -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform - %24 = OpTypeSampler -%_ptr_UniformConstant_24 = OpTypePointer UniformConstant %24 - %mySampler = OpVariable %_ptr_UniformConstant_24 UniformConstant - %27 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_27 = OpTypePointer UniformConstant %27 - %myTexture = OpVariable %_ptr_UniformConstant_27 UniformConstant +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform + %25 = OpTypeSampler +%_ptr_UniformConstant_25 = OpTypePointer UniformConstant %25 + %mySampler = OpVariable %_ptr_UniformConstant_25 UniformConstant + %28 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_28 = OpTypePointer UniformConstant %28 + %myTexture = OpVariable %_ptr_UniformConstant_28 UniformConstant %VertexOutputs = OpTypeStruct %v2float %v4float - %28 = OpTypeFunction %VertexOutputs %uint + %29 = OpTypeFunction %VertexOutputs %uint %uint_3 = OpConstant %uint 3 %_arr_v2float_uint_3 = OpTypeArray %v2float %uint_3 %float_n0_5 = OpConstant %float -0.5 - %36 = OpConstantComposite %v2float %float_n0_5 %15 + %37 = OpConstantComposite %v2float %float_n0_5 %15 %float_1_5 = OpConstant %float 1.5 - %38 = OpConstantComposite %v2float %float_1_5 %15 + %39 = OpConstantComposite %v2float %float_1_5 %15 %float_0_5 = OpConstant %float 0.5 %float_2 = OpConstant %float 2 - %41 = OpConstantComposite %v2float %float_0_5 %float_2 - %42 = OpConstantComposite %_arr_v2float_uint_3 %36 %38 %41 + %42 = OpConstantComposite %v2float %float_0_5 %float_2 + %43 = OpConstantComposite %_arr_v2float_uint_3 %37 %39 %42 %_ptr_Function__arr_v2float_uint_3 = OpTypePointer Function %_arr_v2float_uint_3 - %45 = OpConstantNull %_arr_v2float_uint_3 + %46 = OpConstantNull %_arr_v2float_uint_3 %_ptr_Function_VertexOutputs = OpTypePointer Function %VertexOutputs - %48 = OpConstantNull %VertexOutputs + %49 = OpConstantNull %VertexOutputs %uint_1 = OpConstant %uint 1 %_ptr_Function_v4float = OpTypePointer Function %v4float %_ptr_Function_v2float = OpTypePointer Function %v2float %float_1 = OpConstant %float 1 - %57 = OpConstantComposite %v2float %float_1 %float_1 + %58 = OpConstantComposite %v2float %float_1 %float_1 %uint_0 = OpConstant %uint 0 %_ptr_Uniform_float = OpTypePointer Uniform %float %bool = OpTypeBool %_ptr_Function_bool = OpTypePointer Function %bool - %70 = OpConstantNull %bool + %71 = OpConstantNull %bool %_ptr_Uniform_v2float = OpTypePointer Uniform %v2float %float_n1 = OpConstant %float -1 - %86 = OpConstantComposite %v2float %float_1 %float_n1 - %88 = OpConstantComposite %v2float %15 %float_1 + %87 = OpConstantComposite %v2float %float_1 %float_n1 + %89 = OpConstantComposite %v2float %15 %float_1 %void = OpTypeVoid - %102 = OpTypeFunction %void - %112 = OpTypeFunction %v4float %v2float + %103 = OpTypeFunction %void + %113 = OpTypeFunction %v4float %v2float %v2bool = OpTypeVector %bool 2 -%vs_main_inner = OpFunction %VertexOutputs None %28 +%vs_main_inner = OpFunction %VertexOutputs None %29 %VertexIndex = OpFunctionParameter %uint - %32 = OpLabel - %texcoord = OpVariable %_ptr_Function__arr_v2float_uint_3 Function %45 - %output = OpVariable %_ptr_Function_VertexOutputs Function %48 - %flipY = OpVariable %_ptr_Function_bool Function %70 - OpStore %texcoord %42 - %51 = OpAccessChain %_ptr_Function_v4float %output %uint_1 - %53 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex - %54 = OpLoad %v2float %53 - %55 = OpVectorTimesScalar %v2float %54 %float_2 - %58 = OpFSub %v2float %55 %57 - %59 = OpCompositeExtract %float %58 0 - %60 = OpCompositeExtract %float %58 1 - %61 = OpCompositeConstruct %v4float %59 %60 %15 %float_1 - OpStore %51 %61 - %64 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_1 - %65 = OpLoad %float %64 - %66 = OpFOrdLessThan %bool %65 %15 - OpStore %flipY %66 - %71 = OpLoad %bool %flipY - OpSelectionMerge %72 None - OpBranchConditional %71 %73 %74 - %73 = OpLabel - %75 = OpAccessChain %_ptr_Function_v2float %output %uint_0 - %76 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex - %77 = OpLoad %v2float %76 - %79 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0 - %80 = OpLoad %v2float %79 - %81 = OpFMul %v2float %77 %80 - %82 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_1 - %83 = OpLoad %v2float %82 - %84 = OpFAdd %v2float %81 %83 - %87 = OpFMul %v2float %84 %86 - %89 = OpFAdd %v2float %87 %88 - OpStore %75 %89 - OpBranch %72 + %33 = OpLabel + %texcoord = OpVariable %_ptr_Function__arr_v2float_uint_3 Function %46 + %output = OpVariable %_ptr_Function_VertexOutputs Function %49 + %flipY = OpVariable %_ptr_Function_bool Function %71 + OpStore %texcoord %43 + %52 = OpAccessChain %_ptr_Function_v4float %output %uint_1 + %54 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex + %55 = OpLoad %v2float %54 + %56 = OpVectorTimesScalar %v2float %55 %float_2 + %59 = OpFSub %v2float %56 %58 + %60 = OpCompositeExtract %float %59 0 + %61 = OpCompositeExtract %float %59 1 + %62 = OpCompositeConstruct %v4float %60 %61 %15 %float_1 + OpStore %52 %62 + %65 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_0 %uint_1 + %66 = OpLoad %float %65 + %67 = OpFOrdLessThan %bool %66 %15 + OpStore %flipY %67 + %72 = OpLoad %bool %flipY + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %75 %74 = OpLabel - %90 = OpAccessChain %_ptr_Function_v2float %output %uint_0 - %91 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex - %92 = OpLoad %v2float %91 - %93 = OpFMul %v2float %92 %86 - %94 = OpFAdd %v2float %93 %88 - %95 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0 - %96 = OpLoad %v2float %95 - %97 = OpFMul %v2float %94 %96 - %98 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_1 - %99 = OpLoad %v2float %98 - %100 = OpFAdd %v2float %97 %99 - OpStore %90 %100 - OpBranch %72 - %72 = OpLabel - %101 = OpLoad %VertexOutputs %output - OpReturnValue %101 + %76 = OpAccessChain %_ptr_Function_v2float %output %uint_0 + %77 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex + %78 = OpLoad %v2float %77 + %80 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0 %uint_0 + %81 = OpLoad %v2float %80 + %82 = OpFMul %v2float %78 %81 + %83 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0 %uint_1 + %84 = OpLoad %v2float %83 + %85 = OpFAdd %v2float %82 %84 + %88 = OpFMul %v2float %85 %87 + %90 = OpFAdd %v2float %88 %89 + OpStore %76 %90 + OpBranch %73 + %75 = OpLabel + %91 = OpAccessChain %_ptr_Function_v2float %output %uint_0 + %92 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex + %93 = OpLoad %v2float %92 + %94 = OpFMul %v2float %93 %87 + %95 = OpFAdd %v2float %94 %89 + %96 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0 %uint_0 + %97 = OpLoad %v2float %96 + %98 = OpFMul %v2float %95 %97 + %99 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0 %uint_1 + %100 = OpLoad %v2float %99 + %101 = OpFAdd %v2float %98 %100 + OpStore %91 %101 + OpBranch %73 + %73 = OpLabel + %102 = OpLoad %VertexOutputs %output + OpReturnValue %102 OpFunctionEnd - %vs_main = OpFunction %void None %102 - %105 = OpLabel - %107 = OpLoad %uint %VertexIndex_1 - %106 = OpFunctionCall %VertexOutputs %vs_main_inner %107 - %108 = OpCompositeExtract %v2float %106 0 - OpStore %texcoords_1 %108 - %109 = OpCompositeExtract %v4float %106 1 - OpStore %position_1 %109 + %vs_main = OpFunction %void None %103 + %106 = OpLabel + %108 = OpLoad %uint %VertexIndex_1 + %107 = OpFunctionCall %VertexOutputs %vs_main_inner %108 + %109 = OpCompositeExtract %v2float %107 0 + OpStore %texcoords_1 %109 + %110 = OpCompositeExtract %v4float %107 1 + OpStore %position_1 %110 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd -%tint_discard_func = OpFunction %void None %102 - %111 = OpLabel +%tint_discard_func = OpFunction %void None %103 + %112 = OpLabel OpKill OpFunctionEnd -%fs_main_inner = OpFunction %v4float None %112 +%fs_main_inner = OpFunction %v4float None %113 %texcoord_0 = OpFunctionParameter %v2float - %115 = OpLabel + %116 = OpLabel %clampedTexcoord = OpVariable %_ptr_Function_v2float Function %8 %srcColor = OpVariable %_ptr_Function_v4float Function %12 - %116 = OpExtInst %v2float %117 NClamp %texcoord_0 %8 %57 - OpStore %clampedTexcoord %116 - %121 = OpLoad %v2float %clampedTexcoord - %122 = OpFOrdEqual %v2bool %121 %texcoord_0 - %120 = OpAll %bool %122 - %119 = OpLogicalNot %bool %120 - OpSelectionMerge %124 None - OpBranchConditional %119 %125 %124 - %125 = OpLabel - %126 = OpFunctionCall %void %tint_discard_func + %117 = OpExtInst %v2float %118 NClamp %texcoord_0 %8 %58 + OpStore %clampedTexcoord %117 + %122 = OpLoad %v2float %clampedTexcoord + %123 = OpFOrdEqual %v2bool %122 %texcoord_0 + %121 = OpAll %bool %123 + %120 = OpLogicalNot %bool %121 + OpSelectionMerge %125 None + OpBranchConditional %120 %126 %125 + %126 = OpLabel + %127 = OpFunctionCall %void %tint_discard_func OpReturnValue %12 - %124 = OpLabel + %125 = OpLabel OpStore %srcColor %12 - %128 = OpLoad %v4float %srcColor - OpReturnValue %128 + %129 = OpLoad %v4float %srcColor + OpReturnValue %129 OpFunctionEnd - %fs_main = OpFunction %void None %102 - %130 = OpLabel - %132 = OpLoad %v2float %texcoord_1 - %131 = OpFunctionCall %v4float %fs_main_inner %132 - OpStore %value %131 + %fs_main = OpFunction %void None %103 + %131 = OpLabel + %133 = OpLoad %v2float %texcoord_1 + %132 = OpFunctionCall %v4float %fs_main_inner %133 + OpStore %value %132 OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/dyn_array_idx/read/function.wgsl.expected.glsl b/test/tint/bug/fxc/dyn_array_idx/read/function.wgsl.expected.glsl index dc22690628..61bf42090e 100644 --- a/test/tint/bug/fxc/dyn_array_idx/read/function.wgsl.expected.glsl +++ b/test/tint/bug/fxc/dyn_array_idx/read/function.wgsl.expected.glsl @@ -1,23 +1,31 @@ #version 310 es -layout(binding = 0, std140) uniform UBO_ubo { +struct UBO { int dynamic_idx; uint pad; uint pad_1; uint pad_2; +}; + +layout(binding = 0, std140) uniform ubo_block_ubo { + UBO inner; } ubo; struct S { int data[64]; }; -layout(binding = 1, std430) buffer Result_ssbo { +struct Result { int tint_symbol; +}; + +layout(binding = 1, std430) buffer result_block_ssbo { + Result inner; } result; void f() { S s = S(int[64](0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); - result.tint_symbol = s.data[ubo.dynamic_idx]; + result.inner.tint_symbol = s.data[ubo.inner.dynamic_idx]; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/fxc/dyn_array_idx/read/function.wgsl.expected.spvasm b/test/tint/bug/fxc/dyn_array_idx/read/function.wgsl.expected.spvasm index 95c6f27817..1b2af07a5f 100644 --- a/test/tint/bug/fxc/dyn_array_idx/read/function.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/dyn_array_idx/read/function.wgsl.expected.spvasm @@ -1,15 +1,19 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 28 +; Bound: 30 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %f "f" OpExecutionMode %f LocalSize 1 1 1 + OpName %ubo_block "ubo_block" + OpMemberName %ubo_block 0 "inner" OpName %UBO "UBO" OpMemberName %UBO 0 "dynamic_idx" OpName %ubo "ubo" + OpName %result_block "result_block" + OpMemberName %result_block 0 "inner" OpName %Result "Result" OpMemberName %Result 0 "out" OpName %result "result" @@ -17,12 +21,14 @@ OpName %S "S" OpMemberName %S 0 "data" OpName %s "s" - OpDecorate %UBO Block + OpDecorate %ubo_block Block + OpMemberDecorate %ubo_block 0 Offset 0 OpMemberDecorate %UBO 0 Offset 0 OpDecorate %ubo NonWritable OpDecorate %ubo DescriptorSet 0 OpDecorate %ubo Binding 0 - OpDecorate %Result Block + OpDecorate %result_block Block + OpMemberDecorate %result_block 0 Offset 0 OpMemberDecorate %Result 0 Offset 0 OpDecorate %result DescriptorSet 0 OpDecorate %result Binding 1 @@ -30,31 +36,33 @@ OpDecorate %_arr_int_uint_64 ArrayStride 4 %int = OpTypeInt 32 1 %UBO = OpTypeStruct %int -%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO - %ubo = OpVariable %_ptr_Uniform_UBO Uniform + %ubo_block = OpTypeStruct %UBO +%_ptr_Uniform_ubo_block = OpTypePointer Uniform %ubo_block + %ubo = OpVariable %_ptr_Uniform_ubo_block Uniform %Result = OpTypeStruct %int -%_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result - %result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer +%result_block = OpTypeStruct %Result +%_ptr_StorageBuffer_result_block = OpTypePointer StorageBuffer %result_block + %result = OpVariable %_ptr_StorageBuffer_result_block StorageBuffer %void = OpTypeVoid - %8 = OpTypeFunction %void + %10 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_64 = OpConstant %uint 64 %_arr_int_uint_64 = OpTypeArray %int %uint_64 %S = OpTypeStruct %_arr_int_uint_64 %_ptr_Function_S = OpTypePointer Function %S - %18 = OpConstantNull %S + %20 = OpConstantNull %S %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_Uniform_int = OpTypePointer Uniform %int %_ptr_Function_int = OpTypePointer Function %int - %f = OpFunction %void None %8 - %11 = OpLabel - %s = OpVariable %_ptr_Function_S Function %18 - %21 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 - %23 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 - %24 = OpLoad %int %23 - %26 = OpAccessChain %_ptr_Function_int %s %uint_0 %24 - %27 = OpLoad %int %26 - OpStore %21 %27 + %f = OpFunction %void None %10 + %13 = OpLabel + %s = OpVariable %_ptr_Function_S Function %20 + %23 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %uint_0 + %25 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %uint_0 + %26 = OpLoad %int %25 + %28 = OpAccessChain %_ptr_Function_int %s %uint_0 %26 + %29 = OpLoad %int %28 + OpStore %23 %29 OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/dyn_array_idx/read/private.wgsl.expected.glsl b/test/tint/bug/fxc/dyn_array_idx/read/private.wgsl.expected.glsl index 6b7cb32a44..97160f50cb 100644 --- a/test/tint/bug/fxc/dyn_array_idx/read/private.wgsl.expected.glsl +++ b/test/tint/bug/fxc/dyn_array_idx/read/private.wgsl.expected.glsl @@ -1,23 +1,31 @@ #version 310 es -layout(binding = 0, std140) uniform UBO_ubo { +struct UBO { int dynamic_idx; uint pad; uint pad_1; uint pad_2; +}; + +layout(binding = 0, std140) uniform ubo_block_ubo { + UBO inner; } ubo; struct S { int data[64]; }; -layout(binding = 1, std430) buffer Result_ssbo { +struct Result { int tint_symbol; +}; + +layout(binding = 1, std430) buffer result_block_ssbo { + Result inner; } result; S s = S(int[64](0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); void f() { - result.tint_symbol = s.data[ubo.dynamic_idx]; + result.inner.tint_symbol = s.data[ubo.inner.dynamic_idx]; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/fxc/dyn_array_idx/read/private.wgsl.expected.spvasm b/test/tint/bug/fxc/dyn_array_idx/read/private.wgsl.expected.spvasm index 54eb08ef2a..7afcce61e0 100644 --- a/test/tint/bug/fxc/dyn_array_idx/read/private.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/dyn_array_idx/read/private.wgsl.expected.spvasm @@ -1,15 +1,19 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 28 +; Bound: 30 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %f "f" OpExecutionMode %f LocalSize 1 1 1 + OpName %ubo_block "ubo_block" + OpMemberName %ubo_block 0 "inner" OpName %UBO "UBO" OpMemberName %UBO 0 "dynamic_idx" OpName %ubo "ubo" + OpName %result_block "result_block" + OpMemberName %result_block 0 "inner" OpName %Result "Result" OpMemberName %Result 0 "out" OpName %result "result" @@ -17,12 +21,14 @@ OpMemberName %S 0 "data" OpName %s "s" OpName %f "f" - OpDecorate %UBO Block + OpDecorate %ubo_block Block + OpMemberDecorate %ubo_block 0 Offset 0 OpMemberDecorate %UBO 0 Offset 0 OpDecorate %ubo NonWritable OpDecorate %ubo DescriptorSet 0 OpDecorate %ubo Binding 0 - OpDecorate %Result Block + OpDecorate %result_block Block + OpMemberDecorate %result_block 0 Offset 0 OpMemberDecorate %Result 0 Offset 0 OpDecorate %result DescriptorSet 0 OpDecorate %result Binding 1 @@ -30,31 +36,33 @@ OpDecorate %_arr_int_uint_64 ArrayStride 4 %int = OpTypeInt 32 1 %UBO = OpTypeStruct %int -%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO - %ubo = OpVariable %_ptr_Uniform_UBO Uniform + %ubo_block = OpTypeStruct %UBO +%_ptr_Uniform_ubo_block = OpTypePointer Uniform %ubo_block + %ubo = OpVariable %_ptr_Uniform_ubo_block Uniform %Result = OpTypeStruct %int -%_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result - %result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer +%result_block = OpTypeStruct %Result +%_ptr_StorageBuffer_result_block = OpTypePointer StorageBuffer %result_block + %result = OpVariable %_ptr_StorageBuffer_result_block StorageBuffer %uint = OpTypeInt 32 0 %uint_64 = OpConstant %uint 64 %_arr_int_uint_64 = OpTypeArray %int %uint_64 %S = OpTypeStruct %_arr_int_uint_64 %_ptr_Private_S = OpTypePointer Private %S - %14 = OpConstantNull %S - %s = OpVariable %_ptr_Private_S Private %14 + %16 = OpConstantNull %S + %s = OpVariable %_ptr_Private_S Private %16 %void = OpTypeVoid - %15 = OpTypeFunction %void + %17 = OpTypeFunction %void %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_Uniform_int = OpTypePointer Uniform %int %_ptr_Private_int = OpTypePointer Private %int - %f = OpFunction %void None %15 - %18 = OpLabel - %21 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 - %23 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 - %24 = OpLoad %int %23 - %26 = OpAccessChain %_ptr_Private_int %s %uint_0 %24 - %27 = OpLoad %int %26 - OpStore %21 %27 + %f = OpFunction %void None %17 + %20 = OpLabel + %23 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %uint_0 + %25 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %uint_0 + %26 = OpLoad %int %25 + %28 = OpAccessChain %_ptr_Private_int %s %uint_0 %26 + %29 = OpLoad %int %28 + OpStore %23 %29 OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/dyn_array_idx/read/storage.wgsl.expected.glsl b/test/tint/bug/fxc/dyn_array_idx/read/storage.wgsl.expected.glsl index dee0c361f3..a80c5ccde0 100644 --- a/test/tint/bug/fxc/dyn_array_idx/read/storage.wgsl.expected.glsl +++ b/test/tint/bug/fxc/dyn_array_idx/read/storage.wgsl.expected.glsl @@ -1,22 +1,34 @@ #version 310 es -layout(binding = 0, std140) uniform UBO_ubo { +struct UBO { int dynamic_idx; uint pad; uint pad_1; uint pad_2; +}; + +layout(binding = 0, std140) uniform ubo_block_ubo { + UBO inner; } ubo; -layout(binding = 2, std430) buffer Result_ssbo { +struct Result { int tint_symbol; +}; + +layout(binding = 2, std430) buffer result_block_ssbo { + Result inner; } result; -layout(binding = 1, std430) buffer SSBO_ssbo { +struct SSBO { int data[4]; +}; + +layout(binding = 1, std430) buffer ssbo_block_ssbo { + SSBO inner; } ssbo; void f() { - result.tint_symbol = ssbo.data[ubo.dynamic_idx]; + result.inner.tint_symbol = ssbo.inner.data[ubo.inner.dynamic_idx]; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/fxc/dyn_array_idx/read/storage.wgsl.expected.spvasm b/test/tint/bug/fxc/dyn_array_idx/read/storage.wgsl.expected.spvasm index b5c4ce429a..997d5fb630 100644 --- a/test/tint/bug/fxc/dyn_array_idx/read/storage.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/dyn_array_idx/read/storage.wgsl.expected.spvasm @@ -1,61 +1,73 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 26 +; Bound: 29 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %f "f" OpExecutionMode %f LocalSize 1 1 1 + OpName %ubo_block "ubo_block" + OpMemberName %ubo_block 0 "inner" OpName %UBO "UBO" OpMemberName %UBO 0 "dynamic_idx" OpName %ubo "ubo" + OpName %result_block "result_block" + OpMemberName %result_block 0 "inner" OpName %Result "Result" OpMemberName %Result 0 "out" OpName %result "result" + OpName %ssbo_block "ssbo_block" + OpMemberName %ssbo_block 0 "inner" OpName %SSBO "SSBO" OpMemberName %SSBO 0 "data" OpName %ssbo "ssbo" OpName %f "f" - OpDecorate %UBO Block + OpDecorate %ubo_block Block + OpMemberDecorate %ubo_block 0 Offset 0 OpMemberDecorate %UBO 0 Offset 0 OpDecorate %ubo NonWritable OpDecorate %ubo DescriptorSet 0 OpDecorate %ubo Binding 0 - OpDecorate %Result Block + OpDecorate %result_block Block + OpMemberDecorate %result_block 0 Offset 0 OpMemberDecorate %Result 0 Offset 0 OpDecorate %result DescriptorSet 0 OpDecorate %result Binding 2 - OpDecorate %SSBO Block + OpDecorate %ssbo_block Block + OpMemberDecorate %ssbo_block 0 Offset 0 OpMemberDecorate %SSBO 0 Offset 0 OpDecorate %_arr_int_uint_4 ArrayStride 4 OpDecorate %ssbo DescriptorSet 0 OpDecorate %ssbo Binding 1 %int = OpTypeInt 32 1 %UBO = OpTypeStruct %int -%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO - %ubo = OpVariable %_ptr_Uniform_UBO Uniform + %ubo_block = OpTypeStruct %UBO +%_ptr_Uniform_ubo_block = OpTypePointer Uniform %ubo_block + %ubo = OpVariable %_ptr_Uniform_ubo_block Uniform %Result = OpTypeStruct %int -%_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result - %result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer +%result_block = OpTypeStruct %Result +%_ptr_StorageBuffer_result_block = OpTypePointer StorageBuffer %result_block + %result = OpVariable %_ptr_StorageBuffer_result_block StorageBuffer %uint = OpTypeInt 32 0 %uint_4 = OpConstant %uint 4 %_arr_int_uint_4 = OpTypeArray %int %uint_4 %SSBO = OpTypeStruct %_arr_int_uint_4 -%_ptr_StorageBuffer_SSBO = OpTypePointer StorageBuffer %SSBO - %ssbo = OpVariable %_ptr_StorageBuffer_SSBO StorageBuffer + %ssbo_block = OpTypeStruct %SSBO +%_ptr_StorageBuffer_ssbo_block = OpTypePointer StorageBuffer %ssbo_block + %ssbo = OpVariable %_ptr_StorageBuffer_ssbo_block StorageBuffer %void = OpTypeVoid - %14 = OpTypeFunction %void + %17 = OpTypeFunction %void %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_Uniform_int = OpTypePointer Uniform %int - %f = OpFunction %void None %14 - %17 = OpLabel - %20 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 - %22 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 - %23 = OpLoad %int %22 - %24 = OpAccessChain %_ptr_StorageBuffer_int %ssbo %uint_0 %23 - %25 = OpLoad %int %24 - OpStore %20 %25 + %f = OpFunction %void None %17 + %20 = OpLabel + %23 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %uint_0 + %25 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %uint_0 + %26 = OpLoad %int %25 + %27 = OpAccessChain %_ptr_StorageBuffer_int %ssbo %uint_0 %uint_0 %26 + %28 = OpLoad %int %27 + OpStore %23 %28 OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/dyn_array_idx/read/uniform.wgsl.expected.glsl b/test/tint/bug/fxc/dyn_array_idx/read/uniform.wgsl.expected.glsl index ec3aa7d009..92d115783e 100644 --- a/test/tint/bug/fxc/dyn_array_idx/read/uniform.wgsl.expected.glsl +++ b/test/tint/bug/fxc/dyn_array_idx/read/uniform.wgsl.expected.glsl @@ -1,19 +1,27 @@ #version 310 es -layout(binding = 0, std140) uniform UBO_ubo { +struct UBO { ivec4 data[4]; int dynamic_idx; uint pad; uint pad_1; uint pad_2; +}; + +layout(binding = 0, std140) uniform ubo_block_ubo { + UBO inner; } ubo; -layout(binding = 2, std430) buffer Result_ssbo { +struct Result { int tint_symbol; +}; + +layout(binding = 2, std430) buffer result_block_ssbo { + Result inner; } result; void f() { - result.tint_symbol = ubo.data[ubo.dynamic_idx].x; + result.inner.tint_symbol = ubo.inner.data[ubo.inner.dynamic_idx].x; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/fxc/dyn_array_idx/read/uniform.wgsl.expected.spvasm b/test/tint/bug/fxc/dyn_array_idx/read/uniform.wgsl.expected.spvasm index 8e837ac586..f20543aa70 100644 --- a/test/tint/bug/fxc/dyn_array_idx/read/uniform.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/dyn_array_idx/read/uniform.wgsl.expected.spvasm @@ -1,28 +1,34 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 25 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %f "f" OpExecutionMode %f LocalSize 1 1 1 + OpName %ubo_block "ubo_block" + OpMemberName %ubo_block 0 "inner" OpName %UBO "UBO" OpMemberName %UBO 0 "data" OpMemberName %UBO 1 "dynamic_idx" OpName %ubo "ubo" + OpName %result_block "result_block" + OpMemberName %result_block 0 "inner" OpName %Result "Result" OpMemberName %Result 0 "out" OpName %result "result" OpName %f "f" - OpDecorate %UBO Block + OpDecorate %ubo_block Block + OpMemberDecorate %ubo_block 0 Offset 0 OpMemberDecorate %UBO 0 Offset 0 OpDecorate %_arr_v4int_uint_4 ArrayStride 16 OpMemberDecorate %UBO 1 Offset 64 OpDecorate %ubo NonWritable OpDecorate %ubo DescriptorSet 0 OpDecorate %ubo Binding 0 - OpDecorate %Result Block + OpDecorate %result_block Block + OpMemberDecorate %result_block 0 Offset 0 OpMemberDecorate %Result 0 Offset 0 OpDecorate %result DescriptorSet 0 OpDecorate %result Binding 2 @@ -32,24 +38,26 @@ %uint_4 = OpConstant %uint 4 %_arr_v4int_uint_4 = OpTypeArray %v4int %uint_4 %UBO = OpTypeStruct %_arr_v4int_uint_4 %int -%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO - %ubo = OpVariable %_ptr_Uniform_UBO Uniform + %ubo_block = OpTypeStruct %UBO +%_ptr_Uniform_ubo_block = OpTypePointer Uniform %ubo_block + %ubo = OpVariable %_ptr_Uniform_ubo_block Uniform %Result = OpTypeStruct %int -%_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result - %result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer +%result_block = OpTypeStruct %Result +%_ptr_StorageBuffer_result_block = OpTypePointer StorageBuffer %result_block + %result = OpVariable %_ptr_StorageBuffer_result_block StorageBuffer %void = OpTypeVoid - %12 = OpTypeFunction %void + %14 = OpTypeFunction %void %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %uint_1 = OpConstant %uint 1 %_ptr_Uniform_int = OpTypePointer Uniform %int - %f = OpFunction %void None %12 - %15 = OpLabel - %18 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 - %21 = OpAccessChain %_ptr_Uniform_int %ubo %uint_1 - %22 = OpLoad %int %21 - %23 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %22 %uint_0 + %f = OpFunction %void None %14 + %17 = OpLabel + %20 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %uint_0 + %23 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %uint_1 %24 = OpLoad %int %23 - OpStore %18 %24 + %25 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %uint_0 %24 %uint_0 + %26 = OpLoad %int %25 + OpStore %20 %26 OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.glsl b/test/tint/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.glsl index c163eef147..76d11fb18f 100644 --- a/test/tint/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.glsl +++ b/test/tint/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.glsl @@ -1,18 +1,26 @@ #version 310 es -layout(binding = 0, std140) uniform UBO_ubo { +struct UBO { int dynamic_idx; uint pad; uint pad_1; uint pad_2; +}; + +layout(binding = 0, std140) uniform ubo_block_ubo { + UBO inner; } ubo; struct S { int data[64]; }; -layout(binding = 1, std430) buffer Result_ssbo { +struct Result { int tint_symbol; +}; + +layout(binding = 1, std430) buffer result_block_ssbo { + Result inner; } result; shared S s; @@ -24,7 +32,7 @@ void f(uint local_invocation_index) { } } barrier(); - result.tint_symbol = s.data[ubo.dynamic_idx]; + result.inner.tint_symbol = s.data[ubo.inner.dynamic_idx]; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.spvasm b/test/tint/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.spvasm index fcbdc4dbbb..2d89a9939f 100644 --- a/test/tint/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/dyn_array_idx/read/workgroup.wgsl.expected.spvasm @@ -1,16 +1,20 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 57 +; Bound: 59 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %f "f" %local_invocation_index_1 OpExecutionMode %f LocalSize 1 1 1 OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %ubo_block "ubo_block" + OpMemberName %ubo_block 0 "inner" OpName %UBO "UBO" OpMemberName %UBO 0 "dynamic_idx" OpName %ubo "ubo" + OpName %result_block "result_block" + OpMemberName %result_block 0 "inner" OpName %Result "Result" OpMemberName %Result 0 "out" OpName %result "result" @@ -22,12 +26,14 @@ OpName %idx "idx" OpName %f "f" OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex - OpDecorate %UBO Block + OpDecorate %ubo_block Block + OpMemberDecorate %ubo_block 0 Offset 0 OpMemberDecorate %UBO 0 Offset 0 OpDecorate %ubo NonWritable OpDecorate %ubo DescriptorSet 0 OpDecorate %ubo Binding 0 - OpDecorate %Result Block + OpDecorate %result_block Block + OpMemberDecorate %result_block 0 Offset 0 OpMemberDecorate %Result 0 Offset 0 OpDecorate %result DescriptorSet 0 OpDecorate %result Binding 1 @@ -38,70 +44,72 @@ %local_invocation_index_1 = OpVariable %_ptr_Input_uint Input %int = OpTypeInt 32 1 %UBO = OpTypeStruct %int -%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO - %ubo = OpVariable %_ptr_Uniform_UBO Uniform + %ubo_block = OpTypeStruct %UBO +%_ptr_Uniform_ubo_block = OpTypePointer Uniform %ubo_block + %ubo = OpVariable %_ptr_Uniform_ubo_block Uniform %Result = OpTypeStruct %int -%_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result - %result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer +%result_block = OpTypeStruct %Result +%_ptr_StorageBuffer_result_block = OpTypePointer StorageBuffer %result_block + %result = OpVariable %_ptr_StorageBuffer_result_block StorageBuffer %uint_64 = OpConstant %uint 64 %_arr_int_uint_64 = OpTypeArray %int %uint_64 %S = OpTypeStruct %_arr_int_uint_64 %_ptr_Workgroup_S = OpTypePointer Workgroup %S %s = OpVariable %_ptr_Workgroup_S Workgroup %void = OpTypeVoid - %16 = OpTypeFunction %void %uint + %18 = OpTypeFunction %void %uint %_ptr_Function_uint = OpTypePointer Function %uint - %23 = OpConstantNull %uint + %25 = OpConstantNull %uint %bool = OpTypeBool %uint_0 = OpConstant %uint 0 %_ptr_Workgroup_int = OpTypePointer Workgroup %int - %38 = OpConstantNull %int + %40 = OpConstantNull %int %uint_1 = OpConstant %uint 1 %uint_2 = OpConstant %uint 2 %uint_264 = OpConstant %uint 264 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_Uniform_int = OpTypePointer Uniform %int - %52 = OpTypeFunction %void - %f_inner = OpFunction %void None %16 + %54 = OpTypeFunction %void + %f_inner = OpFunction %void None %18 %local_invocation_index = OpFunctionParameter %uint - %20 = OpLabel - %idx = OpVariable %_ptr_Function_uint Function %23 + %22 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function %25 OpStore %idx %local_invocation_index - OpBranch %24 - %24 = OpLabel - OpLoopMerge %25 %26 None - OpBranch %27 - %27 = OpLabel - %29 = OpLoad %uint %idx - %30 = OpULessThan %bool %29 %uint_64 - %28 = OpLogicalNot %bool %30 - OpSelectionMerge %32 None - OpBranchConditional %28 %33 %32 - %33 = OpLabel - OpBranch %25 - %32 = OpLabel - %34 = OpLoad %uint %idx - %37 = OpAccessChain %_ptr_Workgroup_int %s %uint_0 %34 - OpStore %37 %38 OpBranch %26 %26 = OpLabel - %39 = OpLoad %uint %idx - %41 = OpIAdd %uint %39 %uint_1 - OpStore %idx %41 - OpBranch %24 - %25 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %31 = OpLoad %uint %idx + %32 = OpULessThan %bool %31 %uint_64 + %30 = OpLogicalNot %bool %32 + OpSelectionMerge %34 None + OpBranchConditional %30 %35 %34 + %35 = OpLabel + OpBranch %27 + %34 = OpLabel + %36 = OpLoad %uint %idx + %39 = OpAccessChain %_ptr_Workgroup_int %s %uint_0 %36 + OpStore %39 %40 + OpBranch %28 + %28 = OpLabel + %41 = OpLoad %uint %idx + %43 = OpIAdd %uint %41 %uint_1 + OpStore %idx %43 + OpBranch %26 + %27 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_264 - %46 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 - %48 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 - %49 = OpLoad %int %48 - %50 = OpAccessChain %_ptr_Workgroup_int %s %uint_0 %49 + %48 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %uint_0 + %50 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %uint_0 %51 = OpLoad %int %50 - OpStore %46 %51 + %52 = OpAccessChain %_ptr_Workgroup_int %s %uint_0 %51 + %53 = OpLoad %int %52 + OpStore %48 %53 OpReturn OpFunctionEnd - %f = OpFunction %void None %52 - %54 = OpLabel - %56 = OpLoad %uint %local_invocation_index_1 - %55 = OpFunctionCall %void %f_inner %56 + %f = OpFunction %void None %54 + %56 = OpLabel + %58 = OpLoad %uint %local_invocation_index_1 + %57 = OpFunctionCall %void %f_inner %58 OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/dyn_array_idx/write/function.wgsl.expected.glsl b/test/tint/bug/fxc/dyn_array_idx/write/function.wgsl.expected.glsl index 635b4d853f..2c09302e4c 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/function.wgsl.expected.glsl +++ b/test/tint/bug/fxc/dyn_array_idx/write/function.wgsl.expected.glsl @@ -1,24 +1,32 @@ #version 310 es -layout(binding = 0, std140) uniform UBO_ubo { +struct UBO { int dynamic_idx; uint pad; uint pad_1; uint pad_2; +}; + +layout(binding = 0, std140) uniform ubo_block_ubo { + UBO inner; } ubo; struct S { int data[64]; }; -layout(binding = 1, std430) buffer Result_ssbo { +struct Result { int tint_symbol; +}; + +layout(binding = 1, std430) buffer result_block_ssbo { + Result inner; } result; void f() { S s = S(int[64](0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); - s.data[ubo.dynamic_idx] = 1; - result.tint_symbol = s.data[3]; + s.data[ubo.inner.dynamic_idx] = 1; + result.inner.tint_symbol = s.data[3]; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/fxc/dyn_array_idx/write/function.wgsl.expected.spvasm b/test/tint/bug/fxc/dyn_array_idx/write/function.wgsl.expected.spvasm index 46228e19d0..0424e2f219 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/function.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/dyn_array_idx/write/function.wgsl.expected.spvasm @@ -1,15 +1,19 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 31 +; Bound: 33 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %f "f" OpExecutionMode %f LocalSize 1 1 1 + OpName %ubo_block "ubo_block" + OpMemberName %ubo_block 0 "inner" OpName %UBO "UBO" OpMemberName %UBO 0 "dynamic_idx" OpName %ubo "ubo" + OpName %result_block "result_block" + OpMemberName %result_block 0 "inner" OpName %Result "Result" OpMemberName %Result 0 "out" OpName %result "result" @@ -17,12 +21,14 @@ OpName %S "S" OpMemberName %S 0 "data" OpName %s "s" - OpDecorate %UBO Block + OpDecorate %ubo_block Block + OpMemberDecorate %ubo_block 0 Offset 0 OpMemberDecorate %UBO 0 Offset 0 OpDecorate %ubo NonWritable OpDecorate %ubo DescriptorSet 0 OpDecorate %ubo Binding 0 - OpDecorate %Result Block + OpDecorate %result_block Block + OpMemberDecorate %result_block 0 Offset 0 OpMemberDecorate %Result 0 Offset 0 OpDecorate %result DescriptorSet 0 OpDecorate %result Binding 1 @@ -30,35 +36,37 @@ OpDecorate %_arr_int_uint_64 ArrayStride 4 %int = OpTypeInt 32 1 %UBO = OpTypeStruct %int -%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO - %ubo = OpVariable %_ptr_Uniform_UBO Uniform + %ubo_block = OpTypeStruct %UBO +%_ptr_Uniform_ubo_block = OpTypePointer Uniform %ubo_block + %ubo = OpVariable %_ptr_Uniform_ubo_block Uniform %Result = OpTypeStruct %int -%_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result - %result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer +%result_block = OpTypeStruct %Result +%_ptr_StorageBuffer_result_block = OpTypePointer StorageBuffer %result_block + %result = OpVariable %_ptr_StorageBuffer_result_block StorageBuffer %void = OpTypeVoid - %8 = OpTypeFunction %void + %10 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_64 = OpConstant %uint 64 %_arr_int_uint_64 = OpTypeArray %int %uint_64 %S = OpTypeStruct %_arr_int_uint_64 %_ptr_Function_S = OpTypePointer Function %S - %18 = OpConstantNull %S + %20 = OpConstantNull %S %uint_0 = OpConstant %uint 0 %_ptr_Uniform_int = OpTypePointer Uniform %int %_ptr_Function_int = OpTypePointer Function %int %int_1 = OpConstant %int 1 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_3 = OpConstant %int 3 - %f = OpFunction %void None %8 - %11 = OpLabel - %s = OpVariable %_ptr_Function_S Function %18 - %21 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 - %22 = OpLoad %int %21 - %24 = OpAccessChain %_ptr_Function_int %s %uint_0 %22 - OpStore %24 %int_1 - %27 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 - %29 = OpAccessChain %_ptr_Function_int %s %uint_0 %int_3 - %30 = OpLoad %int %29 - OpStore %27 %30 + %f = OpFunction %void None %10 + %13 = OpLabel + %s = OpVariable %_ptr_Function_S Function %20 + %23 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %uint_0 + %24 = OpLoad %int %23 + %26 = OpAccessChain %_ptr_Function_int %s %uint_0 %24 + OpStore %26 %int_1 + %29 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %uint_0 + %31 = OpAccessChain %_ptr_Function_int %s %uint_0 %int_3 + %32 = OpLoad %int %31 + OpStore %29 %32 OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/dyn_array_idx/write/function_via_param.wgsl.expected.glsl b/test/tint/bug/fxc/dyn_array_idx/write/function_via_param.wgsl.expected.glsl index 5286aa6b4c..ad127fc738 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/function_via_param.wgsl.expected.glsl +++ b/test/tint/bug/fxc/dyn_array_idx/write/function_via_param.wgsl.expected.glsl @@ -1,28 +1,36 @@ #version 310 es -layout(binding = 0, std140) uniform UBO_ubo { +struct UBO { int dynamic_idx; uint pad; uint pad_1; uint pad_2; +}; + +layout(binding = 0, std140) uniform ubo_block_ubo { + UBO inner; } ubo; struct S { int data[64]; }; -layout(binding = 1, std430) buffer Result_ssbo { +struct Result { int tint_symbol; +}; + +layout(binding = 1, std430) buffer result_block_ssbo { + Result inner; } result; void x(inout S p) { - p.data[ubo.dynamic_idx] = 1; + p.data[ubo.inner.dynamic_idx] = 1; } void f() { S s = S(int[64](0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); x(s); - result.tint_symbol = s.data[3]; + result.inner.tint_symbol = s.data[3]; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/fxc/dyn_array_idx/write/function_via_param.wgsl.expected.spvasm b/test/tint/bug/fxc/dyn_array_idx/write/function_via_param.wgsl.expected.spvasm index 446b655cd8..9a4e1f9e14 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/function_via_param.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/dyn_array_idx/write/function_via_param.wgsl.expected.spvasm @@ -1,15 +1,19 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 38 +; Bound: 40 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %f "f" OpExecutionMode %f LocalSize 1 1 1 + OpName %ubo_block "ubo_block" + OpMemberName %ubo_block 0 "inner" OpName %UBO "UBO" OpMemberName %UBO 0 "dynamic_idx" OpName %ubo "ubo" + OpName %result_block "result_block" + OpMemberName %result_block 0 "inner" OpName %Result "Result" OpMemberName %Result 0 "out" OpName %result "result" @@ -19,12 +23,14 @@ OpName %p "p" OpName %f "f" OpName %s "s" - OpDecorate %UBO Block + OpDecorate %ubo_block Block + OpMemberDecorate %ubo_block 0 Offset 0 OpMemberDecorate %UBO 0 Offset 0 OpDecorate %ubo NonWritable OpDecorate %ubo DescriptorSet 0 OpDecorate %ubo Binding 0 - OpDecorate %Result Block + OpDecorate %result_block Block + OpMemberDecorate %result_block 0 Offset 0 OpMemberDecorate %Result 0 Offset 0 OpDecorate %result DescriptorSet 0 OpDecorate %result Binding 1 @@ -32,42 +38,44 @@ OpDecorate %_arr_int_uint_64 ArrayStride 4 %int = OpTypeInt 32 1 %UBO = OpTypeStruct %int -%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO - %ubo = OpVariable %_ptr_Uniform_UBO Uniform + %ubo_block = OpTypeStruct %UBO +%_ptr_Uniform_ubo_block = OpTypePointer Uniform %ubo_block + %ubo = OpVariable %_ptr_Uniform_ubo_block Uniform %Result = OpTypeStruct %int -%_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result - %result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer +%result_block = OpTypeStruct %Result +%_ptr_StorageBuffer_result_block = OpTypePointer StorageBuffer %result_block + %result = OpVariable %_ptr_StorageBuffer_result_block StorageBuffer %void = OpTypeVoid %uint = OpTypeInt 32 0 %uint_64 = OpConstant %uint 64 %_arr_int_uint_64 = OpTypeArray %int %uint_64 %S = OpTypeStruct %_arr_int_uint_64 %_ptr_Function_S = OpTypePointer Function %S - %8 = OpTypeFunction %void %_ptr_Function_S + %10 = OpTypeFunction %void %_ptr_Function_S %uint_0 = OpConstant %uint 0 %_ptr_Uniform_int = OpTypePointer Uniform %int %_ptr_Function_int = OpTypePointer Function %int %int_1 = OpConstant %int 1 - %26 = OpTypeFunction %void - %30 = OpConstantNull %S + %28 = OpTypeFunction %void + %32 = OpConstantNull %S %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_3 = OpConstant %int 3 - %x = OpFunction %void None %8 + %x = OpFunction %void None %10 %p = OpFunctionParameter %_ptr_Function_S - %17 = OpLabel - %21 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 - %22 = OpLoad %int %21 - %24 = OpAccessChain %_ptr_Function_int %p %uint_0 %22 - OpStore %24 %int_1 + %19 = OpLabel + %23 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %uint_0 + %24 = OpLoad %int %23 + %26 = OpAccessChain %_ptr_Function_int %p %uint_0 %24 + OpStore %26 %int_1 OpReturn OpFunctionEnd - %f = OpFunction %void None %26 - %28 = OpLabel - %s = OpVariable %_ptr_Function_S Function %30 - %31 = OpFunctionCall %void %x %s - %34 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 - %36 = OpAccessChain %_ptr_Function_int %s %uint_0 %int_3 - %37 = OpLoad %int %36 - OpStore %34 %37 + %f = OpFunction %void None %28 + %30 = OpLabel + %s = OpVariable %_ptr_Function_S Function %32 + %33 = OpFunctionCall %void %x %s + %36 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %uint_0 + %38 = OpAccessChain %_ptr_Function_int %s %uint_0 %int_3 + %39 = OpLoad %int %38 + OpStore %36 %39 OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/dyn_array_idx/write/private.wgsl.expected.glsl b/test/tint/bug/fxc/dyn_array_idx/write/private.wgsl.expected.glsl index e1a897f394..5808563dc7 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/private.wgsl.expected.glsl +++ b/test/tint/bug/fxc/dyn_array_idx/write/private.wgsl.expected.glsl @@ -1,24 +1,32 @@ #version 310 es -layout(binding = 0, std140) uniform UBO_ubo { +struct UBO { int dynamic_idx; uint pad; uint pad_1; uint pad_2; +}; + +layout(binding = 0, std140) uniform ubo_block_ubo { + UBO inner; } ubo; struct S { int data[64]; }; -layout(binding = 1, std430) buffer Result_ssbo { +struct Result { int tint_symbol; +}; + +layout(binding = 1, std430) buffer result_block_ssbo { + Result inner; } result; S s = S(int[64](0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); void f() { - s.data[ubo.dynamic_idx] = 1; - result.tint_symbol = s.data[3]; + s.data[ubo.inner.dynamic_idx] = 1; + result.inner.tint_symbol = s.data[3]; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/fxc/dyn_array_idx/write/private.wgsl.expected.spvasm b/test/tint/bug/fxc/dyn_array_idx/write/private.wgsl.expected.spvasm index 341b1b8fcc..855b6af7c7 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/private.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/dyn_array_idx/write/private.wgsl.expected.spvasm @@ -1,15 +1,19 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 31 +; Bound: 33 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %f "f" OpExecutionMode %f LocalSize 1 1 1 + OpName %ubo_block "ubo_block" + OpMemberName %ubo_block 0 "inner" OpName %UBO "UBO" OpMemberName %UBO 0 "dynamic_idx" OpName %ubo "ubo" + OpName %result_block "result_block" + OpMemberName %result_block 0 "inner" OpName %Result "Result" OpMemberName %Result 0 "out" OpName %result "result" @@ -17,12 +21,14 @@ OpMemberName %S 0 "data" OpName %s "s" OpName %f "f" - OpDecorate %UBO Block + OpDecorate %ubo_block Block + OpMemberDecorate %ubo_block 0 Offset 0 OpMemberDecorate %UBO 0 Offset 0 OpDecorate %ubo NonWritable OpDecorate %ubo DescriptorSet 0 OpDecorate %ubo Binding 0 - OpDecorate %Result Block + OpDecorate %result_block Block + OpMemberDecorate %result_block 0 Offset 0 OpMemberDecorate %Result 0 Offset 0 OpDecorate %result DescriptorSet 0 OpDecorate %result Binding 1 @@ -30,35 +36,37 @@ OpDecorate %_arr_int_uint_64 ArrayStride 4 %int = OpTypeInt 32 1 %UBO = OpTypeStruct %int -%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO - %ubo = OpVariable %_ptr_Uniform_UBO Uniform + %ubo_block = OpTypeStruct %UBO +%_ptr_Uniform_ubo_block = OpTypePointer Uniform %ubo_block + %ubo = OpVariable %_ptr_Uniform_ubo_block Uniform %Result = OpTypeStruct %int -%_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result - %result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer +%result_block = OpTypeStruct %Result +%_ptr_StorageBuffer_result_block = OpTypePointer StorageBuffer %result_block + %result = OpVariable %_ptr_StorageBuffer_result_block StorageBuffer %uint = OpTypeInt 32 0 %uint_64 = OpConstant %uint 64 %_arr_int_uint_64 = OpTypeArray %int %uint_64 %S = OpTypeStruct %_arr_int_uint_64 %_ptr_Private_S = OpTypePointer Private %S - %14 = OpConstantNull %S - %s = OpVariable %_ptr_Private_S Private %14 + %16 = OpConstantNull %S + %s = OpVariable %_ptr_Private_S Private %16 %void = OpTypeVoid - %15 = OpTypeFunction %void + %17 = OpTypeFunction %void %uint_0 = OpConstant %uint 0 %_ptr_Uniform_int = OpTypePointer Uniform %int %_ptr_Private_int = OpTypePointer Private %int %int_1 = OpConstant %int 1 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_3 = OpConstant %int 3 - %f = OpFunction %void None %15 - %18 = OpLabel - %21 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 - %22 = OpLoad %int %21 - %24 = OpAccessChain %_ptr_Private_int %s %uint_0 %22 - OpStore %24 %int_1 - %27 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 - %29 = OpAccessChain %_ptr_Private_int %s %uint_0 %int_3 - %30 = OpLoad %int %29 - OpStore %27 %30 + %f = OpFunction %void None %17 + %20 = OpLabel + %23 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %uint_0 + %24 = OpLoad %int %23 + %26 = OpAccessChain %_ptr_Private_int %s %uint_0 %24 + OpStore %26 %int_1 + %29 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %uint_0 + %31 = OpAccessChain %_ptr_Private_int %s %uint_0 %int_3 + %32 = OpLoad %int %31 + OpStore %29 %32 OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/dyn_array_idx/write/private_via_param.wgsl.expected.glsl b/test/tint/bug/fxc/dyn_array_idx/write/private_via_param.wgsl.expected.glsl index 12ca09ab8a..63ead6fee0 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/private_via_param.wgsl.expected.glsl +++ b/test/tint/bug/fxc/dyn_array_idx/write/private_via_param.wgsl.expected.glsl @@ -1,28 +1,36 @@ #version 310 es -layout(binding = 0, std140) uniform UBO_ubo { +struct UBO { int dynamic_idx; uint pad; uint pad_1; uint pad_2; +}; + +layout(binding = 0, std140) uniform ubo_block_ubo { + UBO inner; } ubo; struct S { int data[64]; }; -layout(binding = 1, std430) buffer Result_ssbo { +struct Result { int tint_symbol; +}; + +layout(binding = 1, std430) buffer result_block_ssbo { + Result inner; } result; S s = S(int[64](0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); void x(inout S p) { - p.data[ubo.dynamic_idx] = 1; + p.data[ubo.inner.dynamic_idx] = 1; } void f() { x(s); - result.tint_symbol = s.data[3]; + result.inner.tint_symbol = s.data[3]; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/fxc/dyn_array_idx/write/private_via_param.wgsl.expected.spvasm b/test/tint/bug/fxc/dyn_array_idx/write/private_via_param.wgsl.expected.spvasm index 224618fad3..d4613464c2 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/private_via_param.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/dyn_array_idx/write/private_via_param.wgsl.expected.spvasm @@ -1,15 +1,19 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 38 +; Bound: 40 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %f "f" OpExecutionMode %f LocalSize 1 1 1 + OpName %ubo_block "ubo_block" + OpMemberName %ubo_block 0 "inner" OpName %UBO "UBO" OpMemberName %UBO 0 "dynamic_idx" OpName %ubo "ubo" + OpName %result_block "result_block" + OpMemberName %result_block 0 "inner" OpName %Result "Result" OpMemberName %Result 0 "out" OpName %result "result" @@ -19,12 +23,14 @@ OpName %x "x" OpName %p "p" OpName %f "f" - OpDecorate %UBO Block + OpDecorate %ubo_block Block + OpMemberDecorate %ubo_block 0 Offset 0 OpMemberDecorate %UBO 0 Offset 0 OpDecorate %ubo NonWritable OpDecorate %ubo DescriptorSet 0 OpDecorate %ubo Binding 0 - OpDecorate %Result Block + OpDecorate %result_block Block + OpMemberDecorate %result_block 0 Offset 0 OpMemberDecorate %Result 0 Offset 0 OpDecorate %result DescriptorSet 0 OpDecorate %result Binding 1 @@ -32,42 +38,44 @@ OpDecorate %_arr_int_uint_64 ArrayStride 4 %int = OpTypeInt 32 1 %UBO = OpTypeStruct %int -%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO - %ubo = OpVariable %_ptr_Uniform_UBO Uniform + %ubo_block = OpTypeStruct %UBO +%_ptr_Uniform_ubo_block = OpTypePointer Uniform %ubo_block + %ubo = OpVariable %_ptr_Uniform_ubo_block Uniform %Result = OpTypeStruct %int -%_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result - %result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer +%result_block = OpTypeStruct %Result +%_ptr_StorageBuffer_result_block = OpTypePointer StorageBuffer %result_block + %result = OpVariable %_ptr_StorageBuffer_result_block StorageBuffer %uint = OpTypeInt 32 0 %uint_64 = OpConstant %uint 64 %_arr_int_uint_64 = OpTypeArray %int %uint_64 %S = OpTypeStruct %_arr_int_uint_64 %_ptr_Private_S = OpTypePointer Private %S - %14 = OpConstantNull %S - %s = OpVariable %_ptr_Private_S Private %14 + %16 = OpConstantNull %S + %s = OpVariable %_ptr_Private_S Private %16 %void = OpTypeVoid - %15 = OpTypeFunction %void %_ptr_Private_S + %17 = OpTypeFunction %void %_ptr_Private_S %uint_0 = OpConstant %uint 0 %_ptr_Uniform_int = OpTypePointer Uniform %int %_ptr_Private_int = OpTypePointer Private %int %int_1 = OpConstant %int 1 - %28 = OpTypeFunction %void + %30 = OpTypeFunction %void %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_3 = OpConstant %int 3 - %x = OpFunction %void None %15 + %x = OpFunction %void None %17 %p = OpFunctionParameter %_ptr_Private_S - %19 = OpLabel - %23 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 - %24 = OpLoad %int %23 - %26 = OpAccessChain %_ptr_Private_int %p %uint_0 %24 - OpStore %26 %int_1 + %21 = OpLabel + %25 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %uint_0 + %26 = OpLoad %int %25 + %28 = OpAccessChain %_ptr_Private_int %p %uint_0 %26 + OpStore %28 %int_1 OpReturn OpFunctionEnd - %f = OpFunction %void None %28 - %30 = OpLabel - %31 = OpFunctionCall %void %x %s - %34 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 - %36 = OpAccessChain %_ptr_Private_int %s %uint_0 %int_3 - %37 = OpLoad %int %36 - OpStore %34 %37 + %f = OpFunction %void None %30 + %32 = OpLabel + %33 = OpFunctionCall %void %x %s + %36 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %uint_0 + %38 = OpAccessChain %_ptr_Private_int %s %uint_0 %int_3 + %39 = OpLoad %int %38 + OpStore %36 %39 OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/dyn_array_idx/write/storage.wgsl.expected.glsl b/test/tint/bug/fxc/dyn_array_idx/write/storage.wgsl.expected.glsl index be6fc9c478..8e90807c88 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/storage.wgsl.expected.glsl +++ b/test/tint/bug/fxc/dyn_array_idx/write/storage.wgsl.expected.glsl @@ -1,23 +1,35 @@ #version 310 es -layout(binding = 0, std140) uniform UBO_ubo { +struct UBO { int dynamic_idx; uint pad; uint pad_1; uint pad_2; +}; + +layout(binding = 0, std140) uniform ubo_block_ubo { + UBO inner; } ubo; -layout(binding = 2, std430) buffer Result_ssbo { +struct Result { int tint_symbol; +}; + +layout(binding = 2, std430) buffer result_block_ssbo { + Result inner; } result; -layout(binding = 1, std430) buffer SSBO_ssbo { +struct SSBO { int data[4]; +}; + +layout(binding = 1, std430) buffer ssbo_block_ssbo { + SSBO inner; } ssbo; void f() { - ssbo.data[ubo.dynamic_idx] = 1; - result.tint_symbol = ssbo.data[3]; + ssbo.inner.data[ubo.inner.dynamic_idx] = 1; + result.inner.tint_symbol = ssbo.inner.data[3]; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/fxc/dyn_array_idx/write/storage.wgsl.expected.spvasm b/test/tint/bug/fxc/dyn_array_idx/write/storage.wgsl.expected.spvasm index 85915c5102..3a20399d7d 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/storage.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/dyn_array_idx/write/storage.wgsl.expected.spvasm @@ -1,65 +1,77 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 29 +; Bound: 32 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %f "f" OpExecutionMode %f LocalSize 1 1 1 + OpName %ubo_block "ubo_block" + OpMemberName %ubo_block 0 "inner" OpName %UBO "UBO" OpMemberName %UBO 0 "dynamic_idx" OpName %ubo "ubo" + OpName %result_block "result_block" + OpMemberName %result_block 0 "inner" OpName %Result "Result" OpMemberName %Result 0 "out" OpName %result "result" + OpName %ssbo_block "ssbo_block" + OpMemberName %ssbo_block 0 "inner" OpName %SSBO "SSBO" OpMemberName %SSBO 0 "data" OpName %ssbo "ssbo" OpName %f "f" - OpDecorate %UBO Block + OpDecorate %ubo_block Block + OpMemberDecorate %ubo_block 0 Offset 0 OpMemberDecorate %UBO 0 Offset 0 OpDecorate %ubo NonWritable OpDecorate %ubo DescriptorSet 0 OpDecorate %ubo Binding 0 - OpDecorate %Result Block + OpDecorate %result_block Block + OpMemberDecorate %result_block 0 Offset 0 OpMemberDecorate %Result 0 Offset 0 OpDecorate %result DescriptorSet 0 OpDecorate %result Binding 2 - OpDecorate %SSBO Block + OpDecorate %ssbo_block Block + OpMemberDecorate %ssbo_block 0 Offset 0 OpMemberDecorate %SSBO 0 Offset 0 OpDecorate %_arr_int_uint_4 ArrayStride 4 OpDecorate %ssbo DescriptorSet 0 OpDecorate %ssbo Binding 1 %int = OpTypeInt 32 1 %UBO = OpTypeStruct %int -%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO - %ubo = OpVariable %_ptr_Uniform_UBO Uniform + %ubo_block = OpTypeStruct %UBO +%_ptr_Uniform_ubo_block = OpTypePointer Uniform %ubo_block + %ubo = OpVariable %_ptr_Uniform_ubo_block Uniform %Result = OpTypeStruct %int -%_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result - %result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer +%result_block = OpTypeStruct %Result +%_ptr_StorageBuffer_result_block = OpTypePointer StorageBuffer %result_block + %result = OpVariable %_ptr_StorageBuffer_result_block StorageBuffer %uint = OpTypeInt 32 0 %uint_4 = OpConstant %uint 4 %_arr_int_uint_4 = OpTypeArray %int %uint_4 %SSBO = OpTypeStruct %_arr_int_uint_4 -%_ptr_StorageBuffer_SSBO = OpTypePointer StorageBuffer %SSBO - %ssbo = OpVariable %_ptr_StorageBuffer_SSBO StorageBuffer + %ssbo_block = OpTypeStruct %SSBO +%_ptr_StorageBuffer_ssbo_block = OpTypePointer StorageBuffer %ssbo_block + %ssbo = OpVariable %_ptr_StorageBuffer_ssbo_block StorageBuffer %void = OpTypeVoid - %14 = OpTypeFunction %void + %17 = OpTypeFunction %void %uint_0 = OpConstant %uint 0 %_ptr_Uniform_int = OpTypePointer Uniform %int %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_1 = OpConstant %int 1 %int_3 = OpConstant %int 3 - %f = OpFunction %void None %14 - %17 = OpLabel - %20 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 - %21 = OpLoad %int %20 - %23 = OpAccessChain %_ptr_StorageBuffer_int %ssbo %uint_0 %21 - OpStore %23 %int_1 - %25 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 - %27 = OpAccessChain %_ptr_StorageBuffer_int %ssbo %uint_0 %int_3 - %28 = OpLoad %int %27 - OpStore %25 %28 + %f = OpFunction %void None %17 + %20 = OpLabel + %23 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %uint_0 + %24 = OpLoad %int %23 + %26 = OpAccessChain %_ptr_StorageBuffer_int %ssbo %uint_0 %uint_0 %24 + OpStore %26 %int_1 + %28 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %uint_0 + %30 = OpAccessChain %_ptr_StorageBuffer_int %ssbo %uint_0 %uint_0 %int_3 + %31 = OpLoad %int %30 + OpStore %28 %31 OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.glsl b/test/tint/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.glsl index 417dbdf73f..228d9794ea 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.glsl +++ b/test/tint/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.glsl @@ -1,18 +1,26 @@ #version 310 es -layout(binding = 0, std140) uniform UBO_ubo { +struct UBO { int dynamic_idx; uint pad; uint pad_1; uint pad_2; +}; + +layout(binding = 0, std140) uniform ubo_block_ubo { + UBO inner; } ubo; struct S { int data[64]; }; -layout(binding = 1, std430) buffer Result_ssbo { +struct Result { int tint_symbol; +}; + +layout(binding = 1, std430) buffer result_block_ssbo { + Result inner; } result; shared S s; @@ -24,8 +32,8 @@ void f(uint local_invocation_index) { } } barrier(); - s.data[ubo.dynamic_idx] = 1; - result.tint_symbol = s.data[3]; + s.data[ubo.inner.dynamic_idx] = 1; + result.inner.tint_symbol = s.data[3]; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.spvasm b/test/tint/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.spvasm index 830149d7d2..19f5cafb3a 100644 --- a/test/tint/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/dyn_array_idx/write/workgroup.wgsl.expected.spvasm @@ -1,16 +1,20 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 60 +; Bound: 62 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %f "f" %local_invocation_index_1 OpExecutionMode %f LocalSize 1 1 1 OpName %local_invocation_index_1 "local_invocation_index_1" + OpName %ubo_block "ubo_block" + OpMemberName %ubo_block 0 "inner" OpName %UBO "UBO" OpMemberName %UBO 0 "dynamic_idx" OpName %ubo "ubo" + OpName %result_block "result_block" + OpMemberName %result_block 0 "inner" OpName %Result "Result" OpMemberName %Result 0 "out" OpName %result "result" @@ -22,12 +26,14 @@ OpName %idx "idx" OpName %f "f" OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex - OpDecorate %UBO Block + OpDecorate %ubo_block Block + OpMemberDecorate %ubo_block 0 Offset 0 OpMemberDecorate %UBO 0 Offset 0 OpDecorate %ubo NonWritable OpDecorate %ubo DescriptorSet 0 OpDecorate %ubo Binding 0 - OpDecorate %Result Block + OpDecorate %result_block Block + OpMemberDecorate %result_block 0 Offset 0 OpMemberDecorate %Result 0 Offset 0 OpDecorate %result DescriptorSet 0 OpDecorate %result Binding 1 @@ -38,24 +44,26 @@ %local_invocation_index_1 = OpVariable %_ptr_Input_uint Input %int = OpTypeInt 32 1 %UBO = OpTypeStruct %int -%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO - %ubo = OpVariable %_ptr_Uniform_UBO Uniform + %ubo_block = OpTypeStruct %UBO +%_ptr_Uniform_ubo_block = OpTypePointer Uniform %ubo_block + %ubo = OpVariable %_ptr_Uniform_ubo_block Uniform %Result = OpTypeStruct %int -%_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result - %result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer +%result_block = OpTypeStruct %Result +%_ptr_StorageBuffer_result_block = OpTypePointer StorageBuffer %result_block + %result = OpVariable %_ptr_StorageBuffer_result_block StorageBuffer %uint_64 = OpConstant %uint 64 %_arr_int_uint_64 = OpTypeArray %int %uint_64 %S = OpTypeStruct %_arr_int_uint_64 %_ptr_Workgroup_S = OpTypePointer Workgroup %S %s = OpVariable %_ptr_Workgroup_S Workgroup %void = OpTypeVoid - %16 = OpTypeFunction %void %uint + %18 = OpTypeFunction %void %uint %_ptr_Function_uint = OpTypePointer Function %uint - %23 = OpConstantNull %uint + %25 = OpConstantNull %uint %bool = OpTypeBool %uint_0 = OpConstant %uint 0 %_ptr_Workgroup_int = OpTypePointer Workgroup %int - %38 = OpConstantNull %int + %40 = OpConstantNull %int %uint_1 = OpConstant %uint 1 %uint_2 = OpConstant %uint 2 %uint_264 = OpConstant %uint 264 @@ -63,49 +71,49 @@ %int_1 = OpConstant %int 1 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_3 = OpConstant %int 3 - %55 = OpTypeFunction %void - %f_inner = OpFunction %void None %16 + %57 = OpTypeFunction %void + %f_inner = OpFunction %void None %18 %local_invocation_index = OpFunctionParameter %uint - %20 = OpLabel - %idx = OpVariable %_ptr_Function_uint Function %23 + %22 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function %25 OpStore %idx %local_invocation_index - OpBranch %24 - %24 = OpLabel - OpLoopMerge %25 %26 None - OpBranch %27 - %27 = OpLabel - %29 = OpLoad %uint %idx - %30 = OpULessThan %bool %29 %uint_64 - %28 = OpLogicalNot %bool %30 - OpSelectionMerge %32 None - OpBranchConditional %28 %33 %32 - %33 = OpLabel - OpBranch %25 - %32 = OpLabel - %34 = OpLoad %uint %idx - %37 = OpAccessChain %_ptr_Workgroup_int %s %uint_0 %34 - OpStore %37 %38 OpBranch %26 %26 = OpLabel - %39 = OpLoad %uint %idx - %41 = OpIAdd %uint %39 %uint_1 - OpStore %idx %41 - OpBranch %24 - %25 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %31 = OpLoad %uint %idx + %32 = OpULessThan %bool %31 %uint_64 + %30 = OpLogicalNot %bool %32 + OpSelectionMerge %34 None + OpBranchConditional %30 %35 %34 + %35 = OpLabel + OpBranch %27 + %34 = OpLabel + %36 = OpLoad %uint %idx + %39 = OpAccessChain %_ptr_Workgroup_int %s %uint_0 %36 + OpStore %39 %40 + OpBranch %28 + %28 = OpLabel + %41 = OpLoad %uint %idx + %43 = OpIAdd %uint %41 %uint_1 + OpStore %idx %43 + OpBranch %26 + %27 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_264 - %46 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 - %47 = OpLoad %int %46 - %48 = OpAccessChain %_ptr_Workgroup_int %s %uint_0 %47 - OpStore %48 %int_1 - %51 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 - %53 = OpAccessChain %_ptr_Workgroup_int %s %uint_0 %int_3 - %54 = OpLoad %int %53 - OpStore %51 %54 + %48 = OpAccessChain %_ptr_Uniform_int %ubo %uint_0 %uint_0 + %49 = OpLoad %int %48 + %50 = OpAccessChain %_ptr_Workgroup_int %s %uint_0 %49 + OpStore %50 %int_1 + %53 = OpAccessChain %_ptr_StorageBuffer_int %result %uint_0 %uint_0 + %55 = OpAccessChain %_ptr_Workgroup_int %s %uint_0 %int_3 + %56 = OpLoad %int %55 + OpStore %53 %56 OpReturn OpFunctionEnd - %f = OpFunction %void None %55 - %57 = OpLabel - %59 = OpLoad %uint %local_invocation_index_1 - %58 = OpFunctionCall %void %f_inner %59 + %f = OpFunction %void None %57 + %59 = OpLabel + %61 = OpLoad %uint %local_invocation_index_1 + %60 = OpFunctionCall %void %f_inner %61 OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.glsl b/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.glsl index 89e8cbc6e0..92f22e2ae6 100644 --- a/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.glsl +++ b/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.glsl @@ -1,5 +1,12 @@ #version 310 es +struct Simulation { + uint i; + uint pad; + uint pad_1; + uint pad_2; +}; + struct Particle { vec3 position[8]; float lifetime; @@ -15,16 +22,13 @@ layout(binding = 3, std430) buffer Particles_ssbo { Particle p[]; } particles; -layout(binding = 4, std140) uniform Simulation_ubo { - uint i; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 4, std140) uniform sim_block_ubo { + Simulation inner; } sim; void tint_symbol() { Particle particle = particles.p[0]; - particle.position[sim.i] = particle.position[sim.i]; + particle.position[sim.inner.i] = particle.position[sim.inner.i]; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.spvasm b/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.spvasm index 7a4afd73a8..4856ea0c2c 100644 --- a/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/indexed_assign_to_array_in_struct/1206.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 37 +; Bound: 38 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -15,6 +15,8 @@ OpMemberName %Particle 2 "color" OpMemberName %Particle 3 "velocity" OpName %particles "particles" + OpName %sim_block "sim_block" + OpMemberName %sim_block 0 "inner" OpName %Simulation "Simulation" OpMemberName %Simulation 0 "i" OpName %sim "sim" @@ -31,7 +33,8 @@ OpDecorate %particles NonWritable OpDecorate %particles DescriptorSet 1 OpDecorate %particles Binding 3 - OpDecorate %Simulation Block + OpDecorate %sim_block Block + OpMemberDecorate %sim_block 0 Offset 0 OpMemberDecorate %Simulation 0 Offset 0 OpDecorate %sim NonWritable OpDecorate %sim DescriptorSet 1 @@ -48,31 +51,32 @@ %_ptr_StorageBuffer_Particles = OpTypePointer StorageBuffer %Particles %particles = OpVariable %_ptr_StorageBuffer_Particles StorageBuffer %Simulation = OpTypeStruct %uint -%_ptr_Uniform_Simulation = OpTypePointer Uniform %Simulation - %sim = OpVariable %_ptr_Uniform_Simulation Uniform + %sim_block = OpTypeStruct %Simulation +%_ptr_Uniform_sim_block = OpTypePointer Uniform %sim_block + %sim = OpVariable %_ptr_Uniform_sim_block Uniform %void = OpTypeVoid - %15 = OpTypeFunction %void + %16 = OpTypeFunction %void %uint_0 = OpConstant %uint 0 %int = OpTypeInt 32 1 - %21 = OpConstantNull %int + %22 = OpConstantNull %int %_ptr_StorageBuffer_Particle = OpTypePointer StorageBuffer %Particle %_ptr_Function_Particle = OpTypePointer Function %Particle - %27 = OpConstantNull %Particle + %28 = OpConstantNull %Particle %_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Function_v3float = OpTypePointer Function %v3float - %main = OpFunction %void None %15 - %18 = OpLabel - %particle = OpVariable %_ptr_Function_Particle Function %27 - %23 = OpAccessChain %_ptr_StorageBuffer_Particle %particles %uint_0 %21 - %24 = OpLoad %Particle %23 - OpStore %particle %24 - %29 = OpAccessChain %_ptr_Uniform_uint %sim %uint_0 - %30 = OpLoad %uint %29 - %32 = OpAccessChain %_ptr_Function_v3float %particle %uint_0 %30 - %33 = OpAccessChain %_ptr_Uniform_uint %sim %uint_0 - %34 = OpLoad %uint %33 - %35 = OpAccessChain %_ptr_Function_v3float %particle %uint_0 %34 - %36 = OpLoad %v3float %35 - OpStore %32 %36 + %main = OpFunction %void None %16 + %19 = OpLabel + %particle = OpVariable %_ptr_Function_Particle Function %28 + %24 = OpAccessChain %_ptr_StorageBuffer_Particle %particles %uint_0 %22 + %25 = OpLoad %Particle %24 + OpStore %particle %25 + %30 = OpAccessChain %_ptr_Uniform_uint %sim %uint_0 %uint_0 + %31 = OpLoad %uint %30 + %33 = OpAccessChain %_ptr_Function_v3float %particle %uint_0 %31 + %34 = OpAccessChain %_ptr_Uniform_uint %sim %uint_0 %uint_0 + %35 = OpLoad %uint %34 + %36 = OpAccessChain %_ptr_Function_v3float %particle %uint_0 %35 + %37 = OpLoad %v3float %36 + OpStore %33 %37 OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.glsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.glsl index 99500a6e2d..fa0f1fb375 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.glsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.glsl @@ -1,15 +1,19 @@ #version 310 es -layout(binding = 4, std140) uniform Uniforms_ubo { +struct Uniforms { uint i; uint j; uint pad; uint pad_1; +}; + +layout(binding = 4, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; void tint_symbol() { mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - m1[uniforms.i][0] = 1.0f; + m1[uniforms.inner.i][0] = 1.0f; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.spvasm b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.spvasm index 808ef9122f..f2d58ec3b3 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_x.wgsl.expected.spvasm @@ -1,19 +1,22 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 25 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "i" OpMemberName %Uniforms 1 "j" OpName %uniforms "uniforms" OpName %main "main" OpName %m1 "m1" - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 1 Offset 4 OpDecorate %uniforms NonWritable @@ -21,27 +24,28 @@ OpDecorate %uniforms Binding 4 %uint = OpTypeInt 32 0 %Uniforms = OpTypeStruct %uint %uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 %mat2v4float = OpTypeMatrix %v4float 2 %_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float - %14 = OpConstantNull %mat2v4float + %15 = OpConstantNull %mat2v4float %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %int = OpTypeInt 32 1 - %20 = OpConstantNull %int + %21 = OpConstantNull %int %_ptr_Function_float = OpTypePointer Function %float %float_1 = OpConstant %float 1 - %main = OpFunction %void None %5 - %8 = OpLabel - %m1 = OpVariable %_ptr_Function_mat2v4float Function %14 - %17 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %18 = OpLoad %uint %17 - %22 = OpAccessChain %_ptr_Function_float %m1 %18 %20 - OpStore %22 %float_1 + %main = OpFunction %void None %6 + %9 = OpLabel + %m1 = OpVariable %_ptr_Function_mat2v4float Function %15 + %18 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %19 = OpLoad %uint %18 + %23 = OpAccessChain %_ptr_Function_float %m1 %19 %21 + OpStore %23 %float_1 OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.glsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.glsl index 5d76866324..a0c6e98229 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.glsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.glsl @@ -1,15 +1,19 @@ #version 310 es -layout(binding = 4, std140) uniform Uniforms_ubo { +struct Uniforms { uint i; uint j; uint pad; uint pad_1; +}; + +layout(binding = 4, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; void tint_symbol() { mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - m1[uniforms.i][uniforms.j] = 1.0f; + m1[uniforms.inner.i][uniforms.inner.j] = 1.0f; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.spvasm b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.spvasm index b3c73b46b7..1aef23a72a 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_xy.wgsl.expected.spvasm @@ -1,19 +1,22 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 25 +; Bound: 26 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "i" OpMemberName %Uniforms 1 "j" OpName %uniforms "uniforms" OpName %main "main" OpName %m1 "m1" - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 1 Offset 4 OpDecorate %uniforms NonWritable @@ -21,28 +24,29 @@ OpDecorate %uniforms Binding 4 %uint = OpTypeInt 32 0 %Uniforms = OpTypeStruct %uint %uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 %mat2v4float = OpTypeMatrix %v4float 2 %_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float - %14 = OpConstantNull %mat2v4float + %15 = OpConstantNull %mat2v4float %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %uint_1 = OpConstant %uint 1 %_ptr_Function_float = OpTypePointer Function %float %float_1 = OpConstant %float 1 - %main = OpFunction %void None %5 - %8 = OpLabel - %m1 = OpVariable %_ptr_Function_mat2v4float Function %14 - %17 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %18 = OpLoad %uint %17 - %20 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %21 = OpLoad %uint %20 - %23 = OpAccessChain %_ptr_Function_float %m1 %18 %21 - OpStore %23 %float_1 + %main = OpFunction %void None %6 + %9 = OpLabel + %m1 = OpVariable %_ptr_Function_mat2v4float Function %15 + %18 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %19 = OpLoad %uint %18 + %21 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 + %22 = OpLoad %uint %21 + %24 = OpAccessChain %_ptr_Function_float %m1 %19 %22 + OpStore %24 %float_1 OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.glsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.glsl index 8d409b64fa..8c5075a1e0 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.glsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.glsl @@ -1,15 +1,19 @@ #version 310 es -layout(binding = 4, std140) uniform Uniforms_ubo { +struct Uniforms { uint i; uint j; uint pad; uint pad_1; +}; + +layout(binding = 4, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); void tint_symbol() { - m1[0][uniforms.j] = 1.0f; + m1[0][uniforms.inner.j] = 1.0f; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.spvasm b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.spvasm index 9f46f7d0a7..16e684bc63 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_scalar_y.wgsl.expected.spvasm @@ -1,19 +1,22 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 26 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "i" OpMemberName %Uniforms 1 "j" OpName %uniforms "uniforms" OpName %m1 "m1" OpName %main "main" - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 1 Offset 4 OpDecorate %uniforms NonWritable @@ -21,27 +24,29 @@ OpDecorate %uniforms Binding 4 %uint = OpTypeInt 32 0 %Uniforms = OpTypeStruct %uint %uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 %mat2v4float = OpTypeMatrix %v4float 2 %_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float - %10 = OpConstantNull %mat2v4float - %m1 = OpVariable %_ptr_Private_mat2v4float Private %10 + %11 = OpConstantNull %mat2v4float + %m1 = OpVariable %_ptr_Private_mat2v4float Private %11 %void = OpTypeVoid - %11 = OpTypeFunction %void + %12 = OpTypeFunction %void %int = OpTypeInt 32 1 - %16 = OpConstantNull %int + %17 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 %uint_1 = OpConstant %uint 1 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Private_float = OpTypePointer Private %float %float_1 = OpConstant %float 1 - %main = OpFunction %void None %11 - %14 = OpLabel - %19 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %20 = OpLoad %uint %19 - %22 = OpAccessChain %_ptr_Private_float %m1 %16 %20 - OpStore %22 %float_1 + %main = OpFunction %void None %12 + %15 = OpLabel + %21 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 + %22 = OpLoad %uint %21 + %24 = OpAccessChain %_ptr_Private_float %m1 %17 %22 + OpStore %24 %float_1 OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.glsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.glsl index aeaf8f5909..e530f2b0ea 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.glsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.glsl @@ -1,15 +1,19 @@ #version 310 es -layout(binding = 4, std140) uniform Uniforms_ubo { +struct Uniforms { uint i; uint j; uint pad; uint pad_1; +}; + +layout(binding = 4, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; void tint_symbol() { mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - m1[uniforms.i] = vec4(1.0f); + m1[uniforms.inner.i] = vec4(1.0f); } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.spvasm b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.spvasm index afc1c44a7e..24b977cf72 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/local_assign_vector.wgsl.expected.spvasm @@ -1,19 +1,22 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 23 +; Bound: 24 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "i" OpMemberName %Uniforms 1 "j" OpName %uniforms "uniforms" OpName %main "main" OpName %m1 "m1" - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 1 Offset 4 OpDecorate %uniforms NonWritable @@ -21,26 +24,27 @@ OpDecorate %uniforms Binding 4 %uint = OpTypeInt 32 0 %Uniforms = OpTypeStruct %uint %uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 %mat2v4float = OpTypeMatrix %v4float 2 %_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float - %14 = OpConstantNull %mat2v4float + %15 = OpConstantNull %mat2v4float %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Function_v4float = OpTypePointer Function %v4float %float_1 = OpConstant %float 1 - %22 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 - %main = OpFunction %void None %5 - %8 = OpLabel - %m1 = OpVariable %_ptr_Function_mat2v4float Function %14 - %17 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %18 = OpLoad %uint %17 - %20 = OpAccessChain %_ptr_Function_v4float %m1 %18 - OpStore %20 %22 + %23 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main = OpFunction %void None %6 + %9 = OpLabel + %m1 = OpVariable %_ptr_Function_mat2v4float Function %15 + %18 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %19 = OpLoad %uint %18 + %21 = OpAccessChain %_ptr_Function_v4float %m1 %19 + OpStore %21 %23 OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.glsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.glsl index 9ade51c8a4..6332d7141f 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.glsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.glsl @@ -1,15 +1,19 @@ #version 310 es -layout(binding = 4, std140) uniform Uniforms_ubo { +struct Uniforms { uint i; uint j; uint pad; uint pad_1; +}; + +layout(binding = 4, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); void tint_symbol() { - m1[uniforms.i][0] = 1.0f; + m1[uniforms.inner.i][0] = 1.0f; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.spvasm b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.spvasm index 7b3fc5cd69..ef2afdf3a6 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_x.wgsl.expected.spvasm @@ -1,19 +1,22 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 25 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "i" OpMemberName %Uniforms 1 "j" OpName %uniforms "uniforms" OpName %m1 "m1" OpName %main "main" - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 1 Offset 4 OpDecorate %uniforms NonWritable @@ -21,27 +24,28 @@ OpDecorate %uniforms Binding 4 %uint = OpTypeInt 32 0 %Uniforms = OpTypeStruct %uint %uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 %mat2v4float = OpTypeMatrix %v4float 2 %_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float - %10 = OpConstantNull %mat2v4float - %m1 = OpVariable %_ptr_Private_mat2v4float Private %10 + %11 = OpConstantNull %mat2v4float + %m1 = OpVariable %_ptr_Private_mat2v4float Private %11 %void = OpTypeVoid - %11 = OpTypeFunction %void + %12 = OpTypeFunction %void %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %int = OpTypeInt 32 1 - %20 = OpConstantNull %int + %21 = OpConstantNull %int %_ptr_Private_float = OpTypePointer Private %float %float_1 = OpConstant %float 1 - %main = OpFunction %void None %11 - %14 = OpLabel - %17 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %18 = OpLoad %uint %17 - %22 = OpAccessChain %_ptr_Private_float %m1 %18 %20 - OpStore %22 %float_1 + %main = OpFunction %void None %12 + %15 = OpLabel + %18 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %19 = OpLoad %uint %18 + %23 = OpAccessChain %_ptr_Private_float %m1 %19 %21 + OpStore %23 %float_1 OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.glsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.glsl index 89a3e066b6..de04ee621d 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.glsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.glsl @@ -1,15 +1,19 @@ #version 310 es -layout(binding = 4, std140) uniform Uniforms_ubo { +struct Uniforms { uint i; uint j; uint pad; uint pad_1; +}; + +layout(binding = 4, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); void tint_symbol() { - m1[uniforms.i][uniforms.j] = 1.0f; + m1[uniforms.inner.i][uniforms.inner.j] = 1.0f; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.spvasm b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.spvasm index 1b93b116f7..67aa5d3c5a 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_xy.wgsl.expected.spvasm @@ -1,19 +1,22 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 25 +; Bound: 26 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "i" OpMemberName %Uniforms 1 "j" OpName %uniforms "uniforms" OpName %m1 "m1" OpName %main "main" - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 1 Offset 4 OpDecorate %uniforms NonWritable @@ -21,28 +24,29 @@ OpDecorate %uniforms Binding 4 %uint = OpTypeInt 32 0 %Uniforms = OpTypeStruct %uint %uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 %mat2v4float = OpTypeMatrix %v4float 2 %_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float - %10 = OpConstantNull %mat2v4float - %m1 = OpVariable %_ptr_Private_mat2v4float Private %10 + %11 = OpConstantNull %mat2v4float + %m1 = OpVariable %_ptr_Private_mat2v4float Private %11 %void = OpTypeVoid - %11 = OpTypeFunction %void + %12 = OpTypeFunction %void %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %uint_1 = OpConstant %uint 1 %_ptr_Private_float = OpTypePointer Private %float %float_1 = OpConstant %float 1 - %main = OpFunction %void None %11 - %14 = OpLabel - %17 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %18 = OpLoad %uint %17 - %20 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %21 = OpLoad %uint %20 - %23 = OpAccessChain %_ptr_Private_float %m1 %18 %21 - OpStore %23 %float_1 + %main = OpFunction %void None %12 + %15 = OpLabel + %18 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %19 = OpLoad %uint %18 + %21 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 + %22 = OpLoad %uint %21 + %24 = OpAccessChain %_ptr_Private_float %m1 %19 %22 + OpStore %24 %float_1 OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.glsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.glsl index 8d409b64fa..8c5075a1e0 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.glsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.glsl @@ -1,15 +1,19 @@ #version 310 es -layout(binding = 4, std140) uniform Uniforms_ubo { +struct Uniforms { uint i; uint j; uint pad; uint pad_1; +}; + +layout(binding = 4, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); void tint_symbol() { - m1[0][uniforms.j] = 1.0f; + m1[0][uniforms.inner.j] = 1.0f; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.spvasm b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.spvasm index 9f46f7d0a7..16e684bc63 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_scalar_y.wgsl.expected.spvasm @@ -1,19 +1,22 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 26 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "i" OpMemberName %Uniforms 1 "j" OpName %uniforms "uniforms" OpName %m1 "m1" OpName %main "main" - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 1 Offset 4 OpDecorate %uniforms NonWritable @@ -21,27 +24,29 @@ OpDecorate %uniforms Binding 4 %uint = OpTypeInt 32 0 %Uniforms = OpTypeStruct %uint %uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 %mat2v4float = OpTypeMatrix %v4float 2 %_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float - %10 = OpConstantNull %mat2v4float - %m1 = OpVariable %_ptr_Private_mat2v4float Private %10 + %11 = OpConstantNull %mat2v4float + %m1 = OpVariable %_ptr_Private_mat2v4float Private %11 %void = OpTypeVoid - %11 = OpTypeFunction %void + %12 = OpTypeFunction %void %int = OpTypeInt 32 1 - %16 = OpConstantNull %int + %17 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 %uint_1 = OpConstant %uint 1 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Private_float = OpTypePointer Private %float %float_1 = OpConstant %float 1 - %main = OpFunction %void None %11 - %14 = OpLabel - %19 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %20 = OpLoad %uint %19 - %22 = OpAccessChain %_ptr_Private_float %m1 %16 %20 - OpStore %22 %float_1 + %main = OpFunction %void None %12 + %15 = OpLabel + %21 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 + %22 = OpLoad %uint %21 + %24 = OpAccessChain %_ptr_Private_float %m1 %17 %22 + OpStore %24 %float_1 OpReturn OpFunctionEnd diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.glsl b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.glsl index 057a6fd552..e41bfd4bee 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.glsl +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.glsl @@ -1,15 +1,19 @@ #version 310 es -layout(binding = 4, std140) uniform Uniforms_ubo { +struct Uniforms { uint i; uint j; uint pad; uint pad_1; +}; + +layout(binding = 4, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); void tint_symbol() { - m1[uniforms.i] = vec4(1.0f); + m1[uniforms.inner.i] = vec4(1.0f); } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.spvasm b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.spvasm index f66926472b..6bbb7c9a52 100644 --- a/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.spvasm +++ b/test/tint/bug/fxc/matrix_assignment_dynamic_index/module_assign_vector.wgsl.expected.spvasm @@ -1,19 +1,22 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 23 +; Bound: 24 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "i" OpMemberName %Uniforms 1 "j" OpName %uniforms "uniforms" OpName %m1 "m1" OpName %main "main" - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 1 Offset 4 OpDecorate %uniforms NonWritable @@ -21,26 +24,27 @@ OpDecorate %uniforms Binding 4 %uint = OpTypeInt 32 0 %Uniforms = OpTypeStruct %uint %uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 %mat2v4float = OpTypeMatrix %v4float 2 %_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float - %10 = OpConstantNull %mat2v4float - %m1 = OpVariable %_ptr_Private_mat2v4float Private %10 + %11 = OpConstantNull %mat2v4float + %m1 = OpVariable %_ptr_Private_mat2v4float Private %11 %void = OpTypeVoid - %11 = OpTypeFunction %void + %12 = OpTypeFunction %void %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Private_v4float = OpTypePointer Private %v4float %float_1 = OpConstant %float 1 - %22 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 - %main = OpFunction %void None %11 - %14 = OpLabel - %17 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %18 = OpLoad %uint %17 - %20 = OpAccessChain %_ptr_Private_v4float %m1 %18 - OpStore %20 %22 + %23 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main = OpFunction %void None %12 + %15 = OpLabel + %18 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %19 = OpLoad %uint %18 + %21 = OpAccessChain %_ptr_Private_v4float %m1 %19 + OpStore %21 %23 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/1046.wgsl.expected.glsl b/test/tint/bug/tint/1046.wgsl.expected.glsl index 2900bc3b4e..6b2f4351ba 100644 --- a/test/tint/bug/tint/1046.wgsl.expected.glsl +++ b/test/tint/bug/tint/1046.wgsl.expected.glsl @@ -10,7 +10,7 @@ struct PointLight { vec4 position; }; -layout(binding = 0, std140) uniform Uniforms_ubo { +struct Uniforms { mat4 worldView; mat4 proj; uint numPointLights; @@ -18,6 +18,10 @@ layout(binding = 0, std140) uniform Uniforms_ubo { uint pad; uint pad_1; vec4 color; +}; + +layout(binding = 0, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; layout(binding = 1, std430) buffer PointLights_ssbo { diff --git a/test/tint/bug/tint/1046.wgsl.expected.spvasm b/test/tint/bug/tint/1046.wgsl.expected.spvasm index 5d68d323f0..1a7879f9b7 100644 --- a/test/tint/bug/tint/1046.wgsl.expected.spvasm +++ b/test/tint/bug/tint/1046.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 107 +; Bound: 108 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -13,6 +13,8 @@ OpName %uv_1 "uv_1" OpName %color_1 "color_1" OpName %color_2 "color_2" + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "worldView" OpMemberName %Uniforms 1 "proj" @@ -48,7 +50,8 @@ OpDecorate %uv_1 Location 2 OpDecorate %color_1 Location 3 OpDecorate %color_2 Location 0 - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 0 ColMajor OpMemberDecorate %Uniforms 0 MatrixStride 16 @@ -94,25 +97,27 @@ %mat4v4float = OpTypeMatrix %v4float 4 %uint = OpTypeInt 32 0 %Uniforms = OpTypeStruct %mat4v4float %mat4v4float %uint %uint %v4float -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %PointLight = OpTypeStruct %v4float %_runtimearr_PointLight = OpTypeRuntimeArray %PointLight %PointLights = OpTypeStruct %_runtimearr_PointLight %_ptr_StorageBuffer_PointLights = OpTypePointer StorageBuffer %PointLights %pointLights = OpVariable %_ptr_StorageBuffer_PointLights StorageBuffer - %26 = OpTypeSampler -%_ptr_UniformConstant_26 = OpTypePointer UniformConstant %26 - %mySampler = OpVariable %_ptr_UniformConstant_26 UniformConstant - %29 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_29 = OpTypePointer UniformConstant %29 - %myTexture = OpVariable %_ptr_UniformConstant_29 UniformConstant + %27 = OpTypeSampler +%_ptr_UniformConstant_27 = OpTypePointer UniformConstant %27 + %mySampler = OpVariable %_ptr_UniformConstant_27 UniformConstant + %30 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_30 = OpTypePointer UniformConstant %30 + %myTexture = OpVariable %_ptr_UniformConstant_30 UniformConstant %FragmentInput = OpTypeStruct %v4float %v4float %v4float %v2float %v4float - %30 = OpTypeFunction %v4float %FragmentInput + %31 = OpTypeFunction %v4float %FragmentInput %_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_0 = OpConstant %uint 0 %uint_3 = OpConstant %uint 3 %_ptr_Uniform_uint = OpTypePointer Uniform %uint - %41 = OpConstantNull %uint + %43 = OpConstantNull %uint %bool = OpTypeBool %uint_1 = OpConstant %uint 1 %_ptr_Function_float = OpTypePointer Function %float @@ -120,95 +125,94 @@ %uint_2 = OpConstant %uint 2 %uint_4 = OpConstant %uint 4 %_ptr_Uniform_v4float = OpTypePointer Uniform %v4float - %78 = OpTypeSampledImage %29 + %80 = OpTypeSampledImage %30 %FragmentOutput = OpTypeStruct %v4float - %82 = OpTypeFunction %FragmentOutput %FragmentInput + %84 = OpTypeFunction %FragmentOutput %FragmentInput %_ptr_Function_FragmentOutput = OpTypePointer Function %FragmentOutput - %89 = OpConstantNull %FragmentOutput - %uint_0 = OpConstant %uint 0 - %92 = OpConstantNull %float - %93 = OpConstantComposite %v4float %float_1 %92 %92 %float_1 + %91 = OpConstantNull %FragmentOutput + %93 = OpConstantNull %float + %94 = OpConstantComposite %v4float %float_1 %93 %93 %float_1 %void = OpTypeVoid - %95 = OpTypeFunction %void - %getColor = OpFunction %v4float None %30 + %96 = OpTypeFunction %void + %getColor = OpFunction %v4float None %31 %fragment = OpFunctionParameter %FragmentInput - %34 = OpLabel + %35 = OpLabel %color = OpVariable %_ptr_Function_v4float Function %13 - %39 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_3 - %40 = OpLoad %uint %39 - %42 = OpIEqual %bool %40 %41 - OpSelectionMerge %44 None - OpBranchConditional %42 %45 %46 - %45 = OpLabel - %47 = OpCompositeExtract %v4float %fragment 4 - OpStore %color %47 - OpBranch %44 - %46 = OpLabel - %48 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_3 - %49 = OpLoad %uint %48 - %51 = OpIEqual %bool %49 %uint_1 - OpSelectionMerge %52 None - OpBranchConditional %51 %53 %54 - %53 = OpLabel - %55 = OpCompositeExtract %v4float %fragment 2 - OpStore %color %55 - %57 = OpAccessChain %_ptr_Function_float %color %uint_3 - OpStore %57 %float_1 - OpBranch %52 - %54 = OpLabel - %59 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_3 - %60 = OpLoad %uint %59 - %62 = OpIEqual %bool %60 %uint_2 - OpSelectionMerge %63 None - OpBranchConditional %62 %64 %65 - %64 = OpLabel - %68 = OpAccessChain %_ptr_Uniform_v4float %uniforms %uint_4 - %69 = OpLoad %v4float %68 - OpStore %color %69 - OpBranch %63 + %41 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_3 + %42 = OpLoad %uint %41 + %44 = OpIEqual %bool %42 %43 + OpSelectionMerge %46 None + OpBranchConditional %44 %47 %48 + %47 = OpLabel + %49 = OpCompositeExtract %v4float %fragment 4 + OpStore %color %49 + OpBranch %46 + %48 = OpLabel + %50 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_3 + %51 = OpLoad %uint %50 + %53 = OpIEqual %bool %51 %uint_1 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %56 + %55 = OpLabel + %57 = OpCompositeExtract %v4float %fragment 2 + OpStore %color %57 + %59 = OpAccessChain %_ptr_Function_float %color %uint_3 + OpStore %59 %float_1 + OpBranch %54 + %56 = OpLabel + %61 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_3 + %62 = OpLoad %uint %61 + %64 = OpIEqual %bool %62 %uint_2 + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %67 + %66 = OpLabel + %70 = OpAccessChain %_ptr_Uniform_v4float %uniforms %uint_0 %uint_4 + %71 = OpLoad %v4float %70 + OpStore %color %71 + OpBranch %65 + %67 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_3 + %73 = OpLoad %uint %72 + %74 = OpIEqual %bool %73 %uint_3 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %75 + %76 = OpLabel + %78 = OpLoad %27 %mySampler + %79 = OpLoad %30 %myTexture + %81 = OpSampledImage %80 %79 %78 + %82 = OpCompositeExtract %v2float %fragment 3 + %77 = OpImageSampleImplicitLod %v4float %81 %82 + OpStore %color %77 + OpBranch %75 + %75 = OpLabel + OpBranch %65 %65 = OpLabel - %70 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_3 - %71 = OpLoad %uint %70 - %72 = OpIEqual %bool %71 %uint_3 - OpSelectionMerge %73 None - OpBranchConditional %72 %74 %73 - %74 = OpLabel - %76 = OpLoad %26 %mySampler - %77 = OpLoad %29 %myTexture - %79 = OpSampledImage %78 %77 %76 - %80 = OpCompositeExtract %v2float %fragment 3 - %75 = OpImageSampleImplicitLod %v4float %79 %80 - OpStore %color %75 - OpBranch %73 - %73 = OpLabel - OpBranch %63 - %63 = OpLabel - OpBranch %52 - %52 = OpLabel - OpBranch %44 - %44 = OpLabel - %81 = OpLoad %v4float %color - OpReturnValue %81 + OpBranch %54 + %54 = OpLabel + OpBranch %46 + %46 = OpLabel + %83 = OpLoad %v4float %color + OpReturnValue %83 OpFunctionEnd - %main_inner = OpFunction %FragmentOutput None %82 + %main_inner = OpFunction %FragmentOutput None %84 %fragment_0 = OpFunctionParameter %FragmentInput - %86 = OpLabel - %output = OpVariable %_ptr_Function_FragmentOutput Function %89 - %91 = OpAccessChain %_ptr_Function_v4float %output %uint_0 - OpStore %91 %93 - %94 = OpLoad %FragmentOutput %output - OpReturnValue %94 + %88 = OpLabel + %output = OpVariable %_ptr_Function_FragmentOutput Function %91 + %92 = OpAccessChain %_ptr_Function_v4float %output %uint_0 + OpStore %92 %94 + %95 = OpLoad %FragmentOutput %output + OpReturnValue %95 OpFunctionEnd - %main = OpFunction %void None %95 - %98 = OpLabel - %100 = OpLoad %v4float %position_1 - %101 = OpLoad %v4float %view_position_1 - %102 = OpLoad %v4float %normal_1 - %103 = OpLoad %v2float %uv_1 - %104 = OpLoad %v4float %color_1 - %105 = OpCompositeConstruct %FragmentInput %100 %101 %102 %103 %104 - %99 = OpFunctionCall %FragmentOutput %main_inner %105 - %106 = OpCompositeExtract %v4float %99 0 - OpStore %color_2 %106 + %main = OpFunction %void None %96 + %99 = OpLabel + %101 = OpLoad %v4float %position_1 + %102 = OpLoad %v4float %view_position_1 + %103 = OpLoad %v4float %normal_1 + %104 = OpLoad %v2float %uv_1 + %105 = OpLoad %v4float %color_1 + %106 = OpCompositeConstruct %FragmentInput %101 %102 %103 %104 %105 + %100 = OpFunctionCall %FragmentOutput %main_inner %106 + %107 = OpCompositeExtract %v4float %100 0 + OpStore %color_2 %107 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/1061.spvasm.expected.glsl b/test/tint/bug/tint/1061.spvasm.expected.glsl index 72307d3a79..bd0cf58240 100644 --- a/test/tint/bug/tint/1061.spvasm.expected.glsl +++ b/test/tint/bug/tint/1061.spvasm.expected.glsl @@ -2,8 +2,12 @@ precision mediump float; layout(location = 0) out vec4 x_GLF_color_1_1; -layout(binding = 0, std140) uniform buf0_ubo { +struct buf0 { vec4 ref; +}; + +layout(binding = 0, std140) uniform x_7_block_ubo { + buf0 inner; } x_7; vec4 x_GLF_color = vec4(0.0f, 0.0f, 0.0f, 0.0f); @@ -17,7 +21,7 @@ void main_1() { float x_39 = f; v = vec4(sin(x_33), cos(x_35), exp2(x_37), log(x_39)); vec4 x_42 = v; - vec4 x_44 = x_7.ref; + vec4 x_44 = x_7.inner.ref; if ((distance(x_42, x_44) < 0.100000001f)) { x_GLF_color = vec4(1.0f, 0.0f, 0.0f, 1.0f); } else { diff --git a/test/tint/bug/tint/1061.spvasm.expected.spvasm b/test/tint/bug/tint/1061.spvasm.expected.spvasm index 727e9caa30..827b8fe140 100644 --- a/test/tint/bug/tint/1061.spvasm.expected.spvasm +++ b/test/tint/bug/tint/1061.spvasm.expected.spvasm @@ -1,14 +1,16 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 63 +; Bound: 64 ; Schema: 0 OpCapability Shader - %21 = OpExtInstImport "GLSL.std.450" + %22 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %main "main" %x_GLF_color_1_1 OpExecutionMode %main OriginUpperLeft OpName %x_GLF_color_1_1 "x_GLF_color_1_1" + OpName %x_7_block "x_7_block" + OpMemberName %x_7_block 0 "inner" OpName %buf0 "buf0" OpMemberName %buf0 0 "ref" OpName %x_7 "x_7" @@ -21,7 +23,8 @@ OpName %main_inner "main_inner" OpName %main "main" OpDecorate %x_GLF_color_1_1 Location 0 - OpDecorate %buf0 Block + OpDecorate %x_7_block Block + OpMemberDecorate %x_7_block 0 Offset 0 OpMemberDecorate %buf0 0 Offset 0 OpDecorate %x_7 NonWritable OpDecorate %x_7 DescriptorSet 0 @@ -33,73 +36,74 @@ %5 = OpConstantNull %v4float %x_GLF_color_1_1 = OpVariable %_ptr_Output_v4float Output %5 %buf0 = OpTypeStruct %v4float -%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 - %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %x_7_block = OpTypeStruct %buf0 +%_ptr_Uniform_x_7_block = OpTypePointer Uniform %x_7_block + %x_7 = OpVariable %_ptr_Uniform_x_7_block Uniform %_ptr_Private_v4float = OpTypePointer Private %v4float %x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 %void = OpTypeVoid - %11 = OpTypeFunction %void + %12 = OpTypeFunction %void %_ptr_Function_float = OpTypePointer Function %float - %17 = OpConstantNull %float + %18 = OpConstantNull %float %_ptr_Function_v4float = OpTypePointer Function %v4float %v3float = OpTypeVector %float 3 %mat3v3float = OpTypeMatrix %v3float 3 %float_1 = OpConstant %float 1 - %25 = OpConstantComposite %v3float %float_1 %17 %17 - %26 = OpConstantComposite %v3float %17 %float_1 %17 - %27 = OpConstantComposite %v3float %17 %17 %float_1 - %28 = OpConstantComposite %mat3v3float %25 %26 %27 + %26 = OpConstantComposite %v3float %float_1 %18 %18 + %27 = OpConstantComposite %v3float %18 %float_1 %18 + %28 = OpConstantComposite %v3float %18 %18 %float_1 + %29 = OpConstantComposite %mat3v3float %26 %27 %28 %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_Uniform_v4float = OpTypePointer Uniform %v4float %float_0_100000001 = OpConstant %float 0.100000001 %bool = OpTypeBool - %51 = OpConstantComposite %v4float %float_1 %17 %17 %float_1 + %52 = OpConstantComposite %v4float %float_1 %18 %18 %float_1 %main_out = OpTypeStruct %v4float - %52 = OpTypeFunction %main_out - %main_1 = OpFunction %void None %11 - %14 = OpLabel - %f = OpVariable %_ptr_Function_float Function %17 + %53 = OpTypeFunction %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %f = OpVariable %_ptr_Function_float Function %18 %v = OpVariable %_ptr_Function_v4float Function %5 - %20 = OpExtInst %float %21 Determinant %28 - OpStore %f %20 - %29 = OpLoad %float %f + %21 = OpExtInst %float %22 Determinant %29 + OpStore %f %21 %30 = OpLoad %float %f %31 = OpLoad %float %f %32 = OpLoad %float %f - %33 = OpExtInst %float %21 Sin %29 - %34 = OpExtInst %float %21 Cos %30 - %35 = OpExtInst %float %21 Exp2 %31 - %36 = OpExtInst %float %21 Log %32 - %37 = OpCompositeConstruct %v4float %33 %34 %35 %36 - OpStore %v %37 - %38 = OpLoad %v4float %v - %42 = OpAccessChain %_ptr_Uniform_v4float %x_7 %uint_0 - %43 = OpLoad %v4float %42 - %44 = OpExtInst %float %21 Distance %38 %43 - %46 = OpFOrdLessThan %bool %44 %float_0_100000001 - OpSelectionMerge %48 None - OpBranchConditional %46 %49 %50 - %49 = OpLabel - OpStore %x_GLF_color %51 - OpBranch %48 + %33 = OpLoad %float %f + %34 = OpExtInst %float %22 Sin %30 + %35 = OpExtInst %float %22 Cos %31 + %36 = OpExtInst %float %22 Exp2 %32 + %37 = OpExtInst %float %22 Log %33 + %38 = OpCompositeConstruct %v4float %34 %35 %36 %37 + OpStore %v %38 + %39 = OpLoad %v4float %v + %43 = OpAccessChain %_ptr_Uniform_v4float %x_7 %uint_0 %uint_0 + %44 = OpLoad %v4float %43 + %45 = OpExtInst %float %22 Distance %39 %44 + %47 = OpFOrdLessThan %bool %45 %float_0_100000001 + OpSelectionMerge %49 None + OpBranchConditional %47 %50 %51 %50 = OpLabel + OpStore %x_GLF_color %52 + OpBranch %49 + %51 = OpLabel OpStore %x_GLF_color %5 - OpBranch %48 - %48 = OpLabel + OpBranch %49 + %49 = OpLabel OpReturn OpFunctionEnd - %main_inner = OpFunction %main_out None %52 - %55 = OpLabel - %56 = OpFunctionCall %void %main_1 - %57 = OpLoad %v4float %x_GLF_color - %58 = OpCompositeConstruct %main_out %57 - OpReturnValue %58 + %main_inner = OpFunction %main_out None %53 + %56 = OpLabel + %57 = OpFunctionCall %void %main_1 + %58 = OpLoad %v4float %x_GLF_color + %59 = OpCompositeConstruct %main_out %58 + OpReturnValue %59 OpFunctionEnd - %main = OpFunction %void None %11 - %60 = OpLabel - %61 = OpFunctionCall %main_out %main_inner - %62 = OpCompositeExtract %v4float %61 0 - OpStore %x_GLF_color_1_1 %62 + %main = OpFunction %void None %12 + %61 = OpLabel + %62 = OpFunctionCall %main_out %main_inner + %63 = OpCompositeExtract %v4float %62 0 + OpStore %x_GLF_color_1_1 %63 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/1088.spvasm.expected.glsl b/test/tint/bug/tint/1088.spvasm.expected.glsl index 2adb09fbdf..88d88ecd59 100644 --- a/test/tint/bug/tint/1088.spvasm.expected.glsl +++ b/test/tint/bug/tint/1088.spvasm.expected.glsl @@ -11,8 +11,7 @@ struct strided_arr { uint pad_2; }; -vec3 position = vec3(0.0f, 0.0f, 0.0f); -layout(binding = 2, std140) uniform LeftOver_ubo { +struct LeftOver { mat4 worldViewProjection; float time; uint pad_3; @@ -20,6 +19,11 @@ layout(binding = 2, std140) uniform LeftOver_ubo { uint pad_5; mat4 test2[2]; strided_arr test[4]; +}; + +vec3 position = vec3(0.0f, 0.0f, 0.0f); +layout(binding = 2, std140) uniform x_14_block_ubo { + LeftOver inner; } x_14; vec2 vUV = vec2(0.0f, 0.0f); @@ -34,14 +38,14 @@ void main_1() { vec4 x_21 = q; p = vec3(x_21.x, x_21.y, x_21.z); float x_27 = p.x; - float x_41 = x_14.test[0].el; + float x_41 = x_14.inner.test[0].el; float x_45 = position.y; - float x_49 = x_14.time; + float x_49 = x_14.inner.time; p.x = (x_27 + sin(((x_41 * x_45) + x_49))); float x_55 = p.y; - float x_57 = x_14.time; + float x_57 = x_14.inner.time; p.y = (x_55 + sin((x_57 + 4.0f))); - mat4 x_69 = x_14.worldViewProjection; + mat4 x_69 = x_14.inner.worldViewProjection; vec3 x_70 = p; tint_symbol = (x_69 * vec4(x_70.x, x_70.y, x_70.z, 1.0f)); vec2 x_83 = uv; diff --git a/test/tint/bug/tint/1088.spvasm.expected.spvasm b/test/tint/bug/tint/1088.spvasm.expected.spvasm index 6b84892307..3221d0a799 100644 --- a/test/tint/bug/tint/1088.spvasm.expected.spvasm +++ b/test/tint/bug/tint/1088.spvasm.expected.spvasm @@ -1,10 +1,10 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 122 +; Bound: 123 ; Schema: 0 OpCapability Shader - %75 = OpExtInstImport "GLSL.std.450" + %76 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %main "main" %position_param_1 %uv_param_1 %normal_param_1 %gl_Position_1 %vUV_1_1 %vertex_point_size OpName %position_param_1 "position_param_1" @@ -14,6 +14,8 @@ OpName %vUV_1_1 "vUV_1_1" OpName %vertex_point_size "vertex_point_size" OpName %position "position" + OpName %x_14_block "x_14_block" + OpMemberName %x_14_block 0 "inner" OpName %LeftOver "LeftOver" OpMemberName %LeftOver 0 "worldViewProjection" OpMemberName %LeftOver 1 "time" @@ -43,7 +45,8 @@ OpDecorate %gl_Position_1 BuiltIn Position OpDecorate %vUV_1_1 Location 0 OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %LeftOver Block + OpDecorate %x_14_block Block + OpMemberDecorate %x_14_block 0 Offset 0 OpMemberDecorate %LeftOver 0 Offset 0 OpMemberDecorate %LeftOver 0 ColMajor OpMemberDecorate %LeftOver 0 MatrixStride 16 @@ -89,8 +92,9 @@ %uint_4 = OpConstant %uint 4 %_arr_strided_arr_uint_4 = OpTypeArray %strided_arr %uint_4 %LeftOver = OpTypeStruct %mat4v4float %float %_arr_mat4v4float_uint_2 %_arr_strided_arr_uint_4 -%_ptr_Uniform_LeftOver = OpTypePointer Uniform %LeftOver - %x_14 = OpVariable %_ptr_Uniform_LeftOver Uniform + %x_14_block = OpTypeStruct %LeftOver +%_ptr_Uniform_x_14_block = OpTypePointer Uniform %x_14_block + %x_14 = OpVariable %_ptr_Uniform_x_14_block Uniform %_ptr_Private_v2float = OpTypePointer Private %v2float %vUV = OpVariable %_ptr_Private_v2float Private %15 %uv = OpVariable %_ptr_Private_v2float Private %15 @@ -98,7 +102,7 @@ %_ptr_Private_v4float = OpTypePointer Private %v4float %gl_Position = OpVariable %_ptr_Private_v4float Private %12 %void = OpTypeVoid - %38 = OpTypeFunction %void + %39 = OpTypeFunction %void %_ptr_Function_v4float = OpTypePointer Function %v4float %_ptr_Function_v3float = OpTypePointer Function %v3float %float_1 = OpConstant %float 1 @@ -106,7 +110,7 @@ %_ptr_Function_float = OpTypePointer Function %float %uint_3 = OpConstant %uint 3 %int = OpTypeInt 32 1 - %63 = OpConstantNull %int + %64 = OpConstantNull %int %_ptr_Uniform_float = OpTypePointer Uniform %float %uint_1 = OpConstant %uint 1 %_ptr_Private_float = OpTypePointer Private %float @@ -114,88 +118,88 @@ %_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float %float_n1 = OpConstant %float -1 %main_out = OpTypeStruct %v4float %v2float - %103 = OpTypeFunction %main_out %v3float %v2float %v3float - %main_1 = OpFunction %void None %38 - %41 = OpLabel + %104 = OpTypeFunction %main_out %v3float %v2float %v3float + %main_1 = OpFunction %void None %39 + %42 = OpLabel %q = OpVariable %_ptr_Function_v4float Function %12 %p = OpVariable %_ptr_Function_v3float Function %21 - %46 = OpLoad %v3float %position - %47 = OpCompositeExtract %float %46 0 - %48 = OpCompositeExtract %float %46 1 - %49 = OpCompositeExtract %float %46 2 - %51 = OpCompositeConstruct %v4float %47 %48 %49 %float_1 - OpStore %q %51 - %52 = OpLoad %v4float %q - %53 = OpCompositeExtract %float %52 0 - %54 = OpCompositeExtract %float %52 1 - %55 = OpCompositeExtract %float %52 2 - %56 = OpCompositeConstruct %v3float %53 %54 %55 - OpStore %p %56 - %59 = OpAccessChain %_ptr_Function_float %p %uint_0 - %60 = OpLoad %float %59 - %65 = OpAccessChain %_ptr_Uniform_float %x_14 %uint_3 %63 %uint_0 - %66 = OpLoad %float %65 - %69 = OpAccessChain %_ptr_Private_float %position %uint_1 - %70 = OpLoad %float %69 - %71 = OpAccessChain %_ptr_Uniform_float %x_14 %uint_1 - %72 = OpLoad %float %71 - %73 = OpAccessChain %_ptr_Function_float %p %uint_0 - %76 = OpFMul %float %66 %70 - %77 = OpFAdd %float %76 %72 - %74 = OpExtInst %float %75 Sin %77 - %78 = OpFAdd %float %60 %74 - OpStore %73 %78 - %79 = OpAccessChain %_ptr_Function_float %p %uint_1 - %80 = OpLoad %float %79 - %81 = OpAccessChain %_ptr_Uniform_float %x_14 %uint_1 - %82 = OpLoad %float %81 - %83 = OpAccessChain %_ptr_Function_float %p %uint_1 - %86 = OpFAdd %float %82 %float_4 - %84 = OpExtInst %float %75 Sin %86 - %87 = OpFAdd %float %80 %84 - OpStore %83 %87 - %89 = OpAccessChain %_ptr_Uniform_mat4v4float %x_14 %uint_0 - %90 = OpLoad %mat4v4float %89 - %91 = OpLoad %v3float %p - %92 = OpCompositeExtract %float %91 0 - %93 = OpCompositeExtract %float %91 1 - %94 = OpCompositeExtract %float %91 2 - %95 = OpCompositeConstruct %v4float %92 %93 %94 %float_1 - %96 = OpMatrixTimesVector %v4float %90 %95 - OpStore %gl_Position %96 - %97 = OpLoad %v2float %uv - OpStore %vUV %97 - %98 = OpAccessChain %_ptr_Private_float %gl_Position %uint_1 - %99 = OpLoad %float %98 - %100 = OpAccessChain %_ptr_Private_float %gl_Position %uint_1 - %102 = OpFMul %float %99 %float_n1 - OpStore %100 %102 + %47 = OpLoad %v3float %position + %48 = OpCompositeExtract %float %47 0 + %49 = OpCompositeExtract %float %47 1 + %50 = OpCompositeExtract %float %47 2 + %52 = OpCompositeConstruct %v4float %48 %49 %50 %float_1 + OpStore %q %52 + %53 = OpLoad %v4float %q + %54 = OpCompositeExtract %float %53 0 + %55 = OpCompositeExtract %float %53 1 + %56 = OpCompositeExtract %float %53 2 + %57 = OpCompositeConstruct %v3float %54 %55 %56 + OpStore %p %57 + %60 = OpAccessChain %_ptr_Function_float %p %uint_0 + %61 = OpLoad %float %60 + %66 = OpAccessChain %_ptr_Uniform_float %x_14 %uint_0 %uint_3 %64 %uint_0 + %67 = OpLoad %float %66 + %70 = OpAccessChain %_ptr_Private_float %position %uint_1 + %71 = OpLoad %float %70 + %72 = OpAccessChain %_ptr_Uniform_float %x_14 %uint_0 %uint_1 + %73 = OpLoad %float %72 + %74 = OpAccessChain %_ptr_Function_float %p %uint_0 + %77 = OpFMul %float %67 %71 + %78 = OpFAdd %float %77 %73 + %75 = OpExtInst %float %76 Sin %78 + %79 = OpFAdd %float %61 %75 + OpStore %74 %79 + %80 = OpAccessChain %_ptr_Function_float %p %uint_1 + %81 = OpLoad %float %80 + %82 = OpAccessChain %_ptr_Uniform_float %x_14 %uint_0 %uint_1 + %83 = OpLoad %float %82 + %84 = OpAccessChain %_ptr_Function_float %p %uint_1 + %87 = OpFAdd %float %83 %float_4 + %85 = OpExtInst %float %76 Sin %87 + %88 = OpFAdd %float %81 %85 + OpStore %84 %88 + %90 = OpAccessChain %_ptr_Uniform_mat4v4float %x_14 %uint_0 %uint_0 + %91 = OpLoad %mat4v4float %90 + %92 = OpLoad %v3float %p + %93 = OpCompositeExtract %float %92 0 + %94 = OpCompositeExtract %float %92 1 + %95 = OpCompositeExtract %float %92 2 + %96 = OpCompositeConstruct %v4float %93 %94 %95 %float_1 + %97 = OpMatrixTimesVector %v4float %91 %96 + OpStore %gl_Position %97 + %98 = OpLoad %v2float %uv + OpStore %vUV %98 + %99 = OpAccessChain %_ptr_Private_float %gl_Position %uint_1 + %100 = OpLoad %float %99 + %101 = OpAccessChain %_ptr_Private_float %gl_Position %uint_1 + %103 = OpFMul %float %100 %float_n1 + OpStore %101 %103 OpReturn OpFunctionEnd - %main_inner = OpFunction %main_out None %103 + %main_inner = OpFunction %main_out None %104 %position_param = OpFunctionParameter %v3float %uv_param = OpFunctionParameter %v2float %normal_param = OpFunctionParameter %v3float - %109 = OpLabel + %110 = OpLabel OpStore %position %position_param OpStore %uv %uv_param OpStore %normal %normal_param - %110 = OpFunctionCall %void %main_1 - %111 = OpLoad %v4float %gl_Position - %112 = OpLoad %v2float %vUV - %113 = OpCompositeConstruct %main_out %111 %112 - OpReturnValue %113 + %111 = OpFunctionCall %void %main_1 + %112 = OpLoad %v4float %gl_Position + %113 = OpLoad %v2float %vUV + %114 = OpCompositeConstruct %main_out %112 %113 + OpReturnValue %114 OpFunctionEnd - %main = OpFunction %void None %38 - %115 = OpLabel - %117 = OpLoad %v3float %position_param_1 - %118 = OpLoad %v2float %uv_param_1 - %119 = OpLoad %v3float %normal_param_1 - %116 = OpFunctionCall %main_out %main_inner %117 %118 %119 - %120 = OpCompositeExtract %v4float %116 0 - OpStore %gl_Position_1 %120 - %121 = OpCompositeExtract %v2float %116 1 - OpStore %vUV_1_1 %121 + %main = OpFunction %void None %39 + %116 = OpLabel + %118 = OpLoad %v3float %position_param_1 + %119 = OpLoad %v2float %uv_param_1 + %120 = OpLoad %v3float %normal_param_1 + %117 = OpFunctionCall %main_out %main_inner %118 %119 %120 + %121 = OpCompositeExtract %v4float %117 0 + OpStore %gl_Position_1 %121 + %122 = OpCompositeExtract %v2float %117 1 + OpStore %vUV_1_1 %122 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/1113.wgsl.expected.glsl b/test/tint/bug/tint/1113.wgsl.expected.glsl index 456c153a8a..6e02fa682d 100644 --- a/test/tint/bug/tint/1113.wgsl.expected.glsl +++ b/test/tint/bug/tint/1113.wgsl.expected.glsl @@ -1,6 +1,6 @@ #version 310 es -layout(binding = 0, std140) uniform Uniforms_ubo { +struct Uniforms { uint numTriangles; uint gridSize; uint pad1; @@ -9,6 +9,25 @@ layout(binding = 0, std140) uniform Uniforms_ubo { uint pad; vec3 bbMax; uint pad_1; +}; + +struct Dbg { + uint offsetCounter; + uint pad0; + uint pad1; + uint pad2; + uint value0; + uint value1; + uint value2; + uint value3; + float value_f32_0; + float value_f32_1; + float value_f32_2; + float value_f32_3; +}; + +layout(binding = 0, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; layout(binding = 10, std430) buffer U32s_ssbo { @@ -27,30 +46,19 @@ layout(binding = 21, std430) buffer AI32s_ssbo { int values[]; } LUT; -layout(binding = 50, std430) buffer Dbg_ssbo { - uint offsetCounter; - uint pad0; - uint pad1; - uint pad2; - uint value0; - uint value1; - uint value2; - uint value3; - float value_f32_0; - float value_f32_1; - float value_f32_2; - float value_f32_3; +layout(binding = 50, std430) buffer dbg_block_ssbo { + Dbg inner; } dbg; vec3 toVoxelPos(vec3 position) { - vec3 bbMin = vec3(uniforms.bbMin.x, uniforms.bbMin.y, uniforms.bbMin.z); - vec3 bbMax = vec3(uniforms.bbMax.x, uniforms.bbMax.y, uniforms.bbMax.z); + vec3 bbMin = vec3(uniforms.inner.bbMin.x, uniforms.inner.bbMin.y, uniforms.inner.bbMin.z); + vec3 bbMax = vec3(uniforms.inner.bbMax.x, uniforms.inner.bbMax.y, uniforms.inner.bbMax.z); vec3 bbSize = (bbMax - bbMin); float cubeSize = max(max(bbSize.x, bbSize.y), bbSize.z); - float gridSize = float(uniforms.gridSize); - float gx = ((gridSize * (position.x - uniforms.bbMin.x)) / cubeSize); - float gy = ((gridSize * (position.y - uniforms.bbMin.y)) / cubeSize); - float gz = ((gridSize * (position.z - uniforms.bbMin.z)) / cubeSize); + float gridSize = float(uniforms.inner.gridSize); + float gx = ((gridSize * (position.x - uniforms.inner.bbMin.x)) / cubeSize); + float gy = ((gridSize * (position.y - uniforms.inner.bbMin.y)) / cubeSize); + float gz = ((gridSize * (position.z - uniforms.inner.bbMin.z)) / cubeSize); return vec3(gx, gy, gz); } @@ -65,8 +73,8 @@ vec3 loadPosition(uint vertexIndex) { } void doIgnore() { - uint g42 = uniforms.numTriangles; - uint kj6 = dbg.value1; + uint g42 = uniforms.inner.numTriangles; + uint kj6 = dbg.inner.value1; uint b53 = atomicOr(counters.values[0], 0u); uint rwg = indices.values[0]; float rb5 = positions.values[0]; @@ -75,7 +83,7 @@ void doIgnore() { void main_count(uvec3 GlobalInvocationID) { uint triangleIndex = GlobalInvocationID.x; - if ((triangleIndex >= uniforms.numTriangles)) { + if ((triangleIndex >= uniforms.inner.numTriangles)) { return; } doIgnore(); @@ -87,13 +95,13 @@ void main_count(uvec3 GlobalInvocationID) { vec3 p2 = loadPosition(i2); vec3 center = (((p0 + p1) + p2) / 3.0f); vec3 voxelPos = toVoxelPos(center); - uint voxelIndex = toIndex1D(uniforms.gridSize, voxelPos); + uint voxelIndex = toIndex1D(uniforms.inner.gridSize, voxelPos); uint acefg = atomicAdd(counters.values[voxelIndex], 1u); if ((triangleIndex == 0u)) { - dbg.value0 = uniforms.gridSize; - dbg.value_f32_0 = center.x; - dbg.value_f32_1 = center.y; - dbg.value_f32_2 = center.z; + dbg.inner.value0 = uniforms.inner.gridSize; + dbg.inner.value_f32_0 = center.x; + dbg.inner.value_f32_1 = center.y; + dbg.inner.value_f32_2 = center.z; } } @@ -104,7 +112,7 @@ void main() { } #version 310 es -layout(binding = 0, std140) uniform Uniforms_ubo { +struct Uniforms { uint numTriangles; uint gridSize; uint pad1; @@ -113,6 +121,25 @@ layout(binding = 0, std140) uniform Uniforms_ubo { uint pad; vec3 bbMax; uint pad_1; +}; + +struct Dbg { + uint offsetCounter; + uint pad0; + uint pad1; + uint pad2; + uint value0; + uint value1; + uint value2; + uint value3; + float value_f32_0; + float value_f32_1; + float value_f32_2; + float value_f32_3; +}; + +layout(binding = 0, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; layout(binding = 10, std430) buffer U32s_ssbo { @@ -131,24 +158,13 @@ layout(binding = 21, std430) buffer AI32s_ssbo { int values[]; } LUT; -layout(binding = 50, std430) buffer Dbg_ssbo { - uint offsetCounter; - uint pad0; - uint pad1; - uint pad2; - uint value0; - uint value1; - uint value2; - uint value3; - float value_f32_0; - float value_f32_1; - float value_f32_2; - float value_f32_3; +layout(binding = 50, std430) buffer dbg_block_ssbo { + Dbg inner; } dbg; void doIgnore() { - uint g42 = uniforms.numTriangles; - uint kj6 = dbg.value1; + uint g42 = uniforms.inner.numTriangles; + uint kj6 = dbg.inner.value1; uint b53 = atomicOr(counters.values[0], 0u); uint rwg = indices.values[0]; float rb5 = positions.values[0]; @@ -158,14 +174,14 @@ void doIgnore() { void main_create_lut(uvec3 GlobalInvocationID) { uint voxelIndex = GlobalInvocationID.x; doIgnore(); - uint maxVoxels = ((uniforms.gridSize * uniforms.gridSize) * uniforms.gridSize); + uint maxVoxels = ((uniforms.inner.gridSize * uniforms.inner.gridSize) * uniforms.inner.gridSize); if ((voxelIndex >= maxVoxels)) { return; } uint numTriangles = atomicOr(counters.values[voxelIndex], 0u); int offset = -1; if ((numTriangles > 0u)) { - uint tint_symbol = atomicAdd(dbg.offsetCounter, numTriangles); + uint tint_symbol = atomicAdd(dbg.inner.offsetCounter, numTriangles); offset = int(tint_symbol); } atomicExchange(LUT.values[voxelIndex], offset); @@ -178,7 +194,7 @@ void main() { } #version 310 es -layout(binding = 0, std140) uniform Uniforms_ubo { +struct Uniforms { uint numTriangles; uint gridSize; uint pad1; @@ -187,6 +203,25 @@ layout(binding = 0, std140) uniform Uniforms_ubo { uint pad; vec3 bbMax; uint pad_1; +}; + +struct Dbg { + uint offsetCounter; + uint pad0; + uint pad1; + uint pad2; + uint value0; + uint value1; + uint value2; + uint value3; + float value_f32_0; + float value_f32_1; + float value_f32_2; + float value_f32_3; +}; + +layout(binding = 0, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; layout(binding = 10, std430) buffer U32s_ssbo { @@ -205,30 +240,19 @@ layout(binding = 21, std430) buffer AI32s_ssbo { int values[]; } LUT; -layout(binding = 50, std430) buffer Dbg_ssbo { - uint offsetCounter; - uint pad0; - uint pad1; - uint pad2; - uint value0; - uint value1; - uint value2; - uint value3; - float value_f32_0; - float value_f32_1; - float value_f32_2; - float value_f32_3; +layout(binding = 50, std430) buffer dbg_block_ssbo { + Dbg inner; } dbg; vec3 toVoxelPos(vec3 position) { - vec3 bbMin = vec3(uniforms.bbMin.x, uniforms.bbMin.y, uniforms.bbMin.z); - vec3 bbMax = vec3(uniforms.bbMax.x, uniforms.bbMax.y, uniforms.bbMax.z); + vec3 bbMin = vec3(uniforms.inner.bbMin.x, uniforms.inner.bbMin.y, uniforms.inner.bbMin.z); + vec3 bbMax = vec3(uniforms.inner.bbMax.x, uniforms.inner.bbMax.y, uniforms.inner.bbMax.z); vec3 bbSize = (bbMax - bbMin); float cubeSize = max(max(bbSize.x, bbSize.y), bbSize.z); - float gridSize = float(uniforms.gridSize); - float gx = ((gridSize * (position.x - uniforms.bbMin.x)) / cubeSize); - float gy = ((gridSize * (position.y - uniforms.bbMin.y)) / cubeSize); - float gz = ((gridSize * (position.z - uniforms.bbMin.z)) / cubeSize); + float gridSize = float(uniforms.inner.gridSize); + float gx = ((gridSize * (position.x - uniforms.inner.bbMin.x)) / cubeSize); + float gy = ((gridSize * (position.y - uniforms.inner.bbMin.y)) / cubeSize); + float gz = ((gridSize * (position.z - uniforms.inner.bbMin.z)) / cubeSize); return vec3(gx, gy, gz); } @@ -243,8 +267,8 @@ vec3 loadPosition(uint vertexIndex) { } void doIgnore() { - uint g42 = uniforms.numTriangles; - uint kj6 = dbg.value1; + uint g42 = uniforms.inner.numTriangles; + uint kj6 = dbg.inner.value1; uint b53 = atomicOr(counters.values[0], 0u); uint rwg = indices.values[0]; float rb5 = positions.values[0]; @@ -254,7 +278,7 @@ void doIgnore() { void main_sort_triangles(uvec3 GlobalInvocationID) { uint triangleIndex = GlobalInvocationID.x; doIgnore(); - if ((triangleIndex >= uniforms.numTriangles)) { + if ((triangleIndex >= uniforms.inner.numTriangles)) { return; } uint i0 = indices.values[((3u * triangleIndex) + 0u)]; @@ -265,7 +289,7 @@ void main_sort_triangles(uvec3 GlobalInvocationID) { vec3 p2 = loadPosition(i2); vec3 center = (((p0 + p1) + p2) / 3.0f); vec3 voxelPos = toVoxelPos(center); - uint voxelIndex = toIndex1D(uniforms.gridSize, voxelPos); + uint voxelIndex = toIndex1D(uniforms.inner.gridSize, voxelPos); int triangleOffset = atomicAdd(LUT.values[voxelIndex], 1); } diff --git a/test/tint/bug/tint/1113.wgsl.expected.spvasm b/test/tint/bug/tint/1113.wgsl.expected.spvasm index 8a91127124..ae2be84b18 100644 --- a/test/tint/bug/tint/1113.wgsl.expected.spvasm +++ b/test/tint/bug/tint/1113.wgsl.expected.spvasm @@ -1,10 +1,10 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 402 +; Bound: 404 ; Schema: 0 OpCapability Shader - %65 = OpExtInstImport "GLSL.std.450" + %67 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main_count "main_count" %GlobalInvocationID_1 OpEntryPoint GLCompute %main_create_lut "main_create_lut" %GlobalInvocationID_2 @@ -15,6 +15,8 @@ OpName %GlobalInvocationID_1 "GlobalInvocationID_1" OpName %GlobalInvocationID_2 "GlobalInvocationID_2" OpName %GlobalInvocationID_3 "GlobalInvocationID_3" + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "numTriangles" OpMemberName %Uniforms 1 "gridSize" @@ -35,6 +37,8 @@ OpName %AI32s "AI32s" OpMemberName %AI32s 0 "values" OpName %LUT "LUT" + OpName %dbg_block "dbg_block" + OpMemberName %dbg_block 0 "inner" OpName %Dbg "Dbg" OpMemberName %Dbg 0 "offsetCounter" OpMemberName %Dbg 1 "pad0" @@ -117,7 +121,8 @@ OpDecorate %GlobalInvocationID_1 BuiltIn GlobalInvocationId OpDecorate %GlobalInvocationID_2 BuiltIn GlobalInvocationId OpDecorate %GlobalInvocationID_3 BuiltIn GlobalInvocationId - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 1 Offset 4 OpMemberDecorate %Uniforms 2 Offset 8 @@ -147,7 +152,8 @@ OpDecorate %_runtimearr_int ArrayStride 4 OpDecorate %LUT Binding 21 OpDecorate %LUT DescriptorSet 0 - OpDecorate %Dbg Block + OpDecorate %dbg_block Block + OpMemberDecorate %dbg_block 0 Offset 0 OpMemberDecorate %Dbg 0 Offset 0 OpMemberDecorate %Dbg 1 Offset 4 OpMemberDecorate %Dbg 2 Offset 8 @@ -171,8 +177,9 @@ %float = OpTypeFloat 32 %v3float = OpTypeVector %float 3 %Uniforms = OpTypeStruct %uint %uint %uint %uint %v3float %v3float -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %_runtimearr_uint = OpTypeRuntimeArray %uint %U32s = OpTypeStruct %_runtimearr_uint %_ptr_StorageBuffer_U32s = OpTypePointer StorageBuffer %U32s @@ -191,37 +198,38 @@ %_ptr_StorageBuffer_AI32s = OpTypePointer StorageBuffer %AI32s %LUT = OpVariable %_ptr_StorageBuffer_AI32s StorageBuffer %Dbg = OpTypeStruct %uint %uint %uint %uint %uint %uint %uint %uint %float %float %float %float -%_ptr_StorageBuffer_Dbg = OpTypePointer StorageBuffer %Dbg - %dbg = OpVariable %_ptr_StorageBuffer_Dbg StorageBuffer - %32 = OpTypeFunction %v3float %v3float - %uint_4 = OpConstant %uint 4 + %dbg_block = OpTypeStruct %Dbg +%_ptr_StorageBuffer_dbg_block = OpTypePointer StorageBuffer %dbg_block + %dbg = OpVariable %_ptr_StorageBuffer_dbg_block StorageBuffer + %34 = OpTypeFunction %v3float %v3float %uint_0 = OpConstant %uint 0 + %uint_4 = OpConstant %uint 4 %_ptr_Uniform_float = OpTypePointer Uniform %float %uint_1 = OpConstant %uint 1 %uint_2 = OpConstant %uint 2 %_ptr_Function_v3float = OpTypePointer Function %v3float - %50 = OpConstantNull %v3float + %52 = OpConstantNull %v3float %uint_5 = OpConstant %uint 5 %_ptr_Function_float = OpTypePointer Function %float - %75 = OpConstantNull %float + %77 = OpConstantNull %float %_ptr_Uniform_uint = OpTypePointer Uniform %uint - %112 = OpTypeFunction %uint %uint %v3float + %114 = OpTypeFunction %uint %uint %v3float %_ptr_Function_v3uint = OpTypePointer Function %v3uint - %120 = OpConstantNull %v3uint + %122 = OpConstantNull %v3uint %_ptr_Function_uint = OpTypePointer Function %uint - %133 = OpTypeFunction %v3uint %uint %uint - %141 = OpConstantNull %uint - %154 = OpTypeFunction %v3float %uint + %135 = OpTypeFunction %v3uint %uint %uint + %143 = OpConstantNull %uint + %156 = OpTypeFunction %v3float %uint %uint_3 = OpConstant %uint 3 %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float %void = OpTypeVoid - %175 = OpTypeFunction %void + %177 = OpTypeFunction %void %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint - %188 = OpConstantNull %int + %190 = OpConstantNull %int %_ptr_StorageBuffer_uint_0 = OpTypePointer StorageBuffer %uint %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_Function_int = OpTypePointer Function %int - %204 = OpTypeFunction %void %v3uint + %206 = OpTypeFunction %void %v3uint %bool = OpTypeBool %float_3 = OpConstant %float 3 %uint_8 = OpConstant %uint 8 @@ -229,416 +237,416 @@ %uint_10 = OpConstant %uint 10 %int_n1 = OpConstant %int -1 %int_1 = OpConstant %int 1 - %toVoxelPos = OpFunction %v3float None %32 + %toVoxelPos = OpFunction %v3float None %34 %position = OpFunctionParameter %v3float - %35 = OpLabel - %bbMin = OpVariable %_ptr_Function_v3float Function %50 - %bbMax = OpVariable %_ptr_Function_v3float Function %50 - %bbSize = OpVariable %_ptr_Function_v3float Function %50 - %cubeSize = OpVariable %_ptr_Function_float Function %75 - %gridSize = OpVariable %_ptr_Function_float Function %75 - %gx = OpVariable %_ptr_Function_float Function %75 - %gy = OpVariable %_ptr_Function_float Function %75 - %gz = OpVariable %_ptr_Function_float Function %75 - %39 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_0 - %40 = OpLoad %float %39 - %42 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_1 - %43 = OpLoad %float %42 - %45 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_2 - %46 = OpLoad %float %45 - %47 = OpCompositeConstruct %v3float %40 %43 %46 - OpStore %bbMin %47 - %52 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_5 %uint_0 - %53 = OpLoad %float %52 - %54 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_5 %uint_1 + %37 = OpLabel + %bbMin = OpVariable %_ptr_Function_v3float Function %52 + %bbMax = OpVariable %_ptr_Function_v3float Function %52 + %bbSize = OpVariable %_ptr_Function_v3float Function %52 + %cubeSize = OpVariable %_ptr_Function_float Function %77 + %gridSize = OpVariable %_ptr_Function_float Function %77 + %gx = OpVariable %_ptr_Function_float Function %77 + %gy = OpVariable %_ptr_Function_float Function %77 + %gz = OpVariable %_ptr_Function_float Function %77 + %41 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_0 + %42 = OpLoad %float %41 + %44 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_1 + %45 = OpLoad %float %44 + %47 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_2 + %48 = OpLoad %float %47 + %49 = OpCompositeConstruct %v3float %42 %45 %48 + OpStore %bbMin %49 + %54 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_5 %uint_0 %55 = OpLoad %float %54 - %56 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_5 %uint_2 + %56 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_5 %uint_1 %57 = OpLoad %float %56 - %58 = OpCompositeConstruct %v3float %53 %55 %57 - OpStore %bbMax %58 - %60 = OpLoad %v3float %bbMax - %61 = OpLoad %v3float %bbMin - %62 = OpFSub %v3float %60 %61 - OpStore %bbSize %62 - %68 = OpAccessChain %_ptr_Function_float %bbSize %uint_0 - %69 = OpLoad %float %68 - %70 = OpAccessChain %_ptr_Function_float %bbSize %uint_1 + %58 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_5 %uint_2 + %59 = OpLoad %float %58 + %60 = OpCompositeConstruct %v3float %55 %57 %59 + OpStore %bbMax %60 + %62 = OpLoad %v3float %bbMax + %63 = OpLoad %v3float %bbMin + %64 = OpFSub %v3float %62 %63 + OpStore %bbSize %64 + %70 = OpAccessChain %_ptr_Function_float %bbSize %uint_0 %71 = OpLoad %float %70 - %66 = OpExtInst %float %65 NMax %69 %71 - %72 = OpAccessChain %_ptr_Function_float %bbSize %uint_2 + %72 = OpAccessChain %_ptr_Function_float %bbSize %uint_1 %73 = OpLoad %float %72 - %64 = OpExtInst %float %65 NMax %66 %73 - OpStore %cubeSize %64 - %78 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %79 = OpLoad %uint %78 - %76 = OpConvertUToF %float %79 - OpStore %gridSize %76 - %81 = OpLoad %float %gridSize - %82 = OpCompositeExtract %float %position 0 - %83 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_0 - %84 = OpLoad %float %83 - %85 = OpFSub %float %82 %84 - %86 = OpFMul %float %81 %85 - %87 = OpLoad %float %cubeSize - %88 = OpFDiv %float %86 %87 - OpStore %gx %88 - %90 = OpLoad %float %gridSize - %91 = OpCompositeExtract %float %position 1 - %92 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_1 - %93 = OpLoad %float %92 - %94 = OpFSub %float %91 %93 - %95 = OpFMul %float %90 %94 - %96 = OpLoad %float %cubeSize - %97 = OpFDiv %float %95 %96 - OpStore %gy %97 - %99 = OpLoad %float %gridSize - %100 = OpCompositeExtract %float %position 2 - %101 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_2 - %102 = OpLoad %float %101 - %103 = OpFSub %float %100 %102 - %104 = OpFMul %float %99 %103 - %105 = OpLoad %float %cubeSize - %106 = OpFDiv %float %104 %105 - OpStore %gz %106 - %108 = OpLoad %float %gx - %109 = OpLoad %float %gy - %110 = OpLoad %float %gz - %111 = OpCompositeConstruct %v3float %108 %109 %110 - OpReturnValue %111 + %68 = OpExtInst %float %67 NMax %71 %73 + %74 = OpAccessChain %_ptr_Function_float %bbSize %uint_2 + %75 = OpLoad %float %74 + %66 = OpExtInst %float %67 NMax %68 %75 + OpStore %cubeSize %66 + %80 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 + %81 = OpLoad %uint %80 + %78 = OpConvertUToF %float %81 + OpStore %gridSize %78 + %83 = OpLoad %float %gridSize + %84 = OpCompositeExtract %float %position 0 + %85 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_0 + %86 = OpLoad %float %85 + %87 = OpFSub %float %84 %86 + %88 = OpFMul %float %83 %87 + %89 = OpLoad %float %cubeSize + %90 = OpFDiv %float %88 %89 + OpStore %gx %90 + %92 = OpLoad %float %gridSize + %93 = OpCompositeExtract %float %position 1 + %94 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_1 + %95 = OpLoad %float %94 + %96 = OpFSub %float %93 %95 + %97 = OpFMul %float %92 %96 + %98 = OpLoad %float %cubeSize + %99 = OpFDiv %float %97 %98 + OpStore %gy %99 + %101 = OpLoad %float %gridSize + %102 = OpCompositeExtract %float %position 2 + %103 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_2 + %104 = OpLoad %float %103 + %105 = OpFSub %float %102 %104 + %106 = OpFMul %float %101 %105 + %107 = OpLoad %float %cubeSize + %108 = OpFDiv %float %106 %107 + OpStore %gz %108 + %110 = OpLoad %float %gx + %111 = OpLoad %float %gy + %112 = OpLoad %float %gz + %113 = OpCompositeConstruct %v3float %110 %111 %112 + OpReturnValue %113 OpFunctionEnd - %toIndex1D = OpFunction %uint None %112 + %toIndex1D = OpFunction %uint None %114 %gridSize_0 = OpFunctionParameter %uint %voxelPos = OpFunctionParameter %v3float - %116 = OpLabel - %icoord = OpVariable %_ptr_Function_v3uint Function %120 - %117 = OpConvertFToU %v3uint %voxelPos - OpStore %icoord %117 - %122 = OpAccessChain %_ptr_Function_uint %icoord %uint_0 - %123 = OpLoad %uint %122 - %124 = OpAccessChain %_ptr_Function_uint %icoord %uint_1 + %118 = OpLabel + %icoord = OpVariable %_ptr_Function_v3uint Function %122 + %119 = OpConvertFToU %v3uint %voxelPos + OpStore %icoord %119 + %124 = OpAccessChain %_ptr_Function_uint %icoord %uint_0 %125 = OpLoad %uint %124 - %126 = OpIMul %uint %gridSize_0 %125 - %127 = OpIAdd %uint %123 %126 - %128 = OpIMul %uint %gridSize_0 %gridSize_0 - %129 = OpAccessChain %_ptr_Function_uint %icoord %uint_2 - %130 = OpLoad %uint %129 - %131 = OpIMul %uint %128 %130 - %132 = OpIAdd %uint %127 %131 - OpReturnValue %132 + %126 = OpAccessChain %_ptr_Function_uint %icoord %uint_1 + %127 = OpLoad %uint %126 + %128 = OpIMul %uint %gridSize_0 %127 + %129 = OpIAdd %uint %125 %128 + %130 = OpIMul %uint %gridSize_0 %gridSize_0 + %131 = OpAccessChain %_ptr_Function_uint %icoord %uint_2 + %132 = OpLoad %uint %131 + %133 = OpIMul %uint %130 %132 + %134 = OpIAdd %uint %129 %133 + OpReturnValue %134 OpFunctionEnd - %toIndex3D = OpFunction %v3uint None %133 + %toIndex3D = OpFunction %v3uint None %135 %gridSize_1 = OpFunctionParameter %uint %index = OpFunctionParameter %uint - %137 = OpLabel - %z = OpVariable %_ptr_Function_uint Function %141 - %y = OpVariable %_ptr_Function_uint Function %141 - %x = OpVariable %_ptr_Function_uint Function %141 - %138 = OpIMul %uint %gridSize_1 %gridSize_1 - %139 = OpUDiv %uint %index %138 - OpStore %z %139 - %142 = OpIMul %uint %gridSize_1 %gridSize_1 - %143 = OpLoad %uint %z - %144 = OpIMul %uint %142 %143 - %145 = OpISub %uint %index %144 - %146 = OpUDiv %uint %145 %gridSize_1 - OpStore %y %146 - %148 = OpUMod %uint %index %gridSize_1 - OpStore %x %148 - %150 = OpLoad %uint %x - %151 = OpLoad %uint %y - %152 = OpLoad %uint %z - %153 = OpCompositeConstruct %v3uint %150 %151 %152 - OpReturnValue %153 + %139 = OpLabel + %z = OpVariable %_ptr_Function_uint Function %143 + %y = OpVariable %_ptr_Function_uint Function %143 + %x = OpVariable %_ptr_Function_uint Function %143 + %140 = OpIMul %uint %gridSize_1 %gridSize_1 + %141 = OpUDiv %uint %index %140 + OpStore %z %141 + %144 = OpIMul %uint %gridSize_1 %gridSize_1 + %145 = OpLoad %uint %z + %146 = OpIMul %uint %144 %145 + %147 = OpISub %uint %index %146 + %148 = OpUDiv %uint %147 %gridSize_1 + OpStore %y %148 + %150 = OpUMod %uint %index %gridSize_1 + OpStore %x %150 + %152 = OpLoad %uint %x + %153 = OpLoad %uint %y + %154 = OpLoad %uint %z + %155 = OpCompositeConstruct %v3uint %152 %153 %154 + OpReturnValue %155 OpFunctionEnd -%loadPosition = OpFunction %v3float None %154 +%loadPosition = OpFunction %v3float None %156 %vertexIndex = OpFunctionParameter %uint - %157 = OpLabel - %position_0 = OpVariable %_ptr_Function_v3float Function %50 - %159 = OpIMul %uint %uint_3 %vertexIndex - %160 = OpIAdd %uint %159 %141 - %162 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %160 - %163 = OpLoad %float %162 - %164 = OpIMul %uint %uint_3 %vertexIndex - %165 = OpIAdd %uint %164 %uint_1 - %166 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %165 - %167 = OpLoad %float %166 - %168 = OpIMul %uint %uint_3 %vertexIndex - %169 = OpIAdd %uint %168 %uint_2 - %170 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %169 - %171 = OpLoad %float %170 - %172 = OpCompositeConstruct %v3float %163 %167 %171 - OpStore %position_0 %172 - %174 = OpLoad %v3float %position_0 - OpReturnValue %174 + %159 = OpLabel + %position_0 = OpVariable %_ptr_Function_v3float Function %52 + %161 = OpIMul %uint %uint_3 %vertexIndex + %162 = OpIAdd %uint %161 %143 + %164 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %162 + %165 = OpLoad %float %164 + %166 = OpIMul %uint %uint_3 %vertexIndex + %167 = OpIAdd %uint %166 %uint_1 + %168 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %167 + %169 = OpLoad %float %168 + %170 = OpIMul %uint %uint_3 %vertexIndex + %171 = OpIAdd %uint %170 %uint_2 + %172 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %171 + %173 = OpLoad %float %172 + %174 = OpCompositeConstruct %v3float %165 %169 %173 + OpStore %position_0 %174 + %176 = OpLoad %v3float %position_0 + OpReturnValue %176 OpFunctionEnd - %doIgnore = OpFunction %void None %175 - %178 = OpLabel - %g42 = OpVariable %_ptr_Function_uint Function %141 - %kj6 = OpVariable %_ptr_Function_uint Function %141 - %b53 = OpVariable %_ptr_Function_uint Function %141 - %rwg = OpVariable %_ptr_Function_uint Function %141 - %rb5 = OpVariable %_ptr_Function_float Function %75 - %g55 = OpVariable %_ptr_Function_int Function %188 - %179 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %180 = OpLoad %uint %179 - OpStore %g42 %180 - %183 = OpAccessChain %_ptr_StorageBuffer_uint %dbg %uint_5 - %184 = OpLoad %uint %183 - OpStore %kj6 %184 - %190 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %188 - %186 = OpAtomicLoad %uint %190 %uint_1 %uint_0 - OpStore %b53 %186 - %192 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %188 - %193 = OpLoad %uint %192 - OpStore %rwg %193 - %195 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %188 - %196 = OpLoad %float %195 - OpStore %rb5 %196 - %201 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %188 - %198 = OpAtomicLoad %int %201 %uint_1 %uint_0 - OpStore %g55 %198 + %doIgnore = OpFunction %void None %177 + %180 = OpLabel + %g42 = OpVariable %_ptr_Function_uint Function %143 + %kj6 = OpVariable %_ptr_Function_uint Function %143 + %b53 = OpVariable %_ptr_Function_uint Function %143 + %rwg = OpVariable %_ptr_Function_uint Function %143 + %rb5 = OpVariable %_ptr_Function_float Function %77 + %g55 = OpVariable %_ptr_Function_int Function %190 + %181 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %182 = OpLoad %uint %181 + OpStore %g42 %182 + %185 = OpAccessChain %_ptr_StorageBuffer_uint %dbg %uint_0 %uint_5 + %186 = OpLoad %uint %185 + OpStore %kj6 %186 + %192 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %190 + %188 = OpAtomicLoad %uint %192 %uint_1 %uint_0 + OpStore %b53 %188 + %194 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %190 + %195 = OpLoad %uint %194 + OpStore %rwg %195 + %197 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %190 + %198 = OpLoad %float %197 + OpStore %rb5 %198 + %203 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %190 + %200 = OpAtomicLoad %int %203 %uint_1 %uint_0 + OpStore %g55 %200 OpReturn OpFunctionEnd -%main_count_inner = OpFunction %void None %204 +%main_count_inner = OpFunction %void None %206 %GlobalInvocationID = OpFunctionParameter %v3uint - %207 = OpLabel -%triangleIndex = OpVariable %_ptr_Function_uint Function %141 - %i0 = OpVariable %_ptr_Function_uint Function %141 - %i1 = OpVariable %_ptr_Function_uint Function %141 - %i2 = OpVariable %_ptr_Function_uint Function %141 - %p0 = OpVariable %_ptr_Function_v3float Function %50 - %p1 = OpVariable %_ptr_Function_v3float Function %50 - %p2 = OpVariable %_ptr_Function_v3float Function %50 - %252 = OpVariable %_ptr_Function_v3float Function %50 - %center = OpVariable %_ptr_Function_v3float Function %50 - %voxelPos_0 = OpVariable %_ptr_Function_v3float Function %50 - %voxelIndex = OpVariable %_ptr_Function_uint Function %141 - %acefg = OpVariable %_ptr_Function_uint Function %141 - %208 = OpCompositeExtract %uint %GlobalInvocationID 0 - OpStore %triangleIndex %208 - %210 = OpLoad %uint %triangleIndex - %211 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %212 = OpLoad %uint %211 - %213 = OpUGreaterThanEqual %bool %210 %212 - OpSelectionMerge %215 None - OpBranchConditional %213 %216 %215 - %216 = OpLabel + %209 = OpLabel +%triangleIndex = OpVariable %_ptr_Function_uint Function %143 + %i0 = OpVariable %_ptr_Function_uint Function %143 + %i1 = OpVariable %_ptr_Function_uint Function %143 + %i2 = OpVariable %_ptr_Function_uint Function %143 + %p0 = OpVariable %_ptr_Function_v3float Function %52 + %p1 = OpVariable %_ptr_Function_v3float Function %52 + %p2 = OpVariable %_ptr_Function_v3float Function %52 + %254 = OpVariable %_ptr_Function_v3float Function %52 + %center = OpVariable %_ptr_Function_v3float Function %52 + %voxelPos_0 = OpVariable %_ptr_Function_v3float Function %52 + %voxelIndex = OpVariable %_ptr_Function_uint Function %143 + %acefg = OpVariable %_ptr_Function_uint Function %143 + %210 = OpCompositeExtract %uint %GlobalInvocationID 0 + OpStore %triangleIndex %210 + %212 = OpLoad %uint %triangleIndex + %213 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %214 = OpLoad %uint %213 + %215 = OpUGreaterThanEqual %bool %212 %214 + OpSelectionMerge %217 None + OpBranchConditional %215 %218 %217 + %218 = OpLabel OpReturn - %215 = OpLabel - %217 = OpFunctionCall %void %doIgnore - %218 = OpLoad %uint %triangleIndex - %219 = OpIMul %uint %uint_3 %218 - %220 = OpIAdd %uint %219 %141 - %221 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %220 - %222 = OpLoad %uint %221 - OpStore %i0 %222 - %224 = OpLoad %uint %triangleIndex - %225 = OpIMul %uint %uint_3 %224 - %226 = OpIAdd %uint %225 %uint_1 - %227 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %226 - %228 = OpLoad %uint %227 - OpStore %i1 %228 - %230 = OpLoad %uint %triangleIndex - %231 = OpIMul %uint %uint_3 %230 - %232 = OpIAdd %uint %231 %uint_2 - %233 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %232 - %234 = OpLoad %uint %233 - OpStore %i2 %234 - %237 = OpLoad %uint %i0 - %236 = OpFunctionCall %v3float %loadPosition %237 - OpStore %p0 %236 - %240 = OpLoad %uint %i1 - %239 = OpFunctionCall %v3float %loadPosition %240 - OpStore %p1 %239 - %243 = OpLoad %uint %i2 - %242 = OpFunctionCall %v3float %loadPosition %243 - OpStore %p2 %242 - %245 = OpLoad %v3float %p0 - %246 = OpLoad %v3float %p1 - %247 = OpFAdd %v3float %245 %246 - %248 = OpLoad %v3float %p2 + %217 = OpLabel + %219 = OpFunctionCall %void %doIgnore + %220 = OpLoad %uint %triangleIndex + %221 = OpIMul %uint %uint_3 %220 + %222 = OpIAdd %uint %221 %143 + %223 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %222 + %224 = OpLoad %uint %223 + OpStore %i0 %224 + %226 = OpLoad %uint %triangleIndex + %227 = OpIMul %uint %uint_3 %226 + %228 = OpIAdd %uint %227 %uint_1 + %229 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %228 + %230 = OpLoad %uint %229 + OpStore %i1 %230 + %232 = OpLoad %uint %triangleIndex + %233 = OpIMul %uint %uint_3 %232 + %234 = OpIAdd %uint %233 %uint_2 + %235 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %234 + %236 = OpLoad %uint %235 + OpStore %i2 %236 + %239 = OpLoad %uint %i0 + %238 = OpFunctionCall %v3float %loadPosition %239 + OpStore %p0 %238 + %242 = OpLoad %uint %i1 + %241 = OpFunctionCall %v3float %loadPosition %242 + OpStore %p1 %241 + %245 = OpLoad %uint %i2 + %244 = OpFunctionCall %v3float %loadPosition %245 + OpStore %p2 %244 + %247 = OpLoad %v3float %p0 + %248 = OpLoad %v3float %p1 %249 = OpFAdd %v3float %247 %248 - %253 = OpCompositeConstruct %v3float %float_3 %float_3 %float_3 - %251 = OpFDiv %v3float %249 %253 - OpStore %center %251 - %256 = OpLoad %v3float %center - %255 = OpFunctionCall %v3float %toVoxelPos %256 - OpStore %voxelPos_0 %255 - %259 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %260 = OpLoad %uint %259 - %261 = OpLoad %v3float %voxelPos_0 - %258 = OpFunctionCall %uint %toIndex1D %260 %261 - OpStore %voxelIndex %258 - %265 = OpLoad %uint %voxelIndex - %266 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %265 - %263 = OpAtomicIAdd %uint %266 %uint_1 %uint_0 %uint_1 - OpStore %acefg %263 - %268 = OpLoad %uint %triangleIndex - %269 = OpIEqual %bool %268 %141 - OpSelectionMerge %270 None - OpBranchConditional %269 %271 %270 - %271 = OpLabel - %272 = OpAccessChain %_ptr_StorageBuffer_uint %dbg %uint_4 - %273 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %274 = OpLoad %uint %273 - OpStore %272 %274 - %276 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_8 - %277 = OpAccessChain %_ptr_Function_float %center %uint_0 - %278 = OpLoad %float %277 - OpStore %276 %278 - %280 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_9 - %281 = OpAccessChain %_ptr_Function_float %center %uint_1 - %282 = OpLoad %float %281 - OpStore %280 %282 - %284 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_10 - %285 = OpAccessChain %_ptr_Function_float %center %uint_2 - %286 = OpLoad %float %285 - OpStore %284 %286 - OpBranch %270 - %270 = OpLabel + %250 = OpLoad %v3float %p2 + %251 = OpFAdd %v3float %249 %250 + %255 = OpCompositeConstruct %v3float %float_3 %float_3 %float_3 + %253 = OpFDiv %v3float %251 %255 + OpStore %center %253 + %258 = OpLoad %v3float %center + %257 = OpFunctionCall %v3float %toVoxelPos %258 + OpStore %voxelPos_0 %257 + %261 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 + %262 = OpLoad %uint %261 + %263 = OpLoad %v3float %voxelPos_0 + %260 = OpFunctionCall %uint %toIndex1D %262 %263 + OpStore %voxelIndex %260 + %267 = OpLoad %uint %voxelIndex + %268 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %267 + %265 = OpAtomicIAdd %uint %268 %uint_1 %uint_0 %uint_1 + OpStore %acefg %265 + %270 = OpLoad %uint %triangleIndex + %271 = OpIEqual %bool %270 %143 + OpSelectionMerge %272 None + OpBranchConditional %271 %273 %272 + %273 = OpLabel + %274 = OpAccessChain %_ptr_StorageBuffer_uint %dbg %uint_0 %uint_4 + %275 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 + %276 = OpLoad %uint %275 + OpStore %274 %276 + %278 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_0 %uint_8 + %279 = OpAccessChain %_ptr_Function_float %center %uint_0 + %280 = OpLoad %float %279 + OpStore %278 %280 + %282 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_0 %uint_9 + %283 = OpAccessChain %_ptr_Function_float %center %uint_1 + %284 = OpLoad %float %283 + OpStore %282 %284 + %286 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_0 %uint_10 + %287 = OpAccessChain %_ptr_Function_float %center %uint_2 + %288 = OpLoad %float %287 + OpStore %286 %288 + OpBranch %272 + %272 = OpLabel OpReturn OpFunctionEnd - %main_count = OpFunction %void None %175 - %288 = OpLabel - %290 = OpLoad %v3uint %GlobalInvocationID_1 - %289 = OpFunctionCall %void %main_count_inner %290 + %main_count = OpFunction %void None %177 + %290 = OpLabel + %292 = OpLoad %v3uint %GlobalInvocationID_1 + %291 = OpFunctionCall %void %main_count_inner %292 OpReturn OpFunctionEnd -%main_create_lut_inner = OpFunction %void None %204 +%main_create_lut_inner = OpFunction %void None %206 %GlobalInvocationID_0 = OpFunctionParameter %v3uint - %293 = OpLabel -%voxelIndex_0 = OpVariable %_ptr_Function_uint Function %141 - %maxVoxels = OpVariable %_ptr_Function_uint Function %141 -%numTriangles = OpVariable %_ptr_Function_uint Function %141 - %offset = OpVariable %_ptr_Function_int Function %188 - %294 = OpCompositeExtract %uint %GlobalInvocationID_0 0 - OpStore %voxelIndex_0 %294 - %296 = OpFunctionCall %void %doIgnore - %297 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %298 = OpLoad %uint %297 - %299 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 + %295 = OpLabel +%voxelIndex_0 = OpVariable %_ptr_Function_uint Function %143 + %maxVoxels = OpVariable %_ptr_Function_uint Function %143 +%numTriangles = OpVariable %_ptr_Function_uint Function %143 + %offset = OpVariable %_ptr_Function_int Function %190 + %296 = OpCompositeExtract %uint %GlobalInvocationID_0 0 + OpStore %voxelIndex_0 %296 + %298 = OpFunctionCall %void %doIgnore + %299 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 %300 = OpLoad %uint %299 - %301 = OpIMul %uint %298 %300 - %302 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %303 = OpLoad %uint %302 - %304 = OpIMul %uint %301 %303 - OpStore %maxVoxels %304 - %306 = OpLoad %uint %voxelIndex_0 - %307 = OpLoad %uint %maxVoxels - %308 = OpUGreaterThanEqual %bool %306 %307 - OpSelectionMerge %309 None - OpBranchConditional %308 %310 %309 - %310 = OpLabel + %301 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 + %302 = OpLoad %uint %301 + %303 = OpIMul %uint %300 %302 + %304 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 + %305 = OpLoad %uint %304 + %306 = OpIMul %uint %303 %305 + OpStore %maxVoxels %306 + %308 = OpLoad %uint %voxelIndex_0 + %309 = OpLoad %uint %maxVoxels + %310 = OpUGreaterThanEqual %bool %308 %309 + OpSelectionMerge %311 None + OpBranchConditional %310 %312 %311 + %312 = OpLabel OpReturn - %309 = OpLabel - %313 = OpLoad %uint %voxelIndex_0 - %314 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %313 - %311 = OpAtomicLoad %uint %314 %uint_1 %uint_0 - OpStore %numTriangles %311 + %311 = OpLabel + %315 = OpLoad %uint %voxelIndex_0 + %316 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %315 + %313 = OpAtomicLoad %uint %316 %uint_1 %uint_0 + OpStore %numTriangles %313 OpStore %offset %int_n1 - %318 = OpLoad %uint %numTriangles - %319 = OpUGreaterThan %bool %318 %141 - OpSelectionMerge %320 None - OpBranchConditional %319 %321 %320 - %321 = OpLabel - %324 = OpAccessChain %_ptr_StorageBuffer_uint_0 %dbg %uint_0 - %325 = OpLoad %uint %numTriangles - %322 = OpAtomicIAdd %uint %324 %uint_1 %uint_0 %325 - %326 = OpBitcast %int %322 - OpStore %offset %326 - OpBranch %320 - %320 = OpLabel - %329 = OpLoad %uint %voxelIndex_0 - %330 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %329 - %331 = OpLoad %int %offset - OpAtomicStore %330 %uint_1 %uint_0 %331 + %320 = OpLoad %uint %numTriangles + %321 = OpUGreaterThan %bool %320 %143 + OpSelectionMerge %322 None + OpBranchConditional %321 %323 %322 + %323 = OpLabel + %326 = OpAccessChain %_ptr_StorageBuffer_uint_0 %dbg %uint_0 %uint_0 + %327 = OpLoad %uint %numTriangles + %324 = OpAtomicIAdd %uint %326 %uint_1 %uint_0 %327 + %328 = OpBitcast %int %324 + OpStore %offset %328 + OpBranch %322 + %322 = OpLabel + %331 = OpLoad %uint %voxelIndex_0 + %332 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %331 + %333 = OpLoad %int %offset + OpAtomicStore %332 %uint_1 %uint_0 %333 OpReturn OpFunctionEnd -%main_create_lut = OpFunction %void None %175 - %333 = OpLabel - %335 = OpLoad %v3uint %GlobalInvocationID_2 - %334 = OpFunctionCall %void %main_create_lut_inner %335 +%main_create_lut = OpFunction %void None %177 + %335 = OpLabel + %337 = OpLoad %v3uint %GlobalInvocationID_2 + %336 = OpFunctionCall %void %main_create_lut_inner %337 OpReturn OpFunctionEnd -%main_sort_triangles_inner = OpFunction %void None %204 +%main_sort_triangles_inner = OpFunction %void None %206 %GlobalInvocationID_4 = OpFunctionParameter %v3uint - %338 = OpLabel -%triangleIndex_0 = OpVariable %_ptr_Function_uint Function %141 - %i0_0 = OpVariable %_ptr_Function_uint Function %141 - %i1_0 = OpVariable %_ptr_Function_uint Function %141 - %i2_0 = OpVariable %_ptr_Function_uint Function %141 - %p0_0 = OpVariable %_ptr_Function_v3float Function %50 - %p1_0 = OpVariable %_ptr_Function_v3float Function %50 - %p2_0 = OpVariable %_ptr_Function_v3float Function %50 - %381 = OpVariable %_ptr_Function_v3float Function %50 - %center_0 = OpVariable %_ptr_Function_v3float Function %50 - %voxelPos_1 = OpVariable %_ptr_Function_v3float Function %50 -%voxelIndex_1 = OpVariable %_ptr_Function_uint Function %141 -%triangleOffset = OpVariable %_ptr_Function_int Function %188 - %339 = OpCompositeExtract %uint %GlobalInvocationID_4 0 - OpStore %triangleIndex_0 %339 - %341 = OpFunctionCall %void %doIgnore - %342 = OpLoad %uint %triangleIndex_0 - %343 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %344 = OpLoad %uint %343 - %345 = OpUGreaterThanEqual %bool %342 %344 - OpSelectionMerge %346 None - OpBranchConditional %345 %347 %346 - %347 = OpLabel + %340 = OpLabel +%triangleIndex_0 = OpVariable %_ptr_Function_uint Function %143 + %i0_0 = OpVariable %_ptr_Function_uint Function %143 + %i1_0 = OpVariable %_ptr_Function_uint Function %143 + %i2_0 = OpVariable %_ptr_Function_uint Function %143 + %p0_0 = OpVariable %_ptr_Function_v3float Function %52 + %p1_0 = OpVariable %_ptr_Function_v3float Function %52 + %p2_0 = OpVariable %_ptr_Function_v3float Function %52 + %383 = OpVariable %_ptr_Function_v3float Function %52 + %center_0 = OpVariable %_ptr_Function_v3float Function %52 + %voxelPos_1 = OpVariable %_ptr_Function_v3float Function %52 +%voxelIndex_1 = OpVariable %_ptr_Function_uint Function %143 +%triangleOffset = OpVariable %_ptr_Function_int Function %190 + %341 = OpCompositeExtract %uint %GlobalInvocationID_4 0 + OpStore %triangleIndex_0 %341 + %343 = OpFunctionCall %void %doIgnore + %344 = OpLoad %uint %triangleIndex_0 + %345 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %346 = OpLoad %uint %345 + %347 = OpUGreaterThanEqual %bool %344 %346 + OpSelectionMerge %348 None + OpBranchConditional %347 %349 %348 + %349 = OpLabel OpReturn - %346 = OpLabel - %348 = OpLoad %uint %triangleIndex_0 - %349 = OpIMul %uint %uint_3 %348 - %350 = OpIAdd %uint %349 %141 - %351 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %350 - %352 = OpLoad %uint %351 - OpStore %i0_0 %352 - %354 = OpLoad %uint %triangleIndex_0 - %355 = OpIMul %uint %uint_3 %354 - %356 = OpIAdd %uint %355 %uint_1 - %357 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %356 - %358 = OpLoad %uint %357 - OpStore %i1_0 %358 - %360 = OpLoad %uint %triangleIndex_0 - %361 = OpIMul %uint %uint_3 %360 - %362 = OpIAdd %uint %361 %uint_2 - %363 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %362 - %364 = OpLoad %uint %363 - OpStore %i2_0 %364 - %367 = OpLoad %uint %i0_0 - %366 = OpFunctionCall %v3float %loadPosition %367 - OpStore %p0_0 %366 - %370 = OpLoad %uint %i1_0 - %369 = OpFunctionCall %v3float %loadPosition %370 - OpStore %p1_0 %369 - %373 = OpLoad %uint %i2_0 - %372 = OpFunctionCall %v3float %loadPosition %373 - OpStore %p2_0 %372 - %375 = OpLoad %v3float %p0_0 - %376 = OpLoad %v3float %p1_0 - %377 = OpFAdd %v3float %375 %376 - %378 = OpLoad %v3float %p2_0 + %348 = OpLabel + %350 = OpLoad %uint %triangleIndex_0 + %351 = OpIMul %uint %uint_3 %350 + %352 = OpIAdd %uint %351 %143 + %353 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %352 + %354 = OpLoad %uint %353 + OpStore %i0_0 %354 + %356 = OpLoad %uint %triangleIndex_0 + %357 = OpIMul %uint %uint_3 %356 + %358 = OpIAdd %uint %357 %uint_1 + %359 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %358 + %360 = OpLoad %uint %359 + OpStore %i1_0 %360 + %362 = OpLoad %uint %triangleIndex_0 + %363 = OpIMul %uint %uint_3 %362 + %364 = OpIAdd %uint %363 %uint_2 + %365 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %364 + %366 = OpLoad %uint %365 + OpStore %i2_0 %366 + %369 = OpLoad %uint %i0_0 + %368 = OpFunctionCall %v3float %loadPosition %369 + OpStore %p0_0 %368 + %372 = OpLoad %uint %i1_0 + %371 = OpFunctionCall %v3float %loadPosition %372 + OpStore %p1_0 %371 + %375 = OpLoad %uint %i2_0 + %374 = OpFunctionCall %v3float %loadPosition %375 + OpStore %p2_0 %374 + %377 = OpLoad %v3float %p0_0 + %378 = OpLoad %v3float %p1_0 %379 = OpFAdd %v3float %377 %378 - %382 = OpCompositeConstruct %v3float %float_3 %float_3 %float_3 - %380 = OpFDiv %v3float %379 %382 - OpStore %center_0 %380 - %385 = OpLoad %v3float %center_0 - %384 = OpFunctionCall %v3float %toVoxelPos %385 - OpStore %voxelPos_1 %384 - %388 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %389 = OpLoad %uint %388 - %390 = OpLoad %v3float %voxelPos_1 - %387 = OpFunctionCall %uint %toIndex1D %389 %390 - OpStore %voxelIndex_1 %387 - %394 = OpLoad %uint %voxelIndex_1 - %395 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %394 - %392 = OpAtomicIAdd %int %395 %uint_1 %uint_0 %int_1 - OpStore %triangleOffset %392 + %380 = OpLoad %v3float %p2_0 + %381 = OpFAdd %v3float %379 %380 + %384 = OpCompositeConstruct %v3float %float_3 %float_3 %float_3 + %382 = OpFDiv %v3float %381 %384 + OpStore %center_0 %382 + %387 = OpLoad %v3float %center_0 + %386 = OpFunctionCall %v3float %toVoxelPos %387 + OpStore %voxelPos_1 %386 + %390 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 + %391 = OpLoad %uint %390 + %392 = OpLoad %v3float %voxelPos_1 + %389 = OpFunctionCall %uint %toIndex1D %391 %392 + OpStore %voxelIndex_1 %389 + %396 = OpLoad %uint %voxelIndex_1 + %397 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %396 + %394 = OpAtomicIAdd %int %397 %uint_1 %uint_0 %int_1 + OpStore %triangleOffset %394 OpReturn OpFunctionEnd -%main_sort_triangles = OpFunction %void None %175 - %399 = OpLabel - %401 = OpLoad %v3uint %GlobalInvocationID_3 - %400 = OpFunctionCall %void %main_sort_triangles_inner %401 +%main_sort_triangles = OpFunction %void None %177 + %401 = OpLabel + %403 = OpLoad %v3uint %GlobalInvocationID_3 + %402 = OpFunctionCall %void %main_sort_triangles_inner %403 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/1118.wgsl.expected.glsl b/test/tint/bug/tint/1118.wgsl.expected.glsl index cc9147d2b0..7b0565ab1d 100644 --- a/test/tint/bug/tint/1118.wgsl.expected.glsl +++ b/test/tint/bug/tint/1118.wgsl.expected.glsl @@ -4,25 +4,37 @@ precision mediump float; layout(location = 2) in float fClipDistance3_param_1; layout(location = 3) in float fClipDistance4_param_1; layout(location = 0) out vec4 glFragColor_1_1; -float fClipDistance3 = 0.0f; -float fClipDistance4 = 0.0f; -layout(binding = 0, std140) uniform Scene_ubo { +struct Scene { vec4 vEyePosition; -} x_29; +}; -layout(binding = 1, std140) uniform Material_ubo { +struct Material { vec4 vDiffuseColor; vec3 vAmbientColor; float placeholder; vec3 vEmissiveColor; float placeholder2; -} x_49; +}; -layout(binding = 2, std140) uniform Mesh_ubo { +struct Mesh { float visibility; uint pad; uint pad_1; uint pad_2; +}; + +float fClipDistance3 = 0.0f; +float fClipDistance4 = 0.0f; +layout(binding = 0, std140) uniform x_29_block_ubo { + Scene inner; +} x_29; + +layout(binding = 1, std140) uniform x_49_block_ubo { + Material inner; +} x_49; + +layout(binding = 2, std140) uniform x_137_block_ubo { + Mesh inner; } x_137; vec4 glFragColor = vec4(0.0f, 0.0f, 0.0f, 0.0f); @@ -54,13 +66,13 @@ void main_1() { tint_discard = true; return; } - vec4 x_34 = x_29.vEyePosition; + vec4 x_34 = x_29.inner.vEyePosition; vec3 x_38 = vec3(0.0f); viewDirectionW = normalize((vec3(x_34.x, x_34.y, x_34.z) - x_38)); baseColor = vec4(1.0f); - vec4 x_52 = x_49.vDiffuseColor; + vec4 x_52 = x_49.inner.vDiffuseColor; diffuseColor = vec3(x_52.x, x_52.y, x_52.z); - float x_60 = x_49.vDiffuseColor.w; + float x_60 = x_49.inner.vDiffuseColor.w; alpha = x_60; vec3 x_62 = vec3(0.0f); vec3 x_64 = vec3(0.0f); @@ -76,12 +88,12 @@ void main_1() { shadow = 1.0f; refractionColor = vec4(0.0f, 0.0f, 0.0f, 1.0f); reflectionColor = vec4(0.0f, 0.0f, 0.0f, 1.0f); - vec3 x_94 = x_49.vEmissiveColor; + vec3 x_94 = x_49.inner.vEmissiveColor; emissiveColor = x_94; vec3 x_96 = diffuseBase; vec3 x_97 = diffuseColor; vec3 x_99 = emissiveColor; - vec3 x_103 = x_49.vAmbientColor; + vec3 x_103 = x_49.inner.vAmbientColor; vec4 x_108 = baseColor; finalDiffuse = (clamp((((x_96 * x_97) + x_99) + x_103), vec3(0.0f), vec3(1.0f)) * vec3(x_108.x, x_108.y, x_108.z)); finalSpecular = vec3(0.0f); @@ -97,7 +109,7 @@ void main_1() { vec3 x_132 = max(vec3(x_129.x, x_129.y, x_129.z), vec3(0.0f)); vec4 x_133 = color; color = vec4(x_132.x, x_132.y, x_132.z, x_133.w); - float x_140 = x_137.visibility; + float x_140 = x_137.inner.visibility; float x_142 = color.w; color.w = (x_142 * x_140); vec4 x_147 = color; diff --git a/test/tint/bug/tint/1118.wgsl.expected.spvasm b/test/tint/bug/tint/1118.wgsl.expected.spvasm index 2d7ed0119c..bde22d6f9f 100644 --- a/test/tint/bug/tint/1118.wgsl.expected.spvasm +++ b/test/tint/bug/tint/1118.wgsl.expected.spvasm @@ -1,10 +1,10 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 199 +; Bound: 202 ; Schema: 0 OpCapability Shader - %81 = OpExtInstImport "GLSL.std.450" + %84 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %main "main" %fClipDistance3_param_1 %fClipDistance4_param_1 %glFragColor_1_1 OpExecutionMode %main OriginUpperLeft @@ -13,9 +13,13 @@ OpName %glFragColor_1_1 "glFragColor_1_1" OpName %fClipDistance3 "fClipDistance3" OpName %fClipDistance4 "fClipDistance4" + OpName %x_29_block "x_29_block" + OpMemberName %x_29_block 0 "inner" OpName %Scene "Scene" OpMemberName %Scene 0 "vEyePosition" OpName %x_29 "x_29" + OpName %x_49_block "x_49_block" + OpMemberName %x_49_block 0 "inner" OpName %Material "Material" OpMemberName %Material 0 "vDiffuseColor" OpMemberName %Material 1 "vAmbientColor" @@ -23,6 +27,8 @@ OpMemberName %Material 3 "vEmissiveColor" OpMemberName %Material 4 "placeholder2" OpName %x_49 "x_49" + OpName %x_137_block "x_137_block" + OpMemberName %x_137_block 0 "inner" OpName %Mesh "Mesh" OpMemberName %Mesh 0 "visibility" OpName %x_137 "x_137" @@ -56,12 +62,14 @@ OpDecorate %fClipDistance3_param_1 Location 2 OpDecorate %fClipDistance4_param_1 Location 3 OpDecorate %glFragColor_1_1 Location 0 - OpDecorate %Scene Block + OpDecorate %x_29_block Block + OpMemberDecorate %x_29_block 0 Offset 0 OpMemberDecorate %Scene 0 Offset 0 OpDecorate %x_29 NonWritable OpDecorate %x_29 DescriptorSet 0 OpDecorate %x_29 Binding 0 - OpDecorate %Material Block + OpDecorate %x_49_block Block + OpMemberDecorate %x_49_block 0 Offset 0 OpMemberDecorate %Material 0 Offset 0 OpMemberDecorate %Material 1 Offset 16 OpMemberDecorate %Material 2 Offset 28 @@ -70,7 +78,8 @@ OpDecorate %x_49 NonWritable OpDecorate %x_49 DescriptorSet 0 OpDecorate %x_49 Binding 1 - OpDecorate %Mesh Block + OpDecorate %x_137_block Block + OpMemberDecorate %x_137_block 0 Offset 0 OpMemberDecorate %Mesh 0 Offset 0 OpDecorate %x_137 NonWritable OpDecorate %x_137 DescriptorSet 0 @@ -89,237 +98,240 @@ %fClipDistance3 = OpVariable %_ptr_Private_float Private %11 %fClipDistance4 = OpVariable %_ptr_Private_float Private %11 %Scene = OpTypeStruct %v4float -%_ptr_Uniform_Scene = OpTypePointer Uniform %Scene - %x_29 = OpVariable %_ptr_Uniform_Scene Uniform + %x_29_block = OpTypeStruct %Scene +%_ptr_Uniform_x_29_block = OpTypePointer Uniform %x_29_block + %x_29 = OpVariable %_ptr_Uniform_x_29_block Uniform %v3float = OpTypeVector %float 3 %Material = OpTypeStruct %v4float %v3float %float %v3float %float -%_ptr_Uniform_Material = OpTypePointer Uniform %Material - %x_49 = OpVariable %_ptr_Uniform_Material Uniform + %x_49_block = OpTypeStruct %Material +%_ptr_Uniform_x_49_block = OpTypePointer Uniform %x_49_block + %x_49 = OpVariable %_ptr_Uniform_x_49_block Uniform %Mesh = OpTypeStruct %float -%_ptr_Uniform_Mesh = OpTypePointer Uniform %Mesh - %x_137 = OpVariable %_ptr_Uniform_Mesh Uniform +%x_137_block = OpTypeStruct %Mesh +%_ptr_Uniform_x_137_block = OpTypePointer Uniform %x_137_block + %x_137 = OpVariable %_ptr_Uniform_x_137_block Uniform %_ptr_Private_v4float = OpTypePointer Private %v4float %glFragColor = OpVariable %_ptr_Private_v4float Private %8 %bool = OpTypeBool - %26 = OpConstantNull %bool + %29 = OpConstantNull %bool %_ptr_Private_bool = OpTypePointer Private %bool -%tint_discard = OpVariable %_ptr_Private_bool Private %26 +%tint_discard = OpVariable %_ptr_Private_bool Private %29 %void = OpTypeVoid - %29 = OpTypeFunction %void + %32 = OpTypeFunction %void %_ptr_Function_bool = OpTypePointer Function %bool %_ptr_Function_v3float = OpTypePointer Function %v3float - %37 = OpConstantNull %v3float + %40 = OpConstantNull %v3float %_ptr_Function_v4float = OpTypePointer Function %v4float %_ptr_Function_float = OpTypePointer Function %float %v2float = OpTypeVector %float 2 %_ptr_Function_v2float = OpTypePointer Function %v2float - %47 = OpConstantNull %v2float + %50 = OpConstantNull %v2float %true = OpConstantTrue %bool %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_Uniform_v4float = OpTypePointer Uniform %v4float %float_1 = OpConstant %float 1 - %88 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %91 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 %uint_3 = OpConstant %uint 3 %_ptr_Uniform_float = OpTypePointer Uniform %float - %115 = OpConstantComposite %v3float %float_1 %float_1 %float_1 - %116 = OpConstantComposite %v4float %11 %11 %11 %float_1 + %118 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %119 = OpConstantComposite %v4float %11 %11 %11 %float_1 %_ptr_Uniform_v3float = OpTypePointer Uniform %v3float %uint_1 = OpConstant %uint 1 %main_out = OpTypeStruct %v4float - %179 = OpTypeFunction %main_out %float %float - %190 = OpConstantNull %main_out - %main_1 = OpFunction %void None %29 - %32 = OpLabel -%tint_return_flag = OpVariable %_ptr_Function_bool Function %26 -%viewDirectionW = OpVariable %_ptr_Function_v3float Function %37 + %182 = OpTypeFunction %main_out %float %float + %193 = OpConstantNull %main_out + %main_1 = OpFunction %void None %32 + %35 = OpLabel +%tint_return_flag = OpVariable %_ptr_Function_bool Function %29 +%viewDirectionW = OpVariable %_ptr_Function_v3float Function %40 %baseColor = OpVariable %_ptr_Function_v4float Function %8 -%diffuseColor = OpVariable %_ptr_Function_v3float Function %37 +%diffuseColor = OpVariable %_ptr_Function_v3float Function %40 %alpha = OpVariable %_ptr_Function_float Function %11 - %normalW = OpVariable %_ptr_Function_v3float Function %37 - %uvOffset = OpVariable %_ptr_Function_v2float Function %47 -%baseAmbientColor = OpVariable %_ptr_Function_v3float Function %37 + %normalW = OpVariable %_ptr_Function_v3float Function %40 + %uvOffset = OpVariable %_ptr_Function_v2float Function %50 +%baseAmbientColor = OpVariable %_ptr_Function_v3float Function %40 %glossiness = OpVariable %_ptr_Function_float Function %11 -%diffuseBase = OpVariable %_ptr_Function_v3float Function %37 +%diffuseBase = OpVariable %_ptr_Function_v3float Function %40 %shadow = OpVariable %_ptr_Function_float Function %11 %refractionColor = OpVariable %_ptr_Function_v4float Function %8 %reflectionColor = OpVariable %_ptr_Function_v4float Function %8 -%emissiveColor = OpVariable %_ptr_Function_v3float Function %37 -%finalDiffuse = OpVariable %_ptr_Function_v3float Function %37 -%finalSpecular = OpVariable %_ptr_Function_v3float Function %37 +%emissiveColor = OpVariable %_ptr_Function_v3float Function %40 +%finalDiffuse = OpVariable %_ptr_Function_v3float Function %40 +%finalSpecular = OpVariable %_ptr_Function_v3float Function %40 %color = OpVariable %_ptr_Function_v4float Function %8 - %58 = OpLoad %float %fClipDistance3 - %59 = OpFOrdGreaterThan %bool %58 %11 - OpSelectionMerge %60 None - OpBranchConditional %59 %61 %60 - %61 = OpLabel + %61 = OpLoad %float %fClipDistance3 + %62 = OpFOrdGreaterThan %bool %61 %11 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %63 + %64 = OpLabel OpStore %tint_discard %true OpStore %tint_return_flag %true - OpBranch %60 - %60 = OpLabel - %64 = OpLoad %bool %tint_return_flag - %63 = OpLogicalNot %bool %64 - OpSelectionMerge %65 None - OpBranchConditional %63 %66 %65 - %66 = OpLabel - %67 = OpLoad %float %fClipDistance4 - %68 = OpFOrdGreaterThan %bool %67 %11 - OpSelectionMerge %69 None - OpBranchConditional %68 %70 %69 - %70 = OpLabel - OpStore %tint_discard %true - OpStore %tint_return_flag %true - OpBranch %69 + OpBranch %63 + %63 = OpLabel + %67 = OpLoad %bool %tint_return_flag + %66 = OpLogicalNot %bool %67 + OpSelectionMerge %68 None + OpBranchConditional %66 %69 %68 %69 = OpLabel - %72 = OpLoad %bool %tint_return_flag - %71 = OpLogicalNot %bool %72 - OpSelectionMerge %73 None - OpBranchConditional %71 %74 %73 - %74 = OpLabel - %78 = OpAccessChain %_ptr_Uniform_v4float %x_29 %uint_0 - %79 = OpLoad %v4float %78 - %82 = OpCompositeExtract %float %79 0 - %83 = OpCompositeExtract %float %79 1 - %84 = OpCompositeExtract %float %79 2 - %85 = OpCompositeConstruct %v3float %82 %83 %84 - %86 = OpFSub %v3float %85 %37 - %80 = OpExtInst %v3float %81 Normalize %86 - OpStore %viewDirectionW %80 - OpStore %baseColor %88 - %89 = OpAccessChain %_ptr_Uniform_v4float %x_49 %uint_0 - %90 = OpLoad %v4float %89 - %91 = OpCompositeExtract %float %90 0 - %92 = OpCompositeExtract %float %90 1 - %93 = OpCompositeExtract %float %90 2 - %94 = OpCompositeConstruct %v3float %91 %92 %93 - OpStore %diffuseColor %94 - %97 = OpAccessChain %_ptr_Uniform_float %x_49 %uint_0 %uint_3 - %98 = OpLoad %float %97 - OpStore %alpha %98 - OpStore %uvOffset %47 - %99 = OpLoad %v4float %baseColor - %100 = OpCompositeExtract %float %99 0 - %101 = OpCompositeExtract %float %99 1 - %102 = OpCompositeExtract %float %99 2 - %103 = OpCompositeConstruct %v3float %100 %101 %102 - %104 = OpCompositeExtract %float %8 0 - %105 = OpCompositeExtract %float %8 1 - %106 = OpCompositeExtract %float %8 2 - %107 = OpCompositeConstruct %v3float %104 %105 %106 - %108 = OpFMul %v3float %103 %107 - %109 = OpLoad %v4float %baseColor - %110 = OpCompositeExtract %float %108 0 - %111 = OpCompositeExtract %float %108 1 - %112 = OpCompositeExtract %float %108 2 - %113 = OpCompositeExtract %float %109 3 - %114 = OpCompositeConstruct %v4float %110 %111 %112 %113 - OpStore %baseColor %114 - OpStore %baseAmbientColor %115 - OpStore %glossiness %11 - OpStore %diffuseBase %37 - OpStore %shadow %float_1 - OpStore %refractionColor %116 - OpStore %reflectionColor %116 - %118 = OpAccessChain %_ptr_Uniform_v3float %x_49 %uint_3 - %119 = OpLoad %v3float %118 - OpStore %emissiveColor %119 - %120 = OpLoad %v3float %diffuseBase - %121 = OpLoad %v3float %diffuseColor - %122 = OpLoad %v3float %emissiveColor - %124 = OpAccessChain %_ptr_Uniform_v3float %x_49 %uint_1 - %125 = OpLoad %v3float %124 - %126 = OpLoad %v4float %baseColor - %128 = OpFMul %v3float %120 %121 - %129 = OpFAdd %v3float %128 %122 - %130 = OpFAdd %v3float %129 %125 - %127 = OpExtInst %v3float %81 NClamp %130 %37 %115 - %131 = OpCompositeExtract %float %126 0 - %132 = OpCompositeExtract %float %126 1 - %133 = OpCompositeExtract %float %126 2 - %134 = OpCompositeConstruct %v3float %131 %132 %133 - %135 = OpFMul %v3float %127 %134 - OpStore %finalDiffuse %135 - OpStore %finalSpecular %37 - %136 = OpLoad %v3float %finalDiffuse - %137 = OpLoad %v3float %baseAmbientColor - %138 = OpLoad %v3float %finalSpecular - %139 = OpLoad %v4float %reflectionColor - %140 = OpLoad %v4float %refractionColor - %141 = OpFMul %v3float %136 %137 - %142 = OpFAdd %v3float %141 %138 - %143 = OpCompositeExtract %float %139 0 - %144 = OpCompositeExtract %float %139 1 - %145 = OpCompositeExtract %float %139 2 - %146 = OpCompositeConstruct %v3float %143 %144 %145 - %147 = OpFAdd %v3float %142 %146 - %148 = OpCompositeExtract %float %140 0 - %149 = OpCompositeExtract %float %140 1 - %150 = OpCompositeExtract %float %140 2 - %151 = OpCompositeConstruct %v3float %148 %149 %150 - %152 = OpFAdd %v3float %147 %151 - %153 = OpLoad %float %alpha - %154 = OpCompositeExtract %float %152 0 - %155 = OpCompositeExtract %float %152 1 - %156 = OpCompositeExtract %float %152 2 - %157 = OpCompositeConstruct %v4float %154 %155 %156 %153 - OpStore %color %157 - %158 = OpLoad %v4float %color - %160 = OpCompositeExtract %float %158 0 - %161 = OpCompositeExtract %float %158 1 - %162 = OpCompositeExtract %float %158 2 - %163 = OpCompositeConstruct %v3float %160 %161 %162 - %159 = OpExtInst %v3float %81 NMax %163 %37 - %164 = OpLoad %v4float %color - %165 = OpCompositeExtract %float %159 0 - %166 = OpCompositeExtract %float %159 1 - %167 = OpCompositeExtract %float %159 2 - %168 = OpCompositeExtract %float %164 3 - %169 = OpCompositeConstruct %v4float %165 %166 %167 %168 - OpStore %color %169 - %170 = OpAccessChain %_ptr_Uniform_float %x_137 %uint_0 - %171 = OpLoad %float %170 - %172 = OpAccessChain %_ptr_Function_float %color %uint_3 - %173 = OpLoad %float %172 - %174 = OpAccessChain %_ptr_Function_float %color %uint_3 - %175 = OpFMul %float %173 %171 - OpStore %174 %175 - %176 = OpLoad %v4float %color - OpStore %glFragColor %176 - OpStore %tint_return_flag %true - OpBranch %73 + %70 = OpLoad %float %fClipDistance4 + %71 = OpFOrdGreaterThan %bool %70 %11 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %72 %73 = OpLabel - OpBranch %65 - %65 = OpLabel + OpStore %tint_discard %true + OpStore %tint_return_flag %true + OpBranch %72 + %72 = OpLabel + %75 = OpLoad %bool %tint_return_flag + %74 = OpLogicalNot %bool %75 + OpSelectionMerge %76 None + OpBranchConditional %74 %77 %76 + %77 = OpLabel + %81 = OpAccessChain %_ptr_Uniform_v4float %x_29 %uint_0 %uint_0 + %82 = OpLoad %v4float %81 + %85 = OpCompositeExtract %float %82 0 + %86 = OpCompositeExtract %float %82 1 + %87 = OpCompositeExtract %float %82 2 + %88 = OpCompositeConstruct %v3float %85 %86 %87 + %89 = OpFSub %v3float %88 %40 + %83 = OpExtInst %v3float %84 Normalize %89 + OpStore %viewDirectionW %83 + OpStore %baseColor %91 + %92 = OpAccessChain %_ptr_Uniform_v4float %x_49 %uint_0 %uint_0 + %93 = OpLoad %v4float %92 + %94 = OpCompositeExtract %float %93 0 + %95 = OpCompositeExtract %float %93 1 + %96 = OpCompositeExtract %float %93 2 + %97 = OpCompositeConstruct %v3float %94 %95 %96 + OpStore %diffuseColor %97 + %100 = OpAccessChain %_ptr_Uniform_float %x_49 %uint_0 %uint_0 %uint_3 + %101 = OpLoad %float %100 + OpStore %alpha %101 + OpStore %uvOffset %50 + %102 = OpLoad %v4float %baseColor + %103 = OpCompositeExtract %float %102 0 + %104 = OpCompositeExtract %float %102 1 + %105 = OpCompositeExtract %float %102 2 + %106 = OpCompositeConstruct %v3float %103 %104 %105 + %107 = OpCompositeExtract %float %8 0 + %108 = OpCompositeExtract %float %8 1 + %109 = OpCompositeExtract %float %8 2 + %110 = OpCompositeConstruct %v3float %107 %108 %109 + %111 = OpFMul %v3float %106 %110 + %112 = OpLoad %v4float %baseColor + %113 = OpCompositeExtract %float %111 0 + %114 = OpCompositeExtract %float %111 1 + %115 = OpCompositeExtract %float %111 2 + %116 = OpCompositeExtract %float %112 3 + %117 = OpCompositeConstruct %v4float %113 %114 %115 %116 + OpStore %baseColor %117 + OpStore %baseAmbientColor %118 + OpStore %glossiness %11 + OpStore %diffuseBase %40 + OpStore %shadow %float_1 + OpStore %refractionColor %119 + OpStore %reflectionColor %119 + %121 = OpAccessChain %_ptr_Uniform_v3float %x_49 %uint_0 %uint_3 + %122 = OpLoad %v3float %121 + OpStore %emissiveColor %122 + %123 = OpLoad %v3float %diffuseBase + %124 = OpLoad %v3float %diffuseColor + %125 = OpLoad %v3float %emissiveColor + %127 = OpAccessChain %_ptr_Uniform_v3float %x_49 %uint_0 %uint_1 + %128 = OpLoad %v3float %127 + %129 = OpLoad %v4float %baseColor + %131 = OpFMul %v3float %123 %124 + %132 = OpFAdd %v3float %131 %125 + %133 = OpFAdd %v3float %132 %128 + %130 = OpExtInst %v3float %84 NClamp %133 %40 %118 + %134 = OpCompositeExtract %float %129 0 + %135 = OpCompositeExtract %float %129 1 + %136 = OpCompositeExtract %float %129 2 + %137 = OpCompositeConstruct %v3float %134 %135 %136 + %138 = OpFMul %v3float %130 %137 + OpStore %finalDiffuse %138 + OpStore %finalSpecular %40 + %139 = OpLoad %v3float %finalDiffuse + %140 = OpLoad %v3float %baseAmbientColor + %141 = OpLoad %v3float %finalSpecular + %142 = OpLoad %v4float %reflectionColor + %143 = OpLoad %v4float %refractionColor + %144 = OpFMul %v3float %139 %140 + %145 = OpFAdd %v3float %144 %141 + %146 = OpCompositeExtract %float %142 0 + %147 = OpCompositeExtract %float %142 1 + %148 = OpCompositeExtract %float %142 2 + %149 = OpCompositeConstruct %v3float %146 %147 %148 + %150 = OpFAdd %v3float %145 %149 + %151 = OpCompositeExtract %float %143 0 + %152 = OpCompositeExtract %float %143 1 + %153 = OpCompositeExtract %float %143 2 + %154 = OpCompositeConstruct %v3float %151 %152 %153 + %155 = OpFAdd %v3float %150 %154 + %156 = OpLoad %float %alpha + %157 = OpCompositeExtract %float %155 0 + %158 = OpCompositeExtract %float %155 1 + %159 = OpCompositeExtract %float %155 2 + %160 = OpCompositeConstruct %v4float %157 %158 %159 %156 + OpStore %color %160 + %161 = OpLoad %v4float %color + %163 = OpCompositeExtract %float %161 0 + %164 = OpCompositeExtract %float %161 1 + %165 = OpCompositeExtract %float %161 2 + %166 = OpCompositeConstruct %v3float %163 %164 %165 + %162 = OpExtInst %v3float %84 NMax %166 %40 + %167 = OpLoad %v4float %color + %168 = OpCompositeExtract %float %162 0 + %169 = OpCompositeExtract %float %162 1 + %170 = OpCompositeExtract %float %162 2 + %171 = OpCompositeExtract %float %167 3 + %172 = OpCompositeConstruct %v4float %168 %169 %170 %171 + OpStore %color %172 + %173 = OpAccessChain %_ptr_Uniform_float %x_137 %uint_0 %uint_0 + %174 = OpLoad %float %173 + %175 = OpAccessChain %_ptr_Function_float %color %uint_3 + %176 = OpLoad %float %175 + %177 = OpAccessChain %_ptr_Function_float %color %uint_3 + %178 = OpFMul %float %176 %174 + OpStore %177 %178 + %179 = OpLoad %v4float %color + OpStore %glFragColor %179 + OpStore %tint_return_flag %true + OpBranch %76 + %76 = OpLabel + OpBranch %68 + %68 = OpLabel OpReturn OpFunctionEnd -%tint_discard_func = OpFunction %void None %29 - %178 = OpLabel +%tint_discard_func = OpFunction %void None %32 + %181 = OpLabel OpKill OpFunctionEnd - %main_inner = OpFunction %main_out None %179 + %main_inner = OpFunction %main_out None %182 %fClipDistance3_param = OpFunctionParameter %float %fClipDistance4_param = OpFunctionParameter %float - %184 = OpLabel + %187 = OpLabel OpStore %fClipDistance3 %fClipDistance3_param OpStore %fClipDistance4 %fClipDistance4_param - %185 = OpFunctionCall %void %main_1 - %186 = OpLoad %bool %tint_discard - OpSelectionMerge %187 None - OpBranchConditional %186 %188 %187 - %188 = OpLabel - %189 = OpFunctionCall %void %tint_discard_func - OpReturnValue %190 - %187 = OpLabel - %191 = OpLoad %v4float %glFragColor - %192 = OpCompositeConstruct %main_out %191 - OpReturnValue %192 + %188 = OpFunctionCall %void %main_1 + %189 = OpLoad %bool %tint_discard + OpSelectionMerge %190 None + OpBranchConditional %189 %191 %190 + %191 = OpLabel + %192 = OpFunctionCall %void %tint_discard_func + OpReturnValue %193 + %190 = OpLabel + %194 = OpLoad %v4float %glFragColor + %195 = OpCompositeConstruct %main_out %194 + OpReturnValue %195 OpFunctionEnd - %main = OpFunction %void None %29 - %194 = OpLabel - %196 = OpLoad %float %fClipDistance3_param_1 - %197 = OpLoad %float %fClipDistance4_param_1 - %195 = OpFunctionCall %main_out %main_inner %196 %197 - %198 = OpCompositeExtract %v4float %195 0 - OpStore %glFragColor_1_1 %198 + %main = OpFunction %void None %32 + %197 = OpLabel + %199 = OpLoad %float %fClipDistance3_param_1 + %200 = OpLoad %float %fClipDistance4_param_1 + %198 = OpFunctionCall %main_out %main_inner %199 %200 + %201 = OpCompositeExtract %v4float %198 0 + OpStore %glFragColor_1_1 %201 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/1121.wgsl.expected.glsl b/test/tint/bug/tint/1121.wgsl.expected.glsl index 5ebe0aa1f7..864fe5416c 100644 --- a/test/tint/bug/tint/1121.wgsl.expected.glsl +++ b/test/tint/bug/tint/1121.wgsl.expected.glsl @@ -15,11 +15,15 @@ struct TileLightIdData { uint lightId[64]; }; -layout(binding = 0, std430) buffer Tiles_ssbo { +struct Tiles { TileLightIdData data[4]; +}; + +layout(binding = 0, std430) buffer tileLightId_block_ssbo { + Tiles inner; } tileLightId; -layout(binding = 0, std140) uniform Config_ubo { +struct Config { uint numLights; uint numTiles; uint tileCountX; @@ -28,30 +32,38 @@ layout(binding = 0, std140) uniform Config_ubo { uint tileSize; uint pad; uint pad_1; +}; + +layout(binding = 0, std140) uniform config_block_ubo { + Config inner; } config; -layout(binding = 0, std140) uniform Uniforms_ubo { +struct Uniforms { vec4 tint_symbol; vec4 tint_symbol_1; mat4 viewMatrix; mat4 projectionMatrix; vec4 fullScreenSize; +}; + +layout(binding = 0, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; void tint_symbol_2(uvec3 GlobalInvocationID) { uint index = GlobalInvocationID.x; - if ((index >= config.numLights)) { + if ((index >= config.inner.numLights)) { return; } lightsBuffer.lights[index].position.y = ((lightsBuffer.lights[index].position.y - 0.100000001f) + (0.001f * (float(index) - (64.0f * floor((float(index) / 64.0f)))))); - if ((lightsBuffer.lights[index].position.y < uniforms.tint_symbol.y)) { - lightsBuffer.lights[index].position.y = uniforms.tint_symbol_1.y; + if ((lightsBuffer.lights[index].position.y < uniforms.inner.tint_symbol.y)) { + lightsBuffer.lights[index].position.y = uniforms.inner.tint_symbol_1.y; } - mat4 M = uniforms.projectionMatrix; + mat4 M = uniforms.inner.projectionMatrix; float viewNear = (-(M[3][2]) / (-1.0f + M[2][2])); float viewFar = (-(M[3][2]) / (1.0f + M[2][2])); vec4 lightPos = lightsBuffer.lights[index].position; - lightPos = (uniforms.viewMatrix * lightPos); + lightPos = (uniforms.inner.viewMatrix * lightPos); lightPos = (lightPos / lightPos.w); float lightRadius = lightsBuffer.lights[index].radius; vec4 boxMin = (lightPos - vec4(vec3(lightRadius), 0.0f)); @@ -67,8 +79,8 @@ void tint_symbol_2(uvec3 GlobalInvocationID) { { for(int x_1 = 0; (x_1 < TILE_COUNT_X); x_1 = (x_1 + 1)) { ivec2 tilePixel0Idx = ivec2((x_1 * TILE_SIZE), (y_1 * TILE_SIZE)); - vec2 floorCoord = (((2.0f * vec2(tilePixel0Idx)) / uniforms.fullScreenSize.xy) - vec2(1.0f)); - vec2 ceilCoord = (((2.0f * vec2((tilePixel0Idx + ivec2(TILE_SIZE)))) / uniforms.fullScreenSize.xy) - vec2(1.0f)); + vec2 floorCoord = (((2.0f * vec2(tilePixel0Idx)) / uniforms.inner.fullScreenSize.xy) - vec2(1.0f)); + vec2 ceilCoord = (((2.0f * vec2((tilePixel0Idx + ivec2(TILE_SIZE)))) / uniforms.inner.fullScreenSize.xy) - vec2(1.0f)); vec2 viewFloorCoord = vec2((((-(viewNear) * floorCoord.x) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * floorCoord.y) - (M[2][1] * viewNear)) / M[1][1])); vec2 viewCeilCoord = vec2((((-(viewNear) * ceilCoord.x) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * ceilCoord.y) - (M[2][1] * viewNear)) / M[1][1])); frustumPlanes[0] = vec4(1.0f, 0.0f, (-(viewFloorCoord.x) / viewNear), 0.0f); @@ -102,16 +114,16 @@ void tint_symbol_2(uvec3 GlobalInvocationID) { uint tileId = uint((x_1 + (y_1 * TILE_COUNT_X))); bool tint_tmp = (tileId < 0u); if (!tint_tmp) { - tint_tmp = (tileId >= config.numTiles); + tint_tmp = (tileId >= config.inner.numTiles); } if ((tint_tmp)) { continue; } - uint offset = atomicAdd(tileLightId.data[tileId].count, 1u); - if ((offset >= config.numTileLightSlot)) { + uint offset = atomicAdd(tileLightId.inner.data[tileId].count, 1u); + if ((offset >= config.inner.numTileLightSlot)) { continue; } - tileLightId.data[tileId].lightId[offset] = GlobalInvocationID.x; + tileLightId.inner.data[tileId].lightId[offset] = GlobalInvocationID.x; } } } diff --git a/test/tint/bug/tint/1121.wgsl.expected.spvasm b/test/tint/bug/tint/1121.wgsl.expected.spvasm index 5dc7f31d4d..cf177fa551 100644 --- a/test/tint/bug/tint/1121.wgsl.expected.spvasm +++ b/test/tint/bug/tint/1121.wgsl.expected.spvasm @@ -1,10 +1,10 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 415 +; Bound: 418 ; Schema: 0 OpCapability Shader - %60 = OpExtInstImport "GLSL.std.450" + %63 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" %GlobalInvocationID_1 OpExecutionMode %main LocalSize 64 1 1 @@ -16,12 +16,16 @@ OpMemberName %LightData 1 "color" OpMemberName %LightData 2 "radius" OpName %lightsBuffer "lightsBuffer" + OpName %tileLightId_block "tileLightId_block" + OpMemberName %tileLightId_block 0 "inner" OpName %Tiles "Tiles" OpMemberName %Tiles 0 "data" OpName %TileLightIdData "TileLightIdData" OpMemberName %TileLightIdData 0 "count" OpMemberName %TileLightIdData 1 "lightId" OpName %tileLightId "tileLightId" + OpName %config_block "config_block" + OpMemberName %config_block 0 "inner" OpName %Config "Config" OpMemberName %Config 0 "numLights" OpMemberName %Config 1 "numTiles" @@ -30,6 +34,8 @@ OpMemberName %Config 4 "numTileLightSlot" OpMemberName %Config 5 "tileSize" OpName %config "config" + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "min" OpMemberName %Uniforms 1 "max" @@ -70,7 +76,8 @@ OpDecorate %_runtimearr_LightData ArrayStride 32 OpDecorate %lightsBuffer DescriptorSet 0 OpDecorate %lightsBuffer Binding 0 - OpDecorate %Tiles Block + OpDecorate %tileLightId_block Block + OpMemberDecorate %tileLightId_block 0 Offset 0 OpMemberDecorate %Tiles 0 Offset 0 OpMemberDecorate %TileLightIdData 0 Offset 0 OpMemberDecorate %TileLightIdData 1 Offset 4 @@ -78,7 +85,8 @@ OpDecorate %_arr_TileLightIdData_uint_4 ArrayStride 260 OpDecorate %tileLightId DescriptorSet 1 OpDecorate %tileLightId Binding 0 - OpDecorate %Config Block + OpDecorate %config_block Block + OpMemberDecorate %config_block 0 Offset 0 OpMemberDecorate %Config 0 Offset 0 OpMemberDecorate %Config 1 Offset 4 OpMemberDecorate %Config 2 Offset 8 @@ -88,7 +96,8 @@ OpDecorate %config NonWritable OpDecorate %config DescriptorSet 2 OpDecorate %config Binding 0 - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 1 Offset 16 OpMemberDecorate %Uniforms 2 Offset 32 @@ -120,19 +129,22 @@ %uint_4 = OpConstant %uint 4 %_arr_TileLightIdData_uint_4 = OpTypeArray %TileLightIdData %uint_4 %Tiles = OpTypeStruct %_arr_TileLightIdData_uint_4 -%_ptr_StorageBuffer_Tiles = OpTypePointer StorageBuffer %Tiles -%tileLightId = OpVariable %_ptr_StorageBuffer_Tiles StorageBuffer +%tileLightId_block = OpTypeStruct %Tiles +%_ptr_StorageBuffer_tileLightId_block = OpTypePointer StorageBuffer %tileLightId_block +%tileLightId = OpVariable %_ptr_StorageBuffer_tileLightId_block StorageBuffer %Config = OpTypeStruct %uint %uint %uint %uint %uint %uint -%_ptr_Uniform_Config = OpTypePointer Uniform %Config - %config = OpVariable %_ptr_Uniform_Config Uniform +%config_block = OpTypeStruct %Config +%_ptr_Uniform_config_block = OpTypePointer Uniform %config_block + %config = OpVariable %_ptr_Uniform_config_block Uniform %mat4v4float = OpTypeMatrix %v4float 4 %Uniforms = OpTypeStruct %v4float %v4float %mat4v4float %mat4v4float %v4float -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %void = OpTypeVoid - %28 = OpTypeFunction %void %v3uint + %31 = OpTypeFunction %void %v3uint %_ptr_Function_uint = OpTypePointer Function %uint - %36 = OpConstantNull %uint + %39 = OpConstantNull %uint %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %bool = OpTypeBool @@ -145,471 +157,471 @@ %uint_3 = OpConstant %uint 3 %_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float %_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float - %87 = OpConstantNull %mat4v4float + %90 = OpConstantNull %mat4v4float %int = OpTypeInt 32 1 %int_3 = OpConstant %int 3 %int_2 = OpConstant %int 2 %_ptr_Function_float = OpTypePointer Function %float %float_n1 = OpConstant %float -1 - %101 = OpConstantNull %float + %104 = OpConstantNull %float %float_1 = OpConstant %float 1 %_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float %_ptr_Function_v4float = OpTypePointer Function %v4float - %117 = OpConstantNull %v4float + %120 = OpConstantNull %v4float %uint_2 = OpConstant %uint 2 %uint_6 = OpConstant %uint 6 %_arr_v4float_uint_6 = OpTypeArray %v4float %uint_6 %_ptr_Function__arr_v4float_uint_6 = OpTypePointer Function %_arr_v4float_uint_6 - %155 = OpConstantNull %_arr_v4float_uint_6 + %158 = OpConstantNull %_arr_v4float_uint_6 %int_4 = OpConstant %int 4 %int_5 = OpConstant %int 5 %int_16 = OpConstant %int 16 - %166 = OpConstantNull %int + %169 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %v2int = OpTypeVector %int 2 %_ptr_Function_v2int = OpTypePointer Function %v2int - %196 = OpConstantNull %v2int + %199 = OpConstantNull %v2int %float_2 = OpConstant %float 2 %v2float = OpTypeVector %float 2 %_ptr_Uniform_v4float = OpTypePointer Uniform %v4float - %207 = OpConstantComposite %v2float %float_1 %float_1 + %210 = OpConstantComposite %v2float %float_1 %float_1 %_ptr_Function_v2float = OpTypePointer Function %v2float - %211 = OpConstantNull %v2float + %214 = OpConstantNull %v2float %int_1 = OpConstant %int 1 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %_ptr_StorageBuffer_uint_0 = OpTypePointer StorageBuffer %uint - %410 = OpTypeFunction %void - %main_inner = OpFunction %void None %28 + %413 = OpTypeFunction %void + %main_inner = OpFunction %void None %31 %GlobalInvocationID = OpFunctionParameter %v3uint - %32 = OpLabel - %index = OpVariable %_ptr_Function_uint Function %36 - %M = OpVariable %_ptr_Function_mat4v4float Function %87 - %viewNear = OpVariable %_ptr_Function_float Function %101 - %viewFar = OpVariable %_ptr_Function_float Function %101 - %lightPos = OpVariable %_ptr_Function_v4float Function %117 - %127 = OpVariable %_ptr_Function_v4float Function %117 -%lightRadius = OpVariable %_ptr_Function_float Function %101 - %boxMin = OpVariable %_ptr_Function_v4float Function %117 - %boxMax = OpVariable %_ptr_Function_v4float Function %117 -%frustumPlanes = OpVariable %_ptr_Function__arr_v4float_uint_6 Function %155 - %y = OpVariable %_ptr_Function_int Function %166 - %x = OpVariable %_ptr_Function_int Function %166 -%tilePixel0Idx = OpVariable %_ptr_Function_v2int Function %196 - %floorCoord = OpVariable %_ptr_Function_v2float Function %211 - %ceilCoord = OpVariable %_ptr_Function_v2float Function %211 -%viewFloorCoord = OpVariable %_ptr_Function_v2float Function %211 -%viewCeilCoord = OpVariable %_ptr_Function_v2float Function %211 - %dp = OpVariable %_ptr_Function_float Function %101 - %i = OpVariable %_ptr_Function_uint Function %36 - %p = OpVariable %_ptr_Function_v4float Function %117 - %tileId = OpVariable %_ptr_Function_uint Function %36 - %offset = OpVariable %_ptr_Function_uint Function %36 - %33 = OpCompositeExtract %uint %GlobalInvocationID 0 - OpStore %index %33 - %37 = OpLoad %uint %index - %40 = OpAccessChain %_ptr_Uniform_uint %config %uint_0 - %41 = OpLoad %uint %40 - %42 = OpUGreaterThanEqual %bool %37 %41 - OpSelectionMerge %44 None - OpBranchConditional %42 %45 %44 - %45 = OpLabel + %35 = OpLabel + %index = OpVariable %_ptr_Function_uint Function %39 + %M = OpVariable %_ptr_Function_mat4v4float Function %90 + %viewNear = OpVariable %_ptr_Function_float Function %104 + %viewFar = OpVariable %_ptr_Function_float Function %104 + %lightPos = OpVariable %_ptr_Function_v4float Function %120 + %130 = OpVariable %_ptr_Function_v4float Function %120 +%lightRadius = OpVariable %_ptr_Function_float Function %104 + %boxMin = OpVariable %_ptr_Function_v4float Function %120 + %boxMax = OpVariable %_ptr_Function_v4float Function %120 +%frustumPlanes = OpVariable %_ptr_Function__arr_v4float_uint_6 Function %158 + %y = OpVariable %_ptr_Function_int Function %169 + %x = OpVariable %_ptr_Function_int Function %169 +%tilePixel0Idx = OpVariable %_ptr_Function_v2int Function %199 + %floorCoord = OpVariable %_ptr_Function_v2float Function %214 + %ceilCoord = OpVariable %_ptr_Function_v2float Function %214 +%viewFloorCoord = OpVariable %_ptr_Function_v2float Function %214 +%viewCeilCoord = OpVariable %_ptr_Function_v2float Function %214 + %dp = OpVariable %_ptr_Function_float Function %104 + %i = OpVariable %_ptr_Function_uint Function %39 + %p = OpVariable %_ptr_Function_v4float Function %120 + %tileId = OpVariable %_ptr_Function_uint Function %39 + %offset = OpVariable %_ptr_Function_uint Function %39 + %36 = OpCompositeExtract %uint %GlobalInvocationID 0 + OpStore %index %36 + %40 = OpLoad %uint %index + %43 = OpAccessChain %_ptr_Uniform_uint %config %uint_0 %uint_0 + %44 = OpLoad %uint %43 + %45 = OpUGreaterThanEqual %bool %40 %44 + OpSelectionMerge %47 None + OpBranchConditional %45 %48 %47 + %48 = OpLabel OpReturn - %44 = OpLabel - %46 = OpLoad %uint %index - %49 = OpAccessChain %_ptr_StorageBuffer_float %lightsBuffer %uint_0 %46 %uint_0 %uint_1 - %50 = OpLoad %uint %index - %51 = OpAccessChain %_ptr_StorageBuffer_float %lightsBuffer %uint_0 %50 %uint_0 %uint_1 - %52 = OpLoad %float %51 - %54 = OpFSub %float %52 %float_0_100000001 - %57 = OpLoad %uint %index - %56 = OpConvertUToF %float %57 - %62 = OpLoad %uint %index - %61 = OpConvertUToF %float %62 - %63 = OpFDiv %float %61 %float_64 - %59 = OpExtInst %float %60 Floor %63 - %64 = OpFMul %float %float_64 %59 - %65 = OpFSub %float %56 %64 - %66 = OpFMul %float %float_0_00100000005 %65 - %67 = OpFAdd %float %54 %66 - OpStore %49 %67 - %68 = OpLoad %uint %index - %69 = OpAccessChain %_ptr_StorageBuffer_float %lightsBuffer %uint_0 %68 %uint_0 %uint_1 - %70 = OpLoad %float %69 - %72 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_1 + %47 = OpLabel + %49 = OpLoad %uint %index + %52 = OpAccessChain %_ptr_StorageBuffer_float %lightsBuffer %uint_0 %49 %uint_0 %uint_1 + %53 = OpLoad %uint %index + %54 = OpAccessChain %_ptr_StorageBuffer_float %lightsBuffer %uint_0 %53 %uint_0 %uint_1 + %55 = OpLoad %float %54 + %57 = OpFSub %float %55 %float_0_100000001 + %60 = OpLoad %uint %index + %59 = OpConvertUToF %float %60 + %65 = OpLoad %uint %index + %64 = OpConvertUToF %float %65 + %66 = OpFDiv %float %64 %float_64 + %62 = OpExtInst %float %63 Floor %66 + %67 = OpFMul %float %float_64 %62 + %68 = OpFSub %float %59 %67 + %69 = OpFMul %float %float_0_00100000005 %68 + %70 = OpFAdd %float %57 %69 + OpStore %52 %70 + %71 = OpLoad %uint %index + %72 = OpAccessChain %_ptr_StorageBuffer_float %lightsBuffer %uint_0 %71 %uint_0 %uint_1 %73 = OpLoad %float %72 - %74 = OpFOrdLessThan %bool %70 %73 - OpSelectionMerge %75 None - OpBranchConditional %74 %76 %75 - %76 = OpLabel - %77 = OpLoad %uint %index - %78 = OpAccessChain %_ptr_StorageBuffer_float %lightsBuffer %uint_0 %77 %uint_0 %uint_1 - %79 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_1 %uint_1 - %80 = OpLoad %float %79 - OpStore %78 %80 - OpBranch %75 - %75 = OpLabel - %83 = OpAccessChain %_ptr_Uniform_mat4v4float %uniforms %uint_3 - %84 = OpLoad %mat4v4float %83 - OpStore %M %84 - %93 = OpAccessChain %_ptr_Function_float %M %int_3 %int_2 - %94 = OpLoad %float %93 - %88 = OpFNegate %float %94 - %96 = OpAccessChain %_ptr_Function_float %M %int_2 %int_2 + %75 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_0 %uint_1 + %76 = OpLoad %float %75 + %77 = OpFOrdLessThan %bool %73 %76 + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %78 + %79 = OpLabel + %80 = OpLoad %uint %index + %81 = OpAccessChain %_ptr_StorageBuffer_float %lightsBuffer %uint_0 %80 %uint_0 %uint_1 + %82 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_1 %uint_1 + %83 = OpLoad %float %82 + OpStore %81 %83 + OpBranch %78 + %78 = OpLabel + %86 = OpAccessChain %_ptr_Uniform_mat4v4float %uniforms %uint_0 %uint_3 + %87 = OpLoad %mat4v4float %86 + OpStore %M %87 + %96 = OpAccessChain %_ptr_Function_float %M %int_3 %int_2 %97 = OpLoad %float %96 - %98 = OpFAdd %float %float_n1 %97 - %99 = OpFDiv %float %88 %98 - OpStore %viewNear %99 - %103 = OpAccessChain %_ptr_Function_float %M %int_3 %int_2 - %104 = OpLoad %float %103 - %102 = OpFNegate %float %104 - %106 = OpAccessChain %_ptr_Function_float %M %int_2 %int_2 + %91 = OpFNegate %float %97 + %99 = OpAccessChain %_ptr_Function_float %M %int_2 %int_2 + %100 = OpLoad %float %99 + %101 = OpFAdd %float %float_n1 %100 + %102 = OpFDiv %float %91 %101 + OpStore %viewNear %102 + %106 = OpAccessChain %_ptr_Function_float %M %int_3 %int_2 %107 = OpLoad %float %106 - %108 = OpFAdd %float %float_1 %107 - %109 = OpFDiv %float %102 %108 - OpStore %viewFar %109 - %111 = OpLoad %uint %index - %113 = OpAccessChain %_ptr_StorageBuffer_v4float %lightsBuffer %uint_0 %111 %uint_0 - %114 = OpLoad %v4float %113 - OpStore %lightPos %114 - %119 = OpAccessChain %_ptr_Uniform_mat4v4float %uniforms %uint_2 - %120 = OpLoad %mat4v4float %119 - %121 = OpLoad %v4float %lightPos - %122 = OpMatrixTimesVector %v4float %120 %121 - OpStore %lightPos %122 - %123 = OpLoad %v4float %lightPos - %124 = OpAccessChain %_ptr_Function_float %lightPos %uint_3 - %125 = OpLoad %float %124 - %128 = OpCompositeConstruct %v4float %125 %125 %125 %125 - %126 = OpFDiv %v4float %123 %128 - OpStore %lightPos %126 - %129 = OpLoad %uint %index - %130 = OpAccessChain %_ptr_StorageBuffer_float %lightsBuffer %uint_0 %129 %uint_2 - %131 = OpLoad %float %130 - OpStore %lightRadius %131 - %133 = OpLoad %v4float %lightPos - %134 = OpLoad %float %lightRadius - %135 = OpCompositeConstruct %v3float %134 %134 %134 - %136 = OpCompositeExtract %float %135 0 - %137 = OpCompositeExtract %float %135 1 - %138 = OpCompositeExtract %float %135 2 - %139 = OpCompositeConstruct %v4float %136 %137 %138 %101 - %140 = OpFSub %v4float %133 %139 - OpStore %boxMin %140 - %142 = OpLoad %v4float %lightPos - %143 = OpLoad %float %lightRadius - %144 = OpCompositeConstruct %v3float %143 %143 %143 - %145 = OpCompositeExtract %float %144 0 - %146 = OpCompositeExtract %float %144 1 - %147 = OpCompositeExtract %float %144 2 - %148 = OpCompositeConstruct %v4float %145 %146 %147 %101 - %149 = OpFAdd %v4float %142 %148 - OpStore %boxMax %149 - %157 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_4 - %158 = OpLoad %float %viewNear - %159 = OpCompositeConstruct %v4float %101 %101 %float_n1 %158 - OpStore %157 %159 - %161 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_5 - %163 = OpLoad %float %viewFar - %162 = OpFNegate %float %163 - %164 = OpCompositeConstruct %v4float %101 %101 %float_1 %162 - OpStore %161 %164 - OpStore %y %166 - OpBranch %169 - %169 = OpLabel - OpLoopMerge %170 %171 None + %105 = OpFNegate %float %107 + %109 = OpAccessChain %_ptr_Function_float %M %int_2 %int_2 + %110 = OpLoad %float %109 + %111 = OpFAdd %float %float_1 %110 + %112 = OpFDiv %float %105 %111 + OpStore %viewFar %112 + %114 = OpLoad %uint %index + %116 = OpAccessChain %_ptr_StorageBuffer_v4float %lightsBuffer %uint_0 %114 %uint_0 + %117 = OpLoad %v4float %116 + OpStore %lightPos %117 + %122 = OpAccessChain %_ptr_Uniform_mat4v4float %uniforms %uint_0 %uint_2 + %123 = OpLoad %mat4v4float %122 + %124 = OpLoad %v4float %lightPos + %125 = OpMatrixTimesVector %v4float %123 %124 + OpStore %lightPos %125 + %126 = OpLoad %v4float %lightPos + %127 = OpAccessChain %_ptr_Function_float %lightPos %uint_3 + %128 = OpLoad %float %127 + %131 = OpCompositeConstruct %v4float %128 %128 %128 %128 + %129 = OpFDiv %v4float %126 %131 + OpStore %lightPos %129 + %132 = OpLoad %uint %index + %133 = OpAccessChain %_ptr_StorageBuffer_float %lightsBuffer %uint_0 %132 %uint_2 + %134 = OpLoad %float %133 + OpStore %lightRadius %134 + %136 = OpLoad %v4float %lightPos + %137 = OpLoad %float %lightRadius + %138 = OpCompositeConstruct %v3float %137 %137 %137 + %139 = OpCompositeExtract %float %138 0 + %140 = OpCompositeExtract %float %138 1 + %141 = OpCompositeExtract %float %138 2 + %142 = OpCompositeConstruct %v4float %139 %140 %141 %104 + %143 = OpFSub %v4float %136 %142 + OpStore %boxMin %143 + %145 = OpLoad %v4float %lightPos + %146 = OpLoad %float %lightRadius + %147 = OpCompositeConstruct %v3float %146 %146 %146 + %148 = OpCompositeExtract %float %147 0 + %149 = OpCompositeExtract %float %147 1 + %150 = OpCompositeExtract %float %147 2 + %151 = OpCompositeConstruct %v4float %148 %149 %150 %104 + %152 = OpFAdd %v4float %145 %151 + OpStore %boxMax %152 + %160 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_4 + %161 = OpLoad %float %viewNear + %162 = OpCompositeConstruct %v4float %104 %104 %float_n1 %161 + OpStore %160 %162 + %164 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_5 + %166 = OpLoad %float %viewFar + %165 = OpFNegate %float %166 + %167 = OpCompositeConstruct %v4float %104 %104 %float_1 %165 + OpStore %164 %167 + OpStore %y %169 OpBranch %172 %172 = OpLabel - %174 = OpLoad %int %y - %175 = OpSLessThan %bool %174 %int_2 - %173 = OpLogicalNot %bool %175 - OpSelectionMerge %176 None - OpBranchConditional %173 %177 %176 - %177 = OpLabel - OpBranch %170 - %176 = OpLabel - OpStore %x %166 - OpBranch %179 + OpLoopMerge %173 %174 None + OpBranch %175 + %175 = OpLabel + %177 = OpLoad %int %y + %178 = OpSLessThan %bool %177 %int_2 + %176 = OpLogicalNot %bool %178 + OpSelectionMerge %179 None + OpBranchConditional %176 %180 %179 + %180 = OpLabel + OpBranch %173 %179 = OpLabel - OpLoopMerge %180 %181 None + OpStore %x %169 OpBranch %182 %182 = OpLabel - %184 = OpLoad %int %x - %185 = OpSLessThan %bool %184 %int_2 - %183 = OpLogicalNot %bool %185 - OpSelectionMerge %186 None - OpBranchConditional %183 %187 %186 - %187 = OpLabel - OpBranch %180 - %186 = OpLabel - %189 = OpLoad %int %x - %190 = OpIMul %int %189 %int_16 - %191 = OpLoad %int %y - %192 = OpIMul %int %191 %int_16 - %193 = OpCompositeConstruct %v2int %190 %192 - OpStore %tilePixel0Idx %193 - %200 = OpLoad %v2int %tilePixel0Idx - %198 = OpConvertSToF %v2float %200 - %201 = OpVectorTimesScalar %v2float %198 %float_2 - %203 = OpAccessChain %_ptr_Uniform_v4float %uniforms %uint_4 - %204 = OpLoad %v4float %203 - %205 = OpVectorShuffle %v2float %204 %204 0 1 - %206 = OpFDiv %v2float %201 %205 - %208 = OpFSub %v2float %206 %207 - OpStore %floorCoord %208 - %213 = OpLoad %v2int %tilePixel0Idx - %214 = OpCompositeConstruct %v2int %int_16 %int_16 - %215 = OpIAdd %v2int %213 %214 - %212 = OpConvertSToF %v2float %215 - %216 = OpVectorTimesScalar %v2float %212 %float_2 - %217 = OpAccessChain %_ptr_Uniform_v4float %uniforms %uint_4 - %218 = OpLoad %v4float %217 - %219 = OpVectorShuffle %v2float %218 %218 0 1 - %220 = OpFDiv %v2float %216 %219 - %221 = OpFSub %v2float %220 %207 - OpStore %ceilCoord %221 - %224 = OpLoad %float %viewNear - %223 = OpFNegate %float %224 - %225 = OpAccessChain %_ptr_Function_float %floorCoord %uint_0 - %226 = OpLoad %float %225 - %227 = OpFMul %float %223 %226 - %228 = OpAccessChain %_ptr_Function_float %M %int_2 %166 + OpLoopMerge %183 %184 None + OpBranch %185 + %185 = OpLabel + %187 = OpLoad %int %x + %188 = OpSLessThan %bool %187 %int_2 + %186 = OpLogicalNot %bool %188 + OpSelectionMerge %189 None + OpBranchConditional %186 %190 %189 + %190 = OpLabel + OpBranch %183 + %189 = OpLabel + %192 = OpLoad %int %x + %193 = OpIMul %int %192 %int_16 + %194 = OpLoad %int %y + %195 = OpIMul %int %194 %int_16 + %196 = OpCompositeConstruct %v2int %193 %195 + OpStore %tilePixel0Idx %196 + %203 = OpLoad %v2int %tilePixel0Idx + %201 = OpConvertSToF %v2float %203 + %204 = OpVectorTimesScalar %v2float %201 %float_2 + %206 = OpAccessChain %_ptr_Uniform_v4float %uniforms %uint_0 %uint_4 + %207 = OpLoad %v4float %206 + %208 = OpVectorShuffle %v2float %207 %207 0 1 + %209 = OpFDiv %v2float %204 %208 + %211 = OpFSub %v2float %209 %210 + OpStore %floorCoord %211 + %216 = OpLoad %v2int %tilePixel0Idx + %217 = OpCompositeConstruct %v2int %int_16 %int_16 + %218 = OpIAdd %v2int %216 %217 + %215 = OpConvertSToF %v2float %218 + %219 = OpVectorTimesScalar %v2float %215 %float_2 + %220 = OpAccessChain %_ptr_Uniform_v4float %uniforms %uint_0 %uint_4 + %221 = OpLoad %v4float %220 + %222 = OpVectorShuffle %v2float %221 %221 0 1 + %223 = OpFDiv %v2float %219 %222 + %224 = OpFSub %v2float %223 %210 + OpStore %ceilCoord %224 + %227 = OpLoad %float %viewNear + %226 = OpFNegate %float %227 + %228 = OpAccessChain %_ptr_Function_float %floorCoord %uint_0 %229 = OpLoad %float %228 - %230 = OpLoad %float %viewNear - %231 = OpFMul %float %229 %230 - %232 = OpFSub %float %227 %231 - %233 = OpAccessChain %_ptr_Function_float %M %166 %166 - %234 = OpLoad %float %233 - %235 = OpFDiv %float %232 %234 - %237 = OpLoad %float %viewNear - %236 = OpFNegate %float %237 - %238 = OpAccessChain %_ptr_Function_float %floorCoord %uint_1 - %239 = OpLoad %float %238 - %240 = OpFMul %float %236 %239 - %242 = OpAccessChain %_ptr_Function_float %M %int_2 %int_1 - %243 = OpLoad %float %242 - %244 = OpLoad %float %viewNear - %245 = OpFMul %float %243 %244 - %246 = OpFSub %float %240 %245 - %247 = OpAccessChain %_ptr_Function_float %M %int_1 %int_1 - %248 = OpLoad %float %247 - %249 = OpFDiv %float %246 %248 - %250 = OpCompositeConstruct %v2float %235 %249 - OpStore %viewFloorCoord %250 - %253 = OpLoad %float %viewNear - %252 = OpFNegate %float %253 - %254 = OpAccessChain %_ptr_Function_float %ceilCoord %uint_0 - %255 = OpLoad %float %254 - %256 = OpFMul %float %252 %255 - %257 = OpAccessChain %_ptr_Function_float %M %int_2 %166 + %230 = OpFMul %float %226 %229 + %231 = OpAccessChain %_ptr_Function_float %M %int_2 %169 + %232 = OpLoad %float %231 + %233 = OpLoad %float %viewNear + %234 = OpFMul %float %232 %233 + %235 = OpFSub %float %230 %234 + %236 = OpAccessChain %_ptr_Function_float %M %169 %169 + %237 = OpLoad %float %236 + %238 = OpFDiv %float %235 %237 + %240 = OpLoad %float %viewNear + %239 = OpFNegate %float %240 + %241 = OpAccessChain %_ptr_Function_float %floorCoord %uint_1 + %242 = OpLoad %float %241 + %243 = OpFMul %float %239 %242 + %245 = OpAccessChain %_ptr_Function_float %M %int_2 %int_1 + %246 = OpLoad %float %245 + %247 = OpLoad %float %viewNear + %248 = OpFMul %float %246 %247 + %249 = OpFSub %float %243 %248 + %250 = OpAccessChain %_ptr_Function_float %M %int_1 %int_1 + %251 = OpLoad %float %250 + %252 = OpFDiv %float %249 %251 + %253 = OpCompositeConstruct %v2float %238 %252 + OpStore %viewFloorCoord %253 + %256 = OpLoad %float %viewNear + %255 = OpFNegate %float %256 + %257 = OpAccessChain %_ptr_Function_float %ceilCoord %uint_0 %258 = OpLoad %float %257 - %259 = OpLoad %float %viewNear - %260 = OpFMul %float %258 %259 - %261 = OpFSub %float %256 %260 - %262 = OpAccessChain %_ptr_Function_float %M %166 %166 - %263 = OpLoad %float %262 - %264 = OpFDiv %float %261 %263 - %266 = OpLoad %float %viewNear - %265 = OpFNegate %float %266 - %267 = OpAccessChain %_ptr_Function_float %ceilCoord %uint_1 - %268 = OpLoad %float %267 - %269 = OpFMul %float %265 %268 - %270 = OpAccessChain %_ptr_Function_float %M %int_2 %int_1 + %259 = OpFMul %float %255 %258 + %260 = OpAccessChain %_ptr_Function_float %M %int_2 %169 + %261 = OpLoad %float %260 + %262 = OpLoad %float %viewNear + %263 = OpFMul %float %261 %262 + %264 = OpFSub %float %259 %263 + %265 = OpAccessChain %_ptr_Function_float %M %169 %169 + %266 = OpLoad %float %265 + %267 = OpFDiv %float %264 %266 + %269 = OpLoad %float %viewNear + %268 = OpFNegate %float %269 + %270 = OpAccessChain %_ptr_Function_float %ceilCoord %uint_1 %271 = OpLoad %float %270 - %272 = OpLoad %float %viewNear - %273 = OpFMul %float %271 %272 - %274 = OpFSub %float %269 %273 - %275 = OpAccessChain %_ptr_Function_float %M %int_1 %int_1 - %276 = OpLoad %float %275 - %277 = OpFDiv %float %274 %276 - %278 = OpCompositeConstruct %v2float %264 %277 - OpStore %viewCeilCoord %278 - %280 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %166 - %282 = OpAccessChain %_ptr_Function_float %viewFloorCoord %uint_0 - %283 = OpLoad %float %282 - %281 = OpFNegate %float %283 - %284 = OpLoad %float %viewNear - %285 = OpFDiv %float %281 %284 - %286 = OpCompositeConstruct %v4float %float_1 %101 %285 %101 - OpStore %280 %286 - %287 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_1 - %288 = OpAccessChain %_ptr_Function_float %viewCeilCoord %uint_0 - %289 = OpLoad %float %288 - %290 = OpLoad %float %viewNear - %291 = OpFDiv %float %289 %290 - %292 = OpCompositeConstruct %v4float %float_n1 %101 %291 %101 - OpStore %287 %292 - %293 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_2 - %295 = OpAccessChain %_ptr_Function_float %viewFloorCoord %uint_1 - %296 = OpLoad %float %295 - %294 = OpFNegate %float %296 - %297 = OpLoad %float %viewNear - %298 = OpFDiv %float %294 %297 - %299 = OpCompositeConstruct %v4float %101 %float_1 %298 %101 - OpStore %293 %299 - %300 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_3 - %301 = OpAccessChain %_ptr_Function_float %viewCeilCoord %uint_1 - %302 = OpLoad %float %301 - %303 = OpLoad %float %viewNear - %304 = OpFDiv %float %302 %303 - %305 = OpCompositeConstruct %v4float %101 %float_n1 %304 %101 - OpStore %300 %305 - OpStore %dp %101 - OpStore %i %36 - OpBranch %308 - %308 = OpLabel - OpLoopMerge %309 %310 None + %272 = OpFMul %float %268 %271 + %273 = OpAccessChain %_ptr_Function_float %M %int_2 %int_1 + %274 = OpLoad %float %273 + %275 = OpLoad %float %viewNear + %276 = OpFMul %float %274 %275 + %277 = OpFSub %float %272 %276 + %278 = OpAccessChain %_ptr_Function_float %M %int_1 %int_1 + %279 = OpLoad %float %278 + %280 = OpFDiv %float %277 %279 + %281 = OpCompositeConstruct %v2float %267 %280 + OpStore %viewCeilCoord %281 + %283 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %169 + %285 = OpAccessChain %_ptr_Function_float %viewFloorCoord %uint_0 + %286 = OpLoad %float %285 + %284 = OpFNegate %float %286 + %287 = OpLoad %float %viewNear + %288 = OpFDiv %float %284 %287 + %289 = OpCompositeConstruct %v4float %float_1 %104 %288 %104 + OpStore %283 %289 + %290 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_1 + %291 = OpAccessChain %_ptr_Function_float %viewCeilCoord %uint_0 + %292 = OpLoad %float %291 + %293 = OpLoad %float %viewNear + %294 = OpFDiv %float %292 %293 + %295 = OpCompositeConstruct %v4float %float_n1 %104 %294 %104 + OpStore %290 %295 + %296 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_2 + %298 = OpAccessChain %_ptr_Function_float %viewFloorCoord %uint_1 + %299 = OpLoad %float %298 + %297 = OpFNegate %float %299 + %300 = OpLoad %float %viewNear + %301 = OpFDiv %float %297 %300 + %302 = OpCompositeConstruct %v4float %104 %float_1 %301 %104 + OpStore %296 %302 + %303 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %int_3 + %304 = OpAccessChain %_ptr_Function_float %viewCeilCoord %uint_1 + %305 = OpLoad %float %304 + %306 = OpLoad %float %viewNear + %307 = OpFDiv %float %305 %306 + %308 = OpCompositeConstruct %v4float %104 %float_n1 %307 %104 + OpStore %303 %308 + OpStore %dp %104 + OpStore %i %39 OpBranch %311 %311 = OpLabel - %313 = OpLoad %uint %i - %314 = OpULessThan %bool %313 %uint_6 - %312 = OpLogicalNot %bool %314 - OpSelectionMerge %315 None - OpBranchConditional %312 %316 %315 - %316 = OpLabel - OpBranch %309 - %315 = OpLabel - %318 = OpLoad %uint %i - %319 = OpAccessChain %_ptr_Function_float %frustumPlanes %318 %uint_0 - %320 = OpLoad %float %319 - %321 = OpFOrdGreaterThan %bool %320 %101 - OpSelectionMerge %322 None - OpBranchConditional %321 %323 %324 - %323 = OpLabel - %325 = OpAccessChain %_ptr_Function_float %p %uint_0 - %326 = OpAccessChain %_ptr_Function_float %boxMax %uint_0 - %327 = OpLoad %float %326 - OpStore %325 %327 - OpBranch %322 - %324 = OpLabel + OpLoopMerge %312 %313 None + OpBranch %314 + %314 = OpLabel + %316 = OpLoad %uint %i + %317 = OpULessThan %bool %316 %uint_6 + %315 = OpLogicalNot %bool %317 + OpSelectionMerge %318 None + OpBranchConditional %315 %319 %318 + %319 = OpLabel + OpBranch %312 + %318 = OpLabel + %321 = OpLoad %uint %i + %322 = OpAccessChain %_ptr_Function_float %frustumPlanes %321 %uint_0 + %323 = OpLoad %float %322 + %324 = OpFOrdGreaterThan %bool %323 %104 + OpSelectionMerge %325 None + OpBranchConditional %324 %326 %327 + %326 = OpLabel %328 = OpAccessChain %_ptr_Function_float %p %uint_0 - %329 = OpAccessChain %_ptr_Function_float %boxMin %uint_0 + %329 = OpAccessChain %_ptr_Function_float %boxMax %uint_0 %330 = OpLoad %float %329 OpStore %328 %330 - OpBranch %322 - %322 = OpLabel - %331 = OpLoad %uint %i - %332 = OpAccessChain %_ptr_Function_float %frustumPlanes %331 %uint_1 + OpBranch %325 + %327 = OpLabel + %331 = OpAccessChain %_ptr_Function_float %p %uint_0 + %332 = OpAccessChain %_ptr_Function_float %boxMin %uint_0 %333 = OpLoad %float %332 - %334 = OpFOrdGreaterThan %bool %333 %101 - OpSelectionMerge %335 None - OpBranchConditional %334 %336 %337 - %336 = OpLabel - %338 = OpAccessChain %_ptr_Function_float %p %uint_1 - %339 = OpAccessChain %_ptr_Function_float %boxMax %uint_1 - %340 = OpLoad %float %339 - OpStore %338 %340 - OpBranch %335 - %337 = OpLabel + OpStore %331 %333 + OpBranch %325 + %325 = OpLabel + %334 = OpLoad %uint %i + %335 = OpAccessChain %_ptr_Function_float %frustumPlanes %334 %uint_1 + %336 = OpLoad %float %335 + %337 = OpFOrdGreaterThan %bool %336 %104 + OpSelectionMerge %338 None + OpBranchConditional %337 %339 %340 + %339 = OpLabel %341 = OpAccessChain %_ptr_Function_float %p %uint_1 - %342 = OpAccessChain %_ptr_Function_float %boxMin %uint_1 + %342 = OpAccessChain %_ptr_Function_float %boxMax %uint_1 %343 = OpLoad %float %342 OpStore %341 %343 - OpBranch %335 - %335 = OpLabel - %344 = OpLoad %uint %i - %345 = OpAccessChain %_ptr_Function_float %frustumPlanes %344 %uint_2 + OpBranch %338 + %340 = OpLabel + %344 = OpAccessChain %_ptr_Function_float %p %uint_1 + %345 = OpAccessChain %_ptr_Function_float %boxMin %uint_1 %346 = OpLoad %float %345 - %347 = OpFOrdGreaterThan %bool %346 %101 - OpSelectionMerge %348 None - OpBranchConditional %347 %349 %350 - %349 = OpLabel - %351 = OpAccessChain %_ptr_Function_float %p %uint_2 - %352 = OpAccessChain %_ptr_Function_float %boxMax %uint_2 - %353 = OpLoad %float %352 - OpStore %351 %353 - OpBranch %348 - %350 = OpLabel + OpStore %344 %346 + OpBranch %338 + %338 = OpLabel + %347 = OpLoad %uint %i + %348 = OpAccessChain %_ptr_Function_float %frustumPlanes %347 %uint_2 + %349 = OpLoad %float %348 + %350 = OpFOrdGreaterThan %bool %349 %104 + OpSelectionMerge %351 None + OpBranchConditional %350 %352 %353 + %352 = OpLabel %354 = OpAccessChain %_ptr_Function_float %p %uint_2 - %355 = OpAccessChain %_ptr_Function_float %boxMin %uint_2 + %355 = OpAccessChain %_ptr_Function_float %boxMax %uint_2 %356 = OpLoad %float %355 OpStore %354 %356 - OpBranch %348 - %348 = OpLabel - %357 = OpAccessChain %_ptr_Function_float %p %uint_3 - OpStore %357 %float_1 - %358 = OpLoad %float %dp - %361 = OpLoad %v4float %p - %362 = OpLoad %uint %i - %363 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %362 - %364 = OpLoad %v4float %363 - %360 = OpDot %float %361 %364 - %359 = OpExtInst %float %60 NMin %101 %360 - %365 = OpFAdd %float %358 %359 - OpStore %dp %365 - OpBranch %310 - %310 = OpLabel - %366 = OpLoad %uint %i - %367 = OpIAdd %uint %366 %uint_1 - OpStore %i %367 - OpBranch %308 - %309 = OpLabel - %368 = OpLoad %float %dp - %369 = OpFOrdGreaterThanEqual %bool %368 %101 - OpSelectionMerge %370 None - OpBranchConditional %369 %371 %370 - %371 = OpLabel - %373 = OpLoad %int %x - %374 = OpLoad %int %y - %375 = OpIMul %int %374 %int_2 - %376 = OpIAdd %int %373 %375 - %372 = OpBitcast %uint %376 - OpStore %tileId %372 - %378 = OpLoad %uint %tileId - %379 = OpULessThan %bool %378 %36 - OpSelectionMerge %380 None - OpBranchConditional %379 %380 %381 - %381 = OpLabel - %382 = OpLoad %uint %tileId - %383 = OpAccessChain %_ptr_Uniform_uint %config %uint_1 - %384 = OpLoad %uint %383 - %385 = OpUGreaterThanEqual %bool %382 %384 - OpBranch %380 - %380 = OpLabel - %386 = OpPhi %bool %379 %371 %385 %381 - OpSelectionMerge %387 None - OpBranchConditional %386 %388 %387 - %388 = OpLabel - OpBranch %181 - %387 = OpLabel - %391 = OpLoad %uint %tileId - %393 = OpAccessChain %_ptr_StorageBuffer_uint %tileLightId %uint_0 %391 %uint_0 - %389 = OpAtomicIAdd %uint %393 %uint_1 %uint_0 %uint_1 - OpStore %offset %389 - %395 = OpLoad %uint %offset - %396 = OpAccessChain %_ptr_Uniform_uint %config %uint_4 - %397 = OpLoad %uint %396 - %398 = OpUGreaterThanEqual %bool %395 %397 - OpSelectionMerge %399 None - OpBranchConditional %398 %400 %399 - %400 = OpLabel - OpBranch %181 - %399 = OpLabel - %401 = OpLoad %uint %tileId - %402 = OpLoad %uint %offset - %404 = OpAccessChain %_ptr_StorageBuffer_uint_0 %tileLightId %uint_0 %401 %uint_1 %402 - %405 = OpCompositeExtract %uint %GlobalInvocationID 0 - OpStore %404 %405 - OpBranch %370 - %370 = OpLabel - OpBranch %181 - %181 = OpLabel - %406 = OpLoad %int %x - %407 = OpIAdd %int %406 %int_1 - OpStore %x %407 - OpBranch %179 - %180 = OpLabel - OpBranch %171 - %171 = OpLabel - %408 = OpLoad %int %y - %409 = OpIAdd %int %408 %int_1 - OpStore %y %409 - OpBranch %169 - %170 = OpLabel + OpBranch %351 + %353 = OpLabel + %357 = OpAccessChain %_ptr_Function_float %p %uint_2 + %358 = OpAccessChain %_ptr_Function_float %boxMin %uint_2 + %359 = OpLoad %float %358 + OpStore %357 %359 + OpBranch %351 + %351 = OpLabel + %360 = OpAccessChain %_ptr_Function_float %p %uint_3 + OpStore %360 %float_1 + %361 = OpLoad %float %dp + %364 = OpLoad %v4float %p + %365 = OpLoad %uint %i + %366 = OpAccessChain %_ptr_Function_v4float %frustumPlanes %365 + %367 = OpLoad %v4float %366 + %363 = OpDot %float %364 %367 + %362 = OpExtInst %float %63 NMin %104 %363 + %368 = OpFAdd %float %361 %362 + OpStore %dp %368 + OpBranch %313 + %313 = OpLabel + %369 = OpLoad %uint %i + %370 = OpIAdd %uint %369 %uint_1 + OpStore %i %370 + OpBranch %311 + %312 = OpLabel + %371 = OpLoad %float %dp + %372 = OpFOrdGreaterThanEqual %bool %371 %104 + OpSelectionMerge %373 None + OpBranchConditional %372 %374 %373 + %374 = OpLabel + %376 = OpLoad %int %x + %377 = OpLoad %int %y + %378 = OpIMul %int %377 %int_2 + %379 = OpIAdd %int %376 %378 + %375 = OpBitcast %uint %379 + OpStore %tileId %375 + %381 = OpLoad %uint %tileId + %382 = OpULessThan %bool %381 %39 + OpSelectionMerge %383 None + OpBranchConditional %382 %383 %384 + %384 = OpLabel + %385 = OpLoad %uint %tileId + %386 = OpAccessChain %_ptr_Uniform_uint %config %uint_0 %uint_1 + %387 = OpLoad %uint %386 + %388 = OpUGreaterThanEqual %bool %385 %387 + OpBranch %383 + %383 = OpLabel + %389 = OpPhi %bool %382 %374 %388 %384 + OpSelectionMerge %390 None + OpBranchConditional %389 %391 %390 + %391 = OpLabel + OpBranch %184 + %390 = OpLabel + %394 = OpLoad %uint %tileId + %396 = OpAccessChain %_ptr_StorageBuffer_uint %tileLightId %uint_0 %uint_0 %394 %uint_0 + %392 = OpAtomicIAdd %uint %396 %uint_1 %uint_0 %uint_1 + OpStore %offset %392 + %398 = OpLoad %uint %offset + %399 = OpAccessChain %_ptr_Uniform_uint %config %uint_0 %uint_4 + %400 = OpLoad %uint %399 + %401 = OpUGreaterThanEqual %bool %398 %400 + OpSelectionMerge %402 None + OpBranchConditional %401 %403 %402 + %403 = OpLabel + OpBranch %184 + %402 = OpLabel + %404 = OpLoad %uint %tileId + %405 = OpLoad %uint %offset + %407 = OpAccessChain %_ptr_StorageBuffer_uint_0 %tileLightId %uint_0 %uint_0 %404 %uint_1 %405 + %408 = OpCompositeExtract %uint %GlobalInvocationID 0 + OpStore %407 %408 + OpBranch %373 + %373 = OpLabel + OpBranch %184 + %184 = OpLabel + %409 = OpLoad %int %x + %410 = OpIAdd %int %409 %int_1 + OpStore %x %410 + OpBranch %182 + %183 = OpLabel + OpBranch %174 + %174 = OpLabel + %411 = OpLoad %int %y + %412 = OpIAdd %int %411 %int_1 + OpStore %y %412 + OpBranch %172 + %173 = OpLabel OpReturn OpFunctionEnd - %main = OpFunction %void None %410 - %412 = OpLabel - %414 = OpLoad %v3uint %GlobalInvocationID_1 - %413 = OpFunctionCall %void %main_inner %414 + %main = OpFunction %void None %413 + %415 = OpLabel + %417 = OpLoad %v3uint %GlobalInvocationID_1 + %416 = OpFunctionCall %void %main_inner %417 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/1136.wgsl.expected.glsl b/test/tint/bug/tint/1136.wgsl.expected.glsl index 958228b037..a6aac4cc87 100644 --- a/test/tint/bug/tint/1136.wgsl.expected.glsl +++ b/test/tint/bug/tint/1136.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer Buffer_ssbo { +struct Buffer { uint data; +}; + +layout(binding = 0, std430) buffer tint_symbol_block_ssbo { + Buffer inner; } tint_symbol; void tint_symbol_1() { - tint_symbol.data = (tint_symbol.data + 1u); + tint_symbol.inner.data = (tint_symbol.inner.data + 1u); } diff --git a/test/tint/bug/tint/1136.wgsl.expected.spvasm b/test/tint/bug/tint/1136.wgsl.expected.spvasm index ed1e519d5e..0e03fb8bab 100644 --- a/test/tint/bug/tint/1136.wgsl.expected.spvasm +++ b/test/tint/bug/tint/1136.wgsl.expected.spvasm @@ -1,40 +1,44 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 18 +; Bound: 19 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %buffer_block "buffer_block" + OpMemberName %buffer_block 0 "inner" OpName %Buffer "Buffer" OpMemberName %Buffer 0 "data" OpName %buffer "buffer" OpName %unused_entry_point "unused_entry_point" OpName %main "main" - OpDecorate %Buffer Block + OpDecorate %buffer_block Block + OpMemberDecorate %buffer_block 0 Offset 0 OpMemberDecorate %Buffer 0 Offset 0 OpDecorate %buffer DescriptorSet 0 OpDecorate %buffer Binding 0 %uint = OpTypeInt 32 0 %Buffer = OpTypeStruct %uint -%_ptr_StorageBuffer_Buffer = OpTypePointer StorageBuffer %Buffer - %buffer = OpVariable %_ptr_StorageBuffer_Buffer StorageBuffer +%buffer_block = OpTypeStruct %Buffer +%_ptr_StorageBuffer_buffer_block = OpTypePointer StorageBuffer %buffer_block + %buffer = OpVariable %_ptr_StorageBuffer_buffer_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %uint_1 = OpConstant %uint 1 -%unused_entry_point = OpFunction %void None %5 - %8 = OpLabel +%unused_entry_point = OpFunction %void None %6 + %9 = OpLabel OpReturn OpFunctionEnd - %main = OpFunction %void None %5 - %10 = OpLabel - %13 = OpAccessChain %_ptr_StorageBuffer_uint %buffer %uint_0 - %14 = OpAccessChain %_ptr_StorageBuffer_uint %buffer %uint_0 - %15 = OpLoad %uint %14 - %17 = OpIAdd %uint %15 %uint_1 - OpStore %13 %17 + %main = OpFunction %void None %6 + %11 = OpLabel + %14 = OpAccessChain %_ptr_StorageBuffer_uint %buffer %uint_0 %uint_0 + %15 = OpAccessChain %_ptr_StorageBuffer_uint %buffer %uint_0 %uint_0 + %16 = OpLoad %uint %15 + %18 = OpIAdd %uint %16 %uint_1 + OpStore %14 %18 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/1520.spvasm.expected.glsl b/test/tint/bug/tint/1520.spvasm.expected.glsl index c59e118284..74b44090c0 100644 --- a/test/tint/bug/tint/1520.spvasm.expected.glsl +++ b/test/tint/bug/tint/1520.spvasm.expected.glsl @@ -3,7 +3,7 @@ precision mediump float; layout(location = 0) in vec4 vcolor_S0_param_1; layout(location = 0) out vec4 sk_FragColor_1_1; -layout(binding = 0, std140) uniform UniformBuffer_ubo { +struct UniformBuffer { uint pad; uint pad_1; uint pad_2; @@ -15,6 +15,10 @@ layout(binding = 0, std140) uniform UniformBuffer_ubo { vec4 ucolorRed_S1_c0; vec4 ucolorGreen_S1_c0; mat3 umatrix_S1; +}; + +layout(binding = 0, std140) uniform x_4_block_ubo { + UniformBuffer inner; } x_4; vec4 sk_FragColor = vec4(0.0f, 0.0f, 0.0f, 0.0f); @@ -30,7 +34,7 @@ bool test_int_S1_c0_b() { bool x_55 = false; bool x_65 = false; bool x_66 = false; - float x_26 = x_4.unknownInput_S1_c0; + float x_26 = x_4.inner.unknownInput_S1_c0; int x_27 = int(x_26); unknown = x_27; ok = true; @@ -90,7 +94,7 @@ void main_1() { bool x_115 = false; vec4 x_72 = vcolor_S0; outputColor_S0 = x_72; - float x_77 = x_4.unknownInput_S1_c0; + float x_77 = x_4.inner.unknownInput_S1_c0; x_8_unknown = x_77; x_9_ok = true; x_87 = false; @@ -135,10 +139,10 @@ void main_1() { x_115 = x_114; } if (x_115) { - vec4 x_122 = x_4.ucolorGreen_S1_c0; + vec4 x_122 = x_4.inner.ucolorGreen_S1_c0; x_116 = x_122; } else { - vec4 x_124 = x_4.ucolorRed_S1_c0; + vec4 x_124 = x_4.inner.ucolorRed_S1_c0; x_116 = x_124; } vec4 x_125 = x_116; diff --git a/test/tint/bug/tint/1520.spvasm.expected.spvasm b/test/tint/bug/tint/1520.spvasm.expected.spvasm index 5dbf85a5e9..5a7ff67a50 100644 --- a/test/tint/bug/tint/1520.spvasm.expected.spvasm +++ b/test/tint/bug/tint/1520.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 176 +; Bound: 177 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -10,6 +10,8 @@ OpName %sk_Clockwise_param_1 "sk_Clockwise_param_1" OpName %vcolor_S0_param_1 "vcolor_S0_param_1" OpName %sk_FragColor_1_1 "sk_FragColor_1_1" + OpName %x_4_block "x_4_block" + OpMemberName %x_4_block 0 "inner" OpName %UniformBuffer "UniformBuffer" OpMemberName %UniformBuffer 0 "unknownInput_S1_c0" OpMemberName %UniformBuffer 1 "ucolorRed_S1_c0" @@ -53,7 +55,8 @@ OpDecorate %sk_Clockwise_param_1 BuiltIn FrontFacing OpDecorate %vcolor_S0_param_1 Location 0 OpDecorate %sk_FragColor_1_1 Location 0 - OpDecorate %UniformBuffer Block + OpDecorate %x_4_block Block + OpMemberDecorate %x_4_block 0 Offset 0 OpMemberDecorate %UniformBuffer 0 Offset 16 OpMemberDecorate %UniformBuffer 1 Offset 32 OpMemberDecorate %UniformBuffer 2 Offset 48 @@ -77,255 +80,256 @@ %v3float = OpTypeVector %float 3 %mat3v3float = OpTypeMatrix %v3float 3 %UniformBuffer = OpTypeStruct %float %v4float %v4float %mat3v3float -%_ptr_Uniform_UniformBuffer = OpTypePointer Uniform %UniformBuffer - %x_4 = OpVariable %_ptr_Uniform_UniformBuffer Uniform + %x_4_block = OpTypeStruct %UniformBuffer +%_ptr_Uniform_x_4_block = OpTypePointer Uniform %x_4_block + %x_4 = OpVariable %_ptr_Uniform_x_4_block Uniform %_ptr_Private_v4float = OpTypePointer Private %v4float %sk_FragColor = OpVariable %_ptr_Private_v4float Private %10 %_ptr_Private_bool = OpTypePointer Private %bool - %20 = OpConstantNull %bool -%sk_Clockwise = OpVariable %_ptr_Private_bool Private %20 + %21 = OpConstantNull %bool +%sk_Clockwise = OpVariable %_ptr_Private_bool Private %21 %vcolor_S0 = OpVariable %_ptr_Private_v4float Private %10 - %22 = OpTypeFunction %bool + %23 = OpTypeFunction %bool %int = OpTypeInt 32 1 %_ptr_Function_int = OpTypePointer Function %int - %28 = OpConstantNull %int + %29 = OpConstantNull %int %_ptr_Function_bool = OpTypePointer Function %bool %v4int = OpTypeVector %int 4 %_ptr_Function_v4int = OpTypePointer Function %v4int - %34 = OpConstantNull %v4int + %35 = OpConstantNull %v4int %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_Uniform_float = OpTypePointer Uniform %float %true = OpConstantTrue %bool %v4bool = OpTypeVector %bool 4 %int_1 = OpConstant %int 1 - %59 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 + %60 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 %int_2 = OpConstant %int 2 - %72 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 + %73 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 %void = OpTypeVoid - %85 = OpTypeFunction %void + %86 = OpTypeFunction %void %_ptr_Function_v4float = OpTypePointer Function %v4float %_ptr_Function_float = OpTypePointer Function %float - %94 = OpConstantNull %float + %95 = OpConstantNull %float %float_1 = OpConstant %float 1 - %119 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %120 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 %float_2 = OpConstant %float 2 - %132 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %133 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 %uint_2 = OpConstant %uint 2 %_ptr_Uniform_v4float = OpTypePointer Uniform %v4float %uint_1 = OpConstant %uint 1 %main_out = OpTypeStruct %v4float - %161 = OpTypeFunction %main_out %bool %v4float -%test_int_S1_c0_b = OpFunction %bool None %22 - %24 = OpLabel - %unknown = OpVariable %_ptr_Function_int Function %28 - %ok = OpVariable %_ptr_Function_bool Function %20 - %val = OpVariable %_ptr_Function_v4int Function %34 - %x_40 = OpVariable %_ptr_Function_bool Function %20 - %x_41 = OpVariable %_ptr_Function_bool Function %20 - %x_54 = OpVariable %_ptr_Function_bool Function %20 - %x_55 = OpVariable %_ptr_Function_bool Function %20 - %x_65 = OpVariable %_ptr_Function_bool Function %20 - %x_66 = OpVariable %_ptr_Function_bool Function %20 - %44 = OpAccessChain %_ptr_Uniform_float %x_4 %uint_0 - %45 = OpLoad %float %44 - %46 = OpConvertFToS %int %45 - OpStore %unknown %46 + %162 = OpTypeFunction %main_out %bool %v4float +%test_int_S1_c0_b = OpFunction %bool None %23 + %25 = OpLabel + %unknown = OpVariable %_ptr_Function_int Function %29 + %ok = OpVariable %_ptr_Function_bool Function %21 + %val = OpVariable %_ptr_Function_v4int Function %35 + %x_40 = OpVariable %_ptr_Function_bool Function %21 + %x_41 = OpVariable %_ptr_Function_bool Function %21 + %x_54 = OpVariable %_ptr_Function_bool Function %21 + %x_55 = OpVariable %_ptr_Function_bool Function %21 + %x_65 = OpVariable %_ptr_Function_bool Function %21 + %x_66 = OpVariable %_ptr_Function_bool Function %21 + %45 = OpAccessChain %_ptr_Uniform_float %x_4 %uint_0 %uint_0 + %46 = OpLoad %float %45 + %47 = OpConvertFToS %int %46 + OpStore %unknown %47 OpStore %ok %true - OpStore %x_41 %20 - OpSelectionMerge %48 None - OpBranchConditional %true %49 %48 + OpStore %x_41 %21 + OpSelectionMerge %49 None + OpBranchConditional %true %50 %49 + %50 = OpLabel + %52 = OpCompositeConstruct %v4int %47 %47 %47 %47 + %53 = OpSDiv %v4int %35 %52 + %54 = OpIEqual %v4bool %53 %35 + %51 = OpAll %bool %54 + OpStore %x_40 %51 + %56 = OpLoad %bool %x_40 + OpStore %x_41 %56 + OpBranch %49 %49 = OpLabel - %51 = OpCompositeConstruct %v4int %46 %46 %46 %46 - %52 = OpSDiv %v4int %34 %51 - %53 = OpIEqual %v4bool %52 %34 - %50 = OpAll %bool %53 - OpStore %x_40 %50 - %55 = OpLoad %bool %x_40 - OpStore %x_41 %55 - OpBranch %48 - %48 = OpLabel - %56 = OpLoad %bool %x_41 - OpStore %ok %56 - %57 = OpCompositeConstruct %v4int %46 %46 %46 %46 - OpStore %val %57 - %60 = OpIAdd %v4int %57 %59 - OpStore %val %60 - %61 = OpISub %v4int %60 %59 + %57 = OpLoad %bool %x_41 + OpStore %ok %57 + %58 = OpCompositeConstruct %v4int %47 %47 %47 %47 + OpStore %val %58 + %61 = OpIAdd %v4int %58 %60 OpStore %val %61 - %62 = OpIAdd %v4int %61 %59 + %62 = OpISub %v4int %61 %60 OpStore %val %62 - %63 = OpISub %v4int %62 %59 + %63 = OpIAdd %v4int %62 %60 OpStore %val %63 - OpStore %x_55 %20 - %64 = OpLoad %bool %x_41 - OpSelectionMerge %65 None - OpBranchConditional %64 %66 %65 + %64 = OpISub %v4int %63 %60 + OpStore %val %64 + OpStore %x_55 %21 + %65 = OpLoad %bool %x_41 + OpSelectionMerge %66 None + OpBranchConditional %65 %67 %66 + %67 = OpLabel + %69 = OpIEqual %v4bool %64 %58 + %68 = OpAll %bool %69 + OpStore %x_54 %68 + %70 = OpLoad %bool %x_54 + OpStore %x_55 %70 + OpBranch %66 %66 = OpLabel - %68 = OpIEqual %v4bool %63 %57 - %67 = OpAll %bool %68 - OpStore %x_54 %67 - %69 = OpLoad %bool %x_54 - OpStore %x_55 %69 - OpBranch %65 - %65 = OpLabel - %70 = OpLoad %bool %x_55 - OpStore %ok %70 - %73 = OpIMul %v4int %63 %72 - OpStore %val %73 - %74 = OpSDiv %v4int %73 %72 + %71 = OpLoad %bool %x_55 + OpStore %ok %71 + %74 = OpIMul %v4int %64 %73 OpStore %val %74 - %75 = OpIMul %v4int %74 %72 + %75 = OpSDiv %v4int %74 %73 OpStore %val %75 - %76 = OpSDiv %v4int %75 %72 + %76 = OpIMul %v4int %75 %73 OpStore %val %76 - OpStore %x_66 %20 - %77 = OpLoad %bool %x_55 - OpSelectionMerge %78 None - OpBranchConditional %77 %79 %78 + %77 = OpSDiv %v4int %76 %73 + OpStore %val %77 + OpStore %x_66 %21 + %78 = OpLoad %bool %x_55 + OpSelectionMerge %79 None + OpBranchConditional %78 %80 %79 + %80 = OpLabel + %82 = OpIEqual %v4bool %77 %58 + %81 = OpAll %bool %82 + OpStore %x_65 %81 + %83 = OpLoad %bool %x_65 + OpStore %x_66 %83 + OpBranch %79 %79 = OpLabel - %81 = OpIEqual %v4bool %76 %57 - %80 = OpAll %bool %81 - OpStore %x_65 %80 - %82 = OpLoad %bool %x_65 - OpStore %x_66 %82 - OpBranch %78 - %78 = OpLabel - %83 = OpLoad %bool %x_66 - OpStore %ok %83 %84 = OpLoad %bool %x_66 - OpReturnValue %84 + OpStore %ok %84 + %85 = OpLoad %bool %x_66 + OpReturnValue %85 OpFunctionEnd - %main_1 = OpFunction %void None %85 - %88 = OpLabel + %main_1 = OpFunction %void None %86 + %89 = OpLabel %outputColor_S0 = OpVariable %_ptr_Function_v4float Function %10 %output_S1 = OpVariable %_ptr_Function_v4float Function %10 -%x_8_unknown = OpVariable %_ptr_Function_float Function %94 - %x_9_ok = OpVariable %_ptr_Function_bool Function %20 +%x_8_unknown = OpVariable %_ptr_Function_float Function %95 + %x_9_ok = OpVariable %_ptr_Function_bool Function %21 %x_10_val = OpVariable %_ptr_Function_v4float Function %10 %x_116 = OpVariable %_ptr_Function_v4float Function %10 - %x_86 = OpVariable %_ptr_Function_bool Function %20 - %x_87 = OpVariable %_ptr_Function_bool Function %20 - %x_99 = OpVariable %_ptr_Function_bool Function %20 - %x_100 = OpVariable %_ptr_Function_bool Function %20 - %x_110 = OpVariable %_ptr_Function_bool Function %20 - %x_111 = OpVariable %_ptr_Function_bool Function %20 - %x_114 = OpVariable %_ptr_Function_bool Function %20 - %x_115 = OpVariable %_ptr_Function_bool Function %20 - %106 = OpLoad %v4float %vcolor_S0 - OpStore %outputColor_S0 %106 - %107 = OpAccessChain %_ptr_Uniform_float %x_4 %uint_0 - %108 = OpLoad %float %107 - OpStore %x_8_unknown %108 + %x_86 = OpVariable %_ptr_Function_bool Function %21 + %x_87 = OpVariable %_ptr_Function_bool Function %21 + %x_99 = OpVariable %_ptr_Function_bool Function %21 + %x_100 = OpVariable %_ptr_Function_bool Function %21 + %x_110 = OpVariable %_ptr_Function_bool Function %21 + %x_111 = OpVariable %_ptr_Function_bool Function %21 + %x_114 = OpVariable %_ptr_Function_bool Function %21 + %x_115 = OpVariable %_ptr_Function_bool Function %21 + %107 = OpLoad %v4float %vcolor_S0 + OpStore %outputColor_S0 %107 + %108 = OpAccessChain %_ptr_Uniform_float %x_4 %uint_0 %uint_0 + %109 = OpLoad %float %108 + OpStore %x_8_unknown %109 OpStore %x_9_ok %true - OpStore %x_87 %20 - OpSelectionMerge %109 None - OpBranchConditional %true %110 %109 + OpStore %x_87 %21 + OpSelectionMerge %110 None + OpBranchConditional %true %111 %110 + %111 = OpLabel + %113 = OpCompositeConstruct %v4float %109 %109 %109 %109 + %114 = OpFDiv %v4float %10 %113 + %115 = OpFOrdEqual %v4bool %114 %10 + %112 = OpAll %bool %115 + OpStore %x_86 %112 + %116 = OpLoad %bool %x_86 + OpStore %x_87 %116 + OpBranch %110 %110 = OpLabel - %112 = OpCompositeConstruct %v4float %108 %108 %108 %108 - %113 = OpFDiv %v4float %10 %112 - %114 = OpFOrdEqual %v4bool %113 %10 - %111 = OpAll %bool %114 - OpStore %x_86 %111 - %115 = OpLoad %bool %x_86 - OpStore %x_87 %115 - OpBranch %109 - %109 = OpLabel - %116 = OpLoad %bool %x_87 - OpStore %x_9_ok %116 - %117 = OpCompositeConstruct %v4float %108 %108 %108 %108 - OpStore %x_10_val %117 - %120 = OpFAdd %v4float %117 %119 - OpStore %x_10_val %120 - %121 = OpFSub %v4float %120 %119 + %117 = OpLoad %bool %x_87 + OpStore %x_9_ok %117 + %118 = OpCompositeConstruct %v4float %109 %109 %109 %109 + OpStore %x_10_val %118 + %121 = OpFAdd %v4float %118 %120 OpStore %x_10_val %121 - %122 = OpFAdd %v4float %121 %119 + %122 = OpFSub %v4float %121 %120 OpStore %x_10_val %122 - %123 = OpFSub %v4float %122 %119 + %123 = OpFAdd %v4float %122 %120 OpStore %x_10_val %123 - OpStore %x_100 %20 - %124 = OpLoad %bool %x_87 - OpSelectionMerge %125 None - OpBranchConditional %124 %126 %125 + %124 = OpFSub %v4float %123 %120 + OpStore %x_10_val %124 + OpStore %x_100 %21 + %125 = OpLoad %bool %x_87 + OpSelectionMerge %126 None + OpBranchConditional %125 %127 %126 + %127 = OpLabel + %129 = OpFOrdEqual %v4bool %124 %118 + %128 = OpAll %bool %129 + OpStore %x_99 %128 + %130 = OpLoad %bool %x_99 + OpStore %x_100 %130 + OpBranch %126 %126 = OpLabel - %128 = OpFOrdEqual %v4bool %123 %117 - %127 = OpAll %bool %128 - OpStore %x_99 %127 - %129 = OpLoad %bool %x_99 - OpStore %x_100 %129 - OpBranch %125 - %125 = OpLabel - %130 = OpLoad %bool %x_100 - OpStore %x_9_ok %130 - %133 = OpFMul %v4float %123 %132 - OpStore %x_10_val %133 - %134 = OpFDiv %v4float %133 %132 + %131 = OpLoad %bool %x_100 + OpStore %x_9_ok %131 + %134 = OpFMul %v4float %124 %133 OpStore %x_10_val %134 - %135 = OpFMul %v4float %134 %132 + %135 = OpFDiv %v4float %134 %133 OpStore %x_10_val %135 - %136 = OpFDiv %v4float %135 %132 + %136 = OpFMul %v4float %135 %133 OpStore %x_10_val %136 - OpStore %x_111 %20 - %137 = OpLoad %bool %x_100 - OpSelectionMerge %138 None - OpBranchConditional %137 %139 %138 + %137 = OpFDiv %v4float %136 %133 + OpStore %x_10_val %137 + OpStore %x_111 %21 + %138 = OpLoad %bool %x_100 + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %139 + %140 = OpLabel + %142 = OpFOrdEqual %v4bool %137 %118 + %141 = OpAll %bool %142 + OpStore %x_110 %141 + %143 = OpLoad %bool %x_110 + OpStore %x_111 %143 + OpBranch %139 %139 = OpLabel - %141 = OpFOrdEqual %v4bool %136 %117 - %140 = OpAll %bool %141 - OpStore %x_110 %140 - %142 = OpLoad %bool %x_110 - OpStore %x_111 %142 - OpBranch %138 - %138 = OpLabel - %143 = OpLoad %bool %x_111 - OpStore %x_9_ok %143 - OpStore %x_115 %20 %144 = OpLoad %bool %x_111 - OpSelectionMerge %145 None - OpBranchConditional %144 %146 %145 + OpStore %x_9_ok %144 + OpStore %x_115 %21 + %145 = OpLoad %bool %x_111 + OpSelectionMerge %146 None + OpBranchConditional %145 %147 %146 + %147 = OpLabel + %148 = OpFunctionCall %bool %test_int_S1_c0_b + OpStore %x_114 %148 + %149 = OpLoad %bool %x_114 + OpStore %x_115 %149 + OpBranch %146 %146 = OpLabel - %147 = OpFunctionCall %bool %test_int_S1_c0_b - OpStore %x_114 %147 - %148 = OpLoad %bool %x_114 - OpStore %x_115 %148 - OpBranch %145 - %145 = OpLabel - %149 = OpLoad %bool %x_115 - OpSelectionMerge %150 None - OpBranchConditional %149 %151 %152 - %151 = OpLabel - %155 = OpAccessChain %_ptr_Uniform_v4float %x_4 %uint_2 - %156 = OpLoad %v4float %155 - OpStore %x_116 %156 - OpBranch %150 + %150 = OpLoad %bool %x_115 + OpSelectionMerge %151 None + OpBranchConditional %150 %152 %153 %152 = OpLabel - %158 = OpAccessChain %_ptr_Uniform_v4float %x_4 %uint_1 - %159 = OpLoad %v4float %158 - OpStore %x_116 %159 - OpBranch %150 - %150 = OpLabel - %160 = OpLoad %v4float %x_116 - OpStore %output_S1 %160 - OpStore %sk_FragColor %160 + %156 = OpAccessChain %_ptr_Uniform_v4float %x_4 %uint_0 %uint_2 + %157 = OpLoad %v4float %156 + OpStore %x_116 %157 + OpBranch %151 + %153 = OpLabel + %159 = OpAccessChain %_ptr_Uniform_v4float %x_4 %uint_0 %uint_1 + %160 = OpLoad %v4float %159 + OpStore %x_116 %160 + OpBranch %151 + %151 = OpLabel + %161 = OpLoad %v4float %x_116 + OpStore %output_S1 %161 + OpStore %sk_FragColor %161 OpReturn OpFunctionEnd - %main_inner = OpFunction %main_out None %161 + %main_inner = OpFunction %main_out None %162 %sk_Clockwise_param = OpFunctionParameter %bool %vcolor_S0_param = OpFunctionParameter %v4float - %166 = OpLabel + %167 = OpLabel OpStore %sk_Clockwise %sk_Clockwise_param OpStore %vcolor_S0 %vcolor_S0_param - %167 = OpFunctionCall %void %main_1 - %168 = OpLoad %v4float %sk_FragColor - %169 = OpCompositeConstruct %main_out %168 - OpReturnValue %169 + %168 = OpFunctionCall %void %main_1 + %169 = OpLoad %v4float %sk_FragColor + %170 = OpCompositeConstruct %main_out %169 + OpReturnValue %170 OpFunctionEnd - %main = OpFunction %void None %85 - %171 = OpLabel - %173 = OpLoad %bool %sk_Clockwise_param_1 - %174 = OpLoad %v4float %vcolor_S0_param_1 - %172 = OpFunctionCall %main_out %main_inner %173 %174 - %175 = OpCompositeExtract %v4float %172 0 - OpStore %sk_FragColor_1_1 %175 + %main = OpFunction %void None %86 + %172 = OpLabel + %174 = OpLoad %bool %sk_Clockwise_param_1 + %175 = OpLoad %v4float %vcolor_S0_param_1 + %173 = OpFunctionCall %main_out %main_inner %174 %175 + %176 = OpCompositeExtract %v4float %173 0 + OpStore %sk_FragColor_1_1 %176 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/1534.wgsl.expected.glsl b/test/tint/bug/tint/1534.wgsl.expected.glsl index d7e5d452b5..e9d0e432a9 100644 --- a/test/tint/bug/tint/1534.wgsl.expected.glsl +++ b/test/tint/bug/tint/1534.wgsl.expected.glsl @@ -4,18 +4,26 @@ uint tint_int_dot(uvec3 a, uvec3 b) { return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; } -layout(binding = 0, std140) uniform g_ubo { +struct g { uvec3 a; uint pad; +}; + +struct h { + uint a; +}; + +layout(binding = 0, std140) uniform i_block_ubo { + g inner; } i; -layout(binding = 1, std430) buffer h_ssbo { - uint a; +layout(binding = 1, std430) buffer j_block_ssbo { + h inner; } j; void tint_symbol() { - uint l = tint_int_dot(i.a, i.a); - j.a = i.a.x; + uint l = tint_int_dot(i.inner.a, i.inner.a); + j.inner.a = i.inner.a.x; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/tint/1534.wgsl.expected.spvasm b/test/tint/bug/tint/1534.wgsl.expected.spvasm index 0f4a0d5ca0..a2baeb847d 100644 --- a/test/tint/bug/tint/1534.wgsl.expected.spvasm +++ b/test/tint/bug/tint/1534.wgsl.expected.spvasm @@ -1,62 +1,70 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 35 +; Bound: 37 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %i_block "i_block" + OpMemberName %i_block 0 "inner" OpName %g "g" OpMemberName %g 0 "a" OpName %i "i" + OpName %j_block "j_block" + OpMemberName %j_block 0 "inner" OpName %h "h" OpMemberName %h 0 "a" OpName %j "j" OpName %main "main" - OpDecorate %g Block + OpDecorate %i_block Block + OpMemberDecorate %i_block 0 Offset 0 OpMemberDecorate %g 0 Offset 0 OpDecorate %i NonWritable OpDecorate %i DescriptorSet 0 OpDecorate %i Binding 0 - OpDecorate %h Block + OpDecorate %j_block Block + OpMemberDecorate %j_block 0 Offset 0 OpMemberDecorate %h 0 Offset 0 OpDecorate %j DescriptorSet 0 OpDecorate %j Binding 1 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %g = OpTypeStruct %v3uint -%_ptr_Uniform_g = OpTypePointer Uniform %g - %i = OpVariable %_ptr_Uniform_g Uniform + %i_block = OpTypeStruct %g +%_ptr_Uniform_i_block = OpTypePointer Uniform %i_block + %i = OpVariable %_ptr_Uniform_i_block Uniform %h = OpTypeStruct %uint -%_ptr_StorageBuffer_h = OpTypePointer StorageBuffer %h - %j = OpVariable %_ptr_StorageBuffer_h StorageBuffer + %j_block = OpTypeStruct %h +%_ptr_StorageBuffer_j_block = OpTypePointer StorageBuffer %j_block + %j = OpVariable %_ptr_StorageBuffer_j_block StorageBuffer %void = OpTypeVoid - %9 = OpTypeFunction %void + %11 = OpTypeFunction %void %uint_0 = OpConstant %uint 0 %_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %_ptr_Uniform_uint = OpTypePointer Uniform %uint - %main = OpFunction %void None %9 - %12 = OpLabel - %16 = OpAccessChain %_ptr_Uniform_v3uint %i %uint_0 - %17 = OpLoad %v3uint %16 - %18 = OpAccessChain %_ptr_Uniform_v3uint %i %uint_0 + %main = OpFunction %void None %11 + %14 = OpLabel + %18 = OpAccessChain %_ptr_Uniform_v3uint %i %uint_0 %uint_0 %19 = OpLoad %v3uint %18 - %20 = OpCompositeExtract %uint %17 0 - %21 = OpCompositeExtract %uint %19 0 - %22 = OpIMul %uint %20 %21 - %23 = OpCompositeExtract %uint %17 1 - %24 = OpCompositeExtract %uint %19 1 - %25 = OpIMul %uint %23 %24 - %26 = OpIAdd %uint %22 %25 - %27 = OpCompositeExtract %uint %17 2 - %28 = OpCompositeExtract %uint %19 2 - %29 = OpIMul %uint %27 %28 - %13 = OpIAdd %uint %26 %29 - %31 = OpAccessChain %_ptr_StorageBuffer_uint %j %uint_0 - %33 = OpAccessChain %_ptr_Uniform_uint %i %uint_0 %uint_0 - %34 = OpLoad %uint %33 - OpStore %31 %34 + %20 = OpAccessChain %_ptr_Uniform_v3uint %i %uint_0 %uint_0 + %21 = OpLoad %v3uint %20 + %22 = OpCompositeExtract %uint %19 0 + %23 = OpCompositeExtract %uint %21 0 + %24 = OpIMul %uint %22 %23 + %25 = OpCompositeExtract %uint %19 1 + %26 = OpCompositeExtract %uint %21 1 + %27 = OpIMul %uint %25 %26 + %28 = OpIAdd %uint %24 %27 + %29 = OpCompositeExtract %uint %19 2 + %30 = OpCompositeExtract %uint %21 2 + %31 = OpIMul %uint %29 %30 + %15 = OpIAdd %uint %28 %31 + %33 = OpAccessChain %_ptr_StorageBuffer_uint %j %uint_0 %uint_0 + %35 = OpAccessChain %_ptr_Uniform_uint %i %uint_0 %uint_0 %uint_0 + %36 = OpLoad %uint %35 + OpStore %33 %36 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/1542.wgsl.expected.glsl b/test/tint/bug/tint/1542.wgsl.expected.glsl index f49dc3bb48..20288af872 100644 --- a/test/tint/bug/tint/1542.wgsl.expected.glsl +++ b/test/tint/bug/tint/1542.wgsl.expected.glsl @@ -1,12 +1,16 @@ #version 310 es -layout(binding = 0, std140) uniform UniformBuffer_ubo { +struct UniformBuffer { ivec3 d; uint pad; +}; + +layout(binding = 0, std140) uniform u_input_block_ubo { + UniformBuffer inner; } u_input; void tint_symbol() { - ivec3 temp = (u_input.d << uvec3(0u)); + ivec3 temp = (u_input.inner.d << uvec3(0u)); } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/tint/1542.wgsl.expected.spvasm b/test/tint/bug/tint/1542.wgsl.expected.spvasm index a66b08a55b..5efd79affb 100644 --- a/test/tint/bug/tint/1542.wgsl.expected.spvasm +++ b/test/tint/bug/tint/1542.wgsl.expected.spvasm @@ -1,17 +1,20 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 18 +; Bound: 19 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %u_input_block "u_input_block" + OpMemberName %u_input_block 0 "inner" OpName %UniformBuffer "UniformBuffer" OpMemberName %UniformBuffer 0 "d" OpName %u_input "u_input" OpName %main "main" - OpDecorate %UniformBuffer Block + OpDecorate %u_input_block Block + OpMemberDecorate %u_input_block 0 Offset 0 OpMemberDecorate %UniformBuffer 0 Offset 0 OpDecorate %u_input NonWritable OpDecorate %u_input DescriptorSet 0 @@ -19,19 +22,20 @@ %int = OpTypeInt 32 1 %v3int = OpTypeVector %int 3 %UniformBuffer = OpTypeStruct %v3int -%_ptr_Uniform_UniformBuffer = OpTypePointer Uniform %UniformBuffer - %u_input = OpVariable %_ptr_Uniform_UniformBuffer Uniform +%u_input_block = OpTypeStruct %UniformBuffer +%_ptr_Uniform_u_input_block = OpTypePointer Uniform %u_input_block + %u_input = OpVariable %_ptr_Uniform_u_input_block Uniform %void = OpTypeVoid - %6 = OpTypeFunction %void + %7 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_Uniform_v3int = OpTypePointer Uniform %v3int %v3uint = OpTypeVector %uint 3 - %16 = OpConstantNull %v3uint - %main = OpFunction %void None %6 - %9 = OpLabel - %13 = OpAccessChain %_ptr_Uniform_v3int %u_input %uint_0 - %14 = OpLoad %v3int %13 - %17 = OpShiftLeftLogical %v3int %14 %16 + %17 = OpConstantNull %v3uint + %main = OpFunction %void None %7 + %10 = OpLabel + %14 = OpAccessChain %_ptr_Uniform_v3int %u_input %uint_0 %uint_0 + %15 = OpLoad %v3int %14 + %18 = OpShiftLeftLogical %v3int %15 %17 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/1677.wgsl.expected.glsl b/test/tint/bug/tint/1677.wgsl.expected.glsl index eacf548c60..c37934f1db 100644 --- a/test/tint/bug/tint/1677.wgsl.expected.glsl +++ b/test/tint/bug/tint/1677.wgsl.expected.glsl @@ -1,12 +1,16 @@ #version 310 es -layout(binding = 0, std430) buffer Input_ssbo { +struct Input { ivec3 position; uint pad; +}; + +layout(binding = 0, std430) buffer tint_symbol_block_ssbo { + Input inner; } tint_symbol; void tint_symbol_1(uvec3 id) { - ivec3 pos = (tint_symbol.position - ivec3(0)); + ivec3 pos = (tint_symbol.inner.position - ivec3(0)); } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/tint/1677.wgsl.expected.spvasm b/test/tint/bug/tint/1677.wgsl.expected.spvasm index bb88ae5bcd..7ae6012fee 100644 --- a/test/tint/bug/tint/1677.wgsl.expected.spvasm +++ b/test/tint/bug/tint/1677.wgsl.expected.spvasm @@ -1,13 +1,15 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 26 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" %id_1 OpExecutionMode %main LocalSize 1 1 1 OpName %id_1 "id_1" + OpName %input_block "input_block" + OpMemberName %input_block 0 "inner" OpName %Input "Input" OpMemberName %Input 0 "position" OpName %input "input" @@ -15,7 +17,8 @@ OpName %id "id" OpName %main "main" OpDecorate %id_1 BuiltIn GlobalInvocationId - OpDecorate %Input Block + OpDecorate %input_block Block + OpMemberDecorate %input_block 0 Offset 0 OpMemberDecorate %Input 0 Offset 0 OpDecorate %input NonWritable OpDecorate %input DescriptorSet 0 @@ -27,25 +30,26 @@ %int = OpTypeInt 32 1 %v3int = OpTypeVector %int 3 %Input = OpTypeStruct %v3int -%_ptr_StorageBuffer_Input = OpTypePointer StorageBuffer %Input - %input = OpVariable %_ptr_StorageBuffer_Input StorageBuffer +%input_block = OpTypeStruct %Input +%_ptr_StorageBuffer_input_block = OpTypePointer StorageBuffer %input_block + %input = OpVariable %_ptr_StorageBuffer_input_block StorageBuffer %void = OpTypeVoid - %10 = OpTypeFunction %void %v3uint + %11 = OpTypeFunction %void %v3uint %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v3int = OpTypePointer StorageBuffer %v3int - %19 = OpConstantNull %v3int - %21 = OpTypeFunction %void - %main_inner = OpFunction %void None %10 + %20 = OpConstantNull %v3int + %22 = OpTypeFunction %void + %main_inner = OpFunction %void None %11 %id = OpFunctionParameter %v3uint - %14 = OpLabel - %17 = OpAccessChain %_ptr_StorageBuffer_v3int %input %uint_0 - %18 = OpLoad %v3int %17 - %20 = OpISub %v3int %18 %19 + %15 = OpLabel + %18 = OpAccessChain %_ptr_StorageBuffer_v3int %input %uint_0 %uint_0 + %19 = OpLoad %v3int %18 + %21 = OpISub %v3int %19 %20 OpReturn OpFunctionEnd - %main = OpFunction %void None %21 - %23 = OpLabel - %25 = OpLoad %v3uint %id_1 - %24 = OpFunctionCall %void %main_inner %25 + %main = OpFunction %void None %22 + %24 = OpLabel + %26 = OpLoad %v3uint %id_1 + %25 = OpFunctionCall %void %main_inner %26 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/1735.wgsl b/test/tint/bug/tint/1735.wgsl new file mode 100644 index 0000000000..e0b647ed8d --- /dev/null +++ b/test/tint/bug/tint/1735.wgsl @@ -0,0 +1,14 @@ +struct S { + f : f32, +}; + +@group(0) @binding(0) +var in : S; + +@group(0) @binding(1) +var out : S; + +@compute @workgroup_size(1) +fn main() { + out = in; +} diff --git a/test/tint/bug/tint/1735.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/1735.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..084353983b --- /dev/null +++ b/test/tint/bug/tint/1735.wgsl.expected.dxc.hlsl @@ -0,0 +1,21 @@ +struct S { + float f; +}; + +ByteAddressBuffer tint_symbol : register(t0, space0); +RWByteAddressBuffer tint_symbol_1 : register(u1, space0); + +void tint_symbol_2(RWByteAddressBuffer buffer, uint offset, S value) { + buffer.Store((offset + 0u), asuint(value.f)); +} + +S tint_symbol_4(ByteAddressBuffer buffer, uint offset) { + const S tint_symbol_6 = {asfloat(buffer.Load((offset + 0u)))}; + return tint_symbol_6; +} + +[numthreads(1, 1, 1)] +void main() { + tint_symbol_2(tint_symbol_1, 0u, tint_symbol_4(tint_symbol, 0u)); + return; +} diff --git a/test/tint/bug/tint/1735.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1735.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..084353983b --- /dev/null +++ b/test/tint/bug/tint/1735.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +struct S { + float f; +}; + +ByteAddressBuffer tint_symbol : register(t0, space0); +RWByteAddressBuffer tint_symbol_1 : register(u1, space0); + +void tint_symbol_2(RWByteAddressBuffer buffer, uint offset, S value) { + buffer.Store((offset + 0u), asuint(value.f)); +} + +S tint_symbol_4(ByteAddressBuffer buffer, uint offset) { + const S tint_symbol_6 = {asfloat(buffer.Load((offset + 0u)))}; + return tint_symbol_6; +} + +[numthreads(1, 1, 1)] +void main() { + tint_symbol_2(tint_symbol_1, 0u, tint_symbol_4(tint_symbol, 0u)); + return; +} diff --git a/test/tint/bug/tint/1735.wgsl.expected.glsl b/test/tint/bug/tint/1735.wgsl.expected.glsl new file mode 100644 index 0000000000..0dfde92cd0 --- /dev/null +++ b/test/tint/bug/tint/1735.wgsl.expected.glsl @@ -0,0 +1,23 @@ +#version 310 es + +struct S { + float f; +}; + +layout(binding = 0, std430) buffer tint_symbol_block_ssbo { + S inner; +} tint_symbol; + +layout(binding = 1, std430) buffer tint_symbol_block_ssbo_1 { + S inner; +} tint_symbol_1; + +void tint_symbol_2() { + tint_symbol_1.inner = tint_symbol.inner; +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + tint_symbol_2(); + return; +} diff --git a/test/tint/bug/tint/1735.wgsl.expected.msl b/test/tint/bug/tint/1735.wgsl.expected.msl new file mode 100644 index 0000000000..1128aa79ef --- /dev/null +++ b/test/tint/bug/tint/1735.wgsl.expected.msl @@ -0,0 +1,12 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ float f; +}; + +kernel void tint_symbol(device S* tint_symbol_1 [[buffer(0)]], const device S* tint_symbol_2 [[buffer(1)]]) { + *(tint_symbol_1) = *(tint_symbol_2); + return; +} + diff --git a/test/tint/bug/tint/1735.wgsl.expected.spvasm b/test/tint/bug/tint/1735.wgsl.expected.spvasm new file mode 100644 index 0000000000..e513e17daf --- /dev/null +++ b/test/tint/bug/tint/1735.wgsl.expected.spvasm @@ -0,0 +1,43 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %in_block "in_block" + OpMemberName %in_block 0 "inner" + OpName %S "S" + OpMemberName %S 0 "f" + OpName %in "in" + OpName %out "out" + OpName %main "main" + OpDecorate %in_block Block + OpMemberDecorate %in_block 0 Offset 0 + OpMemberDecorate %S 0 Offset 0 + OpDecorate %in NonWritable + OpDecorate %in DescriptorSet 0 + OpDecorate %in Binding 0 + OpDecorate %out DescriptorSet 0 + OpDecorate %out Binding 1 + %float = OpTypeFloat 32 + %S = OpTypeStruct %float + %in_block = OpTypeStruct %S +%_ptr_StorageBuffer_in_block = OpTypePointer StorageBuffer %in_block + %in = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer + %out = OpVariable %_ptr_StorageBuffer_in_block StorageBuffer + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %main = OpFunction %void None %7 + %10 = OpLabel + %14 = OpAccessChain %_ptr_StorageBuffer_S %out %uint_0 + %15 = OpAccessChain %_ptr_StorageBuffer_S %in %uint_0 + %16 = OpLoad %S %15 + OpStore %14 %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/bug/tint/1735.wgsl.expected.wgsl b/test/tint/bug/tint/1735.wgsl.expected.wgsl new file mode 100644 index 0000000000..a18731c8d6 --- /dev/null +++ b/test/tint/bug/tint/1735.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +struct S { + f : f32, +} + +@group(0) @binding(0) var in : S; + +@group(0) @binding(1) var out : S; + +@compute @workgroup_size(1) +fn main() { + out = in; +} diff --git a/test/tint/bug/tint/221.wgsl.expected.glsl b/test/tint/bug/tint/221.wgsl.expected.glsl index 65779b74ac..f00f6e238c 100644 --- a/test/tint/bug/tint/221.wgsl.expected.glsl +++ b/test/tint/bug/tint/221.wgsl.expected.glsl @@ -1,27 +1,31 @@ #version 310 es -layout(binding = 0, std430) buffer Buf_ssbo { +struct Buf { uint count; uint data[50]; +}; + +layout(binding = 0, std430) buffer b_block_ssbo { + Buf inner; } b; void tint_symbol() { uint i = 0u; while (true) { - if ((i >= b.count)) { + if ((i >= b.inner.count)) { break; } uint p_save = i; if (((i % 2u) == 0u)) { { - b.data[p_save] = (b.data[p_save] * 2u); + b.inner.data[p_save] = (b.inner.data[p_save] * 2u); i = (i + 1u); } continue; } - b.data[p_save] = 0u; + b.inner.data[p_save] = 0u; { - b.data[p_save] = (b.data[p_save] * 2u); + b.inner.data[p_save] = (b.inner.data[p_save] * 2u); i = (i + 1u); } } diff --git a/test/tint/bug/tint/221.wgsl.expected.spvasm b/test/tint/bug/tint/221.wgsl.expected.spvasm index 486cb6af88..45ee7a76ea 100644 --- a/test/tint/bug/tint/221.wgsl.expected.spvasm +++ b/test/tint/bug/tint/221.wgsl.expected.spvasm @@ -1,19 +1,22 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 42 +; Bound: 43 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %b_block "b_block" + OpMemberName %b_block 0 "inner" OpName %Buf "Buf" OpMemberName %Buf 0 "count" OpMemberName %Buf 1 "data" OpName %b "b" OpName %main "main" OpName %i "i" - OpDecorate %Buf Block + OpDecorate %b_block Block + OpMemberDecorate %b_block 0 Offset 0 OpMemberDecorate %Buf 0 Offset 0 OpMemberDecorate %Buf 1 Offset 4 OpDecorate %_arr_uint_uint_50 ArrayStride 4 @@ -23,57 +26,58 @@ %uint_50 = OpConstant %uint 50 %_arr_uint_uint_50 = OpTypeArray %uint %uint_50 %Buf = OpTypeStruct %uint %_arr_uint_uint_50 -%_ptr_StorageBuffer_Buf = OpTypePointer StorageBuffer %Buf - %b = OpVariable %_ptr_StorageBuffer_Buf StorageBuffer + %b_block = OpTypeStruct %Buf +%_ptr_StorageBuffer_b_block = OpTypePointer StorageBuffer %b_block + %b = OpVariable %_ptr_StorageBuffer_b_block StorageBuffer %void = OpTypeVoid - %7 = OpTypeFunction %void - %11 = OpConstantNull %uint + %8 = OpTypeFunction %void + %12 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %bool = OpTypeBool %uint_2 = OpConstant %uint 2 %uint_1 = OpConstant %uint 1 - %main = OpFunction %void None %7 - %10 = OpLabel - %i = OpVariable %_ptr_Function_uint Function %11 - OpStore %i %11 - OpBranch %14 - %14 = OpLabel - OpLoopMerge %15 %16 None + %main = OpFunction %void None %8 + %11 = OpLabel + %i = OpVariable %_ptr_Function_uint Function %12 + OpStore %i %12 + OpBranch %15 + %15 = OpLabel + OpLoopMerge %16 %17 None + OpBranch %18 + %18 = OpLabel + %19 = OpLoad %uint %i + %22 = OpAccessChain %_ptr_StorageBuffer_uint %b %uint_0 %uint_0 + %23 = OpLoad %uint %22 + %24 = OpUGreaterThanEqual %bool %19 %23 + OpSelectionMerge %26 None + OpBranchConditional %24 %27 %26 + %27 = OpLabel + OpBranch %16 + %26 = OpLabel + %28 = OpLoad %uint %i + %29 = OpLoad %uint %i + %31 = OpUMod %uint %29 %uint_2 + %32 = OpIEqual %bool %31 %12 + OpSelectionMerge %33 None + OpBranchConditional %32 %34 %33 + %34 = OpLabel + OpBranch %17 + %33 = OpLabel + %36 = OpAccessChain %_ptr_StorageBuffer_uint %b %uint_0 %uint_1 %28 + OpStore %36 %12 OpBranch %17 %17 = OpLabel - %18 = OpLoad %uint %i - %21 = OpAccessChain %_ptr_StorageBuffer_uint %b %uint_0 - %22 = OpLoad %uint %21 - %23 = OpUGreaterThanEqual %bool %18 %22 - OpSelectionMerge %25 None - OpBranchConditional %23 %26 %25 - %26 = OpLabel + %37 = OpAccessChain %_ptr_StorageBuffer_uint %b %uint_0 %uint_1 %28 + %38 = OpAccessChain %_ptr_StorageBuffer_uint %b %uint_0 %uint_1 %28 + %39 = OpLoad %uint %38 + %40 = OpIMul %uint %39 %uint_2 + OpStore %37 %40 + %41 = OpLoad %uint %i + %42 = OpIAdd %uint %41 %uint_1 + OpStore %i %42 OpBranch %15 - %25 = OpLabel - %27 = OpLoad %uint %i - %28 = OpLoad %uint %i - %30 = OpUMod %uint %28 %uint_2 - %31 = OpIEqual %bool %30 %11 - OpSelectionMerge %32 None - OpBranchConditional %31 %33 %32 - %33 = OpLabel - OpBranch %16 - %32 = OpLabel - %35 = OpAccessChain %_ptr_StorageBuffer_uint %b %uint_1 %27 - OpStore %35 %11 - OpBranch %16 %16 = OpLabel - %36 = OpAccessChain %_ptr_StorageBuffer_uint %b %uint_1 %27 - %37 = OpAccessChain %_ptr_StorageBuffer_uint %b %uint_1 %27 - %38 = OpLoad %uint %37 - %39 = OpIMul %uint %38 %uint_2 - OpStore %36 %39 - %40 = OpLoad %uint %i - %41 = OpIAdd %uint %40 %uint_1 - OpStore %i %41 - OpBranch %14 - %15 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/369.wgsl.expected.glsl b/test/tint/bug/tint/369.wgsl.expected.glsl index 8fa9069bf5..0c45f0f887 100644 --- a/test/tint/bug/tint/369.wgsl.expected.glsl +++ b/test/tint/bug/tint/369.wgsl.expected.glsl @@ -4,12 +4,20 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { mat2 m; -} SSBO; +}; -layout(binding = 0, std140) uniform S_std140_ubo { +struct S_std140 { vec2 m_0; vec2 m_1; +}; + +layout(binding = 0, std430) buffer SSBO_block_ssbo { + S inner; +} SSBO; + +layout(binding = 0, std140) uniform SSBO_block_std140_ubo { + S_std140 inner; } UBO; diff --git a/test/tint/bug/tint/369.wgsl.expected.spvasm b/test/tint/bug/tint/369.wgsl.expected.spvasm index 678e86ab1a..e62c873aa5 100644 --- a/test/tint/bug/tint/369.wgsl.expected.spvasm +++ b/test/tint/bug/tint/369.wgsl.expected.spvasm @@ -1,28 +1,34 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 14 +; Bound: 16 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %SSBO_block "SSBO_block" + OpMemberName %SSBO_block 0 "inner" OpName %S "S" OpMemberName %S 0 "m" OpName %SSBO "SSBO" + OpName %SSBO_block_std140 "SSBO_block_std140" + OpMemberName %SSBO_block_std140 0 "inner" OpName %S_std140 "S_std140" OpMemberName %S_std140 0 "m_0" OpMemberName %S_std140 1 "m_1" OpName %UBO "UBO" OpName %unused_entry_point "unused_entry_point" - OpDecorate %S Block + OpDecorate %SSBO_block Block + OpMemberDecorate %SSBO_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpMemberDecorate %S 0 ColMajor OpMemberDecorate %S 0 MatrixStride 8 OpDecorate %SSBO NonWritable OpDecorate %SSBO DescriptorSet 0 OpDecorate %SSBO Binding 0 - OpDecorate %S_std140 Block + OpDecorate %SSBO_block_std140 Block + OpMemberDecorate %SSBO_block_std140 0 Offset 0 OpMemberDecorate %S_std140 0 Offset 0 OpMemberDecorate %S_std140 1 Offset 8 OpDecorate %UBO NonWritable @@ -32,14 +38,16 @@ %v2float = OpTypeVector %float 2 %mat2v2float = OpTypeMatrix %v2float 2 %S = OpTypeStruct %mat2v2float -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %SSBO = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %SSBO_block = OpTypeStruct %S +%_ptr_StorageBuffer_SSBO_block = OpTypePointer StorageBuffer %SSBO_block + %SSBO = OpVariable %_ptr_StorageBuffer_SSBO_block StorageBuffer %S_std140 = OpTypeStruct %v2float %v2float -%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140 - %UBO = OpVariable %_ptr_Uniform_S_std140 Uniform +%SSBO_block_std140 = OpTypeStruct %S_std140 +%_ptr_Uniform_SSBO_block_std140 = OpTypePointer Uniform %SSBO_block_std140 + %UBO = OpVariable %_ptr_Uniform_SSBO_block_std140 Uniform %void = OpTypeVoid - %10 = OpTypeFunction %void -%unused_entry_point = OpFunction %void None %10 - %13 = OpLabel + %12 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %12 + %15 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/403.wgsl.expected.glsl b/test/tint/bug/tint/403.wgsl.expected.glsl index 76fc2c60e5..ad985cf131 100644 --- a/test/tint/bug/tint/403.wgsl.expected.glsl +++ b/test/tint/bug/tint/403.wgsl.expected.glsl @@ -1,27 +1,43 @@ #version 310 es -layout(binding = 0, std140) uniform vertexUniformBuffer1_std140_ubo { +struct vertexUniformBuffer1 { + mat2 transform1; +}; + +struct vertexUniformBuffer1_std140 { vec2 transform1_0; vec2 transform1_1; -} x_20; +}; -layout(binding = 0, std140) uniform vertexUniformBuffer2_std140_ubo { +struct vertexUniformBuffer2 { + mat2 transform2; +}; + +struct vertexUniformBuffer2_std140 { vec2 transform2_0; vec2 transform2_1; +}; + +layout(binding = 0, std140) uniform x_20_block_std140_ubo { + vertexUniformBuffer1_std140 inner; +} x_20; + +layout(binding = 0, std140) uniform x_26_block_std140_ubo { + vertexUniformBuffer2_std140 inner; } x_26; -mat2 load_x_20_transform1() { - return mat2(x_20.transform1_0, x_20.transform1_1); +mat2 load_x_20_inner_transform1() { + return mat2(x_20.inner.transform1_0, x_20.inner.transform1_1); } -mat2 load_x_26_transform2() { - return mat2(x_26.transform2_0, x_26.transform2_1); +mat2 load_x_26_inner_transform2() { + return mat2(x_26.inner.transform2_0, x_26.inner.transform2_1); } vec4 tint_symbol(uint tint_symbol_1) { vec2 indexable[3] = vec2[3](vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), vec2(0.0f, 0.0f)); - mat2 x_23 = load_x_20_transform1(); - mat2 x_28 = load_x_26_transform2(); + mat2 x_23 = load_x_20_inner_transform1(); + mat2 x_28 = load_x_26_inner_transform2(); uint x_46 = tint_symbol_1; vec2 tint_symbol_2[3] = vec2[3](vec2(-1.0f, 1.0f), vec2(1.0f), vec2(-1.0f)); indexable = tint_symbol_2; diff --git a/test/tint/bug/tint/403.wgsl.expected.spvasm b/test/tint/bug/tint/403.wgsl.expected.spvasm index 623c850a47..50285e3d91 100644 --- a/test/tint/bug/tint/403.wgsl.expected.spvasm +++ b/test/tint/bug/tint/403.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 82 +; Bound: 88 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,16 +9,20 @@ OpName %gl_VertexIndex_1 "gl_VertexIndex_1" OpName %value "value" OpName %vertex_point_size "vertex_point_size" + OpName %x_20_block_std140 "x_20_block_std140" + OpMemberName %x_20_block_std140 0 "inner" OpName %vertexUniformBuffer1_std140 "vertexUniformBuffer1_std140" OpMemberName %vertexUniformBuffer1_std140 0 "transform1_0" OpMemberName %vertexUniformBuffer1_std140 1 "transform1_1" OpName %x_20 "x_20" + OpName %x_26_block_std140 "x_26_block_std140" + OpMemberName %x_26_block_std140 0 "inner" OpName %vertexUniformBuffer2_std140 "vertexUniformBuffer2_std140" OpMemberName %vertexUniformBuffer2_std140 0 "transform2_0" OpMemberName %vertexUniformBuffer2_std140 1 "transform2_1" OpName %x_26 "x_26" - OpName %load_x_20_transform1 "load_x_20_transform1" - OpName %load_x_26_transform2 "load_x_26_transform2" + OpName %load_x_20_inner_transform1 "load_x_20_inner_transform1" + OpName %load_x_26_inner_transform2 "load_x_26_inner_transform2" OpName %main_inner "main_inner" OpName %gl_VertexIndex "gl_VertexIndex" OpName %indexable "indexable" @@ -26,13 +30,15 @@ OpDecorate %gl_VertexIndex_1 BuiltIn VertexIndex OpDecorate %value BuiltIn Position OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %vertexUniformBuffer1_std140 Block + OpDecorate %x_20_block_std140 Block + OpMemberDecorate %x_20_block_std140 0 Offset 0 OpMemberDecorate %vertexUniformBuffer1_std140 0 Offset 0 OpMemberDecorate %vertexUniformBuffer1_std140 1 Offset 8 OpDecorate %x_20 NonWritable OpDecorate %x_20 DescriptorSet 0 OpDecorate %x_20 Binding 0 - OpDecorate %vertexUniformBuffer2_std140 Block + OpDecorate %x_26_block_std140 Block + OpMemberDecorate %x_26_block_std140 0 Offset 0 OpMemberDecorate %vertexUniformBuffer2_std140 0 Offset 0 OpMemberDecorate %vertexUniformBuffer2_std140 1 Offset 8 OpDecorate %x_26 NonWritable @@ -52,76 +58,82 @@ %vertex_point_size = OpVariable %_ptr_Output_float Output %11 %v2float = OpTypeVector %float 2 %vertexUniformBuffer1_std140 = OpTypeStruct %v2float %v2float -%_ptr_Uniform_vertexUniformBuffer1_std140 = OpTypePointer Uniform %vertexUniformBuffer1_std140 - %x_20 = OpVariable %_ptr_Uniform_vertexUniformBuffer1_std140 Uniform +%x_20_block_std140 = OpTypeStruct %vertexUniformBuffer1_std140 +%_ptr_Uniform_x_20_block_std140 = OpTypePointer Uniform %x_20_block_std140 + %x_20 = OpVariable %_ptr_Uniform_x_20_block_std140 Uniform %vertexUniformBuffer2_std140 = OpTypeStruct %v2float %v2float -%_ptr_Uniform_vertexUniformBuffer2_std140 = OpTypePointer Uniform %vertexUniformBuffer2_std140 - %x_26 = OpVariable %_ptr_Uniform_vertexUniformBuffer2_std140 Uniform +%x_26_block_std140 = OpTypeStruct %vertexUniformBuffer2_std140 +%_ptr_Uniform_x_26_block_std140 = OpTypePointer Uniform %x_26_block_std140 + %x_26 = OpVariable %_ptr_Uniform_x_26_block_std140 Uniform %mat2v2float = OpTypeMatrix %v2float 2 - %19 = OpTypeFunction %mat2v2float + %21 = OpTypeFunction %mat2v2float %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_vertexUniformBuffer1_std140 = OpTypePointer Uniform %vertexUniformBuffer1_std140 %_ptr_Uniform_v2float = OpTypePointer Uniform %v2float %uint_1 = OpConstant %uint 1 - %44 = OpTypeFunction %v4float %uint +%_ptr_Uniform_vertexUniformBuffer2_std140 = OpTypePointer Uniform %vertexUniformBuffer2_std140 + %50 = OpTypeFunction %v4float %uint %uint_3 = OpConstant %uint 3 %_arr_v2float_uint_3 = OpTypeArray %v2float %uint_3 %_ptr_Function__arr_v2float_uint_3 = OpTypePointer Function %_arr_v2float_uint_3 - %52 = OpConstantNull %_arr_v2float_uint_3 + %58 = OpConstantNull %_arr_v2float_uint_3 %float_n1 = OpConstant %float -1 %float_1 = OpConstant %float 1 - %57 = OpConstantComposite %v2float %float_n1 %float_1 - %58 = OpConstantComposite %v2float %float_1 %float_1 - %59 = OpConstantComposite %v2float %float_n1 %float_n1 - %60 = OpConstantComposite %_arr_v2float_uint_3 %57 %58 %59 + %63 = OpConstantComposite %v2float %float_n1 %float_1 + %64 = OpConstantComposite %v2float %float_1 %float_1 + %65 = OpConstantComposite %v2float %float_n1 %float_n1 + %66 = OpConstantComposite %_arr_v2float_uint_3 %63 %64 %65 %_ptr_Function_v2float = OpTypePointer Function %v2float - %64 = OpConstantNull %uint + %70 = OpConstantNull %uint %void = OpTypeVoid - %76 = OpTypeFunction %void -%load_x_20_transform1 = OpFunction %mat2v2float None %19 - %22 = OpLabel - %27 = OpAccessChain %_ptr_Uniform_v2float %x_20 %uint_0 - %28 = OpLoad %v2float %27 - %31 = OpAccessChain %_ptr_Uniform_v2float %x_20 %uint_1 + %82 = OpTypeFunction %void +%load_x_20_inner_transform1 = OpFunction %mat2v2float None %21 + %24 = OpLabel + %28 = OpAccessChain %_ptr_Uniform_vertexUniformBuffer1_std140 %x_20 %uint_0 + %31 = OpAccessChain %_ptr_Uniform_v2float %28 %uint_0 %32 = OpLoad %v2float %31 - %33 = OpCompositeConstruct %mat2v2float %28 %32 - OpReturnValue %33 + %35 = OpAccessChain %_ptr_Uniform_v2float %28 %uint_1 + %36 = OpLoad %v2float %35 + %37 = OpCompositeConstruct %mat2v2float %32 %36 + OpReturnValue %37 OpFunctionEnd -%load_x_26_transform2 = OpFunction %mat2v2float None %19 - %35 = OpLabel - %38 = OpAccessChain %_ptr_Uniform_v2float %x_26 %uint_0 - %39 = OpLoad %v2float %38 - %41 = OpAccessChain %_ptr_Uniform_v2float %x_26 %uint_1 - %42 = OpLoad %v2float %41 - %43 = OpCompositeConstruct %mat2v2float %39 %42 - OpReturnValue %43 +%load_x_26_inner_transform2 = OpFunction %mat2v2float None %21 + %39 = OpLabel + %42 = OpAccessChain %_ptr_Uniform_vertexUniformBuffer2_std140 %x_26 %uint_0 + %44 = OpAccessChain %_ptr_Uniform_v2float %42 %uint_0 + %45 = OpLoad %v2float %44 + %47 = OpAccessChain %_ptr_Uniform_v2float %42 %uint_1 + %48 = OpLoad %v2float %47 + %49 = OpCompositeConstruct %mat2v2float %45 %48 + OpReturnValue %49 OpFunctionEnd - %main_inner = OpFunction %v4float None %44 + %main_inner = OpFunction %v4float None %50 %gl_VertexIndex = OpFunctionParameter %uint - %47 = OpLabel - %indexable = OpVariable %_ptr_Function__arr_v2float_uint_3 Function %52 - %53 = OpFunctionCall %mat2v2float %load_x_20_transform1 - %54 = OpFunctionCall %mat2v2float %load_x_26_transform2 - OpStore %indexable %60 - %62 = OpAccessChain %_ptr_Function_v2float %indexable %gl_VertexIndex - %63 = OpLoad %v2float %62 - %65 = OpCompositeExtract %v2float %53 0 - %66 = OpCompositeExtract %v2float %54 0 - %67 = OpFAdd %v2float %65 %66 - %68 = OpCompositeExtract %v2float %53 1 - %69 = OpCompositeExtract %v2float %54 1 - %70 = OpFAdd %v2float %68 %69 - %71 = OpCompositeConstruct %mat2v2float %67 %70 - %72 = OpMatrixTimesVector %v2float %71 %63 - %73 = OpCompositeExtract %float %72 0 - %74 = OpCompositeExtract %float %72 1 - %75 = OpCompositeConstruct %v4float %73 %74 %11 %float_1 - OpReturnValue %75 + %53 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v2float_uint_3 Function %58 + %59 = OpFunctionCall %mat2v2float %load_x_20_inner_transform1 + %60 = OpFunctionCall %mat2v2float %load_x_26_inner_transform2 + OpStore %indexable %66 + %68 = OpAccessChain %_ptr_Function_v2float %indexable %gl_VertexIndex + %69 = OpLoad %v2float %68 + %71 = OpCompositeExtract %v2float %59 0 + %72 = OpCompositeExtract %v2float %60 0 + %73 = OpFAdd %v2float %71 %72 + %74 = OpCompositeExtract %v2float %59 1 + %75 = OpCompositeExtract %v2float %60 1 + %76 = OpFAdd %v2float %74 %75 + %77 = OpCompositeConstruct %mat2v2float %73 %76 + %78 = OpMatrixTimesVector %v2float %77 %69 + %79 = OpCompositeExtract %float %78 0 + %80 = OpCompositeExtract %float %78 1 + %81 = OpCompositeConstruct %v4float %79 %80 %11 %float_1 + OpReturnValue %81 OpFunctionEnd - %main = OpFunction %void None %76 - %79 = OpLabel - %81 = OpLoad %uint %gl_VertexIndex_1 - %80 = OpFunctionCall %v4float %main_inner %81 - OpStore %value %80 + %main = OpFunction %void None %82 + %85 = OpLabel + %87 = OpLoad %uint %gl_VertexIndex_1 + %86 = OpFunctionCall %v4float %main_inner %87 + OpStore %value %86 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/492.wgsl.expected.glsl b/test/tint/bug/tint/492.wgsl.expected.glsl index 1e8e23f783..fc248c167a 100644 --- a/test/tint/bug/tint/492.wgsl.expected.glsl +++ b/test/tint/bug/tint/492.wgsl.expected.glsl @@ -1,11 +1,15 @@ #version 310 es -layout(binding = 0, std430) buffer S_ssbo { +struct S { int a; +}; + +layout(binding = 0, std430) buffer buf_block_ssbo { + S inner; } buf; void tint_symbol() { - buf.a = 12; + buf.inner.a = 12; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/tint/492.wgsl.expected.spvasm b/test/tint/bug/tint/492.wgsl.expected.spvasm index 0c5be191ff..4c6ad9d936 100644 --- a/test/tint/bug/tint/492.wgsl.expected.spvasm +++ b/test/tint/bug/tint/492.wgsl.expected.spvasm @@ -1,33 +1,37 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 14 +; Bound: 15 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %buf_block "buf_block" + OpMemberName %buf_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %buf "buf" OpName %main "main" - OpDecorate %S Block + OpDecorate %buf_block Block + OpMemberDecorate %buf_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %buf DescriptorSet 0 OpDecorate %buf Binding 0 %int = OpTypeInt 32 1 %S = OpTypeStruct %int -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %buf = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %buf_block = OpTypeStruct %S +%_ptr_StorageBuffer_buf_block = OpTypePointer StorageBuffer %buf_block + %buf = OpVariable %_ptr_StorageBuffer_buf_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_12 = OpConstant %int 12 - %main = OpFunction %void None %5 - %8 = OpLabel - %12 = OpAccessChain %_ptr_StorageBuffer_int %buf %uint_0 - OpStore %12 %int_12 + %main = OpFunction %void None %6 + %9 = OpLabel + %13 = OpAccessChain %_ptr_StorageBuffer_int %buf %uint_0 %uint_0 + OpStore %13 %int_12 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/534.wgsl.expected.glsl b/test/tint/bug/tint/534.wgsl.expected.glsl index 2f905b56b8..87a2177a65 100644 --- a/test/tint/bug/tint/534.wgsl.expected.glsl +++ b/test/tint/bug/tint/534.wgsl.expected.glsl @@ -1,14 +1,18 @@ #version 310 es +struct Uniforms { + uint dstTextureFlipY; + uint isFloat16; + uint isRGB10A2Unorm; + uint channelCount; +}; + layout(binding = 2, std430) buffer OutputBuf_ssbo { uint result[]; } tint_symbol; -layout(binding = 3, std140) uniform Uniforms_ubo { - uint dstTextureFlipY; - uint isFloat16; - uint isRGB10A2Unorm; - uint channelCount; +layout(binding = 3, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; uint ConvertToFp16FloatValue(float fp32) { @@ -21,7 +25,7 @@ void tint_symbol_1(uvec3 GlobalInvocationID) { uvec2 size = uvec2(textureSize(src_1, 0)); uvec2 dstTexCoord = GlobalInvocationID.xy; uvec2 srcTexCoord = dstTexCoord; - if ((uniforms.dstTextureFlipY == 1u)) { + if ((uniforms.inner.dstTextureFlipY == 1u)) { srcTexCoord.y = ((size.y - dstTexCoord.y) - 1u); } vec4 srcColor = texelFetch(src_1, ivec2(srcTexCoord), 0); @@ -30,7 +34,7 @@ void tint_symbol_1(uvec3 GlobalInvocationID) { uvec4 srcColorBits = uvec4(0u, 0u, 0u, 0u); uvec4 dstColorBits = uvec4(dstColor); { - for(uint i = 0u; (i < uniforms.channelCount); i = (i + 1u)) { + for(uint i = 0u; (i < uniforms.inner.channelCount); i = (i + 1u)) { uint tint_symbol_2 = ConvertToFp16FloatValue(srcColor[i]); srcColorBits[i] = tint_symbol_2; bool tint_tmp = success; diff --git a/test/tint/bug/tint/534.wgsl.expected.spvasm b/test/tint/bug/tint/534.wgsl.expected.spvasm index d9b0972f39..3f6f4a24dc 100644 --- a/test/tint/bug/tint/534.wgsl.expected.spvasm +++ b/test/tint/bug/tint/534.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 134 +; Bound: 135 ; Schema: 0 OpCapability Shader OpCapability ImageQuery @@ -14,6 +14,8 @@ OpName %OutputBuf "OutputBuf" OpMemberName %OutputBuf 0 "result" OpName %output "output" + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "dstTextureFlipY" OpMemberName %Uniforms 1 "isFloat16" @@ -45,7 +47,8 @@ OpDecorate %_runtimearr_uint ArrayStride 4 OpDecorate %output DescriptorSet 0 OpDecorate %output Binding 2 - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 1 Offset 4 OpMemberDecorate %Uniforms 2 Offset 8 @@ -67,160 +70,161 @@ %_ptr_StorageBuffer_OutputBuf = OpTypePointer StorageBuffer %OutputBuf %output = OpVariable %_ptr_StorageBuffer_OutputBuf StorageBuffer %Uniforms = OpTypeStruct %uint %uint %uint %uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform - %17 = OpTypeFunction %uint %float +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform + %18 = OpTypeFunction %uint %float %uint_1 = OpConstant %uint 1 %void = OpTypeVoid - %22 = OpTypeFunction %void %v3uint + %23 = OpTypeFunction %void %v3uint %v2uint = OpTypeVector %uint 2 %int = OpTypeInt 32 1 %int_0 = OpConstant %int 0 %_ptr_Function_v2uint = OpTypePointer Function %v2uint - %34 = OpConstantNull %v2uint + %35 = OpConstantNull %v2uint %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %bool = OpTypeBool %_ptr_Function_uint = OpTypePointer Function %uint %v4float = OpTypeVector %float 4 - %59 = OpConstantNull %int + %60 = OpConstantNull %int %_ptr_Function_v4float = OpTypePointer Function %v4float - %62 = OpConstantNull %v4float + %63 = OpConstantNull %v4float %true = OpConstantTrue %bool %_ptr_Function_bool = OpTypePointer Function %bool - %70 = OpConstantNull %bool + %71 = OpConstantNull %bool %v4uint = OpTypeVector %uint 4 %_ptr_Function_v4uint = OpTypePointer Function %v4uint - %74 = OpConstantNull %v4uint - %78 = OpConstantNull %uint + %75 = OpConstantNull %v4uint + %79 = OpConstantNull %uint %uint_3 = OpConstant %uint 3 %_ptr_Function_float = OpTypePointer Function %float %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint - %129 = OpTypeFunction %void -%ConvertToFp16FloatValue = OpFunction %uint None %17 + %130 = OpTypeFunction %void +%ConvertToFp16FloatValue = OpFunction %uint None %18 %fp32 = OpFunctionParameter %float - %20 = OpLabel + %21 = OpLabel OpReturnValue %uint_1 OpFunctionEnd - %main_inner = OpFunction %void None %22 + %main_inner = OpFunction %void None %23 %GlobalInvocationID = OpFunctionParameter %v3uint - %26 = OpLabel - %size = OpVariable %_ptr_Function_v2uint Function %34 -%dstTexCoord = OpVariable %_ptr_Function_v2uint Function %34 -%srcTexCoord = OpVariable %_ptr_Function_v2uint Function %34 - %srcColor = OpVariable %_ptr_Function_v4float Function %62 - %dstColor = OpVariable %_ptr_Function_v4float Function %62 - %success = OpVariable %_ptr_Function_bool Function %70 -%srcColorBits = OpVariable %_ptr_Function_v4uint Function %74 -%dstColorBits = OpVariable %_ptr_Function_v4uint Function %74 - %i = OpVariable %_ptr_Function_uint Function %78 -%outputIndex = OpVariable %_ptr_Function_uint Function %78 - %29 = OpLoad %7 %src - %27 = OpImageQuerySizeLod %v2uint %29 %int_0 - OpStore %size %27 - %35 = OpVectorShuffle %v2uint %GlobalInvocationID %GlobalInvocationID 0 1 - OpStore %dstTexCoord %35 - %37 = OpLoad %v2uint %dstTexCoord - OpStore %srcTexCoord %37 - %41 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %42 = OpLoad %uint %41 - %43 = OpIEqual %bool %42 %uint_1 - OpSelectionMerge %45 None - OpBranchConditional %43 %46 %45 + %27 = OpLabel + %size = OpVariable %_ptr_Function_v2uint Function %35 +%dstTexCoord = OpVariable %_ptr_Function_v2uint Function %35 +%srcTexCoord = OpVariable %_ptr_Function_v2uint Function %35 + %srcColor = OpVariable %_ptr_Function_v4float Function %63 + %dstColor = OpVariable %_ptr_Function_v4float Function %63 + %success = OpVariable %_ptr_Function_bool Function %71 +%srcColorBits = OpVariable %_ptr_Function_v4uint Function %75 +%dstColorBits = OpVariable %_ptr_Function_v4uint Function %75 + %i = OpVariable %_ptr_Function_uint Function %79 +%outputIndex = OpVariable %_ptr_Function_uint Function %79 + %30 = OpLoad %7 %src + %28 = OpImageQuerySizeLod %v2uint %30 %int_0 + OpStore %size %28 + %36 = OpVectorShuffle %v2uint %GlobalInvocationID %GlobalInvocationID 0 1 + OpStore %dstTexCoord %36 + %38 = OpLoad %v2uint %dstTexCoord + OpStore %srcTexCoord %38 + %42 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %43 = OpLoad %uint %42 + %44 = OpIEqual %bool %43 %uint_1 + OpSelectionMerge %46 None + OpBranchConditional %44 %47 %46 + %47 = OpLabel + %49 = OpAccessChain %_ptr_Function_uint %srcTexCoord %uint_1 + %50 = OpAccessChain %_ptr_Function_uint %size %uint_1 + %51 = OpLoad %uint %50 + %52 = OpAccessChain %_ptr_Function_uint %dstTexCoord %uint_1 + %53 = OpLoad %uint %52 + %54 = OpISub %uint %51 %53 + %55 = OpISub %uint %54 %uint_1 + OpStore %49 %55 + OpBranch %46 %46 = OpLabel - %48 = OpAccessChain %_ptr_Function_uint %srcTexCoord %uint_1 - %49 = OpAccessChain %_ptr_Function_uint %size %uint_1 - %50 = OpLoad %uint %49 - %51 = OpAccessChain %_ptr_Function_uint %dstTexCoord %uint_1 - %52 = OpLoad %uint %51 - %53 = OpISub %uint %50 %52 - %54 = OpISub %uint %53 %uint_1 - OpStore %48 %54 - OpBranch %45 - %45 = OpLabel - %57 = OpLoad %7 %src - %58 = OpLoad %v2uint %srcTexCoord - %55 = OpImageFetch %v4float %57 %58 Lod %59 - OpStore %srcColor %55 - %64 = OpLoad %7 %dst - %65 = OpLoad %v2uint %dstTexCoord - %63 = OpImageFetch %v4float %64 %65 Lod %59 - OpStore %dstColor %63 + %58 = OpLoad %7 %src + %59 = OpLoad %v2uint %srcTexCoord + %56 = OpImageFetch %v4float %58 %59 Lod %60 + OpStore %srcColor %56 + %65 = OpLoad %7 %dst + %66 = OpLoad %v2uint %dstTexCoord + %64 = OpImageFetch %v4float %65 %66 Lod %60 + OpStore %dstColor %64 OpStore %success %true - %76 = OpLoad %v4float %dstColor - %75 = OpConvertFToU %v4uint %76 - OpStore %dstColorBits %75 - OpStore %i %78 - OpBranch %80 - %80 = OpLabel - OpLoopMerge %81 %82 None + %77 = OpLoad %v4float %dstColor + %76 = OpConvertFToU %v4uint %77 + OpStore %dstColorBits %76 + OpStore %i %79 + OpBranch %81 + %81 = OpLabel + OpLoopMerge %82 %83 None + OpBranch %84 + %84 = OpLabel + %86 = OpLoad %uint %i + %88 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_3 + %89 = OpLoad %uint %88 + %90 = OpULessThan %bool %86 %89 + %85 = OpLogicalNot %bool %90 + OpSelectionMerge %91 None + OpBranchConditional %85 %92 %91 + %92 = OpLabel + OpBranch %82 + %91 = OpLabel + %94 = OpLoad %uint %i + %96 = OpAccessChain %_ptr_Function_float %srcColor %94 + %97 = OpLoad %float %96 + %93 = OpFunctionCall %uint %ConvertToFp16FloatValue %97 + %98 = OpLoad %uint %i + %99 = OpAccessChain %_ptr_Function_uint %srcColorBits %98 + OpStore %99 %93 + %100 = OpLoad %bool %success + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + %103 = OpLoad %uint %i + %104 = OpAccessChain %_ptr_Function_uint %srcColorBits %103 + %105 = OpLoad %uint %104 + %106 = OpLoad %uint %i + %107 = OpAccessChain %_ptr_Function_uint %dstColorBits %106 + %108 = OpLoad %uint %107 + %109 = OpIEqual %bool %105 %108 + OpBranch %101 + %101 = OpLabel + %110 = OpPhi %bool %100 %91 %109 %102 + OpStore %success %110 OpBranch %83 %83 = OpLabel - %85 = OpLoad %uint %i - %87 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_3 - %88 = OpLoad %uint %87 - %89 = OpULessThan %bool %85 %88 - %84 = OpLogicalNot %bool %89 - OpSelectionMerge %90 None - OpBranchConditional %84 %91 %90 - %91 = OpLabel + %111 = OpLoad %uint %i + %112 = OpIAdd %uint %111 %uint_1 + OpStore %i %112 OpBranch %81 - %90 = OpLabel - %93 = OpLoad %uint %i - %95 = OpAccessChain %_ptr_Function_float %srcColor %93 - %96 = OpLoad %float %95 - %92 = OpFunctionCall %uint %ConvertToFp16FloatValue %96 - %97 = OpLoad %uint %i - %98 = OpAccessChain %_ptr_Function_uint %srcColorBits %97 - OpStore %98 %92 - %99 = OpLoad %bool %success - OpSelectionMerge %100 None - OpBranchConditional %99 %101 %100 - %101 = OpLabel - %102 = OpLoad %uint %i - %103 = OpAccessChain %_ptr_Function_uint %srcColorBits %102 - %104 = OpLoad %uint %103 - %105 = OpLoad %uint %i - %106 = OpAccessChain %_ptr_Function_uint %dstColorBits %105 - %107 = OpLoad %uint %106 - %108 = OpIEqual %bool %104 %107 - OpBranch %100 - %100 = OpLabel - %109 = OpPhi %bool %99 %90 %108 %101 - OpStore %success %109 - OpBranch %82 %82 = OpLabel - %110 = OpLoad %uint %i - %111 = OpIAdd %uint %110 %uint_1 - OpStore %i %111 - OpBranch %80 - %81 = OpLabel - %112 = OpCompositeExtract %uint %GlobalInvocationID 1 - %114 = OpAccessChain %_ptr_Function_uint %size %uint_0 - %115 = OpLoad %uint %114 - %116 = OpIMul %uint %112 %115 - %117 = OpCompositeExtract %uint %GlobalInvocationID 0 - %118 = OpIAdd %uint %116 %117 - OpStore %outputIndex %118 - %120 = OpLoad %bool %success - OpSelectionMerge %121 None - OpBranchConditional %120 %122 %123 - %122 = OpLabel - %124 = OpLoad %uint %outputIndex - %126 = OpAccessChain %_ptr_StorageBuffer_uint %output %uint_0 %124 - OpStore %126 %uint_1 - OpBranch %121 + %113 = OpCompositeExtract %uint %GlobalInvocationID 1 + %115 = OpAccessChain %_ptr_Function_uint %size %uint_0 + %116 = OpLoad %uint %115 + %117 = OpIMul %uint %113 %116 + %118 = OpCompositeExtract %uint %GlobalInvocationID 0 + %119 = OpIAdd %uint %117 %118 + OpStore %outputIndex %119 + %121 = OpLoad %bool %success + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %124 %123 = OpLabel - %127 = OpLoad %uint %outputIndex - %128 = OpAccessChain %_ptr_StorageBuffer_uint %output %uint_0 %127 - OpStore %128 %78 - OpBranch %121 - %121 = OpLabel + %125 = OpLoad %uint %outputIndex + %127 = OpAccessChain %_ptr_StorageBuffer_uint %output %uint_0 %125 + OpStore %127 %uint_1 + OpBranch %122 + %124 = OpLabel + %128 = OpLoad %uint %outputIndex + %129 = OpAccessChain %_ptr_StorageBuffer_uint %output %uint_0 %128 + OpStore %129 %79 + OpBranch %122 + %122 = OpLabel OpReturn OpFunctionEnd - %main = OpFunction %void None %129 - %131 = OpLabel - %133 = OpLoad %v3uint %GlobalInvocationID_1 - %132 = OpFunctionCall %void %main_inner %133 + %main = OpFunction %void None %130 + %132 = OpLabel + %134 = OpLoad %v3uint %GlobalInvocationID_1 + %133 = OpFunctionCall %void %main_inner %134 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/744.wgsl.expected.glsl b/test/tint/bug/tint/744.wgsl.expected.glsl index a142a002af..f9041222c5 100644 --- a/test/tint/bug/tint/744.wgsl.expected.glsl +++ b/test/tint/bug/tint/744.wgsl.expected.glsl @@ -1,5 +1,13 @@ #version 310 es +struct Uniforms { + uvec2 aShape; + uvec2 bShape; + uvec2 outShape; + uint pad; + uint pad_1; +}; + layout(binding = 0, std430) buffer Matrix_ssbo { uint numbers[]; } firstMatrix; @@ -12,18 +20,14 @@ layout(binding = 2, std430) buffer Matrix_ssbo_2 { uint numbers[]; } resultMatrix; -layout(binding = 3, std140) uniform Uniforms_ubo { - uvec2 aShape; - uvec2 bShape; - uvec2 outShape; - uint pad; - uint pad_1; +layout(binding = 3, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; void tint_symbol(uvec3 global_id) { uvec2 resultCell = uvec2(global_id.y, global_id.x); - uint dimInner = uniforms.aShape.y; - uint dimOutter = uniforms.outShape.y; + uint dimInner = uniforms.inner.aShape.y; + uint dimOutter = uniforms.inner.outShape.y; uint result = 0u; { for(uint i = 0u; (i < dimInner); i = (i + 1u)) { diff --git a/test/tint/bug/tint/744.wgsl.expected.spvasm b/test/tint/bug/tint/744.wgsl.expected.spvasm index f83372b822..e95260668f 100644 --- a/test/tint/bug/tint/744.wgsl.expected.spvasm +++ b/test/tint/bug/tint/744.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 74 +; Bound: 75 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -13,6 +13,8 @@ OpName %firstMatrix "firstMatrix" OpName %secondMatrix "secondMatrix" OpName %resultMatrix "resultMatrix" + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "aShape" OpMemberName %Uniforms 1 "bShape" @@ -35,7 +37,8 @@ OpDecorate %secondMatrix Binding 1 OpDecorate %resultMatrix DescriptorSet 0 OpDecorate %resultMatrix Binding 2 - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 1 Offset 8 OpMemberDecorate %Uniforms 2 Offset 16 @@ -54,81 +57,82 @@ %resultMatrix = OpVariable %_ptr_StorageBuffer_Matrix StorageBuffer %v2uint = OpTypeVector %uint 2 %Uniforms = OpTypeStruct %v2uint %v2uint %v2uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %void = OpTypeVoid - %15 = OpTypeFunction %void %v3uint + %16 = OpTypeFunction %void %v3uint %uint_0 = OpConstant %uint 0 %uint_1 = OpConstant %uint 1 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %uint_2 = OpConstant %uint 2 - %31 = OpConstantNull %uint + %32 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint %bool = OpTypeBool %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint - %69 = OpTypeFunction %void - %main_inner = OpFunction %void None %15 + %70 = OpTypeFunction %void + %main_inner = OpFunction %void None %16 %global_id = OpFunctionParameter %v3uint - %19 = OpLabel - %result = OpVariable %_ptr_Function_uint Function %31 - %i = OpVariable %_ptr_Function_uint Function %31 - %20 = OpCompositeExtract %uint %global_id 1 - %21 = OpCompositeExtract %uint %global_id 0 - %22 = OpCompositeConstruct %v2uint %20 %21 - %26 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 - %27 = OpLoad %uint %26 - %29 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2 %uint_1 - %30 = OpLoad %uint %29 - OpStore %result %31 - OpStore %i %31 - OpBranch %35 - %35 = OpLabel - OpLoopMerge %36 %37 None + %20 = OpLabel + %result = OpVariable %_ptr_Function_uint Function %32 + %i = OpVariable %_ptr_Function_uint Function %32 + %21 = OpCompositeExtract %uint %global_id 1 + %22 = OpCompositeExtract %uint %global_id 0 + %23 = OpCompositeConstruct %v2uint %21 %22 + %27 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 %uint_1 + %28 = OpLoad %uint %27 + %30 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_2 %uint_1 + %31 = OpLoad %uint %30 + OpStore %result %32 + OpStore %i %32 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %41 = OpLoad %uint %i + %42 = OpULessThan %bool %41 %28 + %40 = OpLogicalNot %bool %42 + OpSelectionMerge %44 None + OpBranchConditional %40 %45 %44 + %45 = OpLabel + OpBranch %37 + %44 = OpLabel + %46 = OpLoad %uint %i + %47 = OpCompositeExtract %uint %23 0 + %48 = OpIMul %uint %47 %28 + %49 = OpIAdd %uint %46 %48 + %50 = OpCompositeExtract %uint %23 1 + %51 = OpLoad %uint %i + %52 = OpIMul %uint %51 %31 + %53 = OpIAdd %uint %50 %52 + %54 = OpLoad %uint %result + %56 = OpAccessChain %_ptr_StorageBuffer_uint %firstMatrix %uint_0 %49 + %57 = OpLoad %uint %56 + %58 = OpAccessChain %_ptr_StorageBuffer_uint %secondMatrix %uint_0 %53 + %59 = OpLoad %uint %58 + %60 = OpIMul %uint %57 %59 + %61 = OpIAdd %uint %54 %60 + OpStore %result %61 OpBranch %38 %38 = OpLabel - %40 = OpLoad %uint %i - %41 = OpULessThan %bool %40 %27 - %39 = OpLogicalNot %bool %41 - OpSelectionMerge %43 None - OpBranchConditional %39 %44 %43 - %44 = OpLabel + %62 = OpLoad %uint %i + %63 = OpIAdd %uint %62 %uint_1 + OpStore %i %63 OpBranch %36 - %43 = OpLabel - %45 = OpLoad %uint %i - %46 = OpCompositeExtract %uint %22 0 - %47 = OpIMul %uint %46 %27 - %48 = OpIAdd %uint %45 %47 - %49 = OpCompositeExtract %uint %22 1 - %50 = OpLoad %uint %i - %51 = OpIMul %uint %50 %30 - %52 = OpIAdd %uint %49 %51 - %53 = OpLoad %uint %result - %55 = OpAccessChain %_ptr_StorageBuffer_uint %firstMatrix %uint_0 %48 - %56 = OpLoad %uint %55 - %57 = OpAccessChain %_ptr_StorageBuffer_uint %secondMatrix %uint_0 %52 - %58 = OpLoad %uint %57 - %59 = OpIMul %uint %56 %58 - %60 = OpIAdd %uint %53 %59 - OpStore %result %60 - OpBranch %37 %37 = OpLabel - %61 = OpLoad %uint %i - %62 = OpIAdd %uint %61 %uint_1 - OpStore %i %62 - OpBranch %35 - %36 = OpLabel - %63 = OpCompositeExtract %uint %22 1 - %64 = OpCompositeExtract %uint %22 0 - %65 = OpIMul %uint %64 %30 - %66 = OpIAdd %uint %63 %65 - %67 = OpAccessChain %_ptr_StorageBuffer_uint %resultMatrix %uint_0 %66 - %68 = OpLoad %uint %result - OpStore %67 %68 + %64 = OpCompositeExtract %uint %23 1 + %65 = OpCompositeExtract %uint %23 0 + %66 = OpIMul %uint %65 %31 + %67 = OpIAdd %uint %64 %66 + %68 = OpAccessChain %_ptr_StorageBuffer_uint %resultMatrix %uint_0 %67 + %69 = OpLoad %uint %result + OpStore %68 %69 OpReturn OpFunctionEnd - %main = OpFunction %void None %69 - %71 = OpLabel - %73 = OpLoad %v3uint %global_id_1 - %72 = OpFunctionCall %void %main_inner %73 + %main = OpFunction %void None %70 + %72 = OpLabel + %74 = OpLoad %v3uint %global_id_1 + %73 = OpFunctionCall %void %main_inner %74 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/757.wgsl.expected.spvasm b/test/tint/bug/tint/757.wgsl.expected.spvasm index c660ecbe2d..71611618df 100644 --- a/test/tint/bug/tint/757.wgsl.expected.spvasm +++ b/test/tint/bug/tint/757.wgsl.expected.spvasm @@ -1,13 +1,15 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 79 +; Bound: 80 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" %GlobalInvocationID_1 OpExecutionMode %main LocalSize 1 1 1 OpName %GlobalInvocationID_1 "GlobalInvocationID_1" + OpName %constants_block "constants_block" + OpMemberName %constants_block 0 "inner" OpName %Constants "Constants" OpMemberName %Constants 0 "level" OpName %constants "constants" @@ -22,7 +24,8 @@ OpName %i "i" OpName %main "main" OpDecorate %GlobalInvocationID_1 BuiltIn GlobalInvocationId - OpDecorate %Constants Block + OpDecorate %constants_block Block + OpMemberDecorate %constants_block 0 Offset 0 OpMemberDecorate %Constants 0 Offset 0 OpDecorate %constants NonWritable OpDecorate %constants DescriptorSet 0 @@ -40,93 +43,94 @@ %GlobalInvocationID_1 = OpVariable %_ptr_Input_v3uint Input %int = OpTypeInt 32 1 %Constants = OpTypeStruct %int -%_ptr_Uniform_Constants = OpTypePointer Uniform %Constants - %constants = OpVariable %_ptr_Uniform_Constants Uniform +%constants_block = OpTypeStruct %Constants +%_ptr_Uniform_constants_block = OpTypePointer Uniform %constants_block + %constants = OpVariable %_ptr_Uniform_constants_block Uniform %float = OpTypeFloat 32 - %11 = OpTypeImage %float 2D 0 1 0 1 Unknown -%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 - %myTexture = OpVariable %_ptr_UniformConstant_11 UniformConstant + %12 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_12 = OpTypePointer UniformConstant %12 + %myTexture = OpVariable %_ptr_UniformConstant_12 UniformConstant %_runtimearr_float = OpTypeRuntimeArray %float %Result = OpTypeStruct %_runtimearr_float %_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result %result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer %void = OpTypeVoid - %17 = OpTypeFunction %void %v3uint + %18 = OpTypeFunction %void %v3uint %uint_4 = OpConstant %uint 4 %uint_2 = OpConstant %uint 2 %_ptr_Function_uint = OpTypePointer Function %uint - %33 = OpConstantNull %uint + %34 = OpConstantNull %uint %uint_1 = OpConstant %uint 1 %v4float = OpTypeVector %float 4 %v3int = OpTypeVector %int 3 %v2int = OpTypeVector %int 2 %v2uint = OpTypeVector %uint 2 - %47 = OpConstantNull %int + %48 = OpConstantNull %int %_ptr_Function_v4float = OpTypePointer Function %v4float - %51 = OpConstantNull %v4float + %52 = OpConstantNull %v4float %bool = OpTypeBool %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float %_ptr_Function_float = OpTypePointer Function %float - %74 = OpTypeFunction %void - %main_inner = OpFunction %void None %17 + %75 = OpTypeFunction %void + %main_inner = OpFunction %void None %18 %GlobalInvocationID = OpFunctionParameter %v3uint - %21 = OpLabel - %flatIndex = OpVariable %_ptr_Function_uint Function %33 - %texel = OpVariable %_ptr_Function_v4float Function %51 - %i = OpVariable %_ptr_Function_uint Function %33 - %23 = OpCompositeExtract %uint %GlobalInvocationID 2 - %24 = OpIMul %uint %uint_4 %23 - %26 = OpCompositeExtract %uint %GlobalInvocationID 1 - %27 = OpIMul %uint %uint_2 %26 - %28 = OpIAdd %uint %24 %27 - %29 = OpCompositeExtract %uint %GlobalInvocationID 0 - %30 = OpIAdd %uint %28 %29 - OpStore %flatIndex %30 - %34 = OpLoad %uint %flatIndex - %36 = OpIMul %uint %34 %uint_1 - OpStore %flatIndex %36 - %39 = OpLoad %11 %myTexture - %44 = OpVectorShuffle %v2uint %GlobalInvocationID %GlobalInvocationID 0 1 - %41 = OpBitcast %v2int %44 - %45 = OpCompositeExtract %int %41 0 - %46 = OpCompositeExtract %int %41 1 - %48 = OpCompositeConstruct %v3int %45 %46 %47 - %37 = OpImageFetch %v4float %39 %48 Lod %47 - OpStore %texel %37 - OpStore %i %33 - OpBranch %53 - %53 = OpLabel - OpLoopMerge %54 %55 None + %22 = OpLabel + %flatIndex = OpVariable %_ptr_Function_uint Function %34 + %texel = OpVariable %_ptr_Function_v4float Function %52 + %i = OpVariable %_ptr_Function_uint Function %34 + %24 = OpCompositeExtract %uint %GlobalInvocationID 2 + %25 = OpIMul %uint %uint_4 %24 + %27 = OpCompositeExtract %uint %GlobalInvocationID 1 + %28 = OpIMul %uint %uint_2 %27 + %29 = OpIAdd %uint %25 %28 + %30 = OpCompositeExtract %uint %GlobalInvocationID 0 + %31 = OpIAdd %uint %29 %30 + OpStore %flatIndex %31 + %35 = OpLoad %uint %flatIndex + %37 = OpIMul %uint %35 %uint_1 + OpStore %flatIndex %37 + %40 = OpLoad %12 %myTexture + %45 = OpVectorShuffle %v2uint %GlobalInvocationID %GlobalInvocationID 0 1 + %42 = OpBitcast %v2int %45 + %46 = OpCompositeExtract %int %42 0 + %47 = OpCompositeExtract %int %42 1 + %49 = OpCompositeConstruct %v3int %46 %47 %48 + %38 = OpImageFetch %v4float %40 %49 Lod %48 + OpStore %texel %38 + OpStore %i %34 + OpBranch %54 + %54 = OpLabel + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %59 = OpLoad %uint %i + %60 = OpULessThan %bool %59 %uint_1 + %58 = OpLogicalNot %bool %60 + OpSelectionMerge %62 None + OpBranchConditional %58 %63 %62 + %63 = OpLabel + OpBranch %55 + %62 = OpLabel + %65 = OpLoad %uint %flatIndex + %66 = OpLoad %uint %i + %67 = OpIAdd %uint %65 %66 + %69 = OpAccessChain %_ptr_StorageBuffer_float %result %uint_0 %67 + %71 = OpAccessChain %_ptr_Function_float %texel %uint_0 + %72 = OpLoad %float %71 + OpStore %69 %72 OpBranch %56 %56 = OpLabel - %58 = OpLoad %uint %i - %59 = OpULessThan %bool %58 %uint_1 - %57 = OpLogicalNot %bool %59 - OpSelectionMerge %61 None - OpBranchConditional %57 %62 %61 - %62 = OpLabel + %73 = OpLoad %uint %i + %74 = OpIAdd %uint %73 %uint_1 + OpStore %i %74 OpBranch %54 - %61 = OpLabel - %64 = OpLoad %uint %flatIndex - %65 = OpLoad %uint %i - %66 = OpIAdd %uint %64 %65 - %68 = OpAccessChain %_ptr_StorageBuffer_float %result %uint_0 %66 - %70 = OpAccessChain %_ptr_Function_float %texel %uint_0 - %71 = OpLoad %float %70 - OpStore %68 %71 - OpBranch %55 %55 = OpLabel - %72 = OpLoad %uint %i - %73 = OpIAdd %uint %72 %uint_1 - OpStore %i %73 - OpBranch %53 - %54 = OpLabel OpReturn OpFunctionEnd - %main = OpFunction %void None %74 - %76 = OpLabel - %78 = OpLoad %v3uint %GlobalInvocationID_1 - %77 = OpFunctionCall %void %main_inner %78 + %main = OpFunction %void None %75 + %77 = OpLabel + %79 = OpLoad %v3uint %GlobalInvocationID_1 + %78 = OpFunctionCall %void %main_inner %79 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/870.spvasm.expected.glsl b/test/tint/bug/tint/870.spvasm.expected.glsl index fc79f0fb3c..0cddbf5f3b 100644 --- a/test/tint/bug/tint/870.spvasm.expected.glsl +++ b/test/tint/bug/tint/870.spvasm.expected.glsl @@ -8,13 +8,17 @@ struct sspp962805860buildInformationS { int orientation[6]; }; -layout(binding = 2, std430) buffer x_B4_BuildInformation_ssbo { +struct x_B4_BuildInformation { sspp962805860buildInformationS passthru; +}; + +layout(binding = 2, std430) buffer sspp962805860buildInformation_block_ssbo { + x_B4_BuildInformation inner; } sspp962805860buildInformation; void main_1() { int orientation[6] = int[6](0, 0, 0, 0, 0, 0); - int x_23[6] = sspp962805860buildInformation.passthru.orientation; + int x_23[6] = sspp962805860buildInformation.inner.passthru.orientation; orientation[0] = x_23[0u]; orientation[1] = x_23[1u]; orientation[2] = x_23[2u]; diff --git a/test/tint/bug/tint/870.spvasm.expected.spvasm b/test/tint/bug/tint/870.spvasm.expected.spvasm index 9b6a8004f2..f2505a3c88 100644 --- a/test/tint/bug/tint/870.spvasm.expected.spvasm +++ b/test/tint/bug/tint/870.spvasm.expected.spvasm @@ -1,12 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 50 +; Bound: 51 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %main "main" OpExecutionMode %main OriginUpperLeft + OpName %sspp962805860buildInformation_block "sspp962805860buildInformation_block" + OpMemberName %sspp962805860buildInformation_block 0 "inner" OpName %x_B4_BuildInformation "x_B4_BuildInformation" OpMemberName %x_B4_BuildInformation 0 "passthru" OpName %sspp962805860buildInformationS "sspp962805860buildInformationS" @@ -18,7 +20,8 @@ OpName %main_1 "main_1" OpName %orientation "orientation" OpName %main "main" - OpDecorate %x_B4_BuildInformation Block + OpDecorate %sspp962805860buildInformation_block Block + OpMemberDecorate %sspp962805860buildInformation_block 0 Offset 0 OpMemberDecorate %x_B4_BuildInformation 0 Offset 0 OpMemberDecorate %sspp962805860buildInformationS 0 Offset 0 OpMemberDecorate %sspp962805860buildInformationS 1 Offset 16 @@ -36,18 +39,19 @@ %_arr_int_uint_6 = OpTypeArray %int %uint_6 %sspp962805860buildInformationS = OpTypeStruct %v4float %v4float %int %_arr_int_uint_6 %x_B4_BuildInformation = OpTypeStruct %sspp962805860buildInformationS -%_ptr_StorageBuffer_x_B4_BuildInformation = OpTypePointer StorageBuffer %x_B4_BuildInformation -%sspp962805860buildInformation = OpVariable %_ptr_StorageBuffer_x_B4_BuildInformation StorageBuffer +%sspp962805860buildInformation_block = OpTypeStruct %x_B4_BuildInformation +%_ptr_StorageBuffer_sspp962805860buildInformation_block = OpTypePointer StorageBuffer %sspp962805860buildInformation_block +%sspp962805860buildInformation = OpVariable %_ptr_StorageBuffer_sspp962805860buildInformation_block StorageBuffer %void = OpTypeVoid - %11 = OpTypeFunction %void + %12 = OpTypeFunction %void %_ptr_Function__arr_int_uint_6 = OpTypePointer Function %_arr_int_uint_6 - %17 = OpConstantNull %_arr_int_uint_6 + %18 = OpConstantNull %_arr_int_uint_6 %uint_0 = OpConstant %uint 0 %uint_3 = OpConstant %uint 3 %_ptr_StorageBuffer__arr_int_uint_6 = OpTypePointer StorageBuffer %_arr_int_uint_6 - %23 = OpConstantNull %int + %24 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int - %26 = OpConstantNull %uint + %27 = OpConstantNull %uint %int_1 = OpConstant %int 1 %uint_1 = OpConstant %uint 1 %int_2 = OpConstant %int 2 @@ -57,33 +61,33 @@ %uint_4 = OpConstant %uint 4 %int_5 = OpConstant %int 5 %uint_5 = OpConstant %uint 5 - %main_1 = OpFunction %void None %11 - %14 = OpLabel -%orientation = OpVariable %_ptr_Function__arr_int_uint_6 Function %17 - %21 = OpAccessChain %_ptr_StorageBuffer__arr_int_uint_6 %sspp962805860buildInformation %uint_0 %uint_3 - %22 = OpLoad %_arr_int_uint_6 %21 - %25 = OpAccessChain %_ptr_Function_int %orientation %23 - %27 = OpCompositeExtract %int %22 0 - OpStore %25 %27 - %29 = OpAccessChain %_ptr_Function_int %orientation %int_1 - %31 = OpCompositeExtract %int %22 1 - OpStore %29 %31 - %33 = OpAccessChain %_ptr_Function_int %orientation %int_2 - %35 = OpCompositeExtract %int %22 2 - OpStore %33 %35 - %37 = OpAccessChain %_ptr_Function_int %orientation %int_3 - %38 = OpCompositeExtract %int %22 3 - OpStore %37 %38 - %40 = OpAccessChain %_ptr_Function_int %orientation %int_4 - %42 = OpCompositeExtract %int %22 4 - OpStore %40 %42 - %44 = OpAccessChain %_ptr_Function_int %orientation %int_5 - %46 = OpCompositeExtract %int %22 5 - OpStore %44 %46 + %main_1 = OpFunction %void None %12 + %15 = OpLabel +%orientation = OpVariable %_ptr_Function__arr_int_uint_6 Function %18 + %22 = OpAccessChain %_ptr_StorageBuffer__arr_int_uint_6 %sspp962805860buildInformation %uint_0 %uint_0 %uint_3 + %23 = OpLoad %_arr_int_uint_6 %22 + %26 = OpAccessChain %_ptr_Function_int %orientation %24 + %28 = OpCompositeExtract %int %23 0 + OpStore %26 %28 + %30 = OpAccessChain %_ptr_Function_int %orientation %int_1 + %32 = OpCompositeExtract %int %23 1 + OpStore %30 %32 + %34 = OpAccessChain %_ptr_Function_int %orientation %int_2 + %36 = OpCompositeExtract %int %23 2 + OpStore %34 %36 + %38 = OpAccessChain %_ptr_Function_int %orientation %int_3 + %39 = OpCompositeExtract %int %23 3 + OpStore %38 %39 + %41 = OpAccessChain %_ptr_Function_int %orientation %int_4 + %43 = OpCompositeExtract %int %23 4 + OpStore %41 %43 + %45 = OpAccessChain %_ptr_Function_int %orientation %int_5 + %47 = OpCompositeExtract %int %23 5 + OpStore %45 %47 OpReturn OpFunctionEnd - %main = OpFunction %void None %11 - %48 = OpLabel - %49 = OpFunctionCall %void %main_1 + %main = OpFunction %void None %12 + %49 = OpLabel + %50 = OpFunctionCall %void %main_1 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/913.wgsl.expected.glsl b/test/tint/bug/tint/913.wgsl.expected.glsl index 7fe0bba8e0..788849f751 100644 --- a/test/tint/bug/tint/913.wgsl.expected.glsl +++ b/test/tint/bug/tint/913.wgsl.expected.glsl @@ -1,15 +1,19 @@ #version 310 es -layout(binding = 2, std430) buffer OutputBuf_ssbo { - uint result[]; -} tint_symbol; - -layout(binding = 3, std140) uniform Uniforms_ubo { +struct Uniforms { uint dstTextureFlipY; uint channelCount; uvec2 srcCopyOrigin; uvec2 dstCopyOrigin; uvec2 copySize; +}; + +layout(binding = 2, std430) buffer OutputBuf_ssbo { + uint result[]; +} tint_symbol; + +layout(binding = 3, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; bool aboutEqual(float value, float expect) { @@ -24,17 +28,17 @@ void tint_symbol_1(uvec3 GlobalInvocationID) { uvec2 dstTexCoord = uvec2(GlobalInvocationID.xy); vec4 nonCoveredColor = vec4(0.0f, 1.0f, 0.0f, 1.0f); bool success = true; - bool tint_tmp_2 = (dstTexCoord.x < uniforms.dstCopyOrigin.x); + bool tint_tmp_2 = (dstTexCoord.x < uniforms.inner.dstCopyOrigin.x); if (!tint_tmp_2) { - tint_tmp_2 = (dstTexCoord.y < uniforms.dstCopyOrigin.y); + tint_tmp_2 = (dstTexCoord.y < uniforms.inner.dstCopyOrigin.y); } bool tint_tmp_1 = (tint_tmp_2); if (!tint_tmp_1) { - tint_tmp_1 = (dstTexCoord.x >= (uniforms.dstCopyOrigin.x + uniforms.copySize.x)); + tint_tmp_1 = (dstTexCoord.x >= (uniforms.inner.dstCopyOrigin.x + uniforms.inner.copySize.x)); } bool tint_tmp = (tint_tmp_1); if (!tint_tmp) { - tint_tmp = (dstTexCoord.y >= (uniforms.dstCopyOrigin.y + uniforms.copySize.y)); + tint_tmp = (dstTexCoord.y >= (uniforms.inner.dstCopyOrigin.y + uniforms.inner.copySize.y)); } if ((tint_tmp)) { bool tint_tmp_3 = success; @@ -43,13 +47,13 @@ void tint_symbol_1(uvec3 GlobalInvocationID) { } success = (tint_tmp_3); } else { - uvec2 srcTexCoord = ((dstTexCoord - uniforms.dstCopyOrigin) + uniforms.srcCopyOrigin); - if ((uniforms.dstTextureFlipY == 1u)) { + uvec2 srcTexCoord = ((dstTexCoord - uniforms.inner.dstCopyOrigin) + uniforms.inner.srcCopyOrigin); + if ((uniforms.inner.dstTextureFlipY == 1u)) { srcTexCoord.y = ((srcSize.y - srcTexCoord.y) - 1u); } vec4 srcColor = texelFetch(src_1, ivec2(srcTexCoord), 0); vec4 dstColor = texelFetch(dst_1, ivec2(dstTexCoord), 0); - if ((uniforms.channelCount == 2u)) { + if ((uniforms.inner.channelCount == 2u)) { bool tint_symbol_3 = success; if (tint_symbol_3) { tint_symbol_3 = aboutEqual(dstColor.r, srcColor.r); diff --git a/test/tint/bug/tint/913.wgsl.expected.spvasm b/test/tint/bug/tint/913.wgsl.expected.spvasm index 1abbbc0a4a..65d95a0620 100644 --- a/test/tint/bug/tint/913.wgsl.expected.spvasm +++ b/test/tint/bug/tint/913.wgsl.expected.spvasm @@ -1,11 +1,11 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 205 +; Bound: 206 ; Schema: 0 OpCapability Shader OpCapability ImageQuery - %25 = OpExtInstImport "GLSL.std.450" + %26 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" %GlobalInvocationID_1 OpExecutionMode %main LocalSize 1 1 1 @@ -15,6 +15,8 @@ OpName %OutputBuf "OutputBuf" OpMemberName %OutputBuf 0 "result" OpName %output "output" + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "dstTextureFlipY" OpMemberName %Uniforms 1 "channelCount" @@ -46,7 +48,8 @@ OpDecorate %_runtimearr_uint ArrayStride 4 OpDecorate %output DescriptorSet 0 OpDecorate %output Binding 2 - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 1 Offset 4 OpMemberDecorate %Uniforms 2 Offset 8 @@ -70,261 +73,262 @@ %output = OpVariable %_ptr_StorageBuffer_OutputBuf StorageBuffer %v2uint = OpTypeVector %uint 2 %Uniforms = OpTypeStruct %uint %uint %v2uint %v2uint %v2uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %bool = OpTypeBool - %18 = OpTypeFunction %bool %float %float + %19 = OpTypeFunction %bool %float %float %float_0_00100000005 = OpConstant %float 0.00100000005 %void = OpTypeVoid - %29 = OpTypeFunction %void %v3uint + %30 = OpTypeFunction %void %v3uint %int = OpTypeInt 32 1 %int_0 = OpConstant %int 0 %v4float = OpTypeVector %float 4 - %43 = OpConstantNull %float + %44 = OpConstantNull %float %float_1 = OpConstant %float 1 - %45 = OpConstantComposite %v4float %43 %float_1 %43 %float_1 + %46 = OpConstantComposite %v4float %44 %float_1 %44 %float_1 %true = OpConstantTrue %bool %_ptr_Function_bool = OpTypePointer Function %bool - %49 = OpConstantNull %bool - %uint_3 = OpConstant %uint 3 + %50 = OpConstantNull %bool %uint_0 = OpConstant %uint 0 + %uint_3 = OpConstant %uint 3 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %uint_1 = OpConstant %uint 1 %uint_4 = OpConstant %uint 4 %v2int = OpTypeVector %int 2 - %97 = OpConstantNull %int + %98 = OpConstantNull %int %v4bool = OpTypeVector %bool 4 %_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint %uint_2 = OpConstant %uint 2 %_ptr_Function_v2uint = OpTypePointer Function %v2uint - %111 = OpConstantNull %v2uint + %112 = OpConstantNull %v2uint %_ptr_Function_uint = OpTypePointer Function %uint %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint - %199 = OpConstantNull %uint - %200 = OpTypeFunction %void - %aboutEqual = OpFunction %bool None %18 + %200 = OpConstantNull %uint + %201 = OpTypeFunction %void + %aboutEqual = OpFunction %bool None %19 %value = OpFunctionParameter %float %expect = OpFunctionParameter %float - %23 = OpLabel - %26 = OpFSub %float %value %expect - %24 = OpExtInst %float %25 FAbs %26 - %28 = OpFOrdLessThan %bool %24 %float_0_00100000005 - OpReturnValue %28 + %24 = OpLabel + %27 = OpFSub %float %value %expect + %25 = OpExtInst %float %26 FAbs %27 + %29 = OpFOrdLessThan %bool %25 %float_0_00100000005 + OpReturnValue %29 OpFunctionEnd - %main_inner = OpFunction %void None %29 + %main_inner = OpFunction %void None %30 %GlobalInvocationID = OpFunctionParameter %v3uint - %33 = OpLabel - %success = OpVariable %_ptr_Function_bool Function %49 -%srcTexCoord = OpVariable %_ptr_Function_v2uint Function %111 -%tint_symbol_1 = OpVariable %_ptr_Function_bool Function %49 -%tint_symbol = OpVariable %_ptr_Function_bool Function %49 -%tint_symbol_5 = OpVariable %_ptr_Function_bool Function %49 -%tint_symbol_4 = OpVariable %_ptr_Function_bool Function %49 -%tint_symbol_3 = OpVariable %_ptr_Function_bool Function %49 -%tint_symbol_2 = OpVariable %_ptr_Function_bool Function %49 - %35 = OpLoad %7 %src - %34 = OpImageQuerySizeLod %v2uint %35 %int_0 - %39 = OpLoad %7 %dst - %38 = OpImageQuerySizeLod %v2uint %39 %int_0 - %41 = OpVectorShuffle %v2uint %GlobalInvocationID %GlobalInvocationID 0 1 + %34 = OpLabel + %success = OpVariable %_ptr_Function_bool Function %50 +%srcTexCoord = OpVariable %_ptr_Function_v2uint Function %112 +%tint_symbol_1 = OpVariable %_ptr_Function_bool Function %50 +%tint_symbol = OpVariable %_ptr_Function_bool Function %50 +%tint_symbol_5 = OpVariable %_ptr_Function_bool Function %50 +%tint_symbol_4 = OpVariable %_ptr_Function_bool Function %50 +%tint_symbol_3 = OpVariable %_ptr_Function_bool Function %50 +%tint_symbol_2 = OpVariable %_ptr_Function_bool Function %50 + %36 = OpLoad %7 %src + %35 = OpImageQuerySizeLod %v2uint %36 %int_0 + %40 = OpLoad %7 %dst + %39 = OpImageQuerySizeLod %v2uint %40 %int_0 + %42 = OpVectorShuffle %v2uint %GlobalInvocationID %GlobalInvocationID 0 1 OpStore %success %true - %50 = OpCompositeExtract %uint %41 0 - %54 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_3 %uint_0 - %55 = OpLoad %uint %54 - %56 = OpULessThan %bool %50 %55 - OpSelectionMerge %57 None - OpBranchConditional %56 %57 %58 + %51 = OpCompositeExtract %uint %42 0 + %55 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_3 %uint_0 + %56 = OpLoad %uint %55 + %57 = OpULessThan %bool %51 %56 + OpSelectionMerge %58 None + OpBranchConditional %57 %58 %59 + %59 = OpLabel + %60 = OpCompositeExtract %uint %42 1 + %62 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_3 %uint_1 + %63 = OpLoad %uint %62 + %64 = OpULessThan %bool %60 %63 + OpBranch %58 %58 = OpLabel - %59 = OpCompositeExtract %uint %41 1 - %61 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_3 %uint_1 - %62 = OpLoad %uint %61 - %63 = OpULessThan %bool %59 %62 - OpBranch %57 - %57 = OpLabel - %64 = OpPhi %bool %56 %33 %63 %58 - OpSelectionMerge %65 None - OpBranchConditional %64 %65 %66 + %65 = OpPhi %bool %57 %34 %64 %59 + OpSelectionMerge %66 None + OpBranchConditional %65 %66 %67 + %67 = OpLabel + %68 = OpCompositeExtract %uint %42 0 + %69 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_3 %uint_0 + %70 = OpLoad %uint %69 + %72 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_4 %uint_0 + %73 = OpLoad %uint %72 + %74 = OpIAdd %uint %70 %73 + %75 = OpUGreaterThanEqual %bool %68 %74 + OpBranch %66 %66 = OpLabel - %67 = OpCompositeExtract %uint %41 0 - %68 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_3 %uint_0 - %69 = OpLoad %uint %68 - %71 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_4 %uint_0 - %72 = OpLoad %uint %71 - %73 = OpIAdd %uint %69 %72 - %74 = OpUGreaterThanEqual %bool %67 %73 - OpBranch %65 - %65 = OpLabel - %75 = OpPhi %bool %64 %57 %74 %66 - OpSelectionMerge %76 None - OpBranchConditional %75 %76 %77 + %76 = OpPhi %bool %65 %58 %75 %67 + OpSelectionMerge %77 None + OpBranchConditional %76 %77 %78 + %78 = OpLabel + %79 = OpCompositeExtract %uint %42 1 + %80 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_3 %uint_1 + %81 = OpLoad %uint %80 + %82 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_4 %uint_1 + %83 = OpLoad %uint %82 + %84 = OpIAdd %uint %81 %83 + %85 = OpUGreaterThanEqual %bool %79 %84 + OpBranch %77 %77 = OpLabel - %78 = OpCompositeExtract %uint %41 1 - %79 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_3 %uint_1 - %80 = OpLoad %uint %79 - %81 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_4 %uint_1 - %82 = OpLoad %uint %81 - %83 = OpIAdd %uint %80 %82 - %84 = OpUGreaterThanEqual %bool %78 %83 - OpBranch %76 - %76 = OpLabel - %85 = OpPhi %bool %75 %65 %84 %77 - OpSelectionMerge %86 None - OpBranchConditional %85 %87 %88 - %87 = OpLabel - %89 = OpLoad %bool %success - OpSelectionMerge %90 None - OpBranchConditional %89 %91 %90 - %91 = OpLabel - %94 = OpLoad %7 %dst - %95 = OpBitcast %v2int %41 - %93 = OpImageFetch %v4float %94 %95 Lod %97 - %98 = OpFOrdEqual %v4bool %93 %45 - %92 = OpAll %bool %98 - OpBranch %90 - %90 = OpLabel - %100 = OpPhi %bool %89 %87 %92 %91 - OpStore %success %100 - OpBranch %86 + %86 = OpPhi %bool %76 %66 %85 %78 + OpSelectionMerge %87 None + OpBranchConditional %86 %88 %89 %88 = OpLabel - %102 = OpAccessChain %_ptr_Uniform_v2uint %uniforms %uint_3 - %103 = OpLoad %v2uint %102 - %104 = OpISub %v2uint %41 %103 - %106 = OpAccessChain %_ptr_Uniform_v2uint %uniforms %uint_2 - %107 = OpLoad %v2uint %106 - %108 = OpIAdd %v2uint %104 %107 - OpStore %srcTexCoord %108 - %112 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %113 = OpLoad %uint %112 - %114 = OpIEqual %bool %113 %uint_1 - OpSelectionMerge %115 None - OpBranchConditional %114 %116 %115 + %90 = OpLoad %bool %success + OpSelectionMerge %91 None + OpBranchConditional %90 %92 %91 + %92 = OpLabel + %95 = OpLoad %7 %dst + %96 = OpBitcast %v2int %42 + %94 = OpImageFetch %v4float %95 %96 Lod %98 + %99 = OpFOrdEqual %v4bool %94 %46 + %93 = OpAll %bool %99 + OpBranch %91 + %91 = OpLabel + %101 = OpPhi %bool %90 %88 %93 %92 + OpStore %success %101 + OpBranch %87 + %89 = OpLabel + %103 = OpAccessChain %_ptr_Uniform_v2uint %uniforms %uint_0 %uint_3 + %104 = OpLoad %v2uint %103 + %105 = OpISub %v2uint %42 %104 + %107 = OpAccessChain %_ptr_Uniform_v2uint %uniforms %uint_0 %uint_2 + %108 = OpLoad %v2uint %107 + %109 = OpIAdd %v2uint %105 %108 + OpStore %srcTexCoord %109 + %113 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %114 = OpLoad %uint %113 + %115 = OpIEqual %bool %114 %uint_1 + OpSelectionMerge %116 None + OpBranchConditional %115 %117 %116 + %117 = OpLabel + %119 = OpAccessChain %_ptr_Function_uint %srcTexCoord %uint_1 + %120 = OpCompositeExtract %uint %35 1 + %121 = OpAccessChain %_ptr_Function_uint %srcTexCoord %uint_1 + %122 = OpLoad %uint %121 + %123 = OpISub %uint %120 %122 + %124 = OpISub %uint %123 %uint_1 + OpStore %119 %124 + OpBranch %116 %116 = OpLabel - %118 = OpAccessChain %_ptr_Function_uint %srcTexCoord %uint_1 - %119 = OpCompositeExtract %uint %34 1 - %120 = OpAccessChain %_ptr_Function_uint %srcTexCoord %uint_1 - %121 = OpLoad %uint %120 - %122 = OpISub %uint %119 %121 - %123 = OpISub %uint %122 %uint_1 - OpStore %118 %123 - OpBranch %115 - %115 = OpLabel - %125 = OpLoad %7 %src - %127 = OpLoad %v2uint %srcTexCoord - %126 = OpBitcast %v2int %127 - %124 = OpImageFetch %v4float %125 %126 Lod %97 - %129 = OpLoad %7 %dst - %130 = OpBitcast %v2int %41 - %128 = OpImageFetch %v4float %129 %130 Lod %97 - %131 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %132 = OpLoad %uint %131 - %133 = OpIEqual %bool %132 %uint_2 - OpSelectionMerge %134 None - OpBranchConditional %133 %135 %136 - %135 = OpLabel - %137 = OpLoad %bool %success - OpStore %tint_symbol_1 %137 - %139 = OpLoad %bool %tint_symbol_1 - OpSelectionMerge %140 None - OpBranchConditional %139 %141 %140 - %141 = OpLabel - %143 = OpCompositeExtract %float %128 0 - %144 = OpCompositeExtract %float %124 0 - %142 = OpFunctionCall %bool %aboutEqual %143 %144 - OpStore %tint_symbol_1 %142 - OpBranch %140 - %140 = OpLabel - %145 = OpLoad %bool %tint_symbol_1 - OpStore %tint_symbol %145 - %147 = OpLoad %bool %tint_symbol - OpSelectionMerge %148 None - OpBranchConditional %147 %149 %148 - %149 = OpLabel - %151 = OpCompositeExtract %float %128 1 - %152 = OpCompositeExtract %float %124 1 - %150 = OpFunctionCall %bool %aboutEqual %151 %152 - OpStore %tint_symbol %150 - OpBranch %148 - %148 = OpLabel - %153 = OpLoad %bool %tint_symbol - OpStore %success %153 - OpBranch %134 + %126 = OpLoad %7 %src + %128 = OpLoad %v2uint %srcTexCoord + %127 = OpBitcast %v2int %128 + %125 = OpImageFetch %v4float %126 %127 Lod %98 + %130 = OpLoad %7 %dst + %131 = OpBitcast %v2int %42 + %129 = OpImageFetch %v4float %130 %131 Lod %98 + %132 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 + %133 = OpLoad %uint %132 + %134 = OpIEqual %bool %133 %uint_2 + OpSelectionMerge %135 None + OpBranchConditional %134 %136 %137 %136 = OpLabel - %154 = OpLoad %bool %success - OpStore %tint_symbol_5 %154 - %156 = OpLoad %bool %tint_symbol_5 - OpSelectionMerge %157 None - OpBranchConditional %156 %158 %157 + %138 = OpLoad %bool %success + OpStore %tint_symbol_1 %138 + %140 = OpLoad %bool %tint_symbol_1 + OpSelectionMerge %141 None + OpBranchConditional %140 %142 %141 + %142 = OpLabel + %144 = OpCompositeExtract %float %129 0 + %145 = OpCompositeExtract %float %125 0 + %143 = OpFunctionCall %bool %aboutEqual %144 %145 + OpStore %tint_symbol_1 %143 + OpBranch %141 + %141 = OpLabel + %146 = OpLoad %bool %tint_symbol_1 + OpStore %tint_symbol %146 + %148 = OpLoad %bool %tint_symbol + OpSelectionMerge %149 None + OpBranchConditional %148 %150 %149 + %150 = OpLabel + %152 = OpCompositeExtract %float %129 1 + %153 = OpCompositeExtract %float %125 1 + %151 = OpFunctionCall %bool %aboutEqual %152 %153 + OpStore %tint_symbol %151 + OpBranch %149 + %149 = OpLabel + %154 = OpLoad %bool %tint_symbol + OpStore %success %154 + OpBranch %135 + %137 = OpLabel + %155 = OpLoad %bool %success + OpStore %tint_symbol_5 %155 + %157 = OpLoad %bool %tint_symbol_5 + OpSelectionMerge %158 None + OpBranchConditional %157 %159 %158 + %159 = OpLabel + %161 = OpCompositeExtract %float %129 0 + %162 = OpCompositeExtract %float %125 0 + %160 = OpFunctionCall %bool %aboutEqual %161 %162 + OpStore %tint_symbol_5 %160 + OpBranch %158 %158 = OpLabel - %160 = OpCompositeExtract %float %128 0 - %161 = OpCompositeExtract %float %124 0 - %159 = OpFunctionCall %bool %aboutEqual %160 %161 - OpStore %tint_symbol_5 %159 - OpBranch %157 - %157 = OpLabel - %162 = OpLoad %bool %tint_symbol_5 - OpStore %tint_symbol_4 %162 - %164 = OpLoad %bool %tint_symbol_4 - OpSelectionMerge %165 None - OpBranchConditional %164 %166 %165 + %163 = OpLoad %bool %tint_symbol_5 + OpStore %tint_symbol_4 %163 + %165 = OpLoad %bool %tint_symbol_4 + OpSelectionMerge %166 None + OpBranchConditional %165 %167 %166 + %167 = OpLabel + %169 = OpCompositeExtract %float %129 1 + %170 = OpCompositeExtract %float %125 1 + %168 = OpFunctionCall %bool %aboutEqual %169 %170 + OpStore %tint_symbol_4 %168 + OpBranch %166 %166 = OpLabel - %168 = OpCompositeExtract %float %128 1 - %169 = OpCompositeExtract %float %124 1 - %167 = OpFunctionCall %bool %aboutEqual %168 %169 - OpStore %tint_symbol_4 %167 - OpBranch %165 - %165 = OpLabel - %170 = OpLoad %bool %tint_symbol_4 - OpStore %tint_symbol_3 %170 - %172 = OpLoad %bool %tint_symbol_3 - OpSelectionMerge %173 None - OpBranchConditional %172 %174 %173 + %171 = OpLoad %bool %tint_symbol_4 + OpStore %tint_symbol_3 %171 + %173 = OpLoad %bool %tint_symbol_3 + OpSelectionMerge %174 None + OpBranchConditional %173 %175 %174 + %175 = OpLabel + %177 = OpCompositeExtract %float %129 2 + %178 = OpCompositeExtract %float %125 2 + %176 = OpFunctionCall %bool %aboutEqual %177 %178 + OpStore %tint_symbol_3 %176 + OpBranch %174 %174 = OpLabel - %176 = OpCompositeExtract %float %128 2 - %177 = OpCompositeExtract %float %124 2 - %175 = OpFunctionCall %bool %aboutEqual %176 %177 - OpStore %tint_symbol_3 %175 - OpBranch %173 - %173 = OpLabel - %178 = OpLoad %bool %tint_symbol_3 - OpStore %tint_symbol_2 %178 - %180 = OpLoad %bool %tint_symbol_2 - OpSelectionMerge %181 None - OpBranchConditional %180 %182 %181 + %179 = OpLoad %bool %tint_symbol_3 + OpStore %tint_symbol_2 %179 + %181 = OpLoad %bool %tint_symbol_2 + OpSelectionMerge %182 None + OpBranchConditional %181 %183 %182 + %183 = OpLabel + %185 = OpCompositeExtract %float %129 3 + %186 = OpCompositeExtract %float %125 3 + %184 = OpFunctionCall %bool %aboutEqual %185 %186 + OpStore %tint_symbol_2 %184 + OpBranch %182 %182 = OpLabel - %184 = OpCompositeExtract %float %128 3 - %185 = OpCompositeExtract %float %124 3 - %183 = OpFunctionCall %bool %aboutEqual %184 %185 - OpStore %tint_symbol_2 %183 - OpBranch %181 - %181 = OpLabel - %186 = OpLoad %bool %tint_symbol_2 - OpStore %success %186 - OpBranch %134 - %134 = OpLabel - OpBranch %86 - %86 = OpLabel - %187 = OpCompositeExtract %uint %GlobalInvocationID 1 - %188 = OpCompositeExtract %uint %38 0 - %189 = OpIMul %uint %187 %188 - %190 = OpCompositeExtract %uint %GlobalInvocationID 0 - %191 = OpIAdd %uint %189 %190 - %192 = OpLoad %bool %success - OpSelectionMerge %193 None - OpBranchConditional %192 %194 %195 - %194 = OpLabel - %197 = OpAccessChain %_ptr_StorageBuffer_uint %output %uint_0 %191 - OpStore %197 %uint_1 - OpBranch %193 + %187 = OpLoad %bool %tint_symbol_2 + OpStore %success %187 + OpBranch %135 + %135 = OpLabel + OpBranch %87 + %87 = OpLabel + %188 = OpCompositeExtract %uint %GlobalInvocationID 1 + %189 = OpCompositeExtract %uint %39 0 + %190 = OpIMul %uint %188 %189 + %191 = OpCompositeExtract %uint %GlobalInvocationID 0 + %192 = OpIAdd %uint %190 %191 + %193 = OpLoad %bool %success + OpSelectionMerge %194 None + OpBranchConditional %193 %195 %196 %195 = OpLabel - %198 = OpAccessChain %_ptr_StorageBuffer_uint %output %uint_0 %191 - OpStore %198 %199 - OpBranch %193 - %193 = OpLabel + %198 = OpAccessChain %_ptr_StorageBuffer_uint %output %uint_0 %192 + OpStore %198 %uint_1 + OpBranch %194 + %196 = OpLabel + %199 = OpAccessChain %_ptr_StorageBuffer_uint %output %uint_0 %192 + OpStore %199 %200 + OpBranch %194 + %194 = OpLabel OpReturn OpFunctionEnd - %main = OpFunction %void None %200 - %202 = OpLabel - %204 = OpLoad %v3uint %GlobalInvocationID_1 - %203 = OpFunctionCall %void %main_inner %204 + %main = OpFunction %void None %201 + %203 = OpLabel + %205 = OpLoad %v3uint %GlobalInvocationID_1 + %204 = OpFunctionCall %void %main_inner %205 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/914.wgsl.expected.glsl b/test/tint/bug/tint/914.wgsl.expected.glsl index b9ebe4a1d9..31c557b21d 100644 --- a/test/tint/bug/tint/914.wgsl.expected.glsl +++ b/test/tint/bug/tint/914.wgsl.expected.glsl @@ -1,5 +1,12 @@ #version 310 es +struct Uniforms { + uint dimAOuter; + uint dimInner; + uint dimBOuter; + uint pad; +}; + layout(binding = 0, std430) buffer Matrix_ssbo { float numbers[]; } firstMatrix; @@ -12,44 +19,41 @@ layout(binding = 2, std430) buffer Matrix_ssbo_2 { float numbers[]; } resultMatrix; -layout(binding = 3, std140) uniform Uniforms_ubo { - uint dimAOuter; - uint dimInner; - uint dimBOuter; - uint pad; +layout(binding = 3, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; float mm_readA(uint row, uint col) { - bool tint_tmp = (row < uniforms.dimAOuter); + bool tint_tmp = (row < uniforms.inner.dimAOuter); if (tint_tmp) { - tint_tmp = (col < uniforms.dimInner); + tint_tmp = (col < uniforms.inner.dimInner); } if ((tint_tmp)) { - float result = firstMatrix.numbers[((row * uniforms.dimInner) + col)]; + float result = firstMatrix.numbers[((row * uniforms.inner.dimInner) + col)]; return result; } return 0.0f; } float mm_readB(uint row, uint col) { - bool tint_tmp_1 = (row < uniforms.dimInner); + bool tint_tmp_1 = (row < uniforms.inner.dimInner); if (tint_tmp_1) { - tint_tmp_1 = (col < uniforms.dimBOuter); + tint_tmp_1 = (col < uniforms.inner.dimBOuter); } if ((tint_tmp_1)) { - float result = secondMatrix.numbers[((row * uniforms.dimBOuter) + col)]; + float result = secondMatrix.numbers[((row * uniforms.inner.dimBOuter) + col)]; return result; } return 0.0f; } void mm_write(uint row, uint col, float value) { - bool tint_tmp_2 = (row < uniforms.dimAOuter); + bool tint_tmp_2 = (row < uniforms.inner.dimAOuter); if (tint_tmp_2) { - tint_tmp_2 = (col < uniforms.dimBOuter); + tint_tmp_2 = (col < uniforms.inner.dimBOuter); } if ((tint_tmp_2)) { - uint index = (col + (row * uniforms.dimBOuter)); + uint index = (col + (row * uniforms.inner.dimBOuter)); resultMatrix.numbers[index] = value; } } @@ -70,7 +74,7 @@ void tint_symbol(uvec3 local_id, uvec3 global_id, uint local_invocation_index) { uint tileCol = (local_id.x * 4u); uint globalRow = (global_id.y * 4u); uint globalCol = (global_id.x * 4u); - uint numTiles = (((uniforms.dimInner - 1u) / 64u) + 1u); + uint numTiles = (((uniforms.inner.dimInner - 1u) / 64u) + 1u); float acc[16] = float[16](0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); float ACached = 0.0f; float BCached[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f); diff --git a/test/tint/bug/tint/914.wgsl.expected.spvasm b/test/tint/bug/tint/914.wgsl.expected.spvasm index 3c733d4b2f..f6ddfb7ea0 100644 --- a/test/tint/bug/tint/914.wgsl.expected.spvasm +++ b/test/tint/bug/tint/914.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 388 +; Bound: 389 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -15,6 +15,8 @@ OpName %firstMatrix "firstMatrix" OpName %secondMatrix "secondMatrix" OpName %resultMatrix "resultMatrix" + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "dimAOuter" OpMemberName %Uniforms 1 "dimInner" @@ -71,7 +73,8 @@ OpDecorate %secondMatrix Binding 1 OpDecorate %resultMatrix DescriptorSet 0 OpDecorate %resultMatrix Binding 2 - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 1 Offset 4 OpMemberDecorate %Uniforms 2 Offset 8 @@ -97,20 +100,21 @@ %secondMatrix = OpVariable %_ptr_StorageBuffer_Matrix StorageBuffer %resultMatrix = OpVariable %_ptr_StorageBuffer_Matrix StorageBuffer %Uniforms = OpTypeStruct %uint %uint %uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %uint_64 = OpConstant %uint 64 %_arr_float_uint_64 = OpTypeArray %float %uint_64 %_arr__arr_float_uint_64_uint_64 = OpTypeArray %_arr_float_uint_64 %uint_64 %_ptr_Workgroup__arr__arr_float_uint_64_uint_64 = OpTypePointer Workgroup %_arr__arr_float_uint_64_uint_64 %mm_Asub = OpVariable %_ptr_Workgroup__arr__arr_float_uint_64_uint_64 Workgroup %mm_Bsub = OpVariable %_ptr_Workgroup__arr__arr_float_uint_64_uint_64 Workgroup - %24 = OpTypeFunction %float %uint %uint + %25 = OpTypeFunction %float %uint %uint %bool = OpTypeBool %_ptr_Function_bool = OpTypePointer Function %bool - %32 = OpConstantNull %bool + %33 = OpConstantNull %bool %_ptr_Function_float = OpTypePointer Function %float - %35 = OpConstantNull %float + %36 = OpConstantNull %float %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %uint_1 = OpConstant %uint 1 @@ -118,10 +122,10 @@ %true = OpConstantTrue %bool %uint_2 = OpConstant %uint 2 %void = OpTypeVoid - %92 = OpTypeFunction %void %uint %uint %float - %115 = OpTypeFunction %void %v3uint %v3uint %uint + %93 = OpTypeFunction %void %uint %uint %float + %116 = OpTypeFunction %void %v3uint %v3uint %uint %_ptr_Function_uint = OpTypePointer Function %uint - %123 = OpConstantNull %uint + %124 = OpConstantNull %uint %uint_4096 = OpConstant %uint 4096 %_ptr_Workgroup_float = OpTypePointer Workgroup %float %uint_256 = OpConstant %uint 256 @@ -130,523 +134,523 @@ %uint_16 = OpConstant %uint 16 %_arr_float_uint_16 = OpTypeArray %float %uint_16 %_ptr_Function__arr_float_uint_16 = OpTypePointer Function %_arr_float_uint_16 - %164 = OpConstantNull %_arr_float_uint_16 + %165 = OpConstantNull %_arr_float_uint_16 %_arr_float_uint_4 = OpTypeArray %float %uint_4 %_ptr_Function__arr_float_uint_4 = OpTypePointer Function %_arr_float_uint_4 - %169 = OpConstantNull %_arr_float_uint_4 - %381 = OpTypeFunction %void - %mm_readA = OpFunction %float None %24 + %170 = OpConstantNull %_arr_float_uint_4 + %382 = OpTypeFunction %void + %mm_readA = OpFunction %float None %25 %row = OpFunctionParameter %uint %col = OpFunctionParameter %uint - %28 = OpLabel -%tint_return_flag = OpVariable %_ptr_Function_bool Function %32 -%tint_return_value = OpVariable %_ptr_Function_float Function %35 - %38 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %39 = OpLoad %uint %38 - %40 = OpULessThan %bool %row %39 - OpSelectionMerge %41 None - OpBranchConditional %40 %42 %41 + %29 = OpLabel +%tint_return_flag = OpVariable %_ptr_Function_bool Function %33 +%tint_return_value = OpVariable %_ptr_Function_float Function %36 + %39 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %40 = OpLoad %uint %39 + %41 = OpULessThan %bool %row %40 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %42 + %43 = OpLabel + %45 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 + %46 = OpLoad %uint %45 + %47 = OpULessThan %bool %col %46 + OpBranch %42 %42 = OpLabel - %44 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %45 = OpLoad %uint %44 - %46 = OpULessThan %bool %col %45 - OpBranch %41 - %41 = OpLabel - %47 = OpPhi %bool %40 %28 %46 %42 - OpSelectionMerge %48 None - OpBranchConditional %47 %49 %48 + %48 = OpPhi %bool %41 %29 %47 %43 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %49 + %50 = OpLabel + %51 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 + %52 = OpLoad %uint %51 + %53 = OpIMul %uint %row %52 + %54 = OpIAdd %uint %53 %col + %56 = OpAccessChain %_ptr_StorageBuffer_float %firstMatrix %uint_0 %54 + %57 = OpLoad %float %56 + OpStore %tint_return_flag %true + OpStore %tint_return_value %57 + OpBranch %49 %49 = OpLabel - %50 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %51 = OpLoad %uint %50 - %52 = OpIMul %uint %row %51 - %53 = OpIAdd %uint %52 %col - %55 = OpAccessChain %_ptr_StorageBuffer_float %firstMatrix %uint_0 %53 - %56 = OpLoad %float %55 + %60 = OpLoad %bool %tint_return_flag + %59 = OpLogicalNot %bool %60 + OpSelectionMerge %61 None + OpBranchConditional %59 %62 %61 + %62 = OpLabel OpStore %tint_return_flag %true - OpStore %tint_return_value %56 - OpBranch %48 - %48 = OpLabel - %59 = OpLoad %bool %tint_return_flag - %58 = OpLogicalNot %bool %59 - OpSelectionMerge %60 None - OpBranchConditional %58 %61 %60 + OpStore %tint_return_value %36 + OpBranch %61 %61 = OpLabel - OpStore %tint_return_flag %true - OpStore %tint_return_value %35 - OpBranch %60 - %60 = OpLabel - %62 = OpLoad %float %tint_return_value - OpReturnValue %62 + %63 = OpLoad %float %tint_return_value + OpReturnValue %63 OpFunctionEnd - %mm_readB = OpFunction %float None %24 + %mm_readB = OpFunction %float None %25 %row_0 = OpFunctionParameter %uint %col_0 = OpFunctionParameter %uint - %66 = OpLabel -%tint_return_flag_1 = OpVariable %_ptr_Function_bool Function %32 -%tint_return_value_1 = OpVariable %_ptr_Function_float Function %35 - %69 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %70 = OpLoad %uint %69 - %71 = OpULessThan %bool %row_0 %70 - OpSelectionMerge %72 None - OpBranchConditional %71 %73 %72 + %67 = OpLabel +%tint_return_flag_1 = OpVariable %_ptr_Function_bool Function %33 +%tint_return_value_1 = OpVariable %_ptr_Function_float Function %36 + %70 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 + %71 = OpLoad %uint %70 + %72 = OpULessThan %bool %row_0 %71 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %73 + %74 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_2 + %77 = OpLoad %uint %76 + %78 = OpULessThan %bool %col_0 %77 + OpBranch %73 %73 = OpLabel - %75 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2 - %76 = OpLoad %uint %75 - %77 = OpULessThan %bool %col_0 %76 - OpBranch %72 - %72 = OpLabel - %78 = OpPhi %bool %71 %66 %77 %73 - OpSelectionMerge %79 None - OpBranchConditional %78 %80 %79 + %79 = OpPhi %bool %72 %67 %78 %74 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %80 + %81 = OpLabel + %82 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_2 + %83 = OpLoad %uint %82 + %84 = OpIMul %uint %row_0 %83 + %85 = OpIAdd %uint %84 %col_0 + %86 = OpAccessChain %_ptr_StorageBuffer_float %secondMatrix %uint_0 %85 + %87 = OpLoad %float %86 + OpStore %tint_return_flag_1 %true + OpStore %tint_return_value_1 %87 + OpBranch %80 %80 = OpLabel - %81 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2 - %82 = OpLoad %uint %81 - %83 = OpIMul %uint %row_0 %82 - %84 = OpIAdd %uint %83 %col_0 - %85 = OpAccessChain %_ptr_StorageBuffer_float %secondMatrix %uint_0 %84 - %86 = OpLoad %float %85 + %89 = OpLoad %bool %tint_return_flag_1 + %88 = OpLogicalNot %bool %89 + OpSelectionMerge %90 None + OpBranchConditional %88 %91 %90 + %91 = OpLabel OpStore %tint_return_flag_1 %true - OpStore %tint_return_value_1 %86 - OpBranch %79 - %79 = OpLabel - %88 = OpLoad %bool %tint_return_flag_1 - %87 = OpLogicalNot %bool %88 - OpSelectionMerge %89 None - OpBranchConditional %87 %90 %89 + OpStore %tint_return_value_1 %36 + OpBranch %90 %90 = OpLabel - OpStore %tint_return_flag_1 %true - OpStore %tint_return_value_1 %35 - OpBranch %89 - %89 = OpLabel - %91 = OpLoad %float %tint_return_value_1 - OpReturnValue %91 + %92 = OpLoad %float %tint_return_value_1 + OpReturnValue %92 OpFunctionEnd - %mm_write = OpFunction %void None %92 + %mm_write = OpFunction %void None %93 %row_1 = OpFunctionParameter %uint %col_1 = OpFunctionParameter %uint %value = OpFunctionParameter %float - %98 = OpLabel - %99 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %100 = OpLoad %uint %99 - %101 = OpULessThan %bool %row_1 %100 - OpSelectionMerge %102 None - OpBranchConditional %101 %103 %102 + %99 = OpLabel + %100 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %101 = OpLoad %uint %100 + %102 = OpULessThan %bool %row_1 %101 + OpSelectionMerge %103 None + OpBranchConditional %102 %104 %103 + %104 = OpLabel + %105 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_2 + %106 = OpLoad %uint %105 + %107 = OpULessThan %bool %col_1 %106 + OpBranch %103 %103 = OpLabel - %104 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2 - %105 = OpLoad %uint %104 - %106 = OpULessThan %bool %col_1 %105 - OpBranch %102 - %102 = OpLabel - %107 = OpPhi %bool %101 %98 %106 %103 - OpSelectionMerge %108 None - OpBranchConditional %107 %109 %108 + %108 = OpPhi %bool %102 %99 %107 %104 + OpSelectionMerge %109 None + OpBranchConditional %108 %110 %109 + %110 = OpLabel + %111 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_2 + %112 = OpLoad %uint %111 + %113 = OpIMul %uint %row_1 %112 + %114 = OpIAdd %uint %col_1 %113 + %115 = OpAccessChain %_ptr_StorageBuffer_float %resultMatrix %uint_0 %114 + OpStore %115 %value + OpBranch %109 %109 = OpLabel - %110 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_2 - %111 = OpLoad %uint %110 - %112 = OpIMul %uint %row_1 %111 - %113 = OpIAdd %uint %col_1 %112 - %114 = OpAccessChain %_ptr_StorageBuffer_float %resultMatrix %uint_0 %113 - OpStore %114 %value - OpBranch %108 - %108 = OpLabel OpReturn OpFunctionEnd - %main_inner = OpFunction %void None %115 + %main_inner = OpFunction %void None %116 %local_id = OpFunctionParameter %v3uint %global_id = OpFunctionParameter %v3uint %local_invocation_index = OpFunctionParameter %uint - %120 = OpLabel - %idx = OpVariable %_ptr_Function_uint Function %123 - %acc = OpVariable %_ptr_Function__arr_float_uint_16 Function %164 - %ACached = OpVariable %_ptr_Function_float Function %35 - %BCached = OpVariable %_ptr_Function__arr_float_uint_4 Function %169 - %index = OpVariable %_ptr_Function_uint Function %123 - %t = OpVariable %_ptr_Function_uint Function %123 - %innerRow = OpVariable %_ptr_Function_uint Function %123 - %innerCol = OpVariable %_ptr_Function_uint Function %123 - %innerRow_0 = OpVariable %_ptr_Function_uint Function %123 - %innerCol_0 = OpVariable %_ptr_Function_uint Function %123 - %k = OpVariable %_ptr_Function_uint Function %123 - %inner = OpVariable %_ptr_Function_uint Function %123 - %innerRow_1 = OpVariable %_ptr_Function_uint Function %123 - %innerCol_1 = OpVariable %_ptr_Function_uint Function %123 - %innerRow_2 = OpVariable %_ptr_Function_uint Function %123 - %innerCol_2 = OpVariable %_ptr_Function_uint Function %123 + %121 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function %124 + %acc = OpVariable %_ptr_Function__arr_float_uint_16 Function %165 + %ACached = OpVariable %_ptr_Function_float Function %36 + %BCached = OpVariable %_ptr_Function__arr_float_uint_4 Function %170 + %index = OpVariable %_ptr_Function_uint Function %124 + %t = OpVariable %_ptr_Function_uint Function %124 + %innerRow = OpVariable %_ptr_Function_uint Function %124 + %innerCol = OpVariable %_ptr_Function_uint Function %124 + %innerRow_0 = OpVariable %_ptr_Function_uint Function %124 + %innerCol_0 = OpVariable %_ptr_Function_uint Function %124 + %k = OpVariable %_ptr_Function_uint Function %124 + %inner = OpVariable %_ptr_Function_uint Function %124 + %innerRow_1 = OpVariable %_ptr_Function_uint Function %124 + %innerCol_1 = OpVariable %_ptr_Function_uint Function %124 + %innerRow_2 = OpVariable %_ptr_Function_uint Function %124 + %innerCol_2 = OpVariable %_ptr_Function_uint Function %124 OpStore %idx %local_invocation_index - OpBranch %124 - %124 = OpLabel - OpLoopMerge %125 %126 None + OpBranch %125 + %125 = OpLabel + OpLoopMerge %126 %127 None + OpBranch %128 + %128 = OpLabel + %130 = OpLoad %uint %idx + %132 = OpULessThan %bool %130 %uint_4096 + %129 = OpLogicalNot %bool %132 + OpSelectionMerge %133 None + OpBranchConditional %129 %134 %133 + %134 = OpLabel + OpBranch %126 + %133 = OpLabel + %135 = OpLoad %uint %idx + %136 = OpUDiv %uint %135 %uint_64 + %137 = OpLoad %uint %idx + %138 = OpUMod %uint %137 %uint_64 + %140 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %136 %138 + OpStore %140 %36 + %141 = OpAccessChain %_ptr_Workgroup_float %mm_Bsub %136 %138 + OpStore %141 %36 OpBranch %127 %127 = OpLabel - %129 = OpLoad %uint %idx - %131 = OpULessThan %bool %129 %uint_4096 - %128 = OpLogicalNot %bool %131 - OpSelectionMerge %132 None - OpBranchConditional %128 %133 %132 - %133 = OpLabel + %142 = OpLoad %uint %idx + %144 = OpIAdd %uint %142 %uint_256 + OpStore %idx %144 OpBranch %125 - %132 = OpLabel - %134 = OpLoad %uint %idx - %135 = OpUDiv %uint %134 %uint_64 - %136 = OpLoad %uint %idx - %137 = OpUMod %uint %136 %uint_64 - %139 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %135 %137 - OpStore %139 %35 - %140 = OpAccessChain %_ptr_Workgroup_float %mm_Bsub %135 %137 - OpStore %140 %35 - OpBranch %126 %126 = OpLabel - %141 = OpLoad %uint %idx - %143 = OpIAdd %uint %141 %uint_256 - OpStore %idx %143 - OpBranch %124 - %125 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_264 - %146 = OpCompositeExtract %uint %local_id 1 - %148 = OpIMul %uint %146 %uint_4 - %149 = OpCompositeExtract %uint %local_id 0 - %150 = OpIMul %uint %149 %uint_4 - %151 = OpCompositeExtract %uint %global_id 1 - %152 = OpIMul %uint %151 %uint_4 - %153 = OpCompositeExtract %uint %global_id 0 - %154 = OpIMul %uint %153 %uint_4 - %155 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %156 = OpLoad %uint %155 - %157 = OpISub %uint %156 %uint_1 - %158 = OpUDiv %uint %157 %uint_64 - %159 = OpIAdd %uint %158 %uint_1 - OpStore %index %123 - OpBranch %171 - %171 = OpLabel - OpLoopMerge %172 %173 None + %147 = OpCompositeExtract %uint %local_id 1 + %149 = OpIMul %uint %147 %uint_4 + %150 = OpCompositeExtract %uint %local_id 0 + %151 = OpIMul %uint %150 %uint_4 + %152 = OpCompositeExtract %uint %global_id 1 + %153 = OpIMul %uint %152 %uint_4 + %154 = OpCompositeExtract %uint %global_id 0 + %155 = OpIMul %uint %154 %uint_4 + %156 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 + %157 = OpLoad %uint %156 + %158 = OpISub %uint %157 %uint_1 + %159 = OpUDiv %uint %158 %uint_64 + %160 = OpIAdd %uint %159 %uint_1 + OpStore %index %124 + OpBranch %172 + %172 = OpLabel + OpLoopMerge %173 %174 None + OpBranch %175 + %175 = OpLabel + %177 = OpLoad %uint %index + %178 = OpULessThan %bool %177 %uint_16 + %176 = OpLogicalNot %bool %178 + OpSelectionMerge %179 None + OpBranchConditional %176 %180 %179 + %180 = OpLabel + OpBranch %173 + %179 = OpLabel + %181 = OpLoad %uint %index + %182 = OpAccessChain %_ptr_Function_float %acc %181 + OpStore %182 %36 OpBranch %174 %174 = OpLabel - %176 = OpLoad %uint %index - %177 = OpULessThan %bool %176 %uint_16 - %175 = OpLogicalNot %bool %177 - OpSelectionMerge %178 None - OpBranchConditional %175 %179 %178 - %179 = OpLabel + %183 = OpLoad %uint %index + %184 = OpIAdd %uint %183 %uint_1 + OpStore %index %184 OpBranch %172 - %178 = OpLabel - %180 = OpLoad %uint %index - %181 = OpAccessChain %_ptr_Function_float %acc %180 - OpStore %181 %35 - OpBranch %173 %173 = OpLabel - %182 = OpLoad %uint %index - %183 = OpIAdd %uint %182 %uint_1 - OpStore %index %183 - OpBranch %171 - %172 = OpLabel - %184 = OpCompositeExtract %uint %local_id 0 - %185 = OpIMul %uint %184 %uint_4 - %186 = OpCompositeExtract %uint %local_id 1 - %187 = OpIMul %uint %186 %uint_4 - OpStore %t %123 - OpBranch %189 - %189 = OpLabel - OpLoopMerge %190 %191 None - OpBranch %192 - %192 = OpLabel - %194 = OpLoad %uint %t - %195 = OpULessThan %bool %194 %159 - %193 = OpLogicalNot %bool %195 - OpSelectionMerge %196 None - OpBranchConditional %193 %197 %196 - %197 = OpLabel + %185 = OpCompositeExtract %uint %local_id 0 + %186 = OpIMul %uint %185 %uint_4 + %187 = OpCompositeExtract %uint %local_id 1 + %188 = OpIMul %uint %187 %uint_4 + OpStore %t %124 OpBranch %190 - %196 = OpLabel - OpStore %innerRow %123 - OpBranch %199 - %199 = OpLabel - OpLoopMerge %200 %201 None - OpBranch %202 - %202 = OpLabel - %204 = OpLoad %uint %innerRow - %205 = OpULessThan %bool %204 %uint_4 - %203 = OpLogicalNot %bool %205 - OpSelectionMerge %206 None - OpBranchConditional %203 %207 %206 - %207 = OpLabel + %190 = OpLabel + OpLoopMerge %191 %192 None + OpBranch %193 + %193 = OpLabel + %195 = OpLoad %uint %t + %196 = OpULessThan %bool %195 %160 + %194 = OpLogicalNot %bool %196 + OpSelectionMerge %197 None + OpBranchConditional %194 %198 %197 + %198 = OpLabel + OpBranch %191 + %197 = OpLabel + OpStore %innerRow %124 OpBranch %200 - %206 = OpLabel - OpStore %innerCol %123 - OpBranch %209 - %209 = OpLabel - OpLoopMerge %210 %211 None + %200 = OpLabel + OpLoopMerge %201 %202 None + OpBranch %203 + %203 = OpLabel + %205 = OpLoad %uint %innerRow + %206 = OpULessThan %bool %205 %uint_4 + %204 = OpLogicalNot %bool %206 + OpSelectionMerge %207 None + OpBranchConditional %204 %208 %207 + %208 = OpLabel + OpBranch %201 + %207 = OpLabel + OpStore %innerCol %124 + OpBranch %210 + %210 = OpLabel + OpLoopMerge %211 %212 None + OpBranch %213 + %213 = OpLabel + %215 = OpLoad %uint %innerCol + %216 = OpULessThan %bool %215 %uint_4 + %214 = OpLogicalNot %bool %216 + OpSelectionMerge %217 None + OpBranchConditional %214 %218 %217 + %218 = OpLabel + OpBranch %211 + %217 = OpLabel + %219 = OpLoad %uint %innerRow + %220 = OpIAdd %uint %149 %219 + %221 = OpLoad %uint %innerCol + %222 = OpIAdd %uint %186 %221 + %224 = OpLoad %uint %innerRow + %225 = OpIAdd %uint %153 %224 + %226 = OpLoad %uint %t + %227 = OpIMul %uint %226 %uint_64 + %228 = OpIAdd %uint %227 %222 + %223 = OpFunctionCall %float %mm_readA %225 %228 + %229 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %220 %222 + OpStore %229 %223 OpBranch %212 %212 = OpLabel - %214 = OpLoad %uint %innerCol - %215 = OpULessThan %bool %214 %uint_4 - %213 = OpLogicalNot %bool %215 - OpSelectionMerge %216 None - OpBranchConditional %213 %217 %216 - %217 = OpLabel + %230 = OpLoad %uint %innerCol + %231 = OpIAdd %uint %230 %uint_1 + OpStore %innerCol %231 OpBranch %210 - %216 = OpLabel - %218 = OpLoad %uint %innerRow - %219 = OpIAdd %uint %148 %218 - %220 = OpLoad %uint %innerCol - %221 = OpIAdd %uint %185 %220 - %223 = OpLoad %uint %innerRow - %224 = OpIAdd %uint %152 %223 - %225 = OpLoad %uint %t - %226 = OpIMul %uint %225 %uint_64 - %227 = OpIAdd %uint %226 %221 - %222 = OpFunctionCall %float %mm_readA %224 %227 - %228 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %219 %221 - OpStore %228 %222 - OpBranch %211 %211 = OpLabel - %229 = OpLoad %uint %innerCol - %230 = OpIAdd %uint %229 %uint_1 - OpStore %innerCol %230 - OpBranch %209 - %210 = OpLabel - OpBranch %201 + OpBranch %202 + %202 = OpLabel + %232 = OpLoad %uint %innerRow + %233 = OpIAdd %uint %232 %uint_1 + OpStore %innerRow %233 + OpBranch %200 %201 = OpLabel - %231 = OpLoad %uint %innerRow - %232 = OpIAdd %uint %231 %uint_1 - OpStore %innerRow %232 - OpBranch %199 - %200 = OpLabel - OpStore %innerRow_0 %123 - OpBranch %234 - %234 = OpLabel - OpLoopMerge %235 %236 None - OpBranch %237 - %237 = OpLabel - %239 = OpLoad %uint %innerRow_0 - %240 = OpULessThan %bool %239 %uint_4 - %238 = OpLogicalNot %bool %240 - OpSelectionMerge %241 None - OpBranchConditional %238 %242 %241 - %242 = OpLabel + OpStore %innerRow_0 %124 OpBranch %235 - %241 = OpLabel - OpStore %innerCol_0 %123 - OpBranch %244 - %244 = OpLabel - OpLoopMerge %245 %246 None + %235 = OpLabel + OpLoopMerge %236 %237 None + OpBranch %238 + %238 = OpLabel + %240 = OpLoad %uint %innerRow_0 + %241 = OpULessThan %bool %240 %uint_4 + %239 = OpLogicalNot %bool %241 + OpSelectionMerge %242 None + OpBranchConditional %239 %243 %242 + %243 = OpLabel + OpBranch %236 + %242 = OpLabel + OpStore %innerCol_0 %124 + OpBranch %245 + %245 = OpLabel + OpLoopMerge %246 %247 None + OpBranch %248 + %248 = OpLabel + %250 = OpLoad %uint %innerCol_0 + %251 = OpULessThan %bool %250 %uint_4 + %249 = OpLogicalNot %bool %251 + OpSelectionMerge %252 None + OpBranchConditional %249 %253 %252 + %253 = OpLabel + OpBranch %246 + %252 = OpLabel + %254 = OpLoad %uint %innerRow_0 + %255 = OpIAdd %uint %188 %254 + %256 = OpLoad %uint %innerCol_0 + %257 = OpIAdd %uint %151 %256 + %259 = OpLoad %uint %t + %260 = OpIMul %uint %259 %uint_64 + %261 = OpIAdd %uint %260 %255 + %262 = OpLoad %uint %innerCol_0 + %263 = OpIAdd %uint %155 %262 + %258 = OpFunctionCall %float %mm_readB %261 %263 + %264 = OpLoad %uint %innerCol_0 + %265 = OpAccessChain %_ptr_Workgroup_float %mm_Bsub %264 %257 + OpStore %265 %258 OpBranch %247 %247 = OpLabel - %249 = OpLoad %uint %innerCol_0 - %250 = OpULessThan %bool %249 %uint_4 - %248 = OpLogicalNot %bool %250 - OpSelectionMerge %251 None - OpBranchConditional %248 %252 %251 - %252 = OpLabel + %266 = OpLoad %uint %innerCol_0 + %267 = OpIAdd %uint %266 %uint_1 + OpStore %innerCol_0 %267 OpBranch %245 - %251 = OpLabel - %253 = OpLoad %uint %innerRow_0 - %254 = OpIAdd %uint %187 %253 - %255 = OpLoad %uint %innerCol_0 - %256 = OpIAdd %uint %150 %255 - %258 = OpLoad %uint %t - %259 = OpIMul %uint %258 %uint_64 - %260 = OpIAdd %uint %259 %254 - %261 = OpLoad %uint %innerCol_0 - %262 = OpIAdd %uint %154 %261 - %257 = OpFunctionCall %float %mm_readB %260 %262 - %263 = OpLoad %uint %innerCol_0 - %264 = OpAccessChain %_ptr_Workgroup_float %mm_Bsub %263 %256 - OpStore %264 %257 - OpBranch %246 %246 = OpLabel - %265 = OpLoad %uint %innerCol_0 - %266 = OpIAdd %uint %265 %uint_1 - OpStore %innerCol_0 %266 - OpBranch %244 - %245 = OpLabel - OpBranch %236 + OpBranch %237 + %237 = OpLabel + %268 = OpLoad %uint %innerRow_0 + %269 = OpIAdd %uint %268 %uint_1 + OpStore %innerRow_0 %269 + OpBranch %235 %236 = OpLabel - %267 = OpLoad %uint %innerRow_0 - %268 = OpIAdd %uint %267 %uint_1 - OpStore %innerRow_0 %268 - OpBranch %234 - %235 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_264 - OpStore %k %123 - OpBranch %271 - %271 = OpLabel - OpLoopMerge %272 %273 None - OpBranch %274 - %274 = OpLabel - %276 = OpLoad %uint %k - %277 = OpULessThan %bool %276 %uint_64 - %275 = OpLogicalNot %bool %277 - OpSelectionMerge %278 None - OpBranchConditional %275 %279 %278 - %279 = OpLabel + OpStore %k %124 OpBranch %272 - %278 = OpLabel - OpStore %inner %123 - OpBranch %281 - %281 = OpLabel - OpLoopMerge %282 %283 None + %272 = OpLabel + OpLoopMerge %273 %274 None + OpBranch %275 + %275 = OpLabel + %277 = OpLoad %uint %k + %278 = OpULessThan %bool %277 %uint_64 + %276 = OpLogicalNot %bool %278 + OpSelectionMerge %279 None + OpBranchConditional %276 %280 %279 + %280 = OpLabel + OpBranch %273 + %279 = OpLabel + OpStore %inner %124 + OpBranch %282 + %282 = OpLabel + OpLoopMerge %283 %284 None + OpBranch %285 + %285 = OpLabel + %287 = OpLoad %uint %inner + %288 = OpULessThan %bool %287 %uint_4 + %286 = OpLogicalNot %bool %288 + OpSelectionMerge %289 None + OpBranchConditional %286 %290 %289 + %290 = OpLabel + OpBranch %283 + %289 = OpLabel + %291 = OpLoad %uint %inner + %292 = OpAccessChain %_ptr_Function_float %BCached %291 + %293 = OpLoad %uint %k + %294 = OpLoad %uint %inner + %295 = OpIAdd %uint %151 %294 + %296 = OpAccessChain %_ptr_Workgroup_float %mm_Bsub %293 %295 + %297 = OpLoad %float %296 + OpStore %292 %297 OpBranch %284 %284 = OpLabel - %286 = OpLoad %uint %inner - %287 = OpULessThan %bool %286 %uint_4 - %285 = OpLogicalNot %bool %287 - OpSelectionMerge %288 None - OpBranchConditional %285 %289 %288 - %289 = OpLabel + %298 = OpLoad %uint %inner + %299 = OpIAdd %uint %298 %uint_1 + OpStore %inner %299 OpBranch %282 - %288 = OpLabel - %290 = OpLoad %uint %inner - %291 = OpAccessChain %_ptr_Function_float %BCached %290 - %292 = OpLoad %uint %k - %293 = OpLoad %uint %inner - %294 = OpIAdd %uint %150 %293 - %295 = OpAccessChain %_ptr_Workgroup_float %mm_Bsub %292 %294 - %296 = OpLoad %float %295 - OpStore %291 %296 - OpBranch %283 %283 = OpLabel - %297 = OpLoad %uint %inner - %298 = OpIAdd %uint %297 %uint_1 - OpStore %inner %298 - OpBranch %281 - %282 = OpLabel - OpStore %innerRow_1 %123 - OpBranch %300 - %300 = OpLabel - OpLoopMerge %301 %302 None - OpBranch %303 - %303 = OpLabel - %305 = OpLoad %uint %innerRow_1 - %306 = OpULessThan %bool %305 %uint_4 - %304 = OpLogicalNot %bool %306 - OpSelectionMerge %307 None - OpBranchConditional %304 %308 %307 - %308 = OpLabel + OpStore %innerRow_1 %124 OpBranch %301 - %307 = OpLabel - %309 = OpLoad %uint %innerRow_1 - %310 = OpIAdd %uint %148 %309 - %311 = OpLoad %uint %k - %312 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %310 %311 - %313 = OpLoad %float %312 - OpStore %ACached %313 - OpStore %innerCol_1 %123 - OpBranch %315 - %315 = OpLabel - OpLoopMerge %316 %317 None + %301 = OpLabel + OpLoopMerge %302 %303 None + OpBranch %304 + %304 = OpLabel + %306 = OpLoad %uint %innerRow_1 + %307 = OpULessThan %bool %306 %uint_4 + %305 = OpLogicalNot %bool %307 + OpSelectionMerge %308 None + OpBranchConditional %305 %309 %308 + %309 = OpLabel + OpBranch %302 + %308 = OpLabel + %310 = OpLoad %uint %innerRow_1 + %311 = OpIAdd %uint %149 %310 + %312 = OpLoad %uint %k + %313 = OpAccessChain %_ptr_Workgroup_float %mm_Asub %311 %312 + %314 = OpLoad %float %313 + OpStore %ACached %314 + OpStore %innerCol_1 %124 + OpBranch %316 + %316 = OpLabel + OpLoopMerge %317 %318 None + OpBranch %319 + %319 = OpLabel + %321 = OpLoad %uint %innerCol_1 + %322 = OpULessThan %bool %321 %uint_4 + %320 = OpLogicalNot %bool %322 + OpSelectionMerge %323 None + OpBranchConditional %320 %324 %323 + %324 = OpLabel + OpBranch %317 + %323 = OpLabel + %325 = OpLoad %uint %innerRow_1 + %326 = OpIMul %uint %325 %uint_4 + %327 = OpLoad %uint %innerCol_1 + %328 = OpIAdd %uint %326 %327 + %329 = OpAccessChain %_ptr_Function_float %acc %328 + %330 = OpAccessChain %_ptr_Function_float %acc %328 + %331 = OpLoad %float %330 + %332 = OpLoad %float %ACached + %333 = OpLoad %uint %innerCol_1 + %334 = OpAccessChain %_ptr_Function_float %BCached %333 + %335 = OpLoad %float %334 + %336 = OpFMul %float %332 %335 + %337 = OpFAdd %float %331 %336 + OpStore %329 %337 OpBranch %318 %318 = OpLabel - %320 = OpLoad %uint %innerCol_1 - %321 = OpULessThan %bool %320 %uint_4 - %319 = OpLogicalNot %bool %321 - OpSelectionMerge %322 None - OpBranchConditional %319 %323 %322 - %323 = OpLabel + %338 = OpLoad %uint %innerCol_1 + %339 = OpIAdd %uint %338 %uint_1 + OpStore %innerCol_1 %339 OpBranch %316 - %322 = OpLabel - %324 = OpLoad %uint %innerRow_1 - %325 = OpIMul %uint %324 %uint_4 - %326 = OpLoad %uint %innerCol_1 - %327 = OpIAdd %uint %325 %326 - %328 = OpAccessChain %_ptr_Function_float %acc %327 - %329 = OpAccessChain %_ptr_Function_float %acc %327 - %330 = OpLoad %float %329 - %331 = OpLoad %float %ACached - %332 = OpLoad %uint %innerCol_1 - %333 = OpAccessChain %_ptr_Function_float %BCached %332 - %334 = OpLoad %float %333 - %335 = OpFMul %float %331 %334 - %336 = OpFAdd %float %330 %335 - OpStore %328 %336 - OpBranch %317 %317 = OpLabel - %337 = OpLoad %uint %innerCol_1 - %338 = OpIAdd %uint %337 %uint_1 - OpStore %innerCol_1 %338 - OpBranch %315 - %316 = OpLabel - OpBranch %302 + OpBranch %303 + %303 = OpLabel + %340 = OpLoad %uint %innerRow_1 + %341 = OpIAdd %uint %340 %uint_1 + OpStore %innerRow_1 %341 + OpBranch %301 %302 = OpLabel - %339 = OpLoad %uint %innerRow_1 - %340 = OpIAdd %uint %339 %uint_1 - OpStore %innerRow_1 %340 - OpBranch %300 - %301 = OpLabel - OpBranch %273 + OpBranch %274 + %274 = OpLabel + %342 = OpLoad %uint %k + %343 = OpIAdd %uint %342 %uint_1 + OpStore %k %343 + OpBranch %272 %273 = OpLabel - %341 = OpLoad %uint %k - %342 = OpIAdd %uint %341 %uint_1 - OpStore %k %342 - OpBranch %271 - %272 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_264 - OpBranch %191 + OpBranch %192 + %192 = OpLabel + %345 = OpLoad %uint %t + %346 = OpIAdd %uint %345 %uint_1 + OpStore %t %346 + OpBranch %190 %191 = OpLabel - %344 = OpLoad %uint %t - %345 = OpIAdd %uint %344 %uint_1 - OpStore %t %345 - OpBranch %189 - %190 = OpLabel - OpStore %innerRow_2 %123 - OpBranch %347 - %347 = OpLabel - OpLoopMerge %348 %349 None - OpBranch %350 - %350 = OpLabel - %352 = OpLoad %uint %innerRow_2 - %353 = OpULessThan %bool %352 %uint_4 - %351 = OpLogicalNot %bool %353 - OpSelectionMerge %354 None - OpBranchConditional %351 %355 %354 - %355 = OpLabel + OpStore %innerRow_2 %124 OpBranch %348 - %354 = OpLabel - OpStore %innerCol_2 %123 - OpBranch %357 - %357 = OpLabel - OpLoopMerge %358 %359 None + %348 = OpLabel + OpLoopMerge %349 %350 None + OpBranch %351 + %351 = OpLabel + %353 = OpLoad %uint %innerRow_2 + %354 = OpULessThan %bool %353 %uint_4 + %352 = OpLogicalNot %bool %354 + OpSelectionMerge %355 None + OpBranchConditional %352 %356 %355 + %356 = OpLabel + OpBranch %349 + %355 = OpLabel + OpStore %innerCol_2 %124 + OpBranch %358 + %358 = OpLabel + OpLoopMerge %359 %360 None + OpBranch %361 + %361 = OpLabel + %363 = OpLoad %uint %innerCol_2 + %364 = OpULessThan %bool %363 %uint_4 + %362 = OpLogicalNot %bool %364 + OpSelectionMerge %365 None + OpBranchConditional %362 %366 %365 + %366 = OpLabel + OpBranch %359 + %365 = OpLabel + %367 = OpLoad %uint %innerRow_2 + %368 = OpIMul %uint %367 %uint_4 + %369 = OpLoad %uint %innerCol_2 + %370 = OpIAdd %uint %368 %369 + %372 = OpLoad %uint %innerRow_2 + %373 = OpIAdd %uint %153 %372 + %374 = OpLoad %uint %innerCol_2 + %375 = OpIAdd %uint %155 %374 + %376 = OpAccessChain %_ptr_Function_float %acc %370 + %377 = OpLoad %float %376 + %371 = OpFunctionCall %void %mm_write %373 %375 %377 OpBranch %360 %360 = OpLabel - %362 = OpLoad %uint %innerCol_2 - %363 = OpULessThan %bool %362 %uint_4 - %361 = OpLogicalNot %bool %363 - OpSelectionMerge %364 None - OpBranchConditional %361 %365 %364 - %365 = OpLabel + %378 = OpLoad %uint %innerCol_2 + %379 = OpIAdd %uint %378 %uint_1 + OpStore %innerCol_2 %379 OpBranch %358 - %364 = OpLabel - %366 = OpLoad %uint %innerRow_2 - %367 = OpIMul %uint %366 %uint_4 - %368 = OpLoad %uint %innerCol_2 - %369 = OpIAdd %uint %367 %368 - %371 = OpLoad %uint %innerRow_2 - %372 = OpIAdd %uint %152 %371 - %373 = OpLoad %uint %innerCol_2 - %374 = OpIAdd %uint %154 %373 - %375 = OpAccessChain %_ptr_Function_float %acc %369 - %376 = OpLoad %float %375 - %370 = OpFunctionCall %void %mm_write %372 %374 %376 - OpBranch %359 %359 = OpLabel - %377 = OpLoad %uint %innerCol_2 - %378 = OpIAdd %uint %377 %uint_1 - OpStore %innerCol_2 %378 - OpBranch %357 - %358 = OpLabel - OpBranch %349 + OpBranch %350 + %350 = OpLabel + %380 = OpLoad %uint %innerRow_2 + %381 = OpIAdd %uint %380 %uint_1 + OpStore %innerRow_2 %381 + OpBranch %348 %349 = OpLabel - %379 = OpLoad %uint %innerRow_2 - %380 = OpIAdd %uint %379 %uint_1 - OpStore %innerRow_2 %380 - OpBranch %347 - %348 = OpLabel OpReturn OpFunctionEnd - %main = OpFunction %void None %381 - %383 = OpLabel - %385 = OpLoad %v3uint %local_id_1 - %386 = OpLoad %v3uint %global_id_1 - %387 = OpLoad %uint %local_invocation_index_1 - %384 = OpFunctionCall %void %main_inner %385 %386 %387 + %main = OpFunction %void None %382 + %384 = OpLabel + %386 = OpLoad %v3uint %local_id_1 + %387 = OpLoad %v3uint %global_id_1 + %388 = OpLoad %uint %local_invocation_index_1 + %385 = OpFunctionCall %void %main_inner %386 %387 %388 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/922.wgsl.expected.glsl b/test/tint/bug/tint/922.wgsl.expected.glsl index 9736cc57f6..8b0bb79bb2 100644 --- a/test/tint/bug/tint/922.wgsl.expected.glsl +++ b/test/tint/bug/tint/922.wgsl.expected.glsl @@ -25,23 +25,35 @@ struct Mat4x2_ { vec4 my; }; +struct ub_SceneParams { + Mat4x4_ u_Projection; +}; + +struct ub_MaterialParams { + Mat4x2_ u_TexMtx[1]; + vec4 u_Misc0_; +}; + +struct ub_PacketParams { + Mat4x3_ u_PosMtx[32]; +}; + struct VertexOutput { vec4 v_Color; vec2 v_TexCoord; vec4 member; }; -layout(binding = 0, std140) uniform ub_SceneParams_ubo { - Mat4x4_ u_Projection; +layout(binding = 0, std140) uniform global_block_ubo { + ub_SceneParams inner; } global; -layout(binding = 1, std140) uniform ub_MaterialParams_ubo { - Mat4x2_ u_TexMtx[1]; - vec4 u_Misc0_; +layout(binding = 1, std140) uniform global1_block_ubo { + ub_MaterialParams inner; } global1; -layout(binding = 2, std140) uniform ub_PacketParams_ubo { - Mat4x3_ u_PosMtx[32]; +layout(binding = 2, std140) uniform global2_block_ubo { + ub_PacketParams inner; } global2; vec3 a_Position1 = vec3(0.0f, 0.0f, 0.0f); @@ -116,7 +128,7 @@ void main1() { Mat4x3_ t_PosMtx = Mat4x3_(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); vec2 t_TexSpaceCoord = vec2(0.0f, 0.0f); float x_e15 = a_PosMtxIdx1; - Mat4x3_ x_e18 = global2.u_PosMtx[int(x_e15)]; + Mat4x3_ x_e18 = global2.inner.u_PosMtx[int(x_e15)]; t_PosMtx = x_e18; Mat4x3_ x_e23 = t_PosMtx; Mat4x4_ x_e24 = x_Mat4x4_1(x_e23); @@ -125,7 +137,7 @@ void main1() { Mat4x4_ x_e30 = x_Mat4x4_1(x_e29); vec3 x_e31 = a_Position1; vec4 x_e34 = Mul(x_e30, vec4(x_e31, 1.0f)); - Mat4x4_ x_e35 = global.u_Projection; + Mat4x4_ x_e35 = global.inner.u_Projection; Mat4x3_ x_e37 = t_PosMtx; Mat4x4_ x_e38 = x_Mat4x4_1(x_e37); vec3 x_e39 = a_Position1; @@ -137,11 +149,11 @@ void main1() { tint_symbol = x_e49; vec4 x_e50 = a_Color1; v_Color = x_e50; - vec4 x_e52 = global1.u_Misc0_; + vec4 x_e52 = global1.inner.u_Misc0_; if ((x_e52.x == 2.0f)) { { vec3 x_e59 = a_Normal1; - Mat4x2_ x_e64 = global1.u_TexMtx[0]; + Mat4x2_ x_e64 = global1.inner.u_TexMtx[0]; vec3 x_e65 = a_Normal1; vec2 x_e68 = Mul2(x_e64, vec4(x_e65, 1.0f)); v_TexCoord = x_e68.xy; @@ -150,7 +162,7 @@ void main1() { } else { { vec2 x_e73 = a_UV1; - Mat4x2_ x_e79 = global1.u_TexMtx[0]; + Mat4x2_ x_e79 = global1.inner.u_TexMtx[0]; vec2 x_e80 = a_UV1; vec2 x_e84 = Mul2(x_e79, vec4(x_e80, 1.0f, 1.0f)); v_TexCoord = x_e84.xy; diff --git a/test/tint/bug/tint/922.wgsl.expected.spvasm b/test/tint/bug/tint/922.wgsl.expected.spvasm index 9d37f5d3b8..69a7d4dac7 100644 --- a/test/tint/bug/tint/922.wgsl.expected.spvasm +++ b/test/tint/bug/tint/922.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 390 +; Bound: 393 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -15,6 +15,8 @@ OpName %v_TexCoord_1 "v_TexCoord_1" OpName %member_1 "member_1" OpName %vertex_point_size "vertex_point_size" + OpName %global_block "global_block" + OpMemberName %global_block 0 "inner" OpName %ub_SceneParams "ub_SceneParams" OpMemberName %ub_SceneParams 0 "u_Projection" OpName %Mat4x4_ "Mat4x4_" @@ -23,6 +25,8 @@ OpMemberName %Mat4x4_ 2 "mz" OpMemberName %Mat4x4_ 3 "mw" OpName %global "global" + OpName %global1_block "global1_block" + OpMemberName %global1_block 0 "inner" OpName %ub_MaterialParams "ub_MaterialParams" OpMemberName %ub_MaterialParams 0 "u_TexMtx" OpName %Mat4x2_ "Mat4x2_" @@ -30,6 +34,8 @@ OpMemberName %Mat4x2_ 1 "my" OpMemberName %ub_MaterialParams 1 "u_Misc0_" OpName %global1 "global1" + OpName %global2_block "global2_block" + OpMemberName %global2_block 0 "inner" OpName %ub_PacketParams "ub_PacketParams" OpMemberName %ub_PacketParams 0 "u_PosMtx" OpName %Mat4x3_ "Mat4x3_" @@ -121,7 +127,8 @@ OpDecorate %v_TexCoord_1 Location 1 OpDecorate %member_1 BuiltIn Position OpDecorate %vertex_point_size BuiltIn PointSize - OpDecorate %ub_SceneParams Block + OpDecorate %global_block Block + OpMemberDecorate %global_block 0 Offset 0 OpMemberDecorate %ub_SceneParams 0 Offset 0 OpMemberDecorate %Mat4x4_ 0 Offset 0 OpMemberDecorate %Mat4x4_ 1 Offset 16 @@ -130,7 +137,8 @@ OpDecorate %global NonWritable OpDecorate %global DescriptorSet 0 OpDecorate %global Binding 0 - OpDecorate %ub_MaterialParams Block + OpDecorate %global1_block Block + OpMemberDecorate %global1_block 0 Offset 0 OpMemberDecorate %ub_MaterialParams 0 Offset 0 OpMemberDecorate %Mat4x2_ 0 Offset 0 OpMemberDecorate %Mat4x2_ 1 Offset 16 @@ -139,7 +147,8 @@ OpDecorate %global1 NonWritable OpDecorate %global1 DescriptorSet 0 OpDecorate %global1 Binding 1 - OpDecorate %ub_PacketParams Block + OpDecorate %global2_block Block + OpMemberDecorate %global2_block 0 Offset 0 OpMemberDecorate %ub_PacketParams 0 Offset 0 OpMemberDecorate %Mat4x3_ 0 Offset 0 OpMemberDecorate %Mat4x3_ 1 Offset 16 @@ -176,453 +185,456 @@ %vertex_point_size = OpVariable %_ptr_Output_float Output %23 %Mat4x4_ = OpTypeStruct %v4float %v4float %v4float %v4float %ub_SceneParams = OpTypeStruct %Mat4x4_ -%_ptr_Uniform_ub_SceneParams = OpTypePointer Uniform %ub_SceneParams - %global = OpVariable %_ptr_Uniform_ub_SceneParams Uniform +%global_block = OpTypeStruct %ub_SceneParams +%_ptr_Uniform_global_block = OpTypePointer Uniform %global_block + %global = OpVariable %_ptr_Uniform_global_block Uniform %Mat4x2_ = OpTypeStruct %v4float %v4float %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %_arr_Mat4x2__uint_1 = OpTypeArray %Mat4x2_ %uint_1 %ub_MaterialParams = OpTypeStruct %_arr_Mat4x2__uint_1 %v4float -%_ptr_Uniform_ub_MaterialParams = OpTypePointer Uniform %ub_MaterialParams - %global1 = OpVariable %_ptr_Uniform_ub_MaterialParams Uniform +%global1_block = OpTypeStruct %ub_MaterialParams +%_ptr_Uniform_global1_block = OpTypePointer Uniform %global1_block + %global1 = OpVariable %_ptr_Uniform_global1_block Uniform %Mat4x3_ = OpTypeStruct %v4float %v4float %v4float %uint_32 = OpConstant %uint 32 %_arr_Mat4x3__uint_32 = OpTypeArray %Mat4x3_ %uint_32 %ub_PacketParams = OpTypeStruct %_arr_Mat4x3__uint_32 -%_ptr_Uniform_ub_PacketParams = OpTypePointer Uniform %ub_PacketParams - %global2 = OpVariable %_ptr_Uniform_ub_PacketParams Uniform +%global2_block = OpTypeStruct %ub_PacketParams +%_ptr_Uniform_global2_block = OpTypePointer Uniform %global2_block + %global2 = OpVariable %_ptr_Uniform_global2_block Uniform %_ptr_Private_v3float = OpTypePointer Private %v3float - %43 = OpConstantNull %v3float -%a_Position1 = OpVariable %_ptr_Private_v3float Private %43 + %46 = OpConstantNull %v3float +%a_Position1 = OpVariable %_ptr_Private_v3float Private %46 %_ptr_Private_v2float = OpTypePointer Private %v2float %a_UV1 = OpVariable %_ptr_Private_v2float Private %19 %_ptr_Private_v4float = OpTypePointer Private %v4float %a_Color1 = OpVariable %_ptr_Private_v4float Private %16 - %a_Normal1 = OpVariable %_ptr_Private_v3float Private %43 + %a_Normal1 = OpVariable %_ptr_Private_v3float Private %46 %_ptr_Private_float = OpTypePointer Private %float %a_PosMtxIdx1 = OpVariable %_ptr_Private_float Private %23 %v_Color = OpVariable %_ptr_Private_v4float Private %16 %v_TexCoord = OpVariable %_ptr_Private_v2float Private %19 %gl_Position = OpVariable %_ptr_Private_v4float Private %16 - %54 = OpTypeFunction %v3float %Mat4x3_ + %57 = OpTypeFunction %v3float %Mat4x3_ %_ptr_Function_Mat4x3_ = OpTypePointer Function %Mat4x3_ - %60 = OpConstantNull %Mat4x3_ - %113 = OpTypeFunction %v4float %Mat4x4_ %v4float + %63 = OpConstantNull %Mat4x3_ + %116 = OpTypeFunction %v4float %Mat4x4_ %v4float %_ptr_Function_Mat4x4_ = OpTypePointer Function %Mat4x4_ - %120 = OpConstantNull %Mat4x4_ + %123 = OpConstantNull %Mat4x4_ %_ptr_Function_v4float = OpTypePointer Function %v4float - %140 = OpTypeFunction %v3float %Mat4x3_ %v4float - %160 = OpTypeFunction %v2float %Mat4x2_ %v4float + %143 = OpTypeFunction %v3float %Mat4x3_ %v4float + %163 = OpTypeFunction %v2float %Mat4x2_ %v4float %_ptr_Function_Mat4x2_ = OpTypePointer Function %Mat4x2_ - %167 = OpConstantNull %Mat4x2_ - %178 = OpTypeFunction %v4float %v3float %Mat4x3_ + %170 = OpConstantNull %Mat4x2_ + %181 = OpTypeFunction %v4float %v3float %Mat4x3_ %_ptr_Function_v3float = OpTypePointer Function %v3float - %203 = OpTypeFunction %Mat4x4_ %float + %206 = OpTypeFunction %Mat4x4_ %float %_ptr_Function_float = OpTypePointer Function %float %uint_0 = OpConstant %uint 0 %uint_2 = OpConstant %uint 2 %uint_3 = OpConstant %uint 3 - %226 = OpTypeFunction %Mat4x4_ %Mat4x3_ + %229 = OpTypeFunction %Mat4x4_ %Mat4x3_ %float_1 = OpConstant %float 1 - %244 = OpTypeFunction %Mat4x4_ %Mat4x2_ - %258 = OpTypeFunction %Mat4x3_ %float - %274 = OpTypeFunction %Mat4x3_ %Mat4x4_ + %247 = OpTypeFunction %Mat4x4_ %Mat4x2_ + %261 = OpTypeFunction %Mat4x3_ %float + %277 = OpTypeFunction %Mat4x3_ %Mat4x4_ %void = OpTypeVoid - %290 = OpTypeFunction %void + %293 = OpTypeFunction %void %bool = OpTypeBool %_ptr_Function_bool = OpTypePointer Function %bool - %297 = OpConstantNull %bool + %300 = OpConstantNull %bool %_ptr_Function_v2float = OpTypePointer Function %v2float %int = OpTypeInt 32 1 %_ptr_Uniform_Mat4x3_ = OpTypePointer Uniform %Mat4x3_ %_ptr_Uniform_Mat4x4_ = OpTypePointer Uniform %Mat4x4_ %_ptr_Uniform_v4float = OpTypePointer Uniform %v4float %float_2 = OpConstant %float 2 - %344 = OpConstantNull %int + %347 = OpConstantNull %int %_ptr_Uniform_Mat4x2_ = OpTypePointer Uniform %Mat4x2_ %true = OpConstantTrue %bool %VertexOutput = OpTypeStruct %v4float %v2float %v4float - %365 = OpTypeFunction %VertexOutput %v3float %v2float %v4float %v3float %float -%Mat4x3GetCol0_ = OpFunction %v3float None %54 + %368 = OpTypeFunction %VertexOutput %v3float %v2float %v4float %v3float %float +%Mat4x3GetCol0_ = OpFunction %v3float None %57 %m = OpFunctionParameter %Mat4x3_ - %57 = OpLabel - %m1 = OpVariable %_ptr_Function_Mat4x3_ Function %60 + %60 = OpLabel + %m1 = OpVariable %_ptr_Function_Mat4x3_ Function %63 OpStore %m1 %m - %61 = OpLoad %Mat4x3_ %m1 - %62 = OpLoad %Mat4x3_ %m1 - %63 = OpLoad %Mat4x3_ %m1 - %64 = OpCompositeExtract %v4float %61 0 - %65 = OpCompositeExtract %float %64 0 - %66 = OpCompositeExtract %v4float %62 1 - %67 = OpCompositeExtract %float %66 0 - %68 = OpCompositeExtract %v4float %63 2 - %69 = OpCompositeExtract %float %68 0 - %70 = OpCompositeConstruct %v3float %65 %67 %69 - OpReturnValue %70 + %64 = OpLoad %Mat4x3_ %m1 + %65 = OpLoad %Mat4x3_ %m1 + %66 = OpLoad %Mat4x3_ %m1 + %67 = OpCompositeExtract %v4float %64 0 + %68 = OpCompositeExtract %float %67 0 + %69 = OpCompositeExtract %v4float %65 1 + %70 = OpCompositeExtract %float %69 0 + %71 = OpCompositeExtract %v4float %66 2 + %72 = OpCompositeExtract %float %71 0 + %73 = OpCompositeConstruct %v3float %68 %70 %72 + OpReturnValue %73 OpFunctionEnd -%Mat4x3GetCol1_ = OpFunction %v3float None %54 +%Mat4x3GetCol1_ = OpFunction %v3float None %57 %m2 = OpFunctionParameter %Mat4x3_ - %73 = OpLabel - %m3 = OpVariable %_ptr_Function_Mat4x3_ Function %60 + %76 = OpLabel + %m3 = OpVariable %_ptr_Function_Mat4x3_ Function %63 OpStore %m3 %m2 - %75 = OpLoad %Mat4x3_ %m3 - %76 = OpLoad %Mat4x3_ %m3 - %77 = OpLoad %Mat4x3_ %m3 - %78 = OpCompositeExtract %v4float %75 0 - %79 = OpCompositeExtract %float %78 1 - %80 = OpCompositeExtract %v4float %76 1 - %81 = OpCompositeExtract %float %80 1 - %82 = OpCompositeExtract %v4float %77 2 - %83 = OpCompositeExtract %float %82 1 - %84 = OpCompositeConstruct %v3float %79 %81 %83 - OpReturnValue %84 + %78 = OpLoad %Mat4x3_ %m3 + %79 = OpLoad %Mat4x3_ %m3 + %80 = OpLoad %Mat4x3_ %m3 + %81 = OpCompositeExtract %v4float %78 0 + %82 = OpCompositeExtract %float %81 1 + %83 = OpCompositeExtract %v4float %79 1 + %84 = OpCompositeExtract %float %83 1 + %85 = OpCompositeExtract %v4float %80 2 + %86 = OpCompositeExtract %float %85 1 + %87 = OpCompositeConstruct %v3float %82 %84 %86 + OpReturnValue %87 OpFunctionEnd -%Mat4x3GetCol2_ = OpFunction %v3float None %54 +%Mat4x3GetCol2_ = OpFunction %v3float None %57 %m4 = OpFunctionParameter %Mat4x3_ - %87 = OpLabel - %m5 = OpVariable %_ptr_Function_Mat4x3_ Function %60 + %90 = OpLabel + %m5 = OpVariable %_ptr_Function_Mat4x3_ Function %63 OpStore %m5 %m4 - %89 = OpLoad %Mat4x3_ %m5 - %90 = OpLoad %Mat4x3_ %m5 - %91 = OpLoad %Mat4x3_ %m5 - %92 = OpCompositeExtract %v4float %89 0 - %93 = OpCompositeExtract %float %92 2 - %94 = OpCompositeExtract %v4float %90 1 - %95 = OpCompositeExtract %float %94 2 - %96 = OpCompositeExtract %v4float %91 2 - %97 = OpCompositeExtract %float %96 2 - %98 = OpCompositeConstruct %v3float %93 %95 %97 - OpReturnValue %98 + %92 = OpLoad %Mat4x3_ %m5 + %93 = OpLoad %Mat4x3_ %m5 + %94 = OpLoad %Mat4x3_ %m5 + %95 = OpCompositeExtract %v4float %92 0 + %96 = OpCompositeExtract %float %95 2 + %97 = OpCompositeExtract %v4float %93 1 + %98 = OpCompositeExtract %float %97 2 + %99 = OpCompositeExtract %v4float %94 2 + %100 = OpCompositeExtract %float %99 2 + %101 = OpCompositeConstruct %v3float %96 %98 %100 + OpReturnValue %101 OpFunctionEnd -%Mat4x3GetCol3_ = OpFunction %v3float None %54 +%Mat4x3GetCol3_ = OpFunction %v3float None %57 %m6 = OpFunctionParameter %Mat4x3_ - %101 = OpLabel - %m7 = OpVariable %_ptr_Function_Mat4x3_ Function %60 + %104 = OpLabel + %m7 = OpVariable %_ptr_Function_Mat4x3_ Function %63 OpStore %m7 %m6 - %103 = OpLoad %Mat4x3_ %m7 - %104 = OpLoad %Mat4x3_ %m7 - %105 = OpLoad %Mat4x3_ %m7 - %106 = OpCompositeExtract %v4float %103 0 - %107 = OpCompositeExtract %float %106 3 - %108 = OpCompositeExtract %v4float %104 1 - %109 = OpCompositeExtract %float %108 3 - %110 = OpCompositeExtract %v4float %105 2 - %111 = OpCompositeExtract %float %110 3 - %112 = OpCompositeConstruct %v3float %107 %109 %111 - OpReturnValue %112 + %106 = OpLoad %Mat4x3_ %m7 + %107 = OpLoad %Mat4x3_ %m7 + %108 = OpLoad %Mat4x3_ %m7 + %109 = OpCompositeExtract %v4float %106 0 + %110 = OpCompositeExtract %float %109 3 + %111 = OpCompositeExtract %v4float %107 1 + %112 = OpCompositeExtract %float %111 3 + %113 = OpCompositeExtract %v4float %108 2 + %114 = OpCompositeExtract %float %113 3 + %115 = OpCompositeConstruct %v3float %110 %112 %114 + OpReturnValue %115 OpFunctionEnd - %Mul = OpFunction %v4float None %113 + %Mul = OpFunction %v4float None %116 %m8 = OpFunctionParameter %Mat4x4_ %v = OpFunctionParameter %v4float - %117 = OpLabel - %m9 = OpVariable %_ptr_Function_Mat4x4_ Function %120 + %120 = OpLabel + %m9 = OpVariable %_ptr_Function_Mat4x4_ Function %123 %v1 = OpVariable %_ptr_Function_v4float Function %16 OpStore %m9 %m8 OpStore %v1 %v - %123 = OpLoad %Mat4x4_ %m9 - %124 = OpLoad %v4float %v1 - %125 = OpLoad %Mat4x4_ %m9 - %126 = OpLoad %v4float %v1 - %127 = OpLoad %Mat4x4_ %m9 - %128 = OpLoad %v4float %v1 - %129 = OpLoad %Mat4x4_ %m9 - %130 = OpLoad %v4float %v1 - %132 = OpCompositeExtract %v4float %123 0 - %131 = OpDot %float %132 %124 - %134 = OpCompositeExtract %v4float %125 1 - %133 = OpDot %float %134 %126 - %136 = OpCompositeExtract %v4float %127 2 - %135 = OpDot %float %136 %128 - %138 = OpCompositeExtract %v4float %129 3 - %137 = OpDot %float %138 %130 - %139 = OpCompositeConstruct %v4float %131 %133 %135 %137 - OpReturnValue %139 + %126 = OpLoad %Mat4x4_ %m9 + %127 = OpLoad %v4float %v1 + %128 = OpLoad %Mat4x4_ %m9 + %129 = OpLoad %v4float %v1 + %130 = OpLoad %Mat4x4_ %m9 + %131 = OpLoad %v4float %v1 + %132 = OpLoad %Mat4x4_ %m9 + %133 = OpLoad %v4float %v1 + %135 = OpCompositeExtract %v4float %126 0 + %134 = OpDot %float %135 %127 + %137 = OpCompositeExtract %v4float %128 1 + %136 = OpDot %float %137 %129 + %139 = OpCompositeExtract %v4float %130 2 + %138 = OpDot %float %139 %131 + %141 = OpCompositeExtract %v4float %132 3 + %140 = OpDot %float %141 %133 + %142 = OpCompositeConstruct %v4float %134 %136 %138 %140 + OpReturnValue %142 OpFunctionEnd - %Mul1 = OpFunction %v3float None %140 + %Mul1 = OpFunction %v3float None %143 %m10 = OpFunctionParameter %Mat4x3_ %v2 = OpFunctionParameter %v4float - %144 = OpLabel - %m11 = OpVariable %_ptr_Function_Mat4x3_ Function %60 + %147 = OpLabel + %m11 = OpVariable %_ptr_Function_Mat4x3_ Function %63 %v3 = OpVariable %_ptr_Function_v4float Function %16 OpStore %m11 %m10 OpStore %v3 %v2 - %147 = OpLoad %Mat4x3_ %m11 - %148 = OpLoad %v4float %v3 - %149 = OpLoad %Mat4x3_ %m11 - %150 = OpLoad %v4float %v3 - %151 = OpLoad %Mat4x3_ %m11 - %152 = OpLoad %v4float %v3 - %154 = OpCompositeExtract %v4float %147 0 - %153 = OpDot %float %154 %148 - %156 = OpCompositeExtract %v4float %149 1 - %155 = OpDot %float %156 %150 - %158 = OpCompositeExtract %v4float %151 2 - %157 = OpDot %float %158 %152 - %159 = OpCompositeConstruct %v3float %153 %155 %157 - OpReturnValue %159 + %150 = OpLoad %Mat4x3_ %m11 + %151 = OpLoad %v4float %v3 + %152 = OpLoad %Mat4x3_ %m11 + %153 = OpLoad %v4float %v3 + %154 = OpLoad %Mat4x3_ %m11 + %155 = OpLoad %v4float %v3 + %157 = OpCompositeExtract %v4float %150 0 + %156 = OpDot %float %157 %151 + %159 = OpCompositeExtract %v4float %152 1 + %158 = OpDot %float %159 %153 + %161 = OpCompositeExtract %v4float %154 2 + %160 = OpDot %float %161 %155 + %162 = OpCompositeConstruct %v3float %156 %158 %160 + OpReturnValue %162 OpFunctionEnd - %Mul2 = OpFunction %v2float None %160 + %Mul2 = OpFunction %v2float None %163 %m12 = OpFunctionParameter %Mat4x2_ %v4 = OpFunctionParameter %v4float - %164 = OpLabel - %m13 = OpVariable %_ptr_Function_Mat4x2_ Function %167 + %167 = OpLabel + %m13 = OpVariable %_ptr_Function_Mat4x2_ Function %170 %v5 = OpVariable %_ptr_Function_v4float Function %16 OpStore %m13 %m12 OpStore %v5 %v4 - %169 = OpLoad %Mat4x2_ %m13 - %170 = OpLoad %v4float %v5 - %171 = OpLoad %Mat4x2_ %m13 - %172 = OpLoad %v4float %v5 - %174 = OpCompositeExtract %v4float %169 0 - %173 = OpDot %float %174 %170 - %176 = OpCompositeExtract %v4float %171 1 - %175 = OpDot %float %176 %172 - %177 = OpCompositeConstruct %v2float %173 %175 - OpReturnValue %177 + %172 = OpLoad %Mat4x2_ %m13 + %173 = OpLoad %v4float %v5 + %174 = OpLoad %Mat4x2_ %m13 + %175 = OpLoad %v4float %v5 + %177 = OpCompositeExtract %v4float %172 0 + %176 = OpDot %float %177 %173 + %179 = OpCompositeExtract %v4float %174 1 + %178 = OpDot %float %179 %175 + %180 = OpCompositeConstruct %v2float %176 %178 + OpReturnValue %180 OpFunctionEnd - %Mul3 = OpFunction %v4float None %178 + %Mul3 = OpFunction %v4float None %181 %v6 = OpFunctionParameter %v3float %m14 = OpFunctionParameter %Mat4x3_ - %182 = OpLabel - %v7 = OpVariable %_ptr_Function_v3float Function %43 - %m15 = OpVariable %_ptr_Function_Mat4x3_ Function %60 + %185 = OpLabel + %v7 = OpVariable %_ptr_Function_v3float Function %46 + %m15 = OpVariable %_ptr_Function_Mat4x3_ Function %63 OpStore %v7 %v6 OpStore %m15 %m14 - %186 = OpLoad %Mat4x3_ %m15 - %187 = OpFunctionCall %v3float %Mat4x3GetCol0_ %186 - %188 = OpLoad %v3float %v7 %189 = OpLoad %Mat4x3_ %m15 - %190 = OpFunctionCall %v3float %Mat4x3GetCol1_ %189 + %190 = OpFunctionCall %v3float %Mat4x3GetCol0_ %189 %191 = OpLoad %v3float %v7 %192 = OpLoad %Mat4x3_ %m15 - %193 = OpFunctionCall %v3float %Mat4x3GetCol2_ %192 + %193 = OpFunctionCall %v3float %Mat4x3GetCol1_ %192 %194 = OpLoad %v3float %v7 %195 = OpLoad %Mat4x3_ %m15 - %196 = OpFunctionCall %v3float %Mat4x3GetCol3_ %195 + %196 = OpFunctionCall %v3float %Mat4x3GetCol2_ %195 %197 = OpLoad %v3float %v7 - %198 = OpDot %float %187 %188 - %199 = OpDot %float %190 %191 - %200 = OpDot %float %193 %194 - %201 = OpDot %float %196 %197 - %202 = OpCompositeConstruct %v4float %198 %199 %200 %201 - OpReturnValue %202 + %198 = OpLoad %Mat4x3_ %m15 + %199 = OpFunctionCall %v3float %Mat4x3GetCol3_ %198 + %200 = OpLoad %v3float %v7 + %201 = OpDot %float %190 %191 + %202 = OpDot %float %193 %194 + %203 = OpDot %float %196 %197 + %204 = OpDot %float %199 %200 + %205 = OpCompositeConstruct %v4float %201 %202 %203 %204 + OpReturnValue %205 OpFunctionEnd - %x_Mat4x4_ = OpFunction %Mat4x4_ None %203 + %x_Mat4x4_ = OpFunction %Mat4x4_ None %206 %n = OpFunctionParameter %float - %206 = OpLabel + %209 = OpLabel %n1 = OpVariable %_ptr_Function_float Function %23 - %o = OpVariable %_ptr_Function_Mat4x4_ Function %120 + %o = OpVariable %_ptr_Function_Mat4x4_ Function %123 OpStore %n1 %n - %210 = OpLoad %float %n1 - %212 = OpAccessChain %_ptr_Function_v4float %o %uint_0 - %213 = OpCompositeConstruct %v4float %210 %23 %23 %23 - OpStore %212 %213 - %214 = OpLoad %float %n1 - %215 = OpAccessChain %_ptr_Function_v4float %o %uint_1 - %216 = OpCompositeConstruct %v4float %23 %214 %23 %23 + %213 = OpLoad %float %n1 + %215 = OpAccessChain %_ptr_Function_v4float %o %uint_0 + %216 = OpCompositeConstruct %v4float %213 %23 %23 %23 OpStore %215 %216 %217 = OpLoad %float %n1 - %219 = OpAccessChain %_ptr_Function_v4float %o %uint_2 - %220 = OpCompositeConstruct %v4float %23 %23 %217 %23 - OpStore %219 %220 - %221 = OpLoad %float %n1 - %223 = OpAccessChain %_ptr_Function_v4float %o %uint_3 - %224 = OpCompositeConstruct %v4float %23 %23 %23 %221 - OpStore %223 %224 - %225 = OpLoad %Mat4x4_ %o - OpReturnValue %225 + %218 = OpAccessChain %_ptr_Function_v4float %o %uint_1 + %219 = OpCompositeConstruct %v4float %23 %217 %23 %23 + OpStore %218 %219 + %220 = OpLoad %float %n1 + %222 = OpAccessChain %_ptr_Function_v4float %o %uint_2 + %223 = OpCompositeConstruct %v4float %23 %23 %220 %23 + OpStore %222 %223 + %224 = OpLoad %float %n1 + %226 = OpAccessChain %_ptr_Function_v4float %o %uint_3 + %227 = OpCompositeConstruct %v4float %23 %23 %23 %224 + OpStore %226 %227 + %228 = OpLoad %Mat4x4_ %o + OpReturnValue %228 OpFunctionEnd - %x_Mat4x4_1 = OpFunction %Mat4x4_ None %226 + %x_Mat4x4_1 = OpFunction %Mat4x4_ None %229 %m16 = OpFunctionParameter %Mat4x3_ - %229 = OpLabel - %m17 = OpVariable %_ptr_Function_Mat4x3_ Function %60 - %o1 = OpVariable %_ptr_Function_Mat4x4_ Function %120 + %232 = OpLabel + %m17 = OpVariable %_ptr_Function_Mat4x3_ Function %63 + %o1 = OpVariable %_ptr_Function_Mat4x4_ Function %123 OpStore %m17 %m16 - %232 = OpFunctionCall %Mat4x4_ %x_Mat4x4_ %float_1 - OpStore %o1 %232 - %234 = OpLoad %Mat4x3_ %m17 - %235 = OpAccessChain %_ptr_Function_v4float %o1 %uint_0 - %236 = OpCompositeExtract %v4float %234 0 - OpStore %235 %236 + %235 = OpFunctionCall %Mat4x4_ %x_Mat4x4_ %float_1 + OpStore %o1 %235 %237 = OpLoad %Mat4x3_ %m17 - %238 = OpAccessChain %_ptr_Function_v4float %o1 %uint_1 - %239 = OpCompositeExtract %v4float %237 1 + %238 = OpAccessChain %_ptr_Function_v4float %o1 %uint_0 + %239 = OpCompositeExtract %v4float %237 0 OpStore %238 %239 %240 = OpLoad %Mat4x3_ %m17 - %241 = OpAccessChain %_ptr_Function_v4float %o1 %uint_2 - %242 = OpCompositeExtract %v4float %240 2 + %241 = OpAccessChain %_ptr_Function_v4float %o1 %uint_1 + %242 = OpCompositeExtract %v4float %240 1 OpStore %241 %242 - %243 = OpLoad %Mat4x4_ %o1 - OpReturnValue %243 + %243 = OpLoad %Mat4x3_ %m17 + %244 = OpAccessChain %_ptr_Function_v4float %o1 %uint_2 + %245 = OpCompositeExtract %v4float %243 2 + OpStore %244 %245 + %246 = OpLoad %Mat4x4_ %o1 + OpReturnValue %246 OpFunctionEnd - %x_Mat4x4_2 = OpFunction %Mat4x4_ None %244 + %x_Mat4x4_2 = OpFunction %Mat4x4_ None %247 %m18 = OpFunctionParameter %Mat4x2_ - %247 = OpLabel - %m19 = OpVariable %_ptr_Function_Mat4x2_ Function %167 - %o2 = OpVariable %_ptr_Function_Mat4x4_ Function %120 + %250 = OpLabel + %m19 = OpVariable %_ptr_Function_Mat4x2_ Function %170 + %o2 = OpVariable %_ptr_Function_Mat4x4_ Function %123 OpStore %m19 %m18 - %250 = OpFunctionCall %Mat4x4_ %x_Mat4x4_ %float_1 - OpStore %o2 %250 - %251 = OpLoad %Mat4x2_ %m19 - %252 = OpAccessChain %_ptr_Function_v4float %o2 %uint_0 - %253 = OpCompositeExtract %v4float %251 0 - OpStore %252 %253 + %253 = OpFunctionCall %Mat4x4_ %x_Mat4x4_ %float_1 + OpStore %o2 %253 %254 = OpLoad %Mat4x2_ %m19 - %255 = OpAccessChain %_ptr_Function_v4float %o2 %uint_1 - %256 = OpCompositeExtract %v4float %254 1 + %255 = OpAccessChain %_ptr_Function_v4float %o2 %uint_0 + %256 = OpCompositeExtract %v4float %254 0 OpStore %255 %256 - %257 = OpLoad %Mat4x4_ %o2 - OpReturnValue %257 + %257 = OpLoad %Mat4x2_ %m19 + %258 = OpAccessChain %_ptr_Function_v4float %o2 %uint_1 + %259 = OpCompositeExtract %v4float %257 1 + OpStore %258 %259 + %260 = OpLoad %Mat4x4_ %o2 + OpReturnValue %260 OpFunctionEnd - %x_Mat4x3_ = OpFunction %Mat4x3_ None %258 + %x_Mat4x3_ = OpFunction %Mat4x3_ None %261 %n2 = OpFunctionParameter %float - %261 = OpLabel + %264 = OpLabel %n3 = OpVariable %_ptr_Function_float Function %23 - %o3 = OpVariable %_ptr_Function_Mat4x3_ Function %60 + %o3 = OpVariable %_ptr_Function_Mat4x3_ Function %63 OpStore %n3 %n2 - %264 = OpLoad %float %n3 - %265 = OpAccessChain %_ptr_Function_v4float %o3 %uint_0 - %266 = OpCompositeConstruct %v4float %264 %23 %23 %23 - OpStore %265 %266 %267 = OpLoad %float %n3 - %268 = OpAccessChain %_ptr_Function_v4float %o3 %uint_1 - %269 = OpCompositeConstruct %v4float %23 %267 %23 %23 + %268 = OpAccessChain %_ptr_Function_v4float %o3 %uint_0 + %269 = OpCompositeConstruct %v4float %267 %23 %23 %23 OpStore %268 %269 %270 = OpLoad %float %n3 - %271 = OpAccessChain %_ptr_Function_v4float %o3 %uint_2 - %272 = OpCompositeConstruct %v4float %23 %23 %270 %23 + %271 = OpAccessChain %_ptr_Function_v4float %o3 %uint_1 + %272 = OpCompositeConstruct %v4float %23 %270 %23 %23 OpStore %271 %272 - %273 = OpLoad %Mat4x3_ %o3 - OpReturnValue %273 + %273 = OpLoad %float %n3 + %274 = OpAccessChain %_ptr_Function_v4float %o3 %uint_2 + %275 = OpCompositeConstruct %v4float %23 %23 %273 %23 + OpStore %274 %275 + %276 = OpLoad %Mat4x3_ %o3 + OpReturnValue %276 OpFunctionEnd - %x_Mat4x3_1 = OpFunction %Mat4x3_ None %274 + %x_Mat4x3_1 = OpFunction %Mat4x3_ None %277 %m20 = OpFunctionParameter %Mat4x4_ - %277 = OpLabel - %m21 = OpVariable %_ptr_Function_Mat4x4_ Function %120 - %o4 = OpVariable %_ptr_Function_Mat4x3_ Function %60 + %280 = OpLabel + %m21 = OpVariable %_ptr_Function_Mat4x4_ Function %123 + %o4 = OpVariable %_ptr_Function_Mat4x3_ Function %63 OpStore %m21 %m20 - %280 = OpLoad %Mat4x4_ %m21 - %281 = OpAccessChain %_ptr_Function_v4float %o4 %uint_0 - %282 = OpCompositeExtract %v4float %280 0 - OpStore %281 %282 %283 = OpLoad %Mat4x4_ %m21 - %284 = OpAccessChain %_ptr_Function_v4float %o4 %uint_1 - %285 = OpCompositeExtract %v4float %283 1 + %284 = OpAccessChain %_ptr_Function_v4float %o4 %uint_0 + %285 = OpCompositeExtract %v4float %283 0 OpStore %284 %285 %286 = OpLoad %Mat4x4_ %m21 - %287 = OpAccessChain %_ptr_Function_v4float %o4 %uint_2 - %288 = OpCompositeExtract %v4float %286 2 + %287 = OpAccessChain %_ptr_Function_v4float %o4 %uint_1 + %288 = OpCompositeExtract %v4float %286 1 OpStore %287 %288 - %289 = OpLoad %Mat4x3_ %o4 - OpReturnValue %289 + %289 = OpLoad %Mat4x4_ %m21 + %290 = OpAccessChain %_ptr_Function_v4float %o4 %uint_2 + %291 = OpCompositeExtract %v4float %289 2 + OpStore %290 %291 + %292 = OpLoad %Mat4x3_ %o4 + OpReturnValue %292 OpFunctionEnd - %main1 = OpFunction %void None %290 - %293 = OpLabel -%tint_return_flag = OpVariable %_ptr_Function_bool Function %297 - %t_PosMtx = OpVariable %_ptr_Function_Mat4x3_ Function %60 + %main1 = OpFunction %void None %293 + %296 = OpLabel +%tint_return_flag = OpVariable %_ptr_Function_bool Function %300 + %t_PosMtx = OpVariable %_ptr_Function_Mat4x3_ Function %63 %t_TexSpaceCoord = OpVariable %_ptr_Function_v2float Function %19 - %301 = OpLoad %float %a_PosMtxIdx1 - %302 = OpConvertFToS %int %301 - %305 = OpAccessChain %_ptr_Uniform_Mat4x3_ %global2 %uint_0 %302 - %306 = OpLoad %Mat4x3_ %305 - OpStore %t_PosMtx %306 - %307 = OpLoad %Mat4x3_ %t_PosMtx - %308 = OpFunctionCall %Mat4x4_ %x_Mat4x4_1 %307 - %309 = OpLoad %v3float %a_Position1 + %304 = OpLoad %float %a_PosMtxIdx1 + %305 = OpConvertFToS %int %304 + %308 = OpAccessChain %_ptr_Uniform_Mat4x3_ %global2 %uint_0 %uint_0 %305 + %309 = OpLoad %Mat4x3_ %308 + OpStore %t_PosMtx %309 %310 = OpLoad %Mat4x3_ %t_PosMtx %311 = OpFunctionCall %Mat4x4_ %x_Mat4x4_1 %310 %312 = OpLoad %v3float %a_Position1 - %314 = OpCompositeExtract %float %312 0 - %315 = OpCompositeExtract %float %312 1 - %316 = OpCompositeExtract %float %312 2 - %317 = OpCompositeConstruct %v4float %314 %315 %316 %float_1 - %313 = OpFunctionCall %v4float %Mul %311 %317 - %319 = OpAccessChain %_ptr_Uniform_Mat4x4_ %global %uint_0 - %320 = OpLoad %Mat4x4_ %319 - %321 = OpLoad %Mat4x3_ %t_PosMtx - %322 = OpFunctionCall %Mat4x4_ %x_Mat4x4_1 %321 - %323 = OpLoad %v3float %a_Position1 + %313 = OpLoad %Mat4x3_ %t_PosMtx + %314 = OpFunctionCall %Mat4x4_ %x_Mat4x4_1 %313 + %315 = OpLoad %v3float %a_Position1 + %317 = OpCompositeExtract %float %315 0 + %318 = OpCompositeExtract %float %315 1 + %319 = OpCompositeExtract %float %315 2 + %320 = OpCompositeConstruct %v4float %317 %318 %319 %float_1 + %316 = OpFunctionCall %v4float %Mul %314 %320 + %322 = OpAccessChain %_ptr_Uniform_Mat4x4_ %global %uint_0 %uint_0 + %323 = OpLoad %Mat4x4_ %322 %324 = OpLoad %Mat4x3_ %t_PosMtx %325 = OpFunctionCall %Mat4x4_ %x_Mat4x4_1 %324 %326 = OpLoad %v3float %a_Position1 - %328 = OpCompositeExtract %float %326 0 - %329 = OpCompositeExtract %float %326 1 - %330 = OpCompositeExtract %float %326 2 - %331 = OpCompositeConstruct %v4float %328 %329 %330 %float_1 - %327 = OpFunctionCall %v4float %Mul %325 %331 - %332 = OpFunctionCall %v4float %Mul %320 %327 - OpStore %gl_Position %332 - %333 = OpLoad %v4float %a_Color1 - OpStore %v_Color %333 - %335 = OpAccessChain %_ptr_Uniform_v4float %global1 %uint_1 - %336 = OpLoad %v4float %335 - %337 = OpCompositeExtract %float %336 0 - %339 = OpFOrdEqual %bool %337 %float_2 - OpSelectionMerge %340 None - OpBranchConditional %339 %341 %342 - %341 = OpLabel - %343 = OpLoad %v3float %a_Normal1 - %346 = OpAccessChain %_ptr_Uniform_Mat4x2_ %global1 %uint_0 %344 - %347 = OpLoad %Mat4x2_ %346 - %348 = OpLoad %v3float %a_Normal1 - %350 = OpCompositeExtract %float %348 0 - %351 = OpCompositeExtract %float %348 1 - %352 = OpCompositeExtract %float %348 2 - %353 = OpCompositeConstruct %v4float %350 %351 %352 %float_1 - %349 = OpFunctionCall %v2float %Mul2 %347 %353 - %354 = OpVectorShuffle %v2float %349 %349 0 1 - OpStore %v_TexCoord %354 + %327 = OpLoad %Mat4x3_ %t_PosMtx + %328 = OpFunctionCall %Mat4x4_ %x_Mat4x4_1 %327 + %329 = OpLoad %v3float %a_Position1 + %331 = OpCompositeExtract %float %329 0 + %332 = OpCompositeExtract %float %329 1 + %333 = OpCompositeExtract %float %329 2 + %334 = OpCompositeConstruct %v4float %331 %332 %333 %float_1 + %330 = OpFunctionCall %v4float %Mul %328 %334 + %335 = OpFunctionCall %v4float %Mul %323 %330 + OpStore %gl_Position %335 + %336 = OpLoad %v4float %a_Color1 + OpStore %v_Color %336 + %338 = OpAccessChain %_ptr_Uniform_v4float %global1 %uint_0 %uint_1 + %339 = OpLoad %v4float %338 + %340 = OpCompositeExtract %float %339 0 + %342 = OpFOrdEqual %bool %340 %float_2 + OpSelectionMerge %343 None + OpBranchConditional %342 %344 %345 + %344 = OpLabel + %346 = OpLoad %v3float %a_Normal1 + %349 = OpAccessChain %_ptr_Uniform_Mat4x2_ %global1 %uint_0 %uint_0 %347 + %350 = OpLoad %Mat4x2_ %349 + %351 = OpLoad %v3float %a_Normal1 + %353 = OpCompositeExtract %float %351 0 + %354 = OpCompositeExtract %float %351 1 + %355 = OpCompositeExtract %float %351 2 + %356 = OpCompositeConstruct %v4float %353 %354 %355 %float_1 + %352 = OpFunctionCall %v2float %Mul2 %350 %356 + %357 = OpVectorShuffle %v2float %352 %352 0 1 + OpStore %v_TexCoord %357 OpStore %tint_return_flag %true - OpBranch %340 - %342 = OpLabel - %356 = OpLoad %v2float %a_UV1 - %357 = OpAccessChain %_ptr_Uniform_Mat4x2_ %global1 %uint_0 %344 - %358 = OpLoad %Mat4x2_ %357 + OpBranch %343 + %345 = OpLabel %359 = OpLoad %v2float %a_UV1 - %361 = OpCompositeExtract %float %359 0 - %362 = OpCompositeExtract %float %359 1 - %363 = OpCompositeConstruct %v4float %361 %362 %float_1 %float_1 - %360 = OpFunctionCall %v2float %Mul2 %358 %363 - %364 = OpVectorShuffle %v2float %360 %360 0 1 - OpStore %v_TexCoord %364 + %360 = OpAccessChain %_ptr_Uniform_Mat4x2_ %global1 %uint_0 %uint_0 %347 + %361 = OpLoad %Mat4x2_ %360 + %362 = OpLoad %v2float %a_UV1 + %364 = OpCompositeExtract %float %362 0 + %365 = OpCompositeExtract %float %362 1 + %366 = OpCompositeConstruct %v4float %364 %365 %float_1 %float_1 + %363 = OpFunctionCall %v2float %Mul2 %361 %366 + %367 = OpVectorShuffle %v2float %363 %363 0 1 + OpStore %v_TexCoord %367 OpStore %tint_return_flag %true - OpBranch %340 - %340 = OpLabel + OpBranch %343 + %343 = OpLabel OpReturn OpFunctionEnd - %main_inner = OpFunction %VertexOutput None %365 + %main_inner = OpFunction %VertexOutput None %368 %a_Position = OpFunctionParameter %v3float %a_UV = OpFunctionParameter %v2float %a_Color = OpFunctionParameter %v4float %a_Normal = OpFunctionParameter %v3float %a_PosMtxIdx = OpFunctionParameter %float - %373 = OpLabel + %376 = OpLabel OpStore %a_Position1 %a_Position OpStore %a_UV1 %a_UV OpStore %a_Color1 %a_Color OpStore %a_Normal1 %a_Normal OpStore %a_PosMtxIdx1 %a_PosMtxIdx - %374 = OpFunctionCall %void %main1 - %375 = OpLoad %v4float %v_Color - %376 = OpLoad %v2float %v_TexCoord - %377 = OpLoad %v4float %gl_Position - %378 = OpCompositeConstruct %VertexOutput %375 %376 %377 - OpReturnValue %378 + %377 = OpFunctionCall %void %main1 + %378 = OpLoad %v4float %v_Color + %379 = OpLoad %v2float %v_TexCoord + %380 = OpLoad %v4float %gl_Position + %381 = OpCompositeConstruct %VertexOutput %378 %379 %380 + OpReturnValue %381 OpFunctionEnd - %main = OpFunction %void None %290 - %380 = OpLabel - %382 = OpLoad %v3float %a_Position_1 - %383 = OpLoad %v2float %a_UV_1 - %384 = OpLoad %v4float %a_Color_1 - %385 = OpLoad %v3float %a_Normal_1 - %386 = OpLoad %float %a_PosMtxIdx_1 - %381 = OpFunctionCall %VertexOutput %main_inner %382 %383 %384 %385 %386 - %387 = OpCompositeExtract %v4float %381 0 - OpStore %v_Color_1 %387 - %388 = OpCompositeExtract %v2float %381 1 - OpStore %v_TexCoord_1 %388 - %389 = OpCompositeExtract %v4float %381 2 - OpStore %member_1 %389 + %main = OpFunction %void None %293 + %383 = OpLabel + %385 = OpLoad %v3float %a_Position_1 + %386 = OpLoad %v2float %a_UV_1 + %387 = OpLoad %v4float %a_Color_1 + %388 = OpLoad %v3float %a_Normal_1 + %389 = OpLoad %float %a_PosMtxIdx_1 + %384 = OpFunctionCall %VertexOutput %main_inner %385 %386 %387 %388 %389 + %390 = OpCompositeExtract %v4float %384 0 + OpStore %v_Color_1 %390 + %391 = OpCompositeExtract %v2float %384 1 + OpStore %v_TexCoord_1 %391 + %392 = OpCompositeExtract %v4float %384 2 + OpStore %member_1 %392 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/926.wgsl.expected.glsl b/test/tint/bug/tint/926.wgsl.expected.glsl index 1171d66e02..1ac7b9120e 100644 --- a/test/tint/bug/tint/926.wgsl.expected.glsl +++ b/test/tint/bug/tint/926.wgsl.expected.glsl @@ -1,12 +1,16 @@ #version 310 es -layout(binding = 5, std430) buffer DrawIndirectArgs_ssbo { +struct DrawIndirectArgs { uint vertexCount; +}; + +layout(binding = 5, std430) buffer drawOut_block_ssbo { + DrawIndirectArgs inner; } drawOut; uint cubeVerts = 0u; void computeMain(uvec3 global_id) { - uint firstVertex = atomicAdd(drawOut.vertexCount, cubeVerts); + uint firstVertex = atomicAdd(drawOut.inner.vertexCount, cubeVerts); } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/tint/926.wgsl.expected.spvasm b/test/tint/bug/tint/926.wgsl.expected.spvasm index f3853ec4bb..28d27a5414 100644 --- a/test/tint/bug/tint/926.wgsl.expected.spvasm +++ b/test/tint/bug/tint/926.wgsl.expected.spvasm @@ -1,13 +1,15 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 28 +; Bound: 29 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %computeMain "computeMain" %global_id_1 OpExecutionMode %computeMain LocalSize 1 1 1 OpName %global_id_1 "global_id_1" + OpName %drawOut_block "drawOut_block" + OpMemberName %drawOut_block 0 "inner" OpName %DrawIndirectArgs "DrawIndirectArgs" OpMemberName %DrawIndirectArgs 0 "vertexCount" OpName %drawOut "drawOut" @@ -16,7 +18,8 @@ OpName %global_id "global_id" OpName %computeMain "computeMain" OpDecorate %global_id_1 BuiltIn GlobalInvocationId - OpDecorate %DrawIndirectArgs Block + OpDecorate %drawOut_block Block + OpMemberDecorate %drawOut_block 0 Offset 0 OpMemberDecorate %DrawIndirectArgs 0 Offset 0 OpDecorate %drawOut DescriptorSet 0 OpDecorate %drawOut Binding 5 @@ -25,28 +28,29 @@ %_ptr_Input_v3uint = OpTypePointer Input %v3uint %global_id_1 = OpVariable %_ptr_Input_v3uint Input %DrawIndirectArgs = OpTypeStruct %uint -%_ptr_StorageBuffer_DrawIndirectArgs = OpTypePointer StorageBuffer %DrawIndirectArgs - %drawOut = OpVariable %_ptr_StorageBuffer_DrawIndirectArgs StorageBuffer - %8 = OpConstantNull %uint +%drawOut_block = OpTypeStruct %DrawIndirectArgs +%_ptr_StorageBuffer_drawOut_block = OpTypePointer StorageBuffer %drawOut_block + %drawOut = OpVariable %_ptr_StorageBuffer_drawOut_block StorageBuffer + %9 = OpConstantNull %uint %_ptr_Private_uint = OpTypePointer Private %uint - %cubeVerts = OpVariable %_ptr_Private_uint Private %8 + %cubeVerts = OpVariable %_ptr_Private_uint Private %9 %void = OpTypeVoid - %11 = OpTypeFunction %void %v3uint + %12 = OpTypeFunction %void %v3uint %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint - %23 = OpTypeFunction %void -%computeMain_inner = OpFunction %void None %11 + %24 = OpTypeFunction %void +%computeMain_inner = OpFunction %void None %12 %global_id = OpFunctionParameter %v3uint - %15 = OpLabel - %21 = OpAccessChain %_ptr_StorageBuffer_uint %drawOut %uint_0 - %22 = OpLoad %uint %cubeVerts - %16 = OpAtomicIAdd %uint %21 %uint_1 %uint_0 %22 + %16 = OpLabel + %22 = OpAccessChain %_ptr_StorageBuffer_uint %drawOut %uint_0 %uint_0 + %23 = OpLoad %uint %cubeVerts + %17 = OpAtomicIAdd %uint %22 %uint_1 %uint_0 %23 OpReturn OpFunctionEnd -%computeMain = OpFunction %void None %23 - %25 = OpLabel - %27 = OpLoad %v3uint %global_id_1 - %26 = OpFunctionCall %void %computeMain_inner %27 +%computeMain = OpFunction %void None %24 + %26 = OpLabel + %28 = OpLoad %v3uint %global_id_1 + %27 = OpFunctionCall %void %computeMain_inner %28 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/942.wgsl.expected.glsl b/test/tint/bug/tint/942.wgsl.expected.glsl index 49e6cb155f..6f68af7b02 100644 --- a/test/tint/bug/tint/942.wgsl.expected.glsl +++ b/test/tint/bug/tint/942.wgsl.expected.glsl @@ -1,18 +1,26 @@ #version 310 es -layout(binding = 1, std140) uniform Params_ubo { +struct Params { uint filterDim; uint blockDim; uint pad; uint pad_1; +}; + +layout(binding = 1, std140) uniform params_block_ubo { + Params inner; } params; layout(rgba8) uniform highp writeonly image2D outputTex; -layout(binding = 3, std140) uniform Flip_ubo { +struct Flip { uint value; uint pad_2; uint pad_3; uint pad_4; +}; + +layout(binding = 3, std140) uniform flip_block_ubo { + Flip inner; } flip; shared vec3 tile[4][256]; @@ -28,15 +36,15 @@ void tint_symbol(uvec3 WorkGroupID, uvec3 LocalInvocationID, uint local_invocati } } barrier(); - uint filterOffset = ((params.filterDim - 1u) / 2u); + uint filterOffset = ((params.inner.filterDim - 1u) / 2u); uvec2 dims = uvec2(textureSize(inputTex_1, 0)); - uvec2 baseIndex = (((WorkGroupID.xy * uvec2(params.blockDim, 4u)) + (LocalInvocationID.xy * uvec2(4u, 1u))) - uvec2(filterOffset, 0u)); + uvec2 baseIndex = (((WorkGroupID.xy * uvec2(params.inner.blockDim, 4u)) + (LocalInvocationID.xy * uvec2(4u, 1u))) - uvec2(filterOffset, 0u)); { for(uint r = 0u; (r < 4u); r = (r + 1u)) { { for(uint c = 0u; (c < 4u); c = (c + 1u)) { uvec2 loadIndex = (baseIndex + uvec2(c, r)); - if ((flip.value != 0u)) { + if ((flip.inner.value != 0u)) { loadIndex = loadIndex.yx; } tile[r][((4u * LocalInvocationID.x) + c)] = textureLod(inputTex_samp, ((vec2(loadIndex) + vec2(0.25f)) / vec2(dims)), 0.0f).rgb; @@ -50,7 +58,7 @@ void tint_symbol(uvec3 WorkGroupID, uvec3 LocalInvocationID, uint local_invocati { for(uint c = 0u; (c < 4u); c = (c + 1u)) { uvec2 writeIndex = (baseIndex + uvec2(c, r)); - if ((flip.value != 0u)) { + if ((flip.inner.value != 0u)) { writeIndex = writeIndex.yx; } uint center = ((4u * LocalInvocationID.x) + c); @@ -65,9 +73,9 @@ void tint_symbol(uvec3 WorkGroupID, uvec3 LocalInvocationID, uint local_invocati if ((tint_tmp)) { vec3 acc = vec3(0.0f); { - for(uint f = 0u; (f < params.filterDim); f = (f + 1u)) { + for(uint f = 0u; (f < params.inner.filterDim); f = (f + 1u)) { uint i = ((center + f) - filterOffset); - acc = (acc + ((1.0f / float(params.filterDim)) * tile[r][i])); + acc = (acc + ((1.0f / float(params.inner.filterDim)) * tile[r][i])); } } imageStore(outputTex, ivec2(writeIndex), vec4(acc, 1.0f)); diff --git a/test/tint/bug/tint/942.wgsl.expected.spvasm b/test/tint/bug/tint/942.wgsl.expected.spvasm index 22c15c0c6a..05b4009329 100644 --- a/test/tint/bug/tint/942.wgsl.expected.spvasm +++ b/test/tint/bug/tint/942.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 251 +; Bound: 253 ; Schema: 0 OpCapability Shader OpCapability ImageQuery @@ -12,12 +12,16 @@ OpName %LocalInvocationID_1 "LocalInvocationID_1" OpName %local_invocation_index_1 "local_invocation_index_1" OpName %samp "samp" + OpName %params_block "params_block" + OpMemberName %params_block 0 "inner" OpName %Params "Params" OpMemberName %Params 0 "filterDim" OpMemberName %Params 1 "blockDim" OpName %params "params" OpName %inputTex "inputTex" OpName %outputTex "outputTex" + OpName %flip_block "flip_block" + OpMemberName %flip_block 0 "inner" OpName %Flip "Flip" OpMemberName %Flip 0 "value" OpName %flip "flip" @@ -42,7 +46,8 @@ OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex OpDecorate %samp DescriptorSet 0 OpDecorate %samp Binding 0 - OpDecorate %Params Block + OpDecorate %params_block Block + OpMemberDecorate %params_block 0 Offset 0 OpMemberDecorate %Params 0 Offset 0 OpMemberDecorate %Params 1 Offset 4 OpDecorate %params NonWritable @@ -53,7 +58,8 @@ OpDecorate %outputTex NonReadable OpDecorate %outputTex DescriptorSet 1 OpDecorate %outputTex Binding 2 - OpDecorate %Flip Block + OpDecorate %flip_block Block + OpMemberDecorate %flip_block 0 Offset 0 OpMemberDecorate %Flip 0 Offset 0 OpDecorate %flip NonWritable OpDecorate %flip DescriptorSet 1 @@ -71,18 +77,20 @@ %_ptr_UniformConstant_10 = OpTypePointer UniformConstant %10 %samp = OpVariable %_ptr_UniformConstant_10 UniformConstant %Params = OpTypeStruct %uint %uint -%_ptr_Uniform_Params = OpTypePointer Uniform %Params - %params = OpVariable %_ptr_Uniform_Params Uniform +%params_block = OpTypeStruct %Params +%_ptr_Uniform_params_block = OpTypePointer Uniform %params_block + %params = OpVariable %_ptr_Uniform_params_block Uniform %float = OpTypeFloat 32 - %16 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_16 = OpTypePointer UniformConstant %16 - %inputTex = OpVariable %_ptr_UniformConstant_16 UniformConstant - %20 = OpTypeImage %float 2D 0 0 0 2 Rgba8 -%_ptr_UniformConstant_20 = OpTypePointer UniformConstant %20 - %outputTex = OpVariable %_ptr_UniformConstant_20 UniformConstant + %17 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_17 = OpTypePointer UniformConstant %17 + %inputTex = OpVariable %_ptr_UniformConstant_17 UniformConstant + %21 = OpTypeImage %float 2D 0 0 0 2 Rgba8 +%_ptr_UniformConstant_21 = OpTypePointer UniformConstant %21 + %outputTex = OpVariable %_ptr_UniformConstant_21 UniformConstant %Flip = OpTypeStruct %uint -%_ptr_Uniform_Flip = OpTypePointer Uniform %Flip - %flip = OpVariable %_ptr_Uniform_Flip Uniform + %flip_block = OpTypeStruct %Flip +%_ptr_Uniform_flip_block = OpTypePointer Uniform %flip_block + %flip = OpVariable %_ptr_Uniform_flip_block Uniform %v3float = OpTypeVector %float 3 %uint_256 = OpConstant %uint 256 %_arr_v3float_uint_256 = OpTypeArray %v3float %uint_256 @@ -91,13 +99,13 @@ %_ptr_Workgroup__arr__arr_v3float_uint_256_uint_4 = OpTypePointer Workgroup %_arr__arr_v3float_uint_256_uint_4 %tile = OpVariable %_ptr_Workgroup__arr__arr_v3float_uint_256_uint_4 Workgroup %void = OpTypeVoid - %31 = OpTypeFunction %void %v3uint %v3uint %uint + %33 = OpTypeFunction %void %v3uint %v3uint %uint %_ptr_Function_uint = OpTypePointer Function %uint - %40 = OpConstantNull %uint + %42 = OpConstantNull %uint %uint_1024 = OpConstant %uint 1024 %bool = OpTypeBool %_ptr_Workgroup_v3float = OpTypePointer Workgroup %v3float - %58 = OpConstantNull %v3float + %60 = OpConstantNull %v3float %uint_64 = OpConstant %uint 64 %uint_2 = OpConstant %uint 2 %uint_264 = OpConstant %uint 264 @@ -106,295 +114,295 @@ %uint_1 = OpConstant %uint 1 %v2uint = OpTypeVector %uint 2 %int = OpTypeInt 32 1 - %76 = OpConstantNull %int - %83 = OpConstantComposite %v2uint %uint_4 %uint_1 + %78 = OpConstantNull %int + %85 = OpConstantComposite %v2uint %uint_4 %uint_1 %_ptr_Function_v2uint = OpTypePointer Function %v2uint - %114 = OpConstantNull %v2uint + %116 = OpConstantNull %v2uint %v4float = OpTypeVector %float 4 - %132 = OpTypeSampledImage %16 + %134 = OpTypeSampledImage %17 %v2float = OpTypeVector %float 2 %float_0_25 = OpConstant %float 0.25 - %138 = OpConstantComposite %v2float %float_0_25 %float_0_25 - %142 = OpConstantNull %float + %140 = OpConstantComposite %v2float %float_0_25 %float_0_25 + %144 = OpConstantNull %float %v2bool = OpTypeVector %bool 2 %_ptr_Function_v3float = OpTypePointer Function %v3float %float_1 = OpConstant %float 1 - %244 = OpTypeFunction %void - %main_inner = OpFunction %void None %31 + %246 = OpTypeFunction %void + %main_inner = OpFunction %void None %33 %WorkGroupID = OpFunctionParameter %v3uint %LocalInvocationID = OpFunctionParameter %v3uint %local_invocation_index = OpFunctionParameter %uint - %37 = OpLabel - %idx = OpVariable %_ptr_Function_uint Function %40 - %r = OpVariable %_ptr_Function_uint Function %40 - %c = OpVariable %_ptr_Function_uint Function %40 - %loadIndex = OpVariable %_ptr_Function_v2uint Function %114 - %r_0 = OpVariable %_ptr_Function_uint Function %40 - %c_0 = OpVariable %_ptr_Function_uint Function %40 - %writeIndex = OpVariable %_ptr_Function_v2uint Function %114 - %acc = OpVariable %_ptr_Function_v3float Function %58 - %f = OpVariable %_ptr_Function_uint Function %40 - %i = OpVariable %_ptr_Function_uint Function %40 + %39 = OpLabel + %idx = OpVariable %_ptr_Function_uint Function %42 + %r = OpVariable %_ptr_Function_uint Function %42 + %c = OpVariable %_ptr_Function_uint Function %42 + %loadIndex = OpVariable %_ptr_Function_v2uint Function %116 + %r_0 = OpVariable %_ptr_Function_uint Function %42 + %c_0 = OpVariable %_ptr_Function_uint Function %42 + %writeIndex = OpVariable %_ptr_Function_v2uint Function %116 + %acc = OpVariable %_ptr_Function_v3float Function %60 + %f = OpVariable %_ptr_Function_uint Function %42 + %i = OpVariable %_ptr_Function_uint Function %42 OpStore %idx %local_invocation_index - OpBranch %41 - %41 = OpLabel - OpLoopMerge %42 %43 None - OpBranch %44 - %44 = OpLabel - %46 = OpLoad %uint %idx - %48 = OpULessThan %bool %46 %uint_1024 - %45 = OpLogicalNot %bool %48 - OpSelectionMerge %50 None - OpBranchConditional %45 %51 %50 - %51 = OpLabel - OpBranch %42 - %50 = OpLabel - %52 = OpLoad %uint %idx - %53 = OpUDiv %uint %52 %uint_256 - %54 = OpLoad %uint %idx - %55 = OpUMod %uint %54 %uint_256 - %57 = OpAccessChain %_ptr_Workgroup_v3float %tile %53 %55 - OpStore %57 %58 OpBranch %43 %43 = OpLabel - %59 = OpLoad %uint %idx - %61 = OpIAdd %uint %59 %uint_64 - OpStore %idx %61 - OpBranch %41 - %42 = OpLabel + OpLoopMerge %44 %45 None + OpBranch %46 + %46 = OpLabel + %48 = OpLoad %uint %idx + %50 = OpULessThan %bool %48 %uint_1024 + %47 = OpLogicalNot %bool %50 + OpSelectionMerge %52 None + OpBranchConditional %47 %53 %52 + %53 = OpLabel + OpBranch %44 + %52 = OpLabel + %54 = OpLoad %uint %idx + %55 = OpUDiv %uint %54 %uint_256 + %56 = OpLoad %uint %idx + %57 = OpUMod %uint %56 %uint_256 + %59 = OpAccessChain %_ptr_Workgroup_v3float %tile %55 %57 + OpStore %59 %60 + OpBranch %45 + %45 = OpLabel + %61 = OpLoad %uint %idx + %63 = OpIAdd %uint %61 %uint_64 + OpStore %idx %63 + OpBranch %43 + %44 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_264 - %67 = OpAccessChain %_ptr_Uniform_uint %params %uint_0 - %68 = OpLoad %uint %67 - %70 = OpISub %uint %68 %uint_1 - %71 = OpUDiv %uint %70 %uint_2 - %74 = OpLoad %16 %inputTex - %72 = OpImageQuerySizeLod %v2uint %74 %76 - %77 = OpVectorShuffle %v2uint %WorkGroupID %WorkGroupID 0 1 - %78 = OpAccessChain %_ptr_Uniform_uint %params %uint_1 - %79 = OpLoad %uint %78 - %80 = OpCompositeConstruct %v2uint %79 %uint_4 - %81 = OpIMul %v2uint %77 %80 - %82 = OpVectorShuffle %v2uint %LocalInvocationID %LocalInvocationID 0 1 - %84 = OpIMul %v2uint %82 %83 - %85 = OpIAdd %v2uint %81 %84 - %86 = OpCompositeConstruct %v2uint %71 %40 - %87 = OpISub %v2uint %85 %86 - OpStore %r %40 - OpBranch %89 - %89 = OpLabel - OpLoopMerge %90 %91 None - OpBranch %92 - %92 = OpLabel - %94 = OpLoad %uint %r - %95 = OpULessThan %bool %94 %uint_4 - %93 = OpLogicalNot %bool %95 - OpSelectionMerge %96 None - OpBranchConditional %93 %97 %96 - %97 = OpLabel - OpBranch %90 - %96 = OpLabel - OpStore %c %40 - OpBranch %99 - %99 = OpLabel - OpLoopMerge %100 %101 None - OpBranch %102 - %102 = OpLabel - %104 = OpLoad %uint %c - %105 = OpULessThan %bool %104 %uint_4 - %103 = OpLogicalNot %bool %105 - OpSelectionMerge %106 None - OpBranchConditional %103 %107 %106 - %107 = OpLabel - OpBranch %100 - %106 = OpLabel - %108 = OpLoad %uint %c - %109 = OpLoad %uint %r - %110 = OpCompositeConstruct %v2uint %108 %109 - %111 = OpIAdd %v2uint %87 %110 - OpStore %loadIndex %111 - %115 = OpAccessChain %_ptr_Uniform_uint %flip %uint_0 - %116 = OpLoad %uint %115 - %117 = OpINotEqual %bool %116 %40 - OpSelectionMerge %118 None - OpBranchConditional %117 %119 %118 - %119 = OpLabel - %120 = OpLoad %v2uint %loadIndex - %121 = OpVectorShuffle %v2uint %120 %120 1 0 - OpStore %loadIndex %121 - OpBranch %118 - %118 = OpLabel - %122 = OpLoad %uint %r - %123 = OpCompositeExtract %uint %LocalInvocationID 0 - %124 = OpIMul %uint %uint_4 %123 - %125 = OpLoad %uint %c - %126 = OpIAdd %uint %124 %125 - %127 = OpAccessChain %_ptr_Workgroup_v3float %tile %122 %126 - %130 = OpLoad %10 %samp - %131 = OpLoad %16 %inputTex - %133 = OpSampledImage %132 %131 %130 - %136 = OpLoad %v2uint %loadIndex - %134 = OpConvertUToF %v2float %136 - %139 = OpFAdd %v2float %134 %138 - %140 = OpConvertUToF %v2float %72 - %141 = OpFDiv %v2float %139 %140 - %128 = OpImageSampleExplicitLod %v4float %133 %141 Lod %142 - %143 = OpVectorShuffle %v3float %128 %128 0 1 2 - OpStore %127 %143 - OpBranch %101 - %101 = OpLabel - %144 = OpLoad %uint %c - %145 = OpIAdd %uint %144 %uint_1 - OpStore %c %145 - OpBranch %99 - %100 = OpLabel + %69 = OpAccessChain %_ptr_Uniform_uint %params %uint_0 %uint_0 + %70 = OpLoad %uint %69 + %72 = OpISub %uint %70 %uint_1 + %73 = OpUDiv %uint %72 %uint_2 + %76 = OpLoad %17 %inputTex + %74 = OpImageQuerySizeLod %v2uint %76 %78 + %79 = OpVectorShuffle %v2uint %WorkGroupID %WorkGroupID 0 1 + %80 = OpAccessChain %_ptr_Uniform_uint %params %uint_0 %uint_1 + %81 = OpLoad %uint %80 + %82 = OpCompositeConstruct %v2uint %81 %uint_4 + %83 = OpIMul %v2uint %79 %82 + %84 = OpVectorShuffle %v2uint %LocalInvocationID %LocalInvocationID 0 1 + %86 = OpIMul %v2uint %84 %85 + %87 = OpIAdd %v2uint %83 %86 + %88 = OpCompositeConstruct %v2uint %73 %42 + %89 = OpISub %v2uint %87 %88 + OpStore %r %42 OpBranch %91 %91 = OpLabel - %146 = OpLoad %uint %r + OpLoopMerge %92 %93 None + OpBranch %94 + %94 = OpLabel + %96 = OpLoad %uint %r + %97 = OpULessThan %bool %96 %uint_4 + %95 = OpLogicalNot %bool %97 + OpSelectionMerge %98 None + OpBranchConditional %95 %99 %98 + %99 = OpLabel + OpBranch %92 + %98 = OpLabel + OpStore %c %42 + OpBranch %101 + %101 = OpLabel + OpLoopMerge %102 %103 None + OpBranch %104 + %104 = OpLabel + %106 = OpLoad %uint %c + %107 = OpULessThan %bool %106 %uint_4 + %105 = OpLogicalNot %bool %107 + OpSelectionMerge %108 None + OpBranchConditional %105 %109 %108 + %109 = OpLabel + OpBranch %102 + %108 = OpLabel + %110 = OpLoad %uint %c + %111 = OpLoad %uint %r + %112 = OpCompositeConstruct %v2uint %110 %111 + %113 = OpIAdd %v2uint %89 %112 + OpStore %loadIndex %113 + %117 = OpAccessChain %_ptr_Uniform_uint %flip %uint_0 %uint_0 + %118 = OpLoad %uint %117 + %119 = OpINotEqual %bool %118 %42 + OpSelectionMerge %120 None + OpBranchConditional %119 %121 %120 + %121 = OpLabel + %122 = OpLoad %v2uint %loadIndex + %123 = OpVectorShuffle %v2uint %122 %122 1 0 + OpStore %loadIndex %123 + OpBranch %120 + %120 = OpLabel + %124 = OpLoad %uint %r + %125 = OpCompositeExtract %uint %LocalInvocationID 0 + %126 = OpIMul %uint %uint_4 %125 + %127 = OpLoad %uint %c + %128 = OpIAdd %uint %126 %127 + %129 = OpAccessChain %_ptr_Workgroup_v3float %tile %124 %128 + %132 = OpLoad %10 %samp + %133 = OpLoad %17 %inputTex + %135 = OpSampledImage %134 %133 %132 + %138 = OpLoad %v2uint %loadIndex + %136 = OpConvertUToF %v2float %138 + %141 = OpFAdd %v2float %136 %140 + %142 = OpConvertUToF %v2float %74 + %143 = OpFDiv %v2float %141 %142 + %130 = OpImageSampleExplicitLod %v4float %135 %143 Lod %144 + %145 = OpVectorShuffle %v3float %130 %130 0 1 2 + OpStore %129 %145 + OpBranch %103 + %103 = OpLabel + %146 = OpLoad %uint %c %147 = OpIAdd %uint %146 %uint_1 - OpStore %r %147 - OpBranch %89 - %90 = OpLabel + OpStore %c %147 + OpBranch %101 + %102 = OpLabel + OpBranch %93 + %93 = OpLabel + %148 = OpLoad %uint %r + %149 = OpIAdd %uint %148 %uint_1 + OpStore %r %149 + OpBranch %91 + %92 = OpLabel OpControlBarrier %uint_2 %uint_2 %uint_264 - OpStore %r_0 %40 - OpBranch %150 - %150 = OpLabel - OpLoopMerge %151 %152 None - OpBranch %153 - %153 = OpLabel - %155 = OpLoad %uint %r_0 - %156 = OpULessThan %bool %155 %uint_4 - %154 = OpLogicalNot %bool %156 - OpSelectionMerge %157 None - OpBranchConditional %154 %158 %157 - %158 = OpLabel - OpBranch %151 - %157 = OpLabel - OpStore %c_0 %40 - OpBranch %160 - %160 = OpLabel - OpLoopMerge %161 %162 None - OpBranch %163 - %163 = OpLabel - %165 = OpLoad %uint %c_0 - %166 = OpULessThan %bool %165 %uint_4 - %164 = OpLogicalNot %bool %166 - OpSelectionMerge %167 None - OpBranchConditional %164 %168 %167 - %168 = OpLabel - OpBranch %161 - %167 = OpLabel - %169 = OpLoad %uint %c_0 - %170 = OpLoad %uint %r_0 - %171 = OpCompositeConstruct %v2uint %169 %170 - %172 = OpIAdd %v2uint %87 %171 - OpStore %writeIndex %172 - %174 = OpAccessChain %_ptr_Uniform_uint %flip %uint_0 - %175 = OpLoad %uint %174 - %176 = OpINotEqual %bool %175 %40 - OpSelectionMerge %177 None - OpBranchConditional %176 %178 %177 - %178 = OpLabel - %179 = OpLoad %v2uint %writeIndex - %180 = OpVectorShuffle %v2uint %179 %179 1 0 - OpStore %writeIndex %180 - OpBranch %177 - %177 = OpLabel - %181 = OpCompositeExtract %uint %LocalInvocationID 0 - %182 = OpIMul %uint %uint_4 %181 - %183 = OpLoad %uint %c_0 - %184 = OpIAdd %uint %182 %183 - %185 = OpUGreaterThanEqual %bool %184 %71 - OpSelectionMerge %186 None - OpBranchConditional %185 %187 %186 - %187 = OpLabel - %188 = OpISub %uint %uint_256 %71 - %189 = OpULessThan %bool %184 %188 - OpBranch %186 - %186 = OpLabel - %190 = OpPhi %bool %185 %177 %189 %187 - OpSelectionMerge %191 None - OpBranchConditional %190 %192 %191 - %192 = OpLabel - %194 = OpLoad %v2uint %writeIndex - %195 = OpULessThan %v2bool %194 %72 - %193 = OpAll %bool %195 - OpBranch %191 - %191 = OpLabel - %197 = OpPhi %bool %190 %186 %193 %192 - OpSelectionMerge %198 None - OpBranchConditional %197 %199 %198 - %199 = OpLabel - OpStore %acc %58 - OpStore %f %40 - OpBranch %203 - %203 = OpLabel - OpLoopMerge %204 %205 None - OpBranch %206 - %206 = OpLabel - %208 = OpLoad %uint %f - %209 = OpAccessChain %_ptr_Uniform_uint %params %uint_0 - %210 = OpLoad %uint %209 - %211 = OpULessThan %bool %208 %210 - %207 = OpLogicalNot %bool %211 - OpSelectionMerge %212 None - OpBranchConditional %207 %213 %212 - %213 = OpLabel - OpBranch %204 - %212 = OpLabel - %214 = OpLoad %uint %f - %215 = OpIAdd %uint %184 %214 - %216 = OpISub %uint %215 %71 - OpStore %i %216 - %218 = OpLoad %v3float %acc - %221 = OpAccessChain %_ptr_Uniform_uint %params %uint_0 - %222 = OpLoad %uint %221 - %220 = OpConvertUToF %float %222 - %223 = OpFDiv %float %float_1 %220 - %224 = OpLoad %uint %r_0 - %225 = OpLoad %uint %i - %226 = OpAccessChain %_ptr_Workgroup_v3float %tile %224 %225 - %227 = OpLoad %v3float %226 - %228 = OpVectorTimesScalar %v3float %227 %223 - %229 = OpFAdd %v3float %218 %228 - OpStore %acc %229 - OpBranch %205 - %205 = OpLabel - %230 = OpLoad %uint %f - %231 = OpIAdd %uint %230 %uint_1 - OpStore %f %231 - OpBranch %203 - %204 = OpLabel - %233 = OpLoad %20 %outputTex - %234 = OpLoad %v2uint %writeIndex - %235 = OpLoad %v3float %acc - %236 = OpCompositeExtract %float %235 0 - %237 = OpCompositeExtract %float %235 1 - %238 = OpCompositeExtract %float %235 2 - %239 = OpCompositeConstruct %v4float %236 %237 %238 %float_1 - OpImageWrite %233 %234 %239 - OpBranch %198 - %198 = OpLabel - OpBranch %162 - %162 = OpLabel - %240 = OpLoad %uint %c_0 - %241 = OpIAdd %uint %240 %uint_1 - OpStore %c_0 %241 - OpBranch %160 - %161 = OpLabel + OpStore %r_0 %42 OpBranch %152 %152 = OpLabel - %242 = OpLoad %uint %r_0 + OpLoopMerge %153 %154 None + OpBranch %155 + %155 = OpLabel + %157 = OpLoad %uint %r_0 + %158 = OpULessThan %bool %157 %uint_4 + %156 = OpLogicalNot %bool %158 + OpSelectionMerge %159 None + OpBranchConditional %156 %160 %159 + %160 = OpLabel + OpBranch %153 + %159 = OpLabel + OpStore %c_0 %42 + OpBranch %162 + %162 = OpLabel + OpLoopMerge %163 %164 None + OpBranch %165 + %165 = OpLabel + %167 = OpLoad %uint %c_0 + %168 = OpULessThan %bool %167 %uint_4 + %166 = OpLogicalNot %bool %168 + OpSelectionMerge %169 None + OpBranchConditional %166 %170 %169 + %170 = OpLabel + OpBranch %163 + %169 = OpLabel + %171 = OpLoad %uint %c_0 + %172 = OpLoad %uint %r_0 + %173 = OpCompositeConstruct %v2uint %171 %172 + %174 = OpIAdd %v2uint %89 %173 + OpStore %writeIndex %174 + %176 = OpAccessChain %_ptr_Uniform_uint %flip %uint_0 %uint_0 + %177 = OpLoad %uint %176 + %178 = OpINotEqual %bool %177 %42 + OpSelectionMerge %179 None + OpBranchConditional %178 %180 %179 + %180 = OpLabel + %181 = OpLoad %v2uint %writeIndex + %182 = OpVectorShuffle %v2uint %181 %181 1 0 + OpStore %writeIndex %182 + OpBranch %179 + %179 = OpLabel + %183 = OpCompositeExtract %uint %LocalInvocationID 0 + %184 = OpIMul %uint %uint_4 %183 + %185 = OpLoad %uint %c_0 + %186 = OpIAdd %uint %184 %185 + %187 = OpUGreaterThanEqual %bool %186 %73 + OpSelectionMerge %188 None + OpBranchConditional %187 %189 %188 + %189 = OpLabel + %190 = OpISub %uint %uint_256 %73 + %191 = OpULessThan %bool %186 %190 + OpBranch %188 + %188 = OpLabel + %192 = OpPhi %bool %187 %179 %191 %189 + OpSelectionMerge %193 None + OpBranchConditional %192 %194 %193 + %194 = OpLabel + %196 = OpLoad %v2uint %writeIndex + %197 = OpULessThan %v2bool %196 %74 + %195 = OpAll %bool %197 + OpBranch %193 + %193 = OpLabel + %199 = OpPhi %bool %192 %188 %195 %194 + OpSelectionMerge %200 None + OpBranchConditional %199 %201 %200 + %201 = OpLabel + OpStore %acc %60 + OpStore %f %42 + OpBranch %205 + %205 = OpLabel + OpLoopMerge %206 %207 None + OpBranch %208 + %208 = OpLabel + %210 = OpLoad %uint %f + %211 = OpAccessChain %_ptr_Uniform_uint %params %uint_0 %uint_0 + %212 = OpLoad %uint %211 + %213 = OpULessThan %bool %210 %212 + %209 = OpLogicalNot %bool %213 + OpSelectionMerge %214 None + OpBranchConditional %209 %215 %214 + %215 = OpLabel + OpBranch %206 + %214 = OpLabel + %216 = OpLoad %uint %f + %217 = OpIAdd %uint %186 %216 + %218 = OpISub %uint %217 %73 + OpStore %i %218 + %220 = OpLoad %v3float %acc + %223 = OpAccessChain %_ptr_Uniform_uint %params %uint_0 %uint_0 + %224 = OpLoad %uint %223 + %222 = OpConvertUToF %float %224 + %225 = OpFDiv %float %float_1 %222 + %226 = OpLoad %uint %r_0 + %227 = OpLoad %uint %i + %228 = OpAccessChain %_ptr_Workgroup_v3float %tile %226 %227 + %229 = OpLoad %v3float %228 + %230 = OpVectorTimesScalar %v3float %229 %225 + %231 = OpFAdd %v3float %220 %230 + OpStore %acc %231 + OpBranch %207 + %207 = OpLabel + %232 = OpLoad %uint %f + %233 = OpIAdd %uint %232 %uint_1 + OpStore %f %233 + OpBranch %205 + %206 = OpLabel + %235 = OpLoad %21 %outputTex + %236 = OpLoad %v2uint %writeIndex + %237 = OpLoad %v3float %acc + %238 = OpCompositeExtract %float %237 0 + %239 = OpCompositeExtract %float %237 1 + %240 = OpCompositeExtract %float %237 2 + %241 = OpCompositeConstruct %v4float %238 %239 %240 %float_1 + OpImageWrite %235 %236 %241 + OpBranch %200 + %200 = OpLabel + OpBranch %164 + %164 = OpLabel + %242 = OpLoad %uint %c_0 %243 = OpIAdd %uint %242 %uint_1 - OpStore %r_0 %243 - OpBranch %150 - %151 = OpLabel + OpStore %c_0 %243 + OpBranch %162 + %163 = OpLabel + OpBranch %154 + %154 = OpLabel + %244 = OpLoad %uint %r_0 + %245 = OpIAdd %uint %244 %uint_1 + OpStore %r_0 %245 + OpBranch %152 + %153 = OpLabel OpReturn OpFunctionEnd - %main = OpFunction %void None %244 - %246 = OpLabel - %248 = OpLoad %v3uint %WorkGroupID_1 - %249 = OpLoad %v3uint %LocalInvocationID_1 - %250 = OpLoad %uint %local_invocation_index_1 - %247 = OpFunctionCall %void %main_inner %248 %249 %250 + %main = OpFunction %void None %246 + %248 = OpLabel + %250 = OpLoad %v3uint %WorkGroupID_1 + %251 = OpLoad %v3uint %LocalInvocationID_1 + %252 = OpLoad %uint %local_invocation_index_1 + %249 = OpFunctionCall %void %main_inner %250 %251 %252 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/948.wgsl.expected.glsl b/test/tint/bug/tint/948.wgsl.expected.glsl index 7ea6f08ec7..5814acfda8 100644 --- a/test/tint/bug/tint/948.wgsl.expected.glsl +++ b/test/tint/bug/tint/948.wgsl.expected.glsl @@ -13,7 +13,7 @@ layout(location = 3) in vec2 stageUnits_1_param_1; layout(location = 0) in vec3 vPosition_param_1; layout(location = 1) in vec2 vUV_param_1; layout(location = 0) out vec4 glFragColor_1_1; -layout(binding = 9, std140) uniform LeftOver_ubo { +struct LeftOver { float time; uint padding; uint pad; @@ -26,6 +26,10 @@ layout(binding = 9, std140) uniform LeftOver_ubo { float spriteCount; vec3 colorMul; uint pad_2; +}; + +layout(binding = 9, std140) uniform x_20_block_ubo { + LeftOver inner; } x_20; vec2 tUV = vec2(0.0f, 0.0f); @@ -41,7 +45,7 @@ uniform highp sampler2D frameMapTexture_frameMapSampler; mat4 getFrameData_f1_(inout float frameID) { float fX = 0.0f; float x_15 = frameID; - float x_25 = x_20.spriteCount; + float x_25 = x_20.inner.spriteCount; fX = (x_15 / x_25); float x_37 = fX; vec4 x_40 = texture(frameMapTexture_frameMapSampler, vec2(x_37, 0.0f), 0.0f); @@ -82,11 +86,11 @@ void main_1() { tileUV.y = (1.0f - x_91); vec2 x_95 = tUV; tileID = floor(x_95); - vec2 x_101 = x_20.spriteMapSize; + vec2 x_101 = x_20.inner.spriteMapSize; sheetUnits = (vec2(1.0f) / x_101); - float x_106 = x_20.spriteCount; + float x_106 = x_20.inner.spriteCount; spriteUnits = (1.0f / x_106); - vec2 x_111 = x_20.stageSize; + vec2 x_111 = x_20.inner.stageSize; stageUnits = (vec2(1.0f) / x_111); i = 0; while (true) { @@ -99,14 +103,14 @@ void main_1() { switch(x_126) { case 1: { vec2 x_150 = tileID; - vec2 x_154 = x_20.stageSize; + vec2 x_154 = x_20.inner.stageSize; vec4 x_156 = texture(tileMapsTexture1_tileMapsSampler, ((x_150 + vec2(0.5f)) / x_154), 0.0f); frameID_1 = x_156.x; break; } case 0: { vec2 x_136 = tileID; - vec2 x_140 = x_20.stageSize; + vec2 x_140 = x_20.inner.stageSize; vec4 x_142 = texture(tileMapsTexture0_tileMapsSampler, ((x_136 + vec2(0.5f)) / x_140), 0.0f); frameID_1 = x_142.x; break; @@ -116,12 +120,12 @@ void main_1() { } } float x_166 = frameID_1; - float x_169 = x_20.spriteCount; + float x_169 = x_20.inner.spriteCount; vec4 x_172 = texture(animationMapTexture_animationMapSampler, vec2(((x_166 + 0.5f) / x_169), 0.0f), 0.0f); animationData = x_172; float x_174 = animationData.y; if ((x_174 > 0.0f)) { - float x_181 = x_20.time; + float x_181 = x_20.inner.time; float x_184 = animationData.z; mt = tint_float_modulo((x_181 * x_184), 1.0f); f = 0.0f; @@ -139,7 +143,7 @@ void main_1() { break; } float x_208 = frameID_1; - float x_211 = x_20.spriteCount; + float x_211 = x_20.inner.spriteCount; float x_214 = f; vec4 x_217 = vec4(0.0f); animationData = x_217; @@ -154,7 +158,7 @@ void main_1() { mat4 x_225 = getFrameData_f1_(param); frameData = x_225; vec4 x_228 = frameData[0]; - vec2 x_231 = x_20.spriteMapSize; + vec2 x_231 = x_20.inner.spriteMapSize; frameSize = (vec2(x_228.w, x_228.z) / x_231); vec4 x_235 = frameData[0]; vec2 x_237 = sheetUnits; @@ -196,7 +200,7 @@ void main_1() { i = (x_304 + 1); } } - vec3 x_310 = x_20.colorMul; + vec3 x_310 = x_20.inner.colorMul; vec4 x_311 = color; vec3 x_313 = (vec3(x_311.x, x_311.y, x_311.z) * x_310); vec4 x_314 = color; diff --git a/test/tint/bug/tint/948.wgsl.expected.spvasm b/test/tint/bug/tint/948.wgsl.expected.spvasm index 11c65fb4c0..55c8b99d3f 100644 --- a/test/tint/bug/tint/948.wgsl.expected.spvasm +++ b/test/tint/bug/tint/948.wgsl.expected.spvasm @@ -1,10 +1,10 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 369 +; Bound: 370 ; Schema: 0 OpCapability Shader - %131 = OpExtInstImport "GLSL.std.450" + %133 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %main "main" %tUV_param_1 %tileID_1_param_1 %levelUnits_param_1 %stageUnits_1_param_1 %vPosition_param_1 %vUV_param_1 %glFragColor_1_1 OpExecutionMode %main OriginUpperLeft @@ -15,6 +15,8 @@ OpName %vPosition_param_1 "vPosition_param_1" OpName %vUV_param_1 "vUV_param_1" OpName %glFragColor_1_1 "glFragColor_1_1" + OpName %x_20_block "x_20_block" + OpMemberName %x_20_block 0 "inner" OpName %LeftOver "LeftOver" OpMemberName %LeftOver 0 "time" OpMemberName %LeftOver 1 "padding" @@ -82,7 +84,8 @@ OpDecorate %vPosition_param_1 Location 0 OpDecorate %vUV_param_1 Location 1 OpDecorate %glFragColor_1_1 Location 0 - OpDecorate %LeftOver Block + OpDecorate %x_20_block Block + OpMemberDecorate %x_20_block 0 Offset 0 OpMemberDecorate %LeftOver 0 Offset 0 OpMemberDecorate %LeftOver 1 Offset 4 OpMemberDecorate %LeftOver 2 Offset 16 @@ -134,63 +137,64 @@ %uint = OpTypeInt 32 0 %mat4v4float = OpTypeMatrix %v4float 4 %LeftOver = OpTypeStruct %float %uint %mat4v4float %v2float %v2float %v2float %float %float %v3float -%_ptr_Uniform_LeftOver = OpTypePointer Uniform %LeftOver - %x_20 = OpVariable %_ptr_Uniform_LeftOver Uniform - %23 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_23 = OpTypePointer UniformConstant %23 -%frameMapTexture = OpVariable %_ptr_UniformConstant_23 UniformConstant - %26 = OpTypeSampler -%_ptr_UniformConstant_26 = OpTypePointer UniformConstant %26 -%frameMapSampler = OpVariable %_ptr_UniformConstant_26 UniformConstant + %x_20_block = OpTypeStruct %LeftOver +%_ptr_Uniform_x_20_block = OpTypePointer Uniform %x_20_block + %x_20 = OpVariable %_ptr_Uniform_x_20_block Uniform + %24 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_24 = OpTypePointer UniformConstant %24 +%frameMapTexture = OpVariable %_ptr_UniformConstant_24 UniformConstant + %27 = OpTypeSampler +%_ptr_UniformConstant_27 = OpTypePointer UniformConstant %27 +%frameMapSampler = OpVariable %_ptr_UniformConstant_27 UniformConstant %_ptr_Private_v2float = OpTypePointer Private %v2float - %29 = OpConstantNull %v2float - %tUV = OpVariable %_ptr_Private_v2float Private %29 -%tileMapsTexture0 = OpVariable %_ptr_UniformConstant_23 UniformConstant -%tileMapsSampler = OpVariable %_ptr_UniformConstant_26 UniformConstant -%tileMapsTexture1 = OpVariable %_ptr_UniformConstant_23 UniformConstant -%animationMapTexture = OpVariable %_ptr_UniformConstant_23 UniformConstant -%animationMapSampler = OpVariable %_ptr_UniformConstant_26 UniformConstant + %30 = OpConstantNull %v2float + %tUV = OpVariable %_ptr_Private_v2float Private %30 +%tileMapsTexture0 = OpVariable %_ptr_UniformConstant_24 UniformConstant +%tileMapsSampler = OpVariable %_ptr_UniformConstant_27 UniformConstant +%tileMapsTexture1 = OpVariable %_ptr_UniformConstant_24 UniformConstant +%animationMapTexture = OpVariable %_ptr_UniformConstant_24 UniformConstant +%animationMapSampler = OpVariable %_ptr_UniformConstant_27 UniformConstant %_ptr_Private_float = OpTypePointer Private %float - %37 = OpConstantNull %float - %mt = OpVariable %_ptr_Private_float Private %37 -%spriteSheetTexture = OpVariable %_ptr_UniformConstant_23 UniformConstant -%spriteSheetSampler = OpVariable %_ptr_UniformConstant_26 UniformConstant + %38 = OpConstantNull %float + %mt = OpVariable %_ptr_Private_float Private %38 +%spriteSheetTexture = OpVariable %_ptr_UniformConstant_24 UniformConstant +%spriteSheetSampler = OpVariable %_ptr_UniformConstant_27 UniformConstant %_ptr_Private_v4float = OpTypePointer Private %v4float %glFragColor = OpVariable %_ptr_Private_v4float Private %15 - %tileID_1 = OpVariable %_ptr_Private_v2float Private %29 - %levelUnits = OpVariable %_ptr_Private_v2float Private %29 -%stageUnits_1 = OpVariable %_ptr_Private_v2float Private %29 + %tileID_1 = OpVariable %_ptr_Private_v2float Private %30 + %levelUnits = OpVariable %_ptr_Private_v2float Private %30 +%stageUnits_1 = OpVariable %_ptr_Private_v2float Private %30 %_ptr_Private_v3float = OpTypePointer Private %v3float - %47 = OpConstantNull %v3float - %vPosition = OpVariable %_ptr_Private_v3float Private %47 - %vUV = OpVariable %_ptr_Private_v2float Private %29 + %48 = OpConstantNull %v3float + %vPosition = OpVariable %_ptr_Private_v3float Private %48 + %vUV = OpVariable %_ptr_Private_v2float Private %30 %_ptr_Function_float = OpTypePointer Function %float - %49 = OpTypeFunction %mat4v4float %_ptr_Function_float + %50 = OpTypeFunction %mat4v4float %_ptr_Function_float + %uint_0 = OpConstant %uint 0 %uint_7 = OpConstant %uint 7 %_ptr_Uniform_float = OpTypePointer Uniform %float - %66 = OpTypeSampledImage %23 + %68 = OpTypeSampledImage %24 %float_0_25 = OpConstant %float 0.25 %float_0_5 = OpConstant %float 0.5 %void = OpTypeVoid - %99 = OpTypeFunction %void + %101 = OpTypeFunction %void %_ptr_Function_v4float = OpTypePointer Function %v4float %_ptr_Function_v2float = OpTypePointer Function %v2float %int = OpTypeInt 32 1 %_ptr_Function_int = OpTypePointer Function %int - %114 = OpConstantNull %int + %116 = OpConstantNull %int %_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float - %120 = OpConstantNull %mat4v4float + %122 = OpConstantNull %mat4v4float %_ptr_Function_v3float = OpTypePointer Function %v3float %uint_1 = OpConstant %uint 1 %float_1 = OpConstant %float 1 %uint_5 = OpConstant %uint 5 %_ptr_Uniform_v2float = OpTypePointer Uniform %v2float - %144 = OpConstantComposite %v2float %float_1 %float_1 + %146 = OpConstantComposite %v2float %float_1 %float_1 %uint_4 = OpConstant %uint 4 %int_2 = OpConstant %int 2 %bool = OpTypeBool - %176 = OpConstantComposite %v2float %float_0_5 %float_0_5 - %uint_0 = OpConstant %uint 0 + %178 = OpConstantComposite %v2float %float_0_5 %float_0_5 %uint_2 = OpConstant %uint 2 %float_8 = OpConstant %float 8 %uint_3 = OpConstant %uint 3 @@ -198,368 +202,368 @@ %uint_8 = OpConstant %uint 8 %_ptr_Uniform_v3float = OpTypePointer Uniform %v3float %main_out = OpTypeStruct %v4float - %346 = OpTypeFunction %main_out %v2float %v2float %v2float %v2float %v3float %v2float -%getFrameData_f1_ = OpFunction %mat4v4float None %49 + %347 = OpTypeFunction %main_out %v2float %v2float %v2float %v2float %v3float %v2float +%getFrameData_f1_ = OpFunction %mat4v4float None %50 %frameID = OpFunctionParameter %_ptr_Function_float - %53 = OpLabel - %fX = OpVariable %_ptr_Function_float Function %37 - %56 = OpLoad %float %frameID - %59 = OpAccessChain %_ptr_Uniform_float %x_20 %uint_7 - %60 = OpLoad %float %59 - %61 = OpFDiv %float %56 %60 - OpStore %fX %61 - %62 = OpLoad %float %fX - %64 = OpLoad %26 %frameMapSampler - %65 = OpLoad %23 %frameMapTexture - %67 = OpSampledImage %66 %65 %64 - %68 = OpCompositeConstruct %v2float %62 %37 - %63 = OpImageSampleImplicitLod %v4float %67 %68 Bias %37 - %69 = OpLoad %float %fX - %71 = OpLoad %26 %frameMapSampler - %72 = OpLoad %23 %frameMapTexture - %73 = OpSampledImage %66 %72 %71 - %75 = OpCompositeConstruct %v2float %69 %float_0_25 - %70 = OpImageSampleImplicitLod %v4float %73 %75 Bias %37 - %76 = OpLoad %float %fX - %78 = OpLoad %26 %frameMapSampler - %79 = OpLoad %23 %frameMapTexture - %80 = OpSampledImage %66 %79 %78 - %82 = OpCompositeConstruct %v2float %76 %float_0_5 - %77 = OpImageSampleImplicitLod %v4float %80 %82 Bias %37 - %83 = OpCompositeExtract %float %63 0 - %84 = OpCompositeExtract %float %63 1 - %85 = OpCompositeExtract %float %63 2 - %86 = OpCompositeExtract %float %63 3 - %87 = OpCompositeConstruct %v4float %83 %84 %85 %86 - %88 = OpCompositeExtract %float %70 0 - %89 = OpCompositeExtract %float %70 1 - %90 = OpCompositeExtract %float %70 2 - %91 = OpCompositeExtract %float %70 3 - %92 = OpCompositeConstruct %v4float %88 %89 %90 %91 - %93 = OpCompositeExtract %float %77 0 - %94 = OpCompositeExtract %float %77 1 - %95 = OpCompositeExtract %float %77 2 - %96 = OpCompositeExtract %float %77 3 - %97 = OpCompositeConstruct %v4float %93 %94 %95 %96 - %98 = OpCompositeConstruct %mat4v4float %87 %92 %97 %15 - OpReturnValue %98 + %54 = OpLabel + %fX = OpVariable %_ptr_Function_float Function %38 + %57 = OpLoad %float %frameID + %61 = OpAccessChain %_ptr_Uniform_float %x_20 %uint_0 %uint_7 + %62 = OpLoad %float %61 + %63 = OpFDiv %float %57 %62 + OpStore %fX %63 + %64 = OpLoad %float %fX + %66 = OpLoad %27 %frameMapSampler + %67 = OpLoad %24 %frameMapTexture + %69 = OpSampledImage %68 %67 %66 + %70 = OpCompositeConstruct %v2float %64 %38 + %65 = OpImageSampleImplicitLod %v4float %69 %70 Bias %38 + %71 = OpLoad %float %fX + %73 = OpLoad %27 %frameMapSampler + %74 = OpLoad %24 %frameMapTexture + %75 = OpSampledImage %68 %74 %73 + %77 = OpCompositeConstruct %v2float %71 %float_0_25 + %72 = OpImageSampleImplicitLod %v4float %75 %77 Bias %38 + %78 = OpLoad %float %fX + %80 = OpLoad %27 %frameMapSampler + %81 = OpLoad %24 %frameMapTexture + %82 = OpSampledImage %68 %81 %80 + %84 = OpCompositeConstruct %v2float %78 %float_0_5 + %79 = OpImageSampleImplicitLod %v4float %82 %84 Bias %38 + %85 = OpCompositeExtract %float %65 0 + %86 = OpCompositeExtract %float %65 1 + %87 = OpCompositeExtract %float %65 2 + %88 = OpCompositeExtract %float %65 3 + %89 = OpCompositeConstruct %v4float %85 %86 %87 %88 + %90 = OpCompositeExtract %float %72 0 + %91 = OpCompositeExtract %float %72 1 + %92 = OpCompositeExtract %float %72 2 + %93 = OpCompositeExtract %float %72 3 + %94 = OpCompositeConstruct %v4float %90 %91 %92 %93 + %95 = OpCompositeExtract %float %79 0 + %96 = OpCompositeExtract %float %79 1 + %97 = OpCompositeExtract %float %79 2 + %98 = OpCompositeExtract %float %79 3 + %99 = OpCompositeConstruct %v4float %95 %96 %97 %98 + %100 = OpCompositeConstruct %mat4v4float %89 %94 %99 %15 + OpReturnValue %100 OpFunctionEnd - %main_1 = OpFunction %void None %99 - %102 = OpLabel + %main_1 = OpFunction %void None %101 + %104 = OpLabel %color = OpVariable %_ptr_Function_v4float Function %15 - %tileUV = OpVariable %_ptr_Function_v2float Function %29 - %tileID = OpVariable %_ptr_Function_v2float Function %29 - %sheetUnits = OpVariable %_ptr_Function_v2float Function %29 -%spriteUnits = OpVariable %_ptr_Function_float Function %37 - %stageUnits = OpVariable %_ptr_Function_v2float Function %29 - %i = OpVariable %_ptr_Function_int Function %114 - %frameID_1 = OpVariable %_ptr_Function_float Function %37 + %tileUV = OpVariable %_ptr_Function_v2float Function %30 + %tileID = OpVariable %_ptr_Function_v2float Function %30 + %sheetUnits = OpVariable %_ptr_Function_v2float Function %30 +%spriteUnits = OpVariable %_ptr_Function_float Function %38 + %stageUnits = OpVariable %_ptr_Function_v2float Function %30 + %i = OpVariable %_ptr_Function_int Function %116 + %frameID_1 = OpVariable %_ptr_Function_float Function %38 %animationData = OpVariable %_ptr_Function_v4float Function %15 - %f = OpVariable %_ptr_Function_float Function %37 - %frameData = OpVariable %_ptr_Function_mat4v4float Function %120 - %param = OpVariable %_ptr_Function_float Function %37 - %frameSize = OpVariable %_ptr_Function_v2float Function %29 - %offset_1 = OpVariable %_ptr_Function_v2float Function %29 - %ratio = OpVariable %_ptr_Function_v2float Function %29 + %f = OpVariable %_ptr_Function_float Function %38 + %frameData = OpVariable %_ptr_Function_mat4v4float Function %122 + %param = OpVariable %_ptr_Function_float Function %38 + %frameSize = OpVariable %_ptr_Function_v2float Function %30 + %offset_1 = OpVariable %_ptr_Function_v2float Function %30 + %ratio = OpVariable %_ptr_Function_v2float Function %30 %nc = OpVariable %_ptr_Function_v4float Function %15 - %alpha = OpVariable %_ptr_Function_float Function %37 - %mixed = OpVariable %_ptr_Function_v3float Function %47 + %alpha = OpVariable %_ptr_Function_float Function %38 + %mixed = OpVariable %_ptr_Function_v3float Function %48 OpStore %color %15 - %129 = OpLoad %v2float %tUV - %130 = OpExtInst %v2float %131 Fract %129 - OpStore %tileUV %130 - %133 = OpAccessChain %_ptr_Function_float %tileUV %uint_1 - %134 = OpLoad %float %133 + %131 = OpLoad %v2float %tUV + %132 = OpExtInst %v2float %133 Fract %131 + OpStore %tileUV %132 %135 = OpAccessChain %_ptr_Function_float %tileUV %uint_1 - %137 = OpFSub %float %float_1 %134 - OpStore %135 %137 - %138 = OpLoad %v2float %tUV - %139 = OpExtInst %v2float %131 Floor %138 - OpStore %tileID %139 - %142 = OpAccessChain %_ptr_Uniform_v2float %x_20 %uint_5 - %143 = OpLoad %v2float %142 - %145 = OpFDiv %v2float %144 %143 - OpStore %sheetUnits %145 - %146 = OpAccessChain %_ptr_Uniform_float %x_20 %uint_7 - %147 = OpLoad %float %146 - %148 = OpFDiv %float %float_1 %147 - OpStore %spriteUnits %148 - %150 = OpAccessChain %_ptr_Uniform_v2float %x_20 %uint_4 - %151 = OpLoad %v2float %150 - %152 = OpFDiv %v2float %144 %151 - OpStore %stageUnits %152 - OpStore %i %114 - OpBranch %153 - %153 = OpLabel - OpLoopMerge %154 %155 None - OpBranch %156 - %156 = OpLabel - %157 = OpLoad %int %i - %159 = OpSLessThan %bool %157 %int_2 - OpSelectionMerge %161 None - OpBranchConditional %159 %162 %163 - %162 = OpLabel - OpBranch %161 - %163 = OpLabel - OpBranch %154 - %161 = OpLabel - %164 = OpLoad %int %i - OpSelectionMerge %165 None - OpSwitch %164 %166 1 %167 0 %168 - %167 = OpLabel - %169 = OpLoad %v2float %tileID - %170 = OpAccessChain %_ptr_Uniform_v2float %x_20 %uint_4 - %171 = OpLoad %v2float %170 - %173 = OpLoad %26 %tileMapsSampler - %174 = OpLoad %23 %tileMapsTexture1 - %175 = OpSampledImage %66 %174 %173 - %177 = OpFAdd %v2float %169 %176 - %178 = OpFDiv %v2float %177 %171 - %172 = OpImageSampleImplicitLod %v4float %175 %178 Bias %37 - %179 = OpCompositeExtract %float %172 0 - OpStore %frameID_1 %179 - OpBranch %165 - %168 = OpLabel - %180 = OpLoad %v2float %tileID - %181 = OpAccessChain %_ptr_Uniform_v2float %x_20 %uint_4 - %182 = OpLoad %v2float %181 - %184 = OpLoad %26 %tileMapsSampler - %185 = OpLoad %23 %tileMapsTexture0 - %186 = OpSampledImage %66 %185 %184 - %187 = OpFAdd %v2float %180 %176 - %188 = OpFDiv %v2float %187 %182 - %183 = OpImageSampleImplicitLod %v4float %186 %188 Bias %37 - %189 = OpCompositeExtract %float %183 0 - OpStore %frameID_1 %189 - OpBranch %165 - %166 = OpLabel - OpBranch %165 - %165 = OpLabel - %190 = OpLoad %float %frameID_1 - %191 = OpAccessChain %_ptr_Uniform_float %x_20 %uint_7 - %192 = OpLoad %float %191 - %194 = OpLoad %26 %animationMapSampler - %195 = OpLoad %23 %animationMapTexture - %196 = OpSampledImage %66 %195 %194 - %197 = OpFAdd %float %190 %float_0_5 - %198 = OpFDiv %float %197 %192 - %199 = OpCompositeConstruct %v2float %198 %37 - %193 = OpImageSampleImplicitLod %v4float %196 %199 Bias %37 - OpStore %animationData %193 - %200 = OpAccessChain %_ptr_Function_float %animationData %uint_1 - %201 = OpLoad %float %200 - %202 = OpFOrdGreaterThan %bool %201 %37 - OpSelectionMerge %203 None - OpBranchConditional %202 %204 %203 - %204 = OpLabel - %206 = OpAccessChain %_ptr_Uniform_float %x_20 %uint_0 - %207 = OpLoad %float %206 - %209 = OpAccessChain %_ptr_Function_float %animationData %uint_2 - %210 = OpLoad %float %209 - %211 = OpFMul %float %207 %210 - %212 = OpFRem %float %211 %float_1 - OpStore %mt %212 - OpStore %f %37 - OpBranch %213 - %213 = OpLabel - OpLoopMerge %214 %215 None - OpBranch %216 - %216 = OpLabel - %217 = OpLoad %float %f - %219 = OpFOrdLessThan %bool %217 %float_8 - OpSelectionMerge %220 None - OpBranchConditional %219 %221 %222 - %221 = OpLabel - OpBranch %220 - %222 = OpLabel - OpBranch %214 - %220 = OpLabel - %223 = OpAccessChain %_ptr_Function_float %animationData %uint_1 - %224 = OpLoad %float %223 - %225 = OpLoad %float %mt - %226 = OpFOrdGreaterThan %bool %224 %225 - OpSelectionMerge %227 None - OpBranchConditional %226 %228 %227 - %228 = OpLabel - %229 = OpAccessChain %_ptr_Function_float %animationData %uint_0 - %230 = OpLoad %float %229 - OpStore %frameID_1 %230 - OpBranch %214 - %227 = OpLabel - %231 = OpLoad %float %frameID_1 - %232 = OpAccessChain %_ptr_Uniform_float %x_20 %uint_7 - %233 = OpLoad %float %232 - %234 = OpLoad %float %f - OpStore %animationData %15 - OpBranch %215 - %215 = OpLabel - %235 = OpLoad %float %f - %236 = OpFAdd %float %235 %float_1 - OpStore %f %236 - OpBranch %213 - %214 = OpLabel - OpBranch %203 - %203 = OpLabel - %237 = OpLoad %float %frameID_1 - %238 = OpFAdd %float %237 %float_0_5 - OpStore %param %238 - %239 = OpFunctionCall %mat4v4float %getFrameData_f1_ %param - OpStore %frameData %239 - %241 = OpAccessChain %_ptr_Function_v4float %frameData %114 - %242 = OpLoad %v4float %241 - %243 = OpAccessChain %_ptr_Uniform_v2float %x_20 %uint_5 - %244 = OpLoad %v2float %243 - %245 = OpCompositeExtract %float %242 3 - %246 = OpCompositeExtract %float %242 2 - %247 = OpCompositeConstruct %v2float %245 %246 - %248 = OpFDiv %v2float %247 %244 - OpStore %frameSize %248 - %249 = OpAccessChain %_ptr_Function_v4float %frameData %114 - %250 = OpLoad %v4float %249 - %251 = OpLoad %v2float %sheetUnits - %252 = OpCompositeExtract %float %250 0 - %253 = OpCompositeExtract %float %250 1 - %254 = OpCompositeConstruct %v2float %252 %253 - %255 = OpFMul %v2float %254 %251 - OpStore %offset_1 %255 - %256 = OpAccessChain %_ptr_Function_v4float %frameData %int_2 - %257 = OpLoad %v4float %256 - %258 = OpAccessChain %_ptr_Function_v4float %frameData %114 - %259 = OpLoad %v4float %258 - %260 = OpCompositeExtract %float %257 0 - %261 = OpCompositeExtract %float %257 1 - %262 = OpCompositeConstruct %v2float %260 %261 - %263 = OpCompositeExtract %float %259 3 - %264 = OpCompositeExtract %float %259 2 - %265 = OpCompositeConstruct %v2float %263 %264 - %266 = OpFDiv %v2float %262 %265 - OpStore %ratio %266 - %267 = OpAccessChain %_ptr_Function_float %frameData %int_2 %uint_2 - %268 = OpLoad %float %267 - %269 = OpFOrdEqual %bool %268 %float_1 - OpSelectionMerge %270 None - OpBranchConditional %269 %271 %270 - %271 = OpLabel - %272 = OpLoad %v2float %tileUV - %273 = OpCompositeExtract %float %272 1 - %274 = OpCompositeExtract %float %272 0 - %275 = OpCompositeConstruct %v2float %273 %274 - OpStore %tileUV %275 - OpBranch %270 - %270 = OpLabel - %276 = OpLoad %int %i - %277 = OpIEqual %bool %276 %114 - OpSelectionMerge %278 None - OpBranchConditional %277 %279 %280 - %279 = OpLabel - %281 = OpLoad %v2float %tileUV - %282 = OpLoad %v2float %frameSize - %283 = OpLoad %v2float %offset_1 - %285 = OpLoad %26 %spriteSheetSampler - %286 = OpLoad %23 %spriteSheetTexture - %287 = OpSampledImage %66 %286 %285 - %288 = OpFMul %v2float %281 %282 - %289 = OpFAdd %v2float %288 %283 - %284 = OpImageSampleImplicitLod %v4float %287 %289 - OpStore %color %284 - OpBranch %278 - %280 = OpLabel - %290 = OpLoad %v2float %tileUV - %291 = OpLoad %v2float %frameSize - %292 = OpLoad %v2float %offset_1 - %294 = OpLoad %26 %spriteSheetSampler - %295 = OpLoad %23 %spriteSheetTexture - %296 = OpSampledImage %66 %295 %294 - %297 = OpFMul %v2float %290 %291 - %298 = OpFAdd %v2float %297 %292 - %293 = OpImageSampleImplicitLod %v4float %296 %298 - OpStore %nc %293 - %300 = OpAccessChain %_ptr_Function_float %color %uint_3 - %301 = OpLoad %float %300 - %302 = OpAccessChain %_ptr_Function_float %nc %uint_3 - %303 = OpLoad %float %302 - %305 = OpFAdd %float %301 %303 - %304 = OpExtInst %float %131 NMin %305 %float_1 - OpStore %alpha %304 - %306 = OpLoad %v4float %color - %307 = OpLoad %v4float %nc - %308 = OpAccessChain %_ptr_Function_float %nc %uint_3 - %309 = OpLoad %float %308 - %311 = OpCompositeExtract %float %306 0 - %312 = OpCompositeExtract %float %306 1 - %313 = OpCompositeExtract %float %306 2 - %314 = OpCompositeConstruct %v3float %311 %312 %313 - %315 = OpCompositeExtract %float %307 0 - %316 = OpCompositeExtract %float %307 1 - %317 = OpCompositeExtract %float %307 2 - %318 = OpCompositeConstruct %v3float %315 %316 %317 - %319 = OpCompositeConstruct %v3float %309 %309 %309 - %310 = OpExtInst %v3float %131 FMix %314 %318 %319 - OpStore %mixed %310 - %320 = OpLoad %v3float %mixed - %321 = OpLoad %float %alpha - %322 = OpCompositeExtract %float %320 0 - %323 = OpCompositeExtract %float %320 1 - %324 = OpCompositeExtract %float %320 2 - %325 = OpCompositeConstruct %v4float %322 %323 %324 %321 - OpStore %color %325 - OpBranch %278 - %278 = OpLabel + %136 = OpLoad %float %135 + %137 = OpAccessChain %_ptr_Function_float %tileUV %uint_1 + %139 = OpFSub %float %float_1 %136 + OpStore %137 %139 + %140 = OpLoad %v2float %tUV + %141 = OpExtInst %v2float %133 Floor %140 + OpStore %tileID %141 + %144 = OpAccessChain %_ptr_Uniform_v2float %x_20 %uint_0 %uint_5 + %145 = OpLoad %v2float %144 + %147 = OpFDiv %v2float %146 %145 + OpStore %sheetUnits %147 + %148 = OpAccessChain %_ptr_Uniform_float %x_20 %uint_0 %uint_7 + %149 = OpLoad %float %148 + %150 = OpFDiv %float %float_1 %149 + OpStore %spriteUnits %150 + %152 = OpAccessChain %_ptr_Uniform_v2float %x_20 %uint_0 %uint_4 + %153 = OpLoad %v2float %152 + %154 = OpFDiv %v2float %146 %153 + OpStore %stageUnits %154 + OpStore %i %116 OpBranch %155 %155 = OpLabel - %326 = OpLoad %int %i - %328 = OpIAdd %int %326 %int_1 - OpStore %i %328 - OpBranch %153 - %154 = OpLabel - %331 = OpAccessChain %_ptr_Uniform_v3float %x_20 %uint_8 - %332 = OpLoad %v3float %331 - %333 = OpLoad %v4float %color - %334 = OpCompositeExtract %float %333 0 - %335 = OpCompositeExtract %float %333 1 - %336 = OpCompositeExtract %float %333 2 - %337 = OpCompositeConstruct %v3float %334 %335 %336 - %338 = OpFMul %v3float %337 %332 - %339 = OpLoad %v4float %color - %340 = OpCompositeExtract %float %338 0 - %341 = OpCompositeExtract %float %338 1 - %342 = OpCompositeExtract %float %338 2 - %343 = OpCompositeExtract %float %339 3 - %344 = OpCompositeConstruct %v4float %340 %341 %342 %343 - OpStore %color %344 - %345 = OpLoad %v4float %color - OpStore %glFragColor %345 + OpLoopMerge %156 %157 None + OpBranch %158 + %158 = OpLabel + %159 = OpLoad %int %i + %161 = OpSLessThan %bool %159 %int_2 + OpSelectionMerge %163 None + OpBranchConditional %161 %164 %165 + %164 = OpLabel + OpBranch %163 + %165 = OpLabel + OpBranch %156 + %163 = OpLabel + %166 = OpLoad %int %i + OpSelectionMerge %167 None + OpSwitch %166 %168 1 %169 0 %170 + %169 = OpLabel + %171 = OpLoad %v2float %tileID + %172 = OpAccessChain %_ptr_Uniform_v2float %x_20 %uint_0 %uint_4 + %173 = OpLoad %v2float %172 + %175 = OpLoad %27 %tileMapsSampler + %176 = OpLoad %24 %tileMapsTexture1 + %177 = OpSampledImage %68 %176 %175 + %179 = OpFAdd %v2float %171 %178 + %180 = OpFDiv %v2float %179 %173 + %174 = OpImageSampleImplicitLod %v4float %177 %180 Bias %38 + %181 = OpCompositeExtract %float %174 0 + OpStore %frameID_1 %181 + OpBranch %167 + %170 = OpLabel + %182 = OpLoad %v2float %tileID + %183 = OpAccessChain %_ptr_Uniform_v2float %x_20 %uint_0 %uint_4 + %184 = OpLoad %v2float %183 + %186 = OpLoad %27 %tileMapsSampler + %187 = OpLoad %24 %tileMapsTexture0 + %188 = OpSampledImage %68 %187 %186 + %189 = OpFAdd %v2float %182 %178 + %190 = OpFDiv %v2float %189 %184 + %185 = OpImageSampleImplicitLod %v4float %188 %190 Bias %38 + %191 = OpCompositeExtract %float %185 0 + OpStore %frameID_1 %191 + OpBranch %167 + %168 = OpLabel + OpBranch %167 + %167 = OpLabel + %192 = OpLoad %float %frameID_1 + %193 = OpAccessChain %_ptr_Uniform_float %x_20 %uint_0 %uint_7 + %194 = OpLoad %float %193 + %196 = OpLoad %27 %animationMapSampler + %197 = OpLoad %24 %animationMapTexture + %198 = OpSampledImage %68 %197 %196 + %199 = OpFAdd %float %192 %float_0_5 + %200 = OpFDiv %float %199 %194 + %201 = OpCompositeConstruct %v2float %200 %38 + %195 = OpImageSampleImplicitLod %v4float %198 %201 Bias %38 + OpStore %animationData %195 + %202 = OpAccessChain %_ptr_Function_float %animationData %uint_1 + %203 = OpLoad %float %202 + %204 = OpFOrdGreaterThan %bool %203 %38 + OpSelectionMerge %205 None + OpBranchConditional %204 %206 %205 + %206 = OpLabel + %207 = OpAccessChain %_ptr_Uniform_float %x_20 %uint_0 %uint_0 + %208 = OpLoad %float %207 + %210 = OpAccessChain %_ptr_Function_float %animationData %uint_2 + %211 = OpLoad %float %210 + %212 = OpFMul %float %208 %211 + %213 = OpFRem %float %212 %float_1 + OpStore %mt %213 + OpStore %f %38 + OpBranch %214 + %214 = OpLabel + OpLoopMerge %215 %216 None + OpBranch %217 + %217 = OpLabel + %218 = OpLoad %float %f + %220 = OpFOrdLessThan %bool %218 %float_8 + OpSelectionMerge %221 None + OpBranchConditional %220 %222 %223 + %222 = OpLabel + OpBranch %221 + %223 = OpLabel + OpBranch %215 + %221 = OpLabel + %224 = OpAccessChain %_ptr_Function_float %animationData %uint_1 + %225 = OpLoad %float %224 + %226 = OpLoad %float %mt + %227 = OpFOrdGreaterThan %bool %225 %226 + OpSelectionMerge %228 None + OpBranchConditional %227 %229 %228 + %229 = OpLabel + %230 = OpAccessChain %_ptr_Function_float %animationData %uint_0 + %231 = OpLoad %float %230 + OpStore %frameID_1 %231 + OpBranch %215 + %228 = OpLabel + %232 = OpLoad %float %frameID_1 + %233 = OpAccessChain %_ptr_Uniform_float %x_20 %uint_0 %uint_7 + %234 = OpLoad %float %233 + %235 = OpLoad %float %f + OpStore %animationData %15 + OpBranch %216 + %216 = OpLabel + %236 = OpLoad %float %f + %237 = OpFAdd %float %236 %float_1 + OpStore %f %237 + OpBranch %214 + %215 = OpLabel + OpBranch %205 + %205 = OpLabel + %238 = OpLoad %float %frameID_1 + %239 = OpFAdd %float %238 %float_0_5 + OpStore %param %239 + %240 = OpFunctionCall %mat4v4float %getFrameData_f1_ %param + OpStore %frameData %240 + %242 = OpAccessChain %_ptr_Function_v4float %frameData %116 + %243 = OpLoad %v4float %242 + %244 = OpAccessChain %_ptr_Uniform_v2float %x_20 %uint_0 %uint_5 + %245 = OpLoad %v2float %244 + %246 = OpCompositeExtract %float %243 3 + %247 = OpCompositeExtract %float %243 2 + %248 = OpCompositeConstruct %v2float %246 %247 + %249 = OpFDiv %v2float %248 %245 + OpStore %frameSize %249 + %250 = OpAccessChain %_ptr_Function_v4float %frameData %116 + %251 = OpLoad %v4float %250 + %252 = OpLoad %v2float %sheetUnits + %253 = OpCompositeExtract %float %251 0 + %254 = OpCompositeExtract %float %251 1 + %255 = OpCompositeConstruct %v2float %253 %254 + %256 = OpFMul %v2float %255 %252 + OpStore %offset_1 %256 + %257 = OpAccessChain %_ptr_Function_v4float %frameData %int_2 + %258 = OpLoad %v4float %257 + %259 = OpAccessChain %_ptr_Function_v4float %frameData %116 + %260 = OpLoad %v4float %259 + %261 = OpCompositeExtract %float %258 0 + %262 = OpCompositeExtract %float %258 1 + %263 = OpCompositeConstruct %v2float %261 %262 + %264 = OpCompositeExtract %float %260 3 + %265 = OpCompositeExtract %float %260 2 + %266 = OpCompositeConstruct %v2float %264 %265 + %267 = OpFDiv %v2float %263 %266 + OpStore %ratio %267 + %268 = OpAccessChain %_ptr_Function_float %frameData %int_2 %uint_2 + %269 = OpLoad %float %268 + %270 = OpFOrdEqual %bool %269 %float_1 + OpSelectionMerge %271 None + OpBranchConditional %270 %272 %271 + %272 = OpLabel + %273 = OpLoad %v2float %tileUV + %274 = OpCompositeExtract %float %273 1 + %275 = OpCompositeExtract %float %273 0 + %276 = OpCompositeConstruct %v2float %274 %275 + OpStore %tileUV %276 + OpBranch %271 + %271 = OpLabel + %277 = OpLoad %int %i + %278 = OpIEqual %bool %277 %116 + OpSelectionMerge %279 None + OpBranchConditional %278 %280 %281 + %280 = OpLabel + %282 = OpLoad %v2float %tileUV + %283 = OpLoad %v2float %frameSize + %284 = OpLoad %v2float %offset_1 + %286 = OpLoad %27 %spriteSheetSampler + %287 = OpLoad %24 %spriteSheetTexture + %288 = OpSampledImage %68 %287 %286 + %289 = OpFMul %v2float %282 %283 + %290 = OpFAdd %v2float %289 %284 + %285 = OpImageSampleImplicitLod %v4float %288 %290 + OpStore %color %285 + OpBranch %279 + %281 = OpLabel + %291 = OpLoad %v2float %tileUV + %292 = OpLoad %v2float %frameSize + %293 = OpLoad %v2float %offset_1 + %295 = OpLoad %27 %spriteSheetSampler + %296 = OpLoad %24 %spriteSheetTexture + %297 = OpSampledImage %68 %296 %295 + %298 = OpFMul %v2float %291 %292 + %299 = OpFAdd %v2float %298 %293 + %294 = OpImageSampleImplicitLod %v4float %297 %299 + OpStore %nc %294 + %301 = OpAccessChain %_ptr_Function_float %color %uint_3 + %302 = OpLoad %float %301 + %303 = OpAccessChain %_ptr_Function_float %nc %uint_3 + %304 = OpLoad %float %303 + %306 = OpFAdd %float %302 %304 + %305 = OpExtInst %float %133 NMin %306 %float_1 + OpStore %alpha %305 + %307 = OpLoad %v4float %color + %308 = OpLoad %v4float %nc + %309 = OpAccessChain %_ptr_Function_float %nc %uint_3 + %310 = OpLoad %float %309 + %312 = OpCompositeExtract %float %307 0 + %313 = OpCompositeExtract %float %307 1 + %314 = OpCompositeExtract %float %307 2 + %315 = OpCompositeConstruct %v3float %312 %313 %314 + %316 = OpCompositeExtract %float %308 0 + %317 = OpCompositeExtract %float %308 1 + %318 = OpCompositeExtract %float %308 2 + %319 = OpCompositeConstruct %v3float %316 %317 %318 + %320 = OpCompositeConstruct %v3float %310 %310 %310 + %311 = OpExtInst %v3float %133 FMix %315 %319 %320 + OpStore %mixed %311 + %321 = OpLoad %v3float %mixed + %322 = OpLoad %float %alpha + %323 = OpCompositeExtract %float %321 0 + %324 = OpCompositeExtract %float %321 1 + %325 = OpCompositeExtract %float %321 2 + %326 = OpCompositeConstruct %v4float %323 %324 %325 %322 + OpStore %color %326 + OpBranch %279 + %279 = OpLabel + OpBranch %157 + %157 = OpLabel + %327 = OpLoad %int %i + %329 = OpIAdd %int %327 %int_1 + OpStore %i %329 + OpBranch %155 + %156 = OpLabel + %332 = OpAccessChain %_ptr_Uniform_v3float %x_20 %uint_0 %uint_8 + %333 = OpLoad %v3float %332 + %334 = OpLoad %v4float %color + %335 = OpCompositeExtract %float %334 0 + %336 = OpCompositeExtract %float %334 1 + %337 = OpCompositeExtract %float %334 2 + %338 = OpCompositeConstruct %v3float %335 %336 %337 + %339 = OpFMul %v3float %338 %333 + %340 = OpLoad %v4float %color + %341 = OpCompositeExtract %float %339 0 + %342 = OpCompositeExtract %float %339 1 + %343 = OpCompositeExtract %float %339 2 + %344 = OpCompositeExtract %float %340 3 + %345 = OpCompositeConstruct %v4float %341 %342 %343 %344 + OpStore %color %345 + %346 = OpLoad %v4float %color + OpStore %glFragColor %346 OpReturn OpFunctionEnd - %main_inner = OpFunction %main_out None %346 + %main_inner = OpFunction %main_out None %347 %tUV_param = OpFunctionParameter %v2float %tileID_1_param = OpFunctionParameter %v2float %levelUnits_param = OpFunctionParameter %v2float %stageUnits_1_param = OpFunctionParameter %v2float %vPosition_param = OpFunctionParameter %v3float %vUV_param = OpFunctionParameter %v2float - %355 = OpLabel + %356 = OpLabel OpStore %tUV %tUV_param OpStore %tileID_1 %tileID_1_param OpStore %levelUnits %levelUnits_param OpStore %stageUnits_1 %stageUnits_1_param OpStore %vPosition %vPosition_param OpStore %vUV %vUV_param - %356 = OpFunctionCall %void %main_1 - %357 = OpLoad %v4float %glFragColor - %358 = OpCompositeConstruct %main_out %357 - OpReturnValue %358 + %357 = OpFunctionCall %void %main_1 + %358 = OpLoad %v4float %glFragColor + %359 = OpCompositeConstruct %main_out %358 + OpReturnValue %359 OpFunctionEnd - %main = OpFunction %void None %99 - %360 = OpLabel - %362 = OpLoad %v2float %tUV_param_1 - %363 = OpLoad %v2float %tileID_1_param_1 - %364 = OpLoad %v2float %levelUnits_param_1 - %365 = OpLoad %v2float %stageUnits_1_param_1 - %366 = OpLoad %v3float %vPosition_param_1 - %367 = OpLoad %v2float %vUV_param_1 - %361 = OpFunctionCall %main_out %main_inner %362 %363 %364 %365 %366 %367 - %368 = OpCompositeExtract %v4float %361 0 - OpStore %glFragColor_1_1 %368 + %main = OpFunction %void None %101 + %361 = OpLabel + %363 = OpLoad %v2float %tUV_param_1 + %364 = OpLoad %v2float %tileID_1_param_1 + %365 = OpLoad %v2float %levelUnits_param_1 + %366 = OpLoad %v2float %stageUnits_1_param_1 + %367 = OpLoad %v3float %vPosition_param_1 + %368 = OpLoad %v2float %vUV_param_1 + %362 = OpFunctionCall %main_out %main_inner %363 %364 %365 %366 %367 %368 + %369 = OpCompositeExtract %v4float %362 0 + OpStore %glFragColor_1_1 %369 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/949.wgsl.expected.glsl b/test/tint/bug/tint/949.wgsl.expected.glsl index 2ec8422fb9..0df34d4be3 100644 --- a/test/tint/bug/tint/949.wgsl.expected.glsl +++ b/test/tint/bug/tint/949.wgsl.expected.glsl @@ -11,10 +11,7 @@ struct lightingInfo { vec3 specular; }; -float u_Float = 0.0f; -vec3 u_Color = vec3(0.0f, 0.0f, 0.0f); -vec2 vMainuv = vec2(0.0f, 0.0f); -layout(binding = 6, std140) uniform LeftOver_ubo { +struct LeftOver { mat4 u_World; mat4 u_ViewProjection; float u_bumpStrength; @@ -26,13 +23,9 @@ layout(binding = 6, std140) uniform LeftOver_ubo { float textureInfoName; uint padding_1; vec2 tangentSpaceParameter0; -} x_269; +}; -vec4 v_output1 = vec4(0.0f, 0.0f, 0.0f, 0.0f); -bool tint_symbol = false; -vec2 v_uv = vec2(0.0f, 0.0f); -vec4 v_output2 = vec4(0.0f, 0.0f, 0.0f, 0.0f); -layout(binding = 5, std140) uniform Light0_ubo { +struct Light0 { vec4 vLightData; vec4 vLightDiffuse; vec4 vLightSpecular; @@ -42,6 +35,21 @@ layout(binding = 5, std140) uniform Light0_ubo { vec2 depthValues; uint pad_2; uint pad_3; +}; + +float u_Float = 0.0f; +vec3 u_Color = vec3(0.0f, 0.0f, 0.0f); +vec2 vMainuv = vec2(0.0f, 0.0f); +layout(binding = 6, std140) uniform x_269_block_ubo { + LeftOver inner; +} x_269; + +vec4 v_output1 = vec4(0.0f, 0.0f, 0.0f, 0.0f); +bool tint_symbol = false; +vec2 v_uv = vec2(0.0f, 0.0f); +vec4 v_output2 = vec4(0.0f, 0.0f, 0.0f, 0.0f); +layout(binding = 5, std140) uniform light0_block_ubo { + Light0 inner; } light0; vec4 glFragColor = vec4(0.0f, 0.0f, 0.0f, 0.0f); @@ -239,14 +247,14 @@ void main_1() { vec4 x_262 = texture(TextureSamplerTexture_TextureSamplerSampler, x_261); tempTextureRead = x_262; vec4 x_264 = tempTextureRead; - float x_273 = x_269.textureInfoName; + float x_273 = x_269.inner.textureInfoName; rgb = (vec3(x_264.x, x_264.y, x_264.z) * x_273); - vec3 x_279 = x_269.u_cameraPosition; + vec3 x_279 = x_269.inner.u_cameraPosition; vec4 x_282 = v_output1; output5 = normalize((x_279 - vec3(x_282.x, x_282.y, x_282.z))); output4 = vec4(0.0f); uvOffset = vec2(0.0f); - float x_292 = x_269.u_bumpStrength; + float x_292 = x_269.inner.u_bumpStrength; normalScale = (1.0f / x_292); bool x_298 = tint_symbol; if (x_298) { @@ -265,7 +273,7 @@ void main_1() { param_4 = vec3(x_317.x, x_317.y, x_317.z); vec2 x_320 = TBNUV; param_5 = x_320; - vec2 x_324 = x_269.tangentSpaceParameter0; + vec2 x_324 = x_269.inner.tangentSpaceParameter0; param_6 = x_324; mat3 x_325 = cotangent_frame_vf3_vf3_vf2_vf2_(param_3, param_4, param_5, param_6); TBN = x_325; @@ -279,7 +287,7 @@ void main_1() { mat3 x_337 = invTBN; vec3 x_338 = output5; parallaxLimit = (length(vec2(x_334.x, x_334.y)) / (x_337 * -(x_338)).z); - float x_345 = x_269.u_parallaxScale; + float x_345 = x_269.inner.u_parallaxScale; float x_346 = parallaxLimit; parallaxLimit = (x_346 * x_345); mat3 x_349 = invTBN; @@ -357,7 +365,7 @@ void main_1() { vec2 x_449 = v_uv; vec2 x_450 = uvOffset; vec4 x_452 = texture(TextureSamplerTexture_TextureSamplerSampler, (x_449 + x_450)); - float x_454 = x_269.u_bumpStrength; + float x_454 = x_269.inner.u_bumpStrength; mat3 x_457 = TBN; param_8 = x_457; param_9 = vec3(x_452.x, x_452.y, x_452.z); @@ -373,7 +381,7 @@ void main_1() { tempTextureRead1 = x_475; vec4 x_477 = tempTextureRead1; rgb1 = vec3(x_477.x, x_477.y, x_477.z); - vec3 x_481 = x_269.u_cameraPosition; + vec3 x_481 = x_269.inner.u_cameraPosition; vec4 x_482 = v_output1; viewDirectionW_1 = normalize((x_481 - vec3(x_482.x, x_482.y, x_482.z))); shadow = 1.0f; @@ -387,13 +395,13 @@ void main_1() { param_11 = x_501; vec3 x_503 = normalW; param_12 = x_503; - vec4 x_507 = light0.vLightData; + vec4 x_507 = light0.inner.vLightData; param_13 = x_507; - vec4 x_510 = light0.vLightDiffuse; + vec4 x_510 = light0.inner.vLightDiffuse; param_14 = vec3(x_510.x, x_510.y, x_510.z); - vec4 x_514 = light0.vLightSpecular; + vec4 x_514 = light0.inner.vLightSpecular; param_15 = vec3(x_514.x, x_514.y, x_514.z); - vec3 x_518 = light0.vLightGround; + vec3 x_518 = light0.inner.vLightGround; param_16 = x_518; float x_520 = glossiness_1; param_17 = x_520; diff --git a/test/tint/bug/tint/949.wgsl.expected.spvasm b/test/tint/bug/tint/949.wgsl.expected.spvasm index 68f2093bfe..fc44b4ff25 100644 --- a/test/tint/bug/tint/949.wgsl.expected.spvasm +++ b/test/tint/bug/tint/949.wgsl.expected.spvasm @@ -1,10 +1,10 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 665 +; Bound: 667 ; Schema: 0 OpCapability Shader - %88 = OpExtInstImport "GLSL.std.450" + %90 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %main "main" %vMainuv_param_1 %v_output1_param_1 %gl_FrontFacing_param_1 %v_uv_param_1 %v_output2_param_1 %glFragColor_1_1 OpExecutionMode %main OriginUpperLeft @@ -19,6 +19,8 @@ OpName %TextureSamplerTexture "TextureSamplerTexture" OpName %TextureSamplerSampler "TextureSamplerSampler" OpName %vMainuv "vMainuv" + OpName %x_269_block "x_269_block" + OpMemberName %x_269_block 0 "inner" OpName %LeftOver "LeftOver" OpMemberName %LeftOver 0 "u_World" OpMemberName %LeftOver 1 "u_ViewProjection" @@ -36,6 +38,8 @@ OpName %v_output2 "v_output2" OpName %TextureSampler1Texture "TextureSampler1Texture" OpName %TextureSampler1Sampler "TextureSampler1Sampler" + OpName %light0_block "light0_block" + OpMemberName %light0_block 0 "inner" OpName %Light0 "Light0" OpMemberName %Light0 0 "vLightData" OpMemberName %Light0 1 "vLightDiffuse" @@ -167,7 +171,8 @@ OpDecorate %TextureSamplerTexture Binding 1 OpDecorate %TextureSamplerSampler DescriptorSet 2 OpDecorate %TextureSamplerSampler Binding 0 - OpDecorate %LeftOver Block + OpDecorate %x_269_block Block + OpMemberDecorate %x_269_block 0 Offset 0 OpMemberDecorate %LeftOver 0 Offset 0 OpMemberDecorate %LeftOver 0 ColMajor OpMemberDecorate %LeftOver 0 MatrixStride 16 @@ -188,7 +193,8 @@ OpDecorate %TextureSampler1Texture Binding 3 OpDecorate %TextureSampler1Sampler DescriptorSet 2 OpDecorate %TextureSampler1Sampler Binding 2 - OpDecorate %Light0 Block + OpDecorate %light0_block Block + OpMemberDecorate %light0_block 0 Offset 0 OpMemberDecorate %Light0 0 Offset 0 OpMemberDecorate %Light0 1 Offset 16 OpMemberDecorate %Light0 2 Offset 32 @@ -240,54 +246,56 @@ %mat4v4float = OpTypeMatrix %v4float 4 %uint = OpTypeInt 32 0 %LeftOver = OpTypeStruct %mat4v4float %mat4v4float %float %uint %v3float %float %float %uint %v2float -%_ptr_Uniform_LeftOver = OpTypePointer Uniform %LeftOver - %x_269 = OpVariable %_ptr_Uniform_LeftOver Uniform +%x_269_block = OpTypeStruct %LeftOver +%_ptr_Uniform_x_269_block = OpTypePointer Uniform %x_269_block + %x_269 = OpVariable %_ptr_Uniform_x_269_block Uniform %_ptr_Private_v4float = OpTypePointer Private %v4float %v_output1 = OpVariable %_ptr_Private_v4float Private %15 %_ptr_Private_bool = OpTypePointer Private %bool - %41 = OpConstantNull %bool -%gl_FrontFacing = OpVariable %_ptr_Private_bool Private %41 + %42 = OpConstantNull %bool +%gl_FrontFacing = OpVariable %_ptr_Private_bool Private %42 %v_uv = OpVariable %_ptr_Private_v2float Private %31 %v_output2 = OpVariable %_ptr_Private_v4float Private %15 %TextureSampler1Texture = OpVariable %_ptr_UniformConstant_25 UniformConstant %TextureSampler1Sampler = OpVariable %_ptr_UniformConstant_28 UniformConstant %Light0 = OpTypeStruct %v4float %v4float %v4float %v3float %uint %v4float %v2float -%_ptr_Uniform_Light0 = OpTypePointer Uniform %Light0 - %light0 = OpVariable %_ptr_Uniform_Light0 Uniform +%light0_block = OpTypeStruct %Light0 +%_ptr_Uniform_light0_block = OpTypePointer Uniform %light0_block + %light0 = OpVariable %_ptr_Uniform_light0_block Uniform %glFragColor = OpVariable %_ptr_Private_v4float Private %15 %bumpSamplerSampler = OpVariable %_ptr_UniformConstant_28 UniformConstant %bumpSamplerTexture = OpVariable %_ptr_UniformConstant_25 UniformConstant %mat3v3float = OpTypeMatrix %v3float 3 %_ptr_Function_v3float = OpTypePointer Function %v3float %_ptr_Function_v2float = OpTypePointer Function %v2float - %52 = OpTypeFunction %mat3v3float %_ptr_Function_v3float %_ptr_Function_v3float %_ptr_Function_v2float %_ptr_Function_v2float + %54 = OpTypeFunction %mat3v3float %_ptr_Function_v3float %_ptr_Function_v3float %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_float = OpTypePointer Function %float %uint_0 = OpConstant %uint 0 %uint_1 = OpConstant %uint 1 %_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float - %152 = OpTypeFunction %mat3v3float %_ptr_Function_mat3v3float - %161 = OpConstantNull %mat3v3float + %154 = OpTypeFunction %mat3v3float %_ptr_Function_mat3v3float + %163 = OpConstantNull %mat3v3float %int = OpTypeInt 32 1 - %164 = OpConstantNull %int + %166 = OpConstantNull %int %int_1 = OpConstant %int 1 %int_2 = OpConstant %int 2 %uint_2 = OpConstant %uint 2 - %211 = OpTypeFunction %v3float %_ptr_Function_mat3v3float %_ptr_Function_v3float %_ptr_Function_float + %213 = OpTypeFunction %v3float %_ptr_Function_mat3v3float %_ptr_Function_v3float %_ptr_Function_float %float_2 = OpConstant %float 2 %float_1 = OpConstant %float 1 - %238 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %240 = OpConstantComposite %v3float %float_1 %float_1 %float_1 %lightingInfo = OpTypeStruct %v3float %v3float %_ptr_Function_v4float = OpTypePointer Function %v4float - %246 = OpTypeFunction %lightingInfo %_ptr_Function_v3float %_ptr_Function_v3float %_ptr_Function_v4float %_ptr_Function_v3float %_ptr_Function_v3float %_ptr_Function_v3float %_ptr_Function_float + %248 = OpTypeFunction %lightingInfo %_ptr_Function_v3float %_ptr_Function_v3float %_ptr_Function_v4float %_ptr_Function_v3float %_ptr_Function_v3float %_ptr_Function_v3float %_ptr_Function_float %_ptr_Function_lightingInfo = OpTypePointer Function %lightingInfo - %261 = OpConstantNull %lightingInfo + %263 = OpConstantNull %lightingInfo %float_0_5 = OpConstant %float 0.5 %void = OpTypeVoid - %310 = OpTypeFunction %void + %312 = OpTypeFunction %void %_ptr_Function_int = OpTypePointer Function %int %float_100 = OpConstant %float 100 - %369 = OpConstantComposite %v3float %float_0_5 %float_0_5 %float_0_5 - %374 = OpTypeSampledImage %25 + %371 = OpConstantComposite %v3float %float_0_5 %float_0_5 %float_0_5 + %376 = OpTypeSampledImage %25 %uint_6 = OpConstant %uint 6 %_ptr_Uniform_float = OpTypePointer Uniform %float %uint_4 = OpConstant %uint 4 @@ -301,13 +309,13 @@ %_ptr_Uniform_v4float = OpTypePointer Uniform %v4float %uint_3 = OpConstant %uint 3 %main_out = OpTypeStruct %v4float - %644 = OpTypeFunction %main_out %v2float %v4float %bool %v2float %v4float -%cotangent_frame_vf3_vf3_vf2_vf2_ = OpFunction %mat3v3float None %52 + %646 = OpTypeFunction %main_out %v2float %v4float %bool %v2float %v4float +%cotangent_frame_vf3_vf3_vf2_vf2_ = OpFunction %mat3v3float None %54 %normal_1 = OpFunctionParameter %_ptr_Function_v3float %p = OpFunctionParameter %_ptr_Function_v3float %uv = OpFunctionParameter %_ptr_Function_v2float %tangentSpaceParams = OpFunctionParameter %_ptr_Function_v2float - %61 = OpLabel + %63 = OpLabel %dp1 = OpVariable %_ptr_Function_v3float Function %22 %dp2 = OpVariable %_ptr_Function_v3float Function %22 %duv1 = OpVariable %_ptr_Function_v2float Function %31 @@ -317,172 +325,172 @@ %tangent = OpVariable %_ptr_Function_v3float Function %22 %bitangent = OpVariable %_ptr_Function_v3float Function %22 %invmax = OpVariable %_ptr_Function_float Function %18 - %73 = OpLoad %v3float %p - %74 = OpDPdx %v3float %73 - OpStore %dp1 %74 - %76 = OpLoad %v3float %p - %77 = OpDPdy %v3float %76 - OpStore %dp2 %77 - %79 = OpLoad %v2float %uv - %80 = OpDPdx %v2float %79 - OpStore %duv1 %80 - %82 = OpLoad %v2float %uv - %83 = OpDPdy %v2float %82 - OpStore %duv2 %83 - %84 = OpLoad %v3float %dp2 - %86 = OpLoad %v3float %normal_1 - %87 = OpExtInst %v3float %88 Cross %84 %86 - OpStore %dp2perp %87 - %90 = OpLoad %v3float %normal_1 - %91 = OpLoad %v3float %dp1 - %92 = OpExtInst %v3float %88 Cross %90 %91 - OpStore %dp1perp %92 - %93 = OpLoad %v3float %dp2perp - %95 = OpAccessChain %_ptr_Function_float %duv1 %uint_0 - %96 = OpLoad %float %95 - %97 = OpLoad %v3float %dp1perp - %98 = OpAccessChain %_ptr_Function_float %duv2 %uint_0 - %99 = OpLoad %float %98 - %100 = OpVectorTimesScalar %v3float %93 %96 - %101 = OpVectorTimesScalar %v3float %97 %99 - %102 = OpFAdd %v3float %100 %101 - OpStore %tangent %102 - %103 = OpLoad %v3float %dp2perp - %105 = OpAccessChain %_ptr_Function_float %duv1 %uint_1 - %106 = OpLoad %float %105 - %107 = OpLoad %v3float %dp1perp - %108 = OpAccessChain %_ptr_Function_float %duv2 %uint_1 - %109 = OpLoad %float %108 - %110 = OpVectorTimesScalar %v3float %103 %106 - %111 = OpVectorTimesScalar %v3float %107 %109 - %112 = OpFAdd %v3float %110 %111 - OpStore %bitangent %112 - %114 = OpAccessChain %_ptr_Function_float %tangentSpaceParams %uint_0 - %115 = OpLoad %float %114 - %116 = OpLoad %v3float %tangent - %117 = OpVectorTimesScalar %v3float %116 %115 - OpStore %tangent %117 - %119 = OpAccessChain %_ptr_Function_float %tangentSpaceParams %uint_1 - %120 = OpLoad %float %119 - %121 = OpLoad %v3float %bitangent - %122 = OpVectorTimesScalar %v3float %121 %120 - OpStore %bitangent %122 - %123 = OpLoad %v3float %tangent - %124 = OpLoad %v3float %tangent - %125 = OpLoad %v3float %bitangent - %126 = OpLoad %v3float %bitangent - %129 = OpDot %float %123 %124 - %130 = OpDot %float %125 %126 - %128 = OpExtInst %float %88 NMax %129 %130 - %127 = OpExtInst %float %88 InverseSqrt %128 - OpStore %invmax %127 - %131 = OpLoad %v3float %tangent - %132 = OpLoad %float %invmax - %133 = OpVectorTimesScalar %v3float %131 %132 - %134 = OpLoad %v3float %bitangent - %135 = OpLoad %float %invmax - %136 = OpVectorTimesScalar %v3float %134 %135 - %138 = OpLoad %v3float %normal_1 - %139 = OpCompositeExtract %float %133 0 - %140 = OpCompositeExtract %float %133 1 - %141 = OpCompositeExtract %float %133 2 - %142 = OpCompositeConstruct %v3float %139 %140 %141 - %143 = OpCompositeExtract %float %136 0 - %144 = OpCompositeExtract %float %136 1 - %145 = OpCompositeExtract %float %136 2 - %146 = OpCompositeConstruct %v3float %143 %144 %145 - %147 = OpCompositeExtract %float %138 0 - %148 = OpCompositeExtract %float %138 1 - %149 = OpCompositeExtract %float %138 2 - %150 = OpCompositeConstruct %v3float %147 %148 %149 - %151 = OpCompositeConstruct %mat3v3float %142 %146 %150 - OpReturnValue %151 + %75 = OpLoad %v3float %p + %76 = OpDPdx %v3float %75 + OpStore %dp1 %76 + %78 = OpLoad %v3float %p + %79 = OpDPdy %v3float %78 + OpStore %dp2 %79 + %81 = OpLoad %v2float %uv + %82 = OpDPdx %v2float %81 + OpStore %duv1 %82 + %84 = OpLoad %v2float %uv + %85 = OpDPdy %v2float %84 + OpStore %duv2 %85 + %86 = OpLoad %v3float %dp2 + %88 = OpLoad %v3float %normal_1 + %89 = OpExtInst %v3float %90 Cross %86 %88 + OpStore %dp2perp %89 + %92 = OpLoad %v3float %normal_1 + %93 = OpLoad %v3float %dp1 + %94 = OpExtInst %v3float %90 Cross %92 %93 + OpStore %dp1perp %94 + %95 = OpLoad %v3float %dp2perp + %97 = OpAccessChain %_ptr_Function_float %duv1 %uint_0 + %98 = OpLoad %float %97 + %99 = OpLoad %v3float %dp1perp + %100 = OpAccessChain %_ptr_Function_float %duv2 %uint_0 + %101 = OpLoad %float %100 + %102 = OpVectorTimesScalar %v3float %95 %98 + %103 = OpVectorTimesScalar %v3float %99 %101 + %104 = OpFAdd %v3float %102 %103 + OpStore %tangent %104 + %105 = OpLoad %v3float %dp2perp + %107 = OpAccessChain %_ptr_Function_float %duv1 %uint_1 + %108 = OpLoad %float %107 + %109 = OpLoad %v3float %dp1perp + %110 = OpAccessChain %_ptr_Function_float %duv2 %uint_1 + %111 = OpLoad %float %110 + %112 = OpVectorTimesScalar %v3float %105 %108 + %113 = OpVectorTimesScalar %v3float %109 %111 + %114 = OpFAdd %v3float %112 %113 + OpStore %bitangent %114 + %116 = OpAccessChain %_ptr_Function_float %tangentSpaceParams %uint_0 + %117 = OpLoad %float %116 + %118 = OpLoad %v3float %tangent + %119 = OpVectorTimesScalar %v3float %118 %117 + OpStore %tangent %119 + %121 = OpAccessChain %_ptr_Function_float %tangentSpaceParams %uint_1 + %122 = OpLoad %float %121 + %123 = OpLoad %v3float %bitangent + %124 = OpVectorTimesScalar %v3float %123 %122 + OpStore %bitangent %124 + %125 = OpLoad %v3float %tangent + %126 = OpLoad %v3float %tangent + %127 = OpLoad %v3float %bitangent + %128 = OpLoad %v3float %bitangent + %131 = OpDot %float %125 %126 + %132 = OpDot %float %127 %128 + %130 = OpExtInst %float %90 NMax %131 %132 + %129 = OpExtInst %float %90 InverseSqrt %130 + OpStore %invmax %129 + %133 = OpLoad %v3float %tangent + %134 = OpLoad %float %invmax + %135 = OpVectorTimesScalar %v3float %133 %134 + %136 = OpLoad %v3float %bitangent + %137 = OpLoad %float %invmax + %138 = OpVectorTimesScalar %v3float %136 %137 + %140 = OpLoad %v3float %normal_1 + %141 = OpCompositeExtract %float %135 0 + %142 = OpCompositeExtract %float %135 1 + %143 = OpCompositeExtract %float %135 2 + %144 = OpCompositeConstruct %v3float %141 %142 %143 + %145 = OpCompositeExtract %float %138 0 + %146 = OpCompositeExtract %float %138 1 + %147 = OpCompositeExtract %float %138 2 + %148 = OpCompositeConstruct %v3float %145 %146 %147 + %149 = OpCompositeExtract %float %140 0 + %150 = OpCompositeExtract %float %140 1 + %151 = OpCompositeExtract %float %140 2 + %152 = OpCompositeConstruct %v3float %149 %150 %151 + %153 = OpCompositeConstruct %mat3v3float %144 %148 %152 + OpReturnValue %153 OpFunctionEnd -%transposeMat3_mf33_ = OpFunction %mat3v3float None %152 +%transposeMat3_mf33_ = OpFunction %mat3v3float None %154 %inMatrix = OpFunctionParameter %_ptr_Function_mat3v3float - %156 = OpLabel + %158 = OpLabel %i0 = OpVariable %_ptr_Function_v3float Function %22 %i1 = OpVariable %_ptr_Function_v3float Function %22 %i2 = OpVariable %_ptr_Function_v3float Function %22 - %outMatrix = OpVariable %_ptr_Function_mat3v3float Function %161 - %165 = OpAccessChain %_ptr_Function_v3float %inMatrix %164 - %166 = OpLoad %v3float %165 - OpStore %i0 %166 - %169 = OpAccessChain %_ptr_Function_v3float %inMatrix %int_1 - %170 = OpLoad %v3float %169 - OpStore %i1 %170 - %173 = OpAccessChain %_ptr_Function_v3float %inMatrix %int_2 - %174 = OpLoad %v3float %173 - OpStore %i2 %174 - %175 = OpAccessChain %_ptr_Function_float %i0 %uint_0 - %176 = OpLoad %float %175 - %177 = OpAccessChain %_ptr_Function_float %i1 %uint_0 + %outMatrix = OpVariable %_ptr_Function_mat3v3float Function %163 + %167 = OpAccessChain %_ptr_Function_v3float %inMatrix %166 + %168 = OpLoad %v3float %167 + OpStore %i0 %168 + %171 = OpAccessChain %_ptr_Function_v3float %inMatrix %int_1 + %172 = OpLoad %v3float %171 + OpStore %i1 %172 + %175 = OpAccessChain %_ptr_Function_v3float %inMatrix %int_2 + %176 = OpLoad %v3float %175 + OpStore %i2 %176 + %177 = OpAccessChain %_ptr_Function_float %i0 %uint_0 %178 = OpLoad %float %177 - %179 = OpAccessChain %_ptr_Function_float %i2 %uint_0 + %179 = OpAccessChain %_ptr_Function_float %i1 %uint_0 %180 = OpLoad %float %179 - %181 = OpCompositeConstruct %v3float %176 %178 %180 - %182 = OpAccessChain %_ptr_Function_float %i0 %uint_1 - %183 = OpLoad %float %182 - %184 = OpAccessChain %_ptr_Function_float %i1 %uint_1 + %181 = OpAccessChain %_ptr_Function_float %i2 %uint_0 + %182 = OpLoad %float %181 + %183 = OpCompositeConstruct %v3float %178 %180 %182 + %184 = OpAccessChain %_ptr_Function_float %i0 %uint_1 %185 = OpLoad %float %184 - %186 = OpAccessChain %_ptr_Function_float %i2 %uint_1 + %186 = OpAccessChain %_ptr_Function_float %i1 %uint_1 %187 = OpLoad %float %186 - %188 = OpCompositeConstruct %v3float %183 %185 %187 - %190 = OpAccessChain %_ptr_Function_float %i0 %uint_2 - %191 = OpLoad %float %190 - %192 = OpAccessChain %_ptr_Function_float %i1 %uint_2 + %188 = OpAccessChain %_ptr_Function_float %i2 %uint_1 + %189 = OpLoad %float %188 + %190 = OpCompositeConstruct %v3float %185 %187 %189 + %192 = OpAccessChain %_ptr_Function_float %i0 %uint_2 %193 = OpLoad %float %192 - %194 = OpAccessChain %_ptr_Function_float %i2 %uint_2 + %194 = OpAccessChain %_ptr_Function_float %i1 %uint_2 %195 = OpLoad %float %194 - %196 = OpCompositeConstruct %v3float %191 %193 %195 - %197 = OpCompositeExtract %float %181 0 - %198 = OpCompositeExtract %float %181 1 - %199 = OpCompositeExtract %float %181 2 - %200 = OpCompositeConstruct %v3float %197 %198 %199 - %201 = OpCompositeExtract %float %188 0 - %202 = OpCompositeExtract %float %188 1 - %203 = OpCompositeExtract %float %188 2 - %204 = OpCompositeConstruct %v3float %201 %202 %203 - %205 = OpCompositeExtract %float %196 0 - %206 = OpCompositeExtract %float %196 1 - %207 = OpCompositeExtract %float %196 2 - %208 = OpCompositeConstruct %v3float %205 %206 %207 - %209 = OpCompositeConstruct %mat3v3float %200 %204 %208 - OpStore %outMatrix %209 - %210 = OpLoad %mat3v3float %outMatrix - OpReturnValue %210 + %196 = OpAccessChain %_ptr_Function_float %i2 %uint_2 + %197 = OpLoad %float %196 + %198 = OpCompositeConstruct %v3float %193 %195 %197 + %199 = OpCompositeExtract %float %183 0 + %200 = OpCompositeExtract %float %183 1 + %201 = OpCompositeExtract %float %183 2 + %202 = OpCompositeConstruct %v3float %199 %200 %201 + %203 = OpCompositeExtract %float %190 0 + %204 = OpCompositeExtract %float %190 1 + %205 = OpCompositeExtract %float %190 2 + %206 = OpCompositeConstruct %v3float %203 %204 %205 + %207 = OpCompositeExtract %float %198 0 + %208 = OpCompositeExtract %float %198 1 + %209 = OpCompositeExtract %float %198 2 + %210 = OpCompositeConstruct %v3float %207 %208 %209 + %211 = OpCompositeConstruct %mat3v3float %202 %206 %210 + OpStore %outMatrix %211 + %212 = OpLoad %mat3v3float %outMatrix + OpReturnValue %212 OpFunctionEnd -%perturbNormalBase_mf33_vf3_f1_ = OpFunction %v3float None %211 +%perturbNormalBase_mf33_vf3_f1_ = OpFunction %v3float None %213 %cotangentFrame = OpFunctionParameter %_ptr_Function_mat3v3float %normal = OpFunctionParameter %_ptr_Function_v3float %scale = OpFunctionParameter %_ptr_Function_float - %216 = OpLabel - %218 = OpLoad %mat3v3float %cotangentFrame - %220 = OpLoad %v3float %normal - %222 = OpMatrixTimesVector %v3float %218 %220 - %221 = OpExtInst %v3float %88 Normalize %222 - OpReturnValue %221 + %218 = OpLabel + %220 = OpLoad %mat3v3float %cotangentFrame + %222 = OpLoad %v3float %normal + %224 = OpMatrixTimesVector %v3float %220 %222 + %223 = OpExtInst %v3float %90 Normalize %224 + OpReturnValue %223 OpFunctionEnd -%perturbNormal_mf33_vf3_f1_ = OpFunction %v3float None %211 +%perturbNormal_mf33_vf3_f1_ = OpFunction %v3float None %213 %cotangentFrame_1 = OpFunctionParameter %_ptr_Function_mat3v3float %textureSample = OpFunctionParameter %_ptr_Function_v3float %scale_1 = OpFunctionParameter %_ptr_Function_float - %227 = OpLabel - %param = OpVariable %_ptr_Function_mat3v3float Function %161 + %229 = OpLabel + %param = OpVariable %_ptr_Function_mat3v3float Function %163 %param_1 = OpVariable %_ptr_Function_v3float Function %22 %param_2 = OpVariable %_ptr_Function_float Function %18 - %232 = OpLoad %v3float %textureSample - %234 = OpLoad %mat3v3float %cotangentFrame_1 - OpStore %param %234 - %236 = OpVectorTimesScalar %v3float %232 %float_2 - %239 = OpFSub %v3float %236 %238 - OpStore %param_1 %239 - %241 = OpLoad %float %scale_1 - OpStore %param_2 %241 - %242 = OpFunctionCall %v3float %perturbNormalBase_mf33_vf3_f1_ %param %param_1 %param_2 - OpReturnValue %242 + %234 = OpLoad %v3float %textureSample + %236 = OpLoad %mat3v3float %cotangentFrame_1 + OpStore %param %236 + %238 = OpVectorTimesScalar %v3float %234 %float_2 + %241 = OpFSub %v3float %238 %240 + OpStore %param_1 %241 + %243 = OpLoad %float %scale_1 + OpStore %param_2 %243 + %244 = OpFunctionCall %v3float %perturbNormalBase_mf33_vf3_f1_ %param %param_1 %param_2 + OpReturnValue %244 OpFunctionEnd -%computeHemisphericLighting_vf3_vf3_vf4_vf3_vf3_vf3_f1_ = OpFunction %lightingInfo None %246 +%computeHemisphericLighting_vf3_vf3_vf4_vf3_vf3_vf3_f1_ = OpFunction %lightingInfo None %248 %viewDirectionW = OpFunctionParameter %_ptr_Function_v3float %vNormal = OpFunctionParameter %_ptr_Function_v3float %lightData = OpFunctionParameter %_ptr_Function_v4float @@ -490,57 +498,57 @@ %specularColor = OpFunctionParameter %_ptr_Function_v3float %groundColor = OpFunctionParameter %_ptr_Function_v3float %glossiness = OpFunctionParameter %_ptr_Function_float - %257 = OpLabel + %259 = OpLabel %ndl = OpVariable %_ptr_Function_float Function %18 - %result = OpVariable %_ptr_Function_lightingInfo Function %261 + %result = OpVariable %_ptr_Function_lightingInfo Function %263 %angleW = OpVariable %_ptr_Function_v3float Function %22 %specComp = OpVariable %_ptr_Function_float Function %18 - %265 = OpLoad %v3float %vNormal - %267 = OpLoad %v4float %lightData - %269 = OpCompositeExtract %float %267 0 - %270 = OpCompositeExtract %float %267 1 - %271 = OpCompositeExtract %float %267 2 - %272 = OpCompositeConstruct %v3float %269 %270 %271 - %268 = OpDot %float %265 %272 - %274 = OpFMul %float %268 %float_0_5 - %275 = OpFAdd %float %274 %float_0_5 - OpStore %ndl %275 - %277 = OpLoad %v3float %groundColor - %279 = OpLoad %v3float %diffuseColor - %280 = OpLoad %float %ndl - %281 = OpAccessChain %_ptr_Function_v3float %result %uint_0 - %283 = OpCompositeConstruct %v3float %280 %280 %280 - %282 = OpExtInst %v3float %88 FMix %277 %279 %283 - OpStore %281 %282 - %285 = OpLoad %v3float %viewDirectionW - %287 = OpLoad %v4float %lightData - %289 = OpCompositeExtract %float %287 0 - %290 = OpCompositeExtract %float %287 1 - %291 = OpCompositeExtract %float %287 2 - %292 = OpCompositeConstruct %v3float %289 %290 %291 - %293 = OpFAdd %v3float %285 %292 - %288 = OpExtInst %v3float %88 Normalize %293 - OpStore %angleW %288 - %295 = OpLoad %v3float %vNormal - %296 = OpLoad %v3float %angleW - %298 = OpDot %float %295 %296 - %297 = OpExtInst %float %88 NMax %18 %298 - OpStore %specComp %297 - %299 = OpLoad %float %specComp - %301 = OpLoad %float %glossiness - %303 = OpExtInst %float %88 NMax %float_1 %301 - %302 = OpExtInst %float %88 Pow %299 %303 - OpStore %specComp %302 - %304 = OpLoad %float %specComp - %306 = OpLoad %v3float %specularColor - %307 = OpAccessChain %_ptr_Function_v3float %result %uint_1 - %308 = OpVectorTimesScalar %v3float %306 %304 - OpStore %307 %308 - %309 = OpLoad %lightingInfo %result - OpReturnValue %309 + %267 = OpLoad %v3float %vNormal + %269 = OpLoad %v4float %lightData + %271 = OpCompositeExtract %float %269 0 + %272 = OpCompositeExtract %float %269 1 + %273 = OpCompositeExtract %float %269 2 + %274 = OpCompositeConstruct %v3float %271 %272 %273 + %270 = OpDot %float %267 %274 + %276 = OpFMul %float %270 %float_0_5 + %277 = OpFAdd %float %276 %float_0_5 + OpStore %ndl %277 + %279 = OpLoad %v3float %groundColor + %281 = OpLoad %v3float %diffuseColor + %282 = OpLoad %float %ndl + %283 = OpAccessChain %_ptr_Function_v3float %result %uint_0 + %285 = OpCompositeConstruct %v3float %282 %282 %282 + %284 = OpExtInst %v3float %90 FMix %279 %281 %285 + OpStore %283 %284 + %287 = OpLoad %v3float %viewDirectionW + %289 = OpLoad %v4float %lightData + %291 = OpCompositeExtract %float %289 0 + %292 = OpCompositeExtract %float %289 1 + %293 = OpCompositeExtract %float %289 2 + %294 = OpCompositeConstruct %v3float %291 %292 %293 + %295 = OpFAdd %v3float %287 %294 + %290 = OpExtInst %v3float %90 Normalize %295 + OpStore %angleW %290 + %297 = OpLoad %v3float %vNormal + %298 = OpLoad %v3float %angleW + %300 = OpDot %float %297 %298 + %299 = OpExtInst %float %90 NMax %18 %300 + OpStore %specComp %299 + %301 = OpLoad %float %specComp + %303 = OpLoad %float %glossiness + %305 = OpExtInst %float %90 NMax %float_1 %303 + %304 = OpExtInst %float %90 Pow %301 %305 + OpStore %specComp %304 + %306 = OpLoad %float %specComp + %308 = OpLoad %v3float %specularColor + %309 = OpAccessChain %_ptr_Function_v3float %result %uint_1 + %310 = OpVectorTimesScalar %v3float %308 %306 + OpStore %309 %310 + %311 = OpLoad %lightingInfo %result + OpReturnValue %311 OpFunctionEnd - %main_1 = OpFunction %void None %310 - %313 = OpLabel + %main_1 = OpFunction %void None %312 + %315 = OpLabel %tempTextureRead = OpVariable %_ptr_Function_v4float Function %15 %rgb = OpVariable %_ptr_Function_v3float Function %22 %output5 = OpVariable %_ptr_Function_v3float Function %22 @@ -549,13 +557,13 @@ %normalScale = OpVariable %_ptr_Function_float Function %18 %TBNUV = OpVariable %_ptr_Function_v2float Function %31 %x_299 = OpVariable %_ptr_Function_v2float Function %31 - %TBN = OpVariable %_ptr_Function_mat3v3float Function %161 + %TBN = OpVariable %_ptr_Function_mat3v3float Function %163 %param_3 = OpVariable %_ptr_Function_v3float Function %22 %param_4 = OpVariable %_ptr_Function_v3float Function %22 %param_5 = OpVariable %_ptr_Function_v2float Function %31 %param_6 = OpVariable %_ptr_Function_v2float Function %31 - %invTBN = OpVariable %_ptr_Function_mat3v3float Function %161 - %param_7 = OpVariable %_ptr_Function_mat3v3float Function %161 + %invTBN = OpVariable %_ptr_Function_mat3v3float Function %163 + %param_7 = OpVariable %_ptr_Function_mat3v3float Function %163 %parallaxLimit = OpVariable %_ptr_Function_float Function %18 %vOffsetDir = OpVariable %_ptr_Function_v2float Function %31 %vMaxOffset = OpVariable %_ptr_Function_v2float Function %31 @@ -566,12 +574,12 @@ %vLastOffset = OpVariable %_ptr_Function_v2float Function %31 %lastSampledHeight = OpVariable %_ptr_Function_float Function %18 %currSampledHeight = OpVariable %_ptr_Function_float Function %18 - %i = OpVariable %_ptr_Function_int Function %164 + %i = OpVariable %_ptr_Function_int Function %166 %delta1 = OpVariable %_ptr_Function_float Function %18 %delta2 = OpVariable %_ptr_Function_float Function %18 %ratio = OpVariable %_ptr_Function_float Function %18 %parallaxOcclusion_0 = OpVariable %_ptr_Function_v2float Function %31 - %param_8 = OpVariable %_ptr_Function_mat3v3float Function %161 + %param_8 = OpVariable %_ptr_Function_mat3v3float Function %163 %param_9 = OpVariable %_ptr_Function_v3float Function %22 %param_10 = OpVariable %_ptr_Function_float Function %18 %output6 = OpVariable %_ptr_Function_v2float Function %31 @@ -583,7 +591,7 @@ %diffuseBase = OpVariable %_ptr_Function_v3float Function %22 %specularBase = OpVariable %_ptr_Function_v3float Function %22 %normalW = OpVariable %_ptr_Function_v3float Function %22 - %info = OpVariable %_ptr_Function_lightingInfo Function %261 + %info = OpVariable %_ptr_Function_lightingInfo Function %263 %param_11 = OpVariable %_ptr_Function_v3float Function %22 %param_12 = OpVariable %_ptr_Function_v3float Function %22 %param_13 = OpVariable %_ptr_Function_v4float Function %15 @@ -595,366 +603,366 @@ %specularOutput = OpVariable %_ptr_Function_v3float Function %22 %output3 = OpVariable %_ptr_Function_v3float Function %22 OpStore %u_Float %float_100 - OpStore %u_Color %369 - %370 = OpLoad %v2float %vMainuv - %372 = OpLoad %28 %TextureSamplerSampler - %373 = OpLoad %25 %TextureSamplerTexture - %375 = OpSampledImage %374 %373 %372 - %371 = OpImageSampleImplicitLod %v4float %375 %370 - OpStore %tempTextureRead %371 - %376 = OpLoad %v4float %tempTextureRead - %379 = OpAccessChain %_ptr_Uniform_float %x_269 %uint_6 - %380 = OpLoad %float %379 - %381 = OpCompositeExtract %float %376 0 - %382 = OpCompositeExtract %float %376 1 - %383 = OpCompositeExtract %float %376 2 - %384 = OpCompositeConstruct %v3float %381 %382 %383 - %385 = OpVectorTimesScalar %v3float %384 %380 - OpStore %rgb %385 - %388 = OpAccessChain %_ptr_Uniform_v3float %x_269 %uint_4 - %389 = OpLoad %v3float %388 - %390 = OpLoad %v4float %v_output1 - %392 = OpCompositeExtract %float %390 0 - %393 = OpCompositeExtract %float %390 1 - %394 = OpCompositeExtract %float %390 2 - %395 = OpCompositeConstruct %v3float %392 %393 %394 - %396 = OpFSub %v3float %389 %395 - %391 = OpExtInst %v3float %88 Normalize %396 - OpStore %output5 %391 + OpStore %u_Color %371 + %372 = OpLoad %v2float %vMainuv + %374 = OpLoad %28 %TextureSamplerSampler + %375 = OpLoad %25 %TextureSamplerTexture + %377 = OpSampledImage %376 %375 %374 + %373 = OpImageSampleImplicitLod %v4float %377 %372 + OpStore %tempTextureRead %373 + %378 = OpLoad %v4float %tempTextureRead + %381 = OpAccessChain %_ptr_Uniform_float %x_269 %uint_0 %uint_6 + %382 = OpLoad %float %381 + %383 = OpCompositeExtract %float %378 0 + %384 = OpCompositeExtract %float %378 1 + %385 = OpCompositeExtract %float %378 2 + %386 = OpCompositeConstruct %v3float %383 %384 %385 + %387 = OpVectorTimesScalar %v3float %386 %382 + OpStore %rgb %387 + %390 = OpAccessChain %_ptr_Uniform_v3float %x_269 %uint_0 %uint_4 + %391 = OpLoad %v3float %390 + %392 = OpLoad %v4float %v_output1 + %394 = OpCompositeExtract %float %392 0 + %395 = OpCompositeExtract %float %392 1 + %396 = OpCompositeExtract %float %392 2 + %397 = OpCompositeConstruct %v3float %394 %395 %396 + %398 = OpFSub %v3float %391 %397 + %393 = OpExtInst %v3float %90 Normalize %398 + OpStore %output5 %393 OpStore %output4 %15 OpStore %uvOffset %31 - %397 = OpAccessChain %_ptr_Uniform_float %x_269 %uint_2 - %398 = OpLoad %float %397 - %399 = OpFDiv %float %float_1 %398 - OpStore %normalScale %399 - %400 = OpLoad %bool %gl_FrontFacing - OpSelectionMerge %401 None - OpBranchConditional %400 %402 %403 - %402 = OpLabel - %404 = OpLoad %v2float %v_uv - OpStore %x_299 %404 - OpBranch %401 - %403 = OpLabel - %405 = OpLoad %v2float %v_uv - %406 = OpFNegate %v2float %405 + %399 = OpAccessChain %_ptr_Uniform_float %x_269 %uint_0 %uint_2 + %400 = OpLoad %float %399 + %401 = OpFDiv %float %float_1 %400 + OpStore %normalScale %401 + %402 = OpLoad %bool %gl_FrontFacing + OpSelectionMerge %403 None + OpBranchConditional %402 %404 %405 + %404 = OpLabel + %406 = OpLoad %v2float %v_uv OpStore %x_299 %406 - OpBranch %401 - %401 = OpLabel - %407 = OpLoad %v2float %x_299 - OpStore %TBNUV %407 - %408 = OpLoad %v4float %v_output2 - %409 = OpLoad %float %normalScale - %410 = OpCompositeExtract %float %408 0 - %411 = OpCompositeExtract %float %408 1 - %412 = OpCompositeExtract %float %408 2 - %413 = OpCompositeConstruct %v3float %410 %411 %412 - %414 = OpVectorTimesScalar %v3float %413 %409 - OpStore %param_3 %414 - %415 = OpLoad %v4float %v_output1 - %416 = OpCompositeExtract %float %415 0 - %417 = OpCompositeExtract %float %415 1 - %418 = OpCompositeExtract %float %415 2 - %419 = OpCompositeConstruct %v3float %416 %417 %418 - OpStore %param_4 %419 - %420 = OpLoad %v2float %TBNUV - OpStore %param_5 %420 - %423 = OpAccessChain %_ptr_Uniform_v2float %x_269 %uint_8 - %424 = OpLoad %v2float %423 - OpStore %param_6 %424 - %425 = OpFunctionCall %mat3v3float %cotangent_frame_vf3_vf3_vf2_vf2_ %param_3 %param_4 %param_5 %param_6 - OpStore %TBN %425 - %430 = OpLoad %mat3v3float %TBN - OpStore %param_7 %430 - %431 = OpFunctionCall %mat3v3float %transposeMat3_mf33_ %param_7 - OpStore %invTBN %431 - %433 = OpLoad %mat3v3float %invTBN - %434 = OpLoad %v3float %output5 - %435 = OpFNegate %v3float %434 - %436 = OpMatrixTimesVector %v3float %433 %435 - %437 = OpLoad %mat3v3float %invTBN - %438 = OpLoad %v3float %output5 - %440 = OpCompositeExtract %float %436 0 - %441 = OpCompositeExtract %float %436 1 - %442 = OpCompositeConstruct %v2float %440 %441 - %439 = OpExtInst %float %88 Length %442 - %443 = OpFNegate %v3float %438 - %444 = OpMatrixTimesVector %v3float %437 %443 - %445 = OpCompositeExtract %float %444 2 - %446 = OpFDiv %float %439 %445 - OpStore %parallaxLimit %446 - %448 = OpAccessChain %_ptr_Uniform_float %x_269 %uint_5 - %449 = OpLoad %float %448 - %450 = OpLoad %float %parallaxLimit - %451 = OpFMul %float %450 %449 - OpStore %parallaxLimit %451 - %452 = OpLoad %mat3v3float %invTBN - %453 = OpLoad %v3float %output5 - %454 = OpFNegate %v3float %453 - %455 = OpMatrixTimesVector %v3float %452 %454 - %457 = OpCompositeExtract %float %455 0 - %458 = OpCompositeExtract %float %455 1 - %459 = OpCompositeConstruct %v2float %457 %458 - %456 = OpExtInst %v2float %88 Normalize %459 - OpStore %vOffsetDir %456 - %460 = OpLoad %v2float %vOffsetDir - %461 = OpLoad %float %parallaxLimit - %462 = OpVectorTimesScalar %v2float %460 %461 - OpStore %vMaxOffset %462 - %463 = OpLoad %mat3v3float %invTBN - %464 = OpLoad %v3float %output5 + OpBranch %403 + %405 = OpLabel + %407 = OpLoad %v2float %v_uv + %408 = OpFNegate %v2float %407 + OpStore %x_299 %408 + OpBranch %403 + %403 = OpLabel + %409 = OpLoad %v2float %x_299 + OpStore %TBNUV %409 + %410 = OpLoad %v4float %v_output2 + %411 = OpLoad %float %normalScale + %412 = OpCompositeExtract %float %410 0 + %413 = OpCompositeExtract %float %410 1 + %414 = OpCompositeExtract %float %410 2 + %415 = OpCompositeConstruct %v3float %412 %413 %414 + %416 = OpVectorTimesScalar %v3float %415 %411 + OpStore %param_3 %416 + %417 = OpLoad %v4float %v_output1 + %418 = OpCompositeExtract %float %417 0 + %419 = OpCompositeExtract %float %417 1 + %420 = OpCompositeExtract %float %417 2 + %421 = OpCompositeConstruct %v3float %418 %419 %420 + OpStore %param_4 %421 + %422 = OpLoad %v2float %TBNUV + OpStore %param_5 %422 + %425 = OpAccessChain %_ptr_Uniform_v2float %x_269 %uint_0 %uint_8 + %426 = OpLoad %v2float %425 + OpStore %param_6 %426 + %427 = OpFunctionCall %mat3v3float %cotangent_frame_vf3_vf3_vf2_vf2_ %param_3 %param_4 %param_5 %param_6 + OpStore %TBN %427 + %432 = OpLoad %mat3v3float %TBN + OpStore %param_7 %432 + %433 = OpFunctionCall %mat3v3float %transposeMat3_mf33_ %param_7 + OpStore %invTBN %433 + %435 = OpLoad %mat3v3float %invTBN + %436 = OpLoad %v3float %output5 + %437 = OpFNegate %v3float %436 + %438 = OpMatrixTimesVector %v3float %435 %437 + %439 = OpLoad %mat3v3float %invTBN + %440 = OpLoad %v3float %output5 + %442 = OpCompositeExtract %float %438 0 + %443 = OpCompositeExtract %float %438 1 + %444 = OpCompositeConstruct %v2float %442 %443 + %441 = OpExtInst %float %90 Length %444 + %445 = OpFNegate %v3float %440 + %446 = OpMatrixTimesVector %v3float %439 %445 + %447 = OpCompositeExtract %float %446 2 + %448 = OpFDiv %float %441 %447 + OpStore %parallaxLimit %448 + %450 = OpAccessChain %_ptr_Uniform_float %x_269 %uint_0 %uint_5 + %451 = OpLoad %float %450 + %452 = OpLoad %float %parallaxLimit + %453 = OpFMul %float %452 %451 + OpStore %parallaxLimit %453 + %454 = OpLoad %mat3v3float %invTBN + %455 = OpLoad %v3float %output5 + %456 = OpFNegate %v3float %455 + %457 = OpMatrixTimesVector %v3float %454 %456 + %459 = OpCompositeExtract %float %457 0 + %460 = OpCompositeExtract %float %457 1 + %461 = OpCompositeConstruct %v2float %459 %460 + %458 = OpExtInst %v2float %90 Normalize %461 + OpStore %vOffsetDir %458 + %462 = OpLoad %v2float %vOffsetDir + %463 = OpLoad %float %parallaxLimit + %464 = OpVectorTimesScalar %v2float %462 %463 + OpStore %vMaxOffset %464 %465 = OpLoad %mat3v3float %invTBN - %466 = OpLoad %v4float %v_output2 - %469 = OpFNegate %v3float %464 - %470 = OpMatrixTimesVector %v3float %463 %469 - %471 = OpCompositeExtract %float %466 0 - %472 = OpCompositeExtract %float %466 1 - %473 = OpCompositeExtract %float %466 2 - %474 = OpCompositeConstruct %v3float %471 %472 %473 - %475 = OpMatrixTimesVector %v3float %465 %474 - %468 = OpDot %float %470 %475 - %477 = OpFMul %float %468 %float_n11 - %478 = OpFAdd %float %float_15 %477 - OpStore %numSamples %478 - %479 = OpLoad %float %numSamples - %480 = OpFDiv %float %float_1 %479 - OpStore %stepSize %480 + %466 = OpLoad %v3float %output5 + %467 = OpLoad %mat3v3float %invTBN + %468 = OpLoad %v4float %v_output2 + %471 = OpFNegate %v3float %466 + %472 = OpMatrixTimesVector %v3float %465 %471 + %473 = OpCompositeExtract %float %468 0 + %474 = OpCompositeExtract %float %468 1 + %475 = OpCompositeExtract %float %468 2 + %476 = OpCompositeConstruct %v3float %473 %474 %475 + %477 = OpMatrixTimesVector %v3float %467 %476 + %470 = OpDot %float %472 %477 + %479 = OpFMul %float %470 %float_n11 + %480 = OpFAdd %float %float_15 %479 + OpStore %numSamples %480 + %481 = OpLoad %float %numSamples + %482 = OpFDiv %float %float_1 %481 + OpStore %stepSize %482 OpStore %currRayHeight %float_1 OpStore %vCurrOffset %31 OpStore %vLastOffset %31 OpStore %lastSampledHeight %float_1 OpStore %currSampledHeight %float_1 - OpStore %i %164 - OpBranch %481 - %481 = OpLabel - OpLoopMerge %482 %483 None - OpBranch %484 - %484 = OpLabel - %485 = OpLoad %int %i - %487 = OpSLessThan %bool %485 %int_15 - OpSelectionMerge %488 None - OpBranchConditional %487 %489 %490 - %489 = OpLabel - OpBranch %488 - %490 = OpLabel - OpBranch %482 - %488 = OpLabel - %491 = OpLoad %v2float %v_uv - %492 = OpLoad %v2float %vCurrOffset - %493 = OpCompositeExtract %float %15 3 - OpStore %currSampledHeight %493 - %494 = OpLoad %float %currSampledHeight - %495 = OpLoad %float %currRayHeight - %496 = OpFOrdGreaterThan %bool %494 %495 - OpSelectionMerge %497 None - OpBranchConditional %496 %498 %499 - %498 = OpLabel - %500 = OpLoad %float %currSampledHeight - %501 = OpLoad %float %currRayHeight - %502 = OpFSub %float %500 %501 - OpStore %delta1 %502 - %503 = OpLoad %float %currRayHeight - %504 = OpLoad %float %stepSize - %505 = OpLoad %float %lastSampledHeight - %506 = OpFAdd %float %503 %504 - %507 = OpFSub %float %506 %505 - OpStore %delta2 %507 - %508 = OpLoad %float %delta1 - %509 = OpLoad %float %delta1 - %510 = OpLoad %float %delta2 - %511 = OpFAdd %float %509 %510 - %512 = OpFDiv %float %508 %511 - OpStore %ratio %512 - %513 = OpLoad %float %ratio - %514 = OpLoad %v2float %vLastOffset - %515 = OpLoad %float %ratio - %516 = OpLoad %v2float %vCurrOffset - %517 = OpVectorTimesScalar %v2float %514 %513 - %518 = OpFSub %float %float_1 %515 - %519 = OpVectorTimesScalar %v2float %516 %518 - %520 = OpFAdd %v2float %517 %519 - OpStore %vCurrOffset %520 - OpBranch %482 - %499 = OpLabel - %521 = OpLoad %float %stepSize - %522 = OpLoad %float %currRayHeight - %523 = OpFSub %float %522 %521 - OpStore %currRayHeight %523 - %524 = OpLoad %v2float %vCurrOffset - OpStore %vLastOffset %524 - %525 = OpLoad %float %stepSize - %526 = OpLoad %v2float %vMaxOffset - %527 = OpLoad %v2float %vCurrOffset - %528 = OpVectorTimesScalar %v2float %526 %525 - %529 = OpFAdd %v2float %527 %528 - OpStore %vCurrOffset %529 - %530 = OpLoad %float %currSampledHeight - OpStore %lastSampledHeight %530 - OpBranch %497 - %497 = OpLabel + OpStore %i %166 OpBranch %483 %483 = OpLabel - %531 = OpLoad %int %i - %532 = OpIAdd %int %531 %int_1 - OpStore %i %532 - OpBranch %481 - %482 = OpLabel - %533 = OpLoad %v2float %vCurrOffset - OpStore %parallaxOcclusion_0 %533 - %534 = OpLoad %v2float %parallaxOcclusion_0 - OpStore %uvOffset %534 - %535 = OpLoad %v2float %v_uv - %536 = OpLoad %v2float %uvOffset - %538 = OpLoad %28 %TextureSamplerSampler - %539 = OpLoad %25 %TextureSamplerTexture - %540 = OpSampledImage %374 %539 %538 - %541 = OpFAdd %v2float %535 %536 - %537 = OpImageSampleImplicitLod %v4float %540 %541 - %542 = OpAccessChain %_ptr_Uniform_float %x_269 %uint_2 - %543 = OpLoad %float %542 - %544 = OpLoad %mat3v3float %TBN - OpStore %param_8 %544 - %545 = OpCompositeExtract %float %537 0 - %546 = OpCompositeExtract %float %537 1 - %547 = OpCompositeExtract %float %537 2 - %548 = OpCompositeConstruct %v3float %545 %546 %547 - OpStore %param_9 %548 - %549 = OpFDiv %float %float_1 %543 - OpStore %param_10 %549 - %550 = OpFunctionCall %v3float %perturbNormal_mf33_vf3_f1_ %param_8 %param_9 %param_10 - %554 = OpLoad %v4float %output4 - %555 = OpCompositeExtract %float %550 0 - %556 = OpCompositeExtract %float %550 1 - %557 = OpCompositeExtract %float %550 2 - %558 = OpCompositeExtract %float %554 3 - %559 = OpCompositeConstruct %v4float %555 %556 %557 %558 - OpStore %output4 %559 - %560 = OpLoad %v2float %v_uv - %561 = OpLoad %v2float %uvOffset - %562 = OpFAdd %v2float %560 %561 - OpStore %output6 %562 - %563 = OpLoad %v2float %output6 - %565 = OpLoad %28 %TextureSampler1Sampler - %566 = OpLoad %25 %TextureSampler1Texture - %567 = OpSampledImage %374 %566 %565 - %564 = OpImageSampleImplicitLod %v4float %567 %563 - OpStore %tempTextureRead1 %564 - %568 = OpLoad %v4float %tempTextureRead1 - %569 = OpCompositeExtract %float %568 0 - %570 = OpCompositeExtract %float %568 1 - %571 = OpCompositeExtract %float %568 2 - %572 = OpCompositeConstruct %v3float %569 %570 %571 - OpStore %rgb1 %572 - %573 = OpAccessChain %_ptr_Uniform_v3float %x_269 %uint_4 - %574 = OpLoad %v3float %573 - %575 = OpLoad %v4float %v_output1 - %577 = OpCompositeExtract %float %575 0 - %578 = OpCompositeExtract %float %575 1 - %579 = OpCompositeExtract %float %575 2 - %580 = OpCompositeConstruct %v3float %577 %578 %579 - %581 = OpFSub %v3float %574 %580 - %576 = OpExtInst %v3float %88 Normalize %581 - OpStore %viewDirectionW_1 %576 + OpLoopMerge %484 %485 None + OpBranch %486 + %486 = OpLabel + %487 = OpLoad %int %i + %489 = OpSLessThan %bool %487 %int_15 + OpSelectionMerge %490 None + OpBranchConditional %489 %491 %492 + %491 = OpLabel + OpBranch %490 + %492 = OpLabel + OpBranch %484 + %490 = OpLabel + %493 = OpLoad %v2float %v_uv + %494 = OpLoad %v2float %vCurrOffset + %495 = OpCompositeExtract %float %15 3 + OpStore %currSampledHeight %495 + %496 = OpLoad %float %currSampledHeight + %497 = OpLoad %float %currRayHeight + %498 = OpFOrdGreaterThan %bool %496 %497 + OpSelectionMerge %499 None + OpBranchConditional %498 %500 %501 + %500 = OpLabel + %502 = OpLoad %float %currSampledHeight + %503 = OpLoad %float %currRayHeight + %504 = OpFSub %float %502 %503 + OpStore %delta1 %504 + %505 = OpLoad %float %currRayHeight + %506 = OpLoad %float %stepSize + %507 = OpLoad %float %lastSampledHeight + %508 = OpFAdd %float %505 %506 + %509 = OpFSub %float %508 %507 + OpStore %delta2 %509 + %510 = OpLoad %float %delta1 + %511 = OpLoad %float %delta1 + %512 = OpLoad %float %delta2 + %513 = OpFAdd %float %511 %512 + %514 = OpFDiv %float %510 %513 + OpStore %ratio %514 + %515 = OpLoad %float %ratio + %516 = OpLoad %v2float %vLastOffset + %517 = OpLoad %float %ratio + %518 = OpLoad %v2float %vCurrOffset + %519 = OpVectorTimesScalar %v2float %516 %515 + %520 = OpFSub %float %float_1 %517 + %521 = OpVectorTimesScalar %v2float %518 %520 + %522 = OpFAdd %v2float %519 %521 + OpStore %vCurrOffset %522 + OpBranch %484 + %501 = OpLabel + %523 = OpLoad %float %stepSize + %524 = OpLoad %float %currRayHeight + %525 = OpFSub %float %524 %523 + OpStore %currRayHeight %525 + %526 = OpLoad %v2float %vCurrOffset + OpStore %vLastOffset %526 + %527 = OpLoad %float %stepSize + %528 = OpLoad %v2float %vMaxOffset + %529 = OpLoad %v2float %vCurrOffset + %530 = OpVectorTimesScalar %v2float %528 %527 + %531 = OpFAdd %v2float %529 %530 + OpStore %vCurrOffset %531 + %532 = OpLoad %float %currSampledHeight + OpStore %lastSampledHeight %532 + OpBranch %499 + %499 = OpLabel + OpBranch %485 + %485 = OpLabel + %533 = OpLoad %int %i + %534 = OpIAdd %int %533 %int_1 + OpStore %i %534 + OpBranch %483 + %484 = OpLabel + %535 = OpLoad %v2float %vCurrOffset + OpStore %parallaxOcclusion_0 %535 + %536 = OpLoad %v2float %parallaxOcclusion_0 + OpStore %uvOffset %536 + %537 = OpLoad %v2float %v_uv + %538 = OpLoad %v2float %uvOffset + %540 = OpLoad %28 %TextureSamplerSampler + %541 = OpLoad %25 %TextureSamplerTexture + %542 = OpSampledImage %376 %541 %540 + %543 = OpFAdd %v2float %537 %538 + %539 = OpImageSampleImplicitLod %v4float %542 %543 + %544 = OpAccessChain %_ptr_Uniform_float %x_269 %uint_0 %uint_2 + %545 = OpLoad %float %544 + %546 = OpLoad %mat3v3float %TBN + OpStore %param_8 %546 + %547 = OpCompositeExtract %float %539 0 + %548 = OpCompositeExtract %float %539 1 + %549 = OpCompositeExtract %float %539 2 + %550 = OpCompositeConstruct %v3float %547 %548 %549 + OpStore %param_9 %550 + %551 = OpFDiv %float %float_1 %545 + OpStore %param_10 %551 + %552 = OpFunctionCall %v3float %perturbNormal_mf33_vf3_f1_ %param_8 %param_9 %param_10 + %556 = OpLoad %v4float %output4 + %557 = OpCompositeExtract %float %552 0 + %558 = OpCompositeExtract %float %552 1 + %559 = OpCompositeExtract %float %552 2 + %560 = OpCompositeExtract %float %556 3 + %561 = OpCompositeConstruct %v4float %557 %558 %559 %560 + OpStore %output4 %561 + %562 = OpLoad %v2float %v_uv + %563 = OpLoad %v2float %uvOffset + %564 = OpFAdd %v2float %562 %563 + OpStore %output6 %564 + %565 = OpLoad %v2float %output6 + %567 = OpLoad %28 %TextureSampler1Sampler + %568 = OpLoad %25 %TextureSampler1Texture + %569 = OpSampledImage %376 %568 %567 + %566 = OpImageSampleImplicitLod %v4float %569 %565 + OpStore %tempTextureRead1 %566 + %570 = OpLoad %v4float %tempTextureRead1 + %571 = OpCompositeExtract %float %570 0 + %572 = OpCompositeExtract %float %570 1 + %573 = OpCompositeExtract %float %570 2 + %574 = OpCompositeConstruct %v3float %571 %572 %573 + OpStore %rgb1 %574 + %575 = OpAccessChain %_ptr_Uniform_v3float %x_269 %uint_0 %uint_4 + %576 = OpLoad %v3float %575 + %577 = OpLoad %v4float %v_output1 + %579 = OpCompositeExtract %float %577 0 + %580 = OpCompositeExtract %float %577 1 + %581 = OpCompositeExtract %float %577 2 + %582 = OpCompositeConstruct %v3float %579 %580 %581 + %583 = OpFSub %v3float %576 %582 + %578 = OpExtInst %v3float %90 Normalize %583 + OpStore %viewDirectionW_1 %578 OpStore %shadow %float_1 - %582 = OpLoad %float %u_Float - %583 = OpFMul %float %float_1 %582 - OpStore %glossiness_1 %583 + %584 = OpLoad %float %u_Float + %585 = OpFMul %float %float_1 %584 + OpStore %glossiness_1 %585 OpStore %diffuseBase %22 OpStore %specularBase %22 - %584 = OpLoad %v4float %output4 - %585 = OpCompositeExtract %float %584 0 - %586 = OpCompositeExtract %float %584 1 - %587 = OpCompositeExtract %float %584 2 - %588 = OpCompositeConstruct %v3float %585 %586 %587 - OpStore %normalW %588 - %589 = OpLoad %v3float %viewDirectionW_1 - OpStore %param_11 %589 - %590 = OpLoad %v3float %normalW - OpStore %param_12 %590 - %592 = OpAccessChain %_ptr_Uniform_v4float %light0 %uint_0 - %593 = OpLoad %v4float %592 - OpStore %param_13 %593 - %594 = OpAccessChain %_ptr_Uniform_v4float %light0 %uint_1 + %586 = OpLoad %v4float %output4 + %587 = OpCompositeExtract %float %586 0 + %588 = OpCompositeExtract %float %586 1 + %589 = OpCompositeExtract %float %586 2 + %590 = OpCompositeConstruct %v3float %587 %588 %589 + OpStore %normalW %590 + %591 = OpLoad %v3float %viewDirectionW_1 + OpStore %param_11 %591 + %592 = OpLoad %v3float %normalW + OpStore %param_12 %592 + %594 = OpAccessChain %_ptr_Uniform_v4float %light0 %uint_0 %uint_0 %595 = OpLoad %v4float %594 - %596 = OpCompositeExtract %float %595 0 - %597 = OpCompositeExtract %float %595 1 - %598 = OpCompositeExtract %float %595 2 - %599 = OpCompositeConstruct %v3float %596 %597 %598 - OpStore %param_14 %599 - %600 = OpAccessChain %_ptr_Uniform_v4float %light0 %uint_2 - %601 = OpLoad %v4float %600 - %602 = OpCompositeExtract %float %601 0 - %603 = OpCompositeExtract %float %601 1 - %604 = OpCompositeExtract %float %601 2 - %605 = OpCompositeConstruct %v3float %602 %603 %604 - OpStore %param_15 %605 - %607 = OpAccessChain %_ptr_Uniform_v3float %light0 %uint_3 - %608 = OpLoad %v3float %607 - OpStore %param_16 %608 - %609 = OpLoad %float %glossiness_1 - OpStore %param_17 %609 - %610 = OpFunctionCall %lightingInfo %computeHemisphericLighting_vf3_vf3_vf4_vf3_vf3_vf3_f1_ %param_11 %param_12 %param_13 %param_14 %param_15 %param_16 %param_17 - OpStore %info %610 + OpStore %param_13 %595 + %596 = OpAccessChain %_ptr_Uniform_v4float %light0 %uint_0 %uint_1 + %597 = OpLoad %v4float %596 + %598 = OpCompositeExtract %float %597 0 + %599 = OpCompositeExtract %float %597 1 + %600 = OpCompositeExtract %float %597 2 + %601 = OpCompositeConstruct %v3float %598 %599 %600 + OpStore %param_14 %601 + %602 = OpAccessChain %_ptr_Uniform_v4float %light0 %uint_0 %uint_2 + %603 = OpLoad %v4float %602 + %604 = OpCompositeExtract %float %603 0 + %605 = OpCompositeExtract %float %603 1 + %606 = OpCompositeExtract %float %603 2 + %607 = OpCompositeConstruct %v3float %604 %605 %606 + OpStore %param_15 %607 + %609 = OpAccessChain %_ptr_Uniform_v3float %light0 %uint_0 %uint_3 + %610 = OpLoad %v3float %609 + OpStore %param_16 %610 + %611 = OpLoad %float %glossiness_1 + OpStore %param_17 %611 + %612 = OpFunctionCall %lightingInfo %computeHemisphericLighting_vf3_vf3_vf4_vf3_vf3_vf3_f1_ %param_11 %param_12 %param_13 %param_14 %param_15 %param_16 %param_17 + OpStore %info %612 OpStore %shadow %float_1 - %618 = OpAccessChain %_ptr_Function_v3float %info %uint_0 - %619 = OpLoad %v3float %618 - %620 = OpLoad %float %shadow - %621 = OpLoad %v3float %diffuseBase - %622 = OpVectorTimesScalar %v3float %619 %620 - %623 = OpFAdd %v3float %621 %622 - OpStore %diffuseBase %623 - %624 = OpAccessChain %_ptr_Function_v3float %info %uint_1 - %625 = OpLoad %v3float %624 - %626 = OpLoad %float %shadow - %627 = OpLoad %v3float %specularBase - %628 = OpVectorTimesScalar %v3float %625 %626 - %629 = OpFAdd %v3float %627 %628 - OpStore %specularBase %629 - %630 = OpLoad %v3float %diffuseBase - %631 = OpLoad %v3float %rgb1 - %632 = OpFMul %v3float %630 %631 - OpStore %diffuseOutput %632 - %633 = OpLoad %v3float %specularBase - %634 = OpLoad %v3float %u_Color - %635 = OpFMul %v3float %633 %634 - OpStore %specularOutput %635 - %636 = OpLoad %v3float %diffuseOutput - %637 = OpLoad %v3float %specularOutput - %638 = OpFAdd %v3float %636 %637 - OpStore %output3 %638 - %639 = OpLoad %v3float %output3 - %640 = OpCompositeExtract %float %639 0 - %641 = OpCompositeExtract %float %639 1 - %642 = OpCompositeExtract %float %639 2 - %643 = OpCompositeConstruct %v4float %640 %641 %642 %float_1 - OpStore %glFragColor %643 + %620 = OpAccessChain %_ptr_Function_v3float %info %uint_0 + %621 = OpLoad %v3float %620 + %622 = OpLoad %float %shadow + %623 = OpLoad %v3float %diffuseBase + %624 = OpVectorTimesScalar %v3float %621 %622 + %625 = OpFAdd %v3float %623 %624 + OpStore %diffuseBase %625 + %626 = OpAccessChain %_ptr_Function_v3float %info %uint_1 + %627 = OpLoad %v3float %626 + %628 = OpLoad %float %shadow + %629 = OpLoad %v3float %specularBase + %630 = OpVectorTimesScalar %v3float %627 %628 + %631 = OpFAdd %v3float %629 %630 + OpStore %specularBase %631 + %632 = OpLoad %v3float %diffuseBase + %633 = OpLoad %v3float %rgb1 + %634 = OpFMul %v3float %632 %633 + OpStore %diffuseOutput %634 + %635 = OpLoad %v3float %specularBase + %636 = OpLoad %v3float %u_Color + %637 = OpFMul %v3float %635 %636 + OpStore %specularOutput %637 + %638 = OpLoad %v3float %diffuseOutput + %639 = OpLoad %v3float %specularOutput + %640 = OpFAdd %v3float %638 %639 + OpStore %output3 %640 + %641 = OpLoad %v3float %output3 + %642 = OpCompositeExtract %float %641 0 + %643 = OpCompositeExtract %float %641 1 + %644 = OpCompositeExtract %float %641 2 + %645 = OpCompositeConstruct %v4float %642 %643 %644 %float_1 + OpStore %glFragColor %645 OpReturn OpFunctionEnd - %main_inner = OpFunction %main_out None %644 + %main_inner = OpFunction %main_out None %646 %vMainuv_param = OpFunctionParameter %v2float %v_output1_param = OpFunctionParameter %v4float %gl_FrontFacing_param = OpFunctionParameter %bool %v_uv_param = OpFunctionParameter %v2float %v_output2_param = OpFunctionParameter %v4float - %652 = OpLabel + %654 = OpLabel OpStore %vMainuv %vMainuv_param OpStore %v_output1 %v_output1_param OpStore %gl_FrontFacing %gl_FrontFacing_param OpStore %v_uv %v_uv_param OpStore %v_output2 %v_output2_param - %653 = OpFunctionCall %void %main_1 - %654 = OpLoad %v4float %glFragColor - %655 = OpCompositeConstruct %main_out %654 - OpReturnValue %655 + %655 = OpFunctionCall %void %main_1 + %656 = OpLoad %v4float %glFragColor + %657 = OpCompositeConstruct %main_out %656 + OpReturnValue %657 OpFunctionEnd - %main = OpFunction %void None %310 - %657 = OpLabel - %659 = OpLoad %v2float %vMainuv_param_1 - %660 = OpLoad %v4float %v_output1_param_1 - %661 = OpLoad %bool %gl_FrontFacing_param_1 - %662 = OpLoad %v2float %v_uv_param_1 - %663 = OpLoad %v4float %v_output2_param_1 - %658 = OpFunctionCall %main_out %main_inner %659 %660 %661 %662 %663 - %664 = OpCompositeExtract %v4float %658 0 - OpStore %glFragColor_1_1 %664 + %main = OpFunction %void None %312 + %659 = OpLabel + %661 = OpLoad %v2float %vMainuv_param_1 + %662 = OpLoad %v4float %v_output1_param_1 + %663 = OpLoad %bool %gl_FrontFacing_param_1 + %664 = OpLoad %v2float %v_uv_param_1 + %665 = OpLoad %v4float %v_output2_param_1 + %660 = OpFunctionCall %main_out %main_inner %661 %662 %663 %664 %665 + %666 = OpCompositeExtract %v4float %660 0 + OpStore %glFragColor_1_1 %666 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/951.spvasm.expected.glsl b/test/tint/bug/tint/951.spvasm.expected.glsl index e8e306503f..af71d80b67 100644 --- a/test/tint/bug/tint/951.spvasm.expected.glsl +++ b/test/tint/bug/tint/951.spvasm.expected.glsl @@ -1,5 +1,16 @@ #version 310 es +struct Uniforms { + float NAN; + int aShape; + int outShape; + int outShapeStrides; + int size; + uint pad; + uint pad_1; + uint pad_2; +}; + layout(binding = 0, std430) buffer ssbOut_ssbo { float result[]; } x_16; @@ -9,15 +20,8 @@ layout(binding = 1, std430) buffer ssbA_ssbo { } x_20; uvec3 tint_symbol = uvec3(0u, 0u, 0u); -layout(binding = 2, std140) uniform Uniforms_ubo { - float NAN; - int aShape; - int outShape; - int outShapeStrides; - int size; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 2, std140) uniform x_24_block_ubo { + Uniforms inner; } x_24; float getAAtOutCoords_() { @@ -51,7 +55,7 @@ void main_1() { uint x_61 = tint_symbol.x; index = int(x_61); int x_63 = index; - int x_70 = x_24.size; + int x_70 = x_24.inner.size; if ((x_63 < x_70)) { float x_75 = getAAtOutCoords_(); a_1 = x_75; diff --git a/test/tint/bug/tint/951.spvasm.expected.spvasm b/test/tint/bug/tint/951.spvasm.expected.spvasm index 34ba443208..bff1ddae9a 100644 --- a/test/tint/bug/tint/951.spvasm.expected.spvasm +++ b/test/tint/bug/tint/951.spvasm.expected.spvasm @@ -1,10 +1,10 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 106 +; Bound: 107 ; Schema: 0 OpCapability Shader - %55 = OpExtInstImport "GLSL.std.450" + %56 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID_param_1 OpExecutionMode %main LocalSize 128 1 1 @@ -16,6 +16,8 @@ OpMemberName %ssbA 0 "A" OpName %x_20 "x_20" OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpName %x_24_block "x_24_block" + OpMemberName %x_24_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "NAN" OpMemberName %Uniforms 1 "aShape" @@ -51,7 +53,8 @@ OpDecorate %x_20 NonWritable OpDecorate %x_20 DescriptorSet 0 OpDecorate %x_20 Binding 1 - OpDecorate %Uniforms Block + OpDecorate %x_24_block Block + OpMemberDecorate %x_24_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 1 Offset 4 OpMemberDecorate %Uniforms 2 Offset 8 @@ -77,115 +80,116 @@ %gl_GlobalInvocationID = OpVariable %_ptr_Private_v3uint Private %15 %int = OpTypeInt 32 1 %Uniforms = OpTypeStruct %float %int %int %int %int -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %x_24 = OpVariable %_ptr_Uniform_Uniforms Uniform - %20 = OpTypeFunction %float + %x_24_block = OpTypeStruct %Uniforms +%_ptr_Uniform_x_24_block = OpTypePointer Uniform %x_24_block + %x_24 = OpVariable %_ptr_Uniform_x_24_block Uniform + %21 = OpTypeFunction %float %uint_0 = OpConstant %uint 0 %_ptr_Private_uint = OpTypePointer Private %uint %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float %_ptr_Function_float = OpTypePointer Function %float - %30 = OpTypeFunction %float %_ptr_Function_float + %31 = OpTypeFunction %float %_ptr_Function_float %bool = OpTypeBool %_ptr_Function_bool = OpTypePointer Function %bool - %38 = OpConstantNull %bool - %40 = OpConstantNull %float + %39 = OpConstantNull %bool + %41 = OpConstantNull %float %true = OpConstantTrue %bool %float_0x1p_128 = OpConstant %float 0x1p+128 %void = OpTypeVoid %_ptr_Function_int = OpTypePointer Function %int - %57 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_float - %69 = OpTypeFunction %void - %73 = OpConstantNull %int + %58 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_float + %70 = OpTypeFunction %void + %74 = OpConstantNull %int %uint_4 = OpConstant %uint 4 %_ptr_Uniform_int = OpTypePointer Uniform %int - %97 = OpTypeFunction %void %v3uint -%getAAtOutCoords_ = OpFunction %float None %20 - %22 = OpLabel - %25 = OpAccessChain %_ptr_Private_uint %gl_GlobalInvocationID %uint_0 - %26 = OpLoad %uint %25 - %28 = OpAccessChain %_ptr_StorageBuffer_float %x_20 %uint_0 %26 - %29 = OpLoad %float %28 - OpReturnValue %29 + %98 = OpTypeFunction %void %v3uint +%getAAtOutCoords_ = OpFunction %float None %21 + %23 = OpLabel + %26 = OpAccessChain %_ptr_Private_uint %gl_GlobalInvocationID %uint_0 + %27 = OpLoad %uint %26 + %29 = OpAccessChain %_ptr_StorageBuffer_float %x_20 %uint_0 %27 + %30 = OpLoad %float %29 + OpReturnValue %30 OpFunctionEnd -%unaryOperation_f1_ = OpFunction %float None %30 +%unaryOperation_f1_ = OpFunction %float None %31 %a = OpFunctionParameter %_ptr_Function_float - %34 = OpLabel -%tint_return_flag = OpVariable %_ptr_Function_bool Function %38 -%tint_return_value = OpVariable %_ptr_Function_float Function %40 - %42 = OpLoad %float %a - %43 = OpFOrdLessThan %bool %42 %40 - OpSelectionMerge %44 None - OpBranchConditional %43 %45 %44 - %45 = OpLabel + %35 = OpLabel +%tint_return_flag = OpVariable %_ptr_Function_bool Function %39 +%tint_return_value = OpVariable %_ptr_Function_float Function %41 + %43 = OpLoad %float %a + %44 = OpFOrdLessThan %bool %43 %41 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %45 + %46 = OpLabel OpStore %tint_return_flag %true OpStore %tint_return_value %float_0x1p_128 - OpBranch %44 - %44 = OpLabel - %49 = OpLoad %bool %tint_return_flag - %48 = OpLogicalNot %bool %49 - OpSelectionMerge %50 None - OpBranchConditional %48 %51 %50 - %51 = OpLabel - %53 = OpLoad %float %a + OpBranch %45 + %45 = OpLabel + %50 = OpLoad %bool %tint_return_flag + %49 = OpLogicalNot %bool %50 + OpSelectionMerge %51 None + OpBranchConditional %49 %52 %51 + %52 = OpLabel + %54 = OpLoad %float %a OpStore %tint_return_flag %true - %54 = OpExtInst %float %55 Log %53 - OpStore %tint_return_value %54 - OpBranch %50 - %50 = OpLabel - %56 = OpLoad %float %tint_return_value - OpReturnValue %56 + %55 = OpExtInst %float %56 Log %54 + OpStore %tint_return_value %55 + OpBranch %51 + %51 = OpLabel + %57 = OpLoad %float %tint_return_value + OpReturnValue %57 OpFunctionEnd -%setOutput_i1_f1_ = OpFunction %void None %57 +%setOutput_i1_f1_ = OpFunction %void None %58 %flatIndex = OpFunctionParameter %_ptr_Function_int %value = OpFunctionParameter %_ptr_Function_float - %63 = OpLabel - %65 = OpLoad %int %flatIndex - %67 = OpLoad %float %value - %68 = OpAccessChain %_ptr_StorageBuffer_float %x_16 %uint_0 %65 - OpStore %68 %67 + %64 = OpLabel + %66 = OpLoad %int %flatIndex + %68 = OpLoad %float %value + %69 = OpAccessChain %_ptr_StorageBuffer_float %x_16 %uint_0 %66 + OpStore %69 %68 OpReturn OpFunctionEnd - %main_1 = OpFunction %void None %69 - %71 = OpLabel - %index = OpVariable %_ptr_Function_int Function %73 - %a_1 = OpVariable %_ptr_Function_float Function %40 - %param = OpVariable %_ptr_Function_float Function %40 - %param_1 = OpVariable %_ptr_Function_int Function %73 - %param_2 = OpVariable %_ptr_Function_float Function %40 - %78 = OpAccessChain %_ptr_Private_uint %gl_GlobalInvocationID %uint_0 - %79 = OpLoad %uint %78 - %80 = OpBitcast %int %79 - OpStore %index %80 - %81 = OpLoad %int %index - %84 = OpAccessChain %_ptr_Uniform_int %x_24 %uint_4 - %85 = OpLoad %int %84 - %86 = OpSLessThan %bool %81 %85 - OpSelectionMerge %87 None - OpBranchConditional %86 %88 %87 + %main_1 = OpFunction %void None %70 + %72 = OpLabel + %index = OpVariable %_ptr_Function_int Function %74 + %a_1 = OpVariable %_ptr_Function_float Function %41 + %param = OpVariable %_ptr_Function_float Function %41 + %param_1 = OpVariable %_ptr_Function_int Function %74 + %param_2 = OpVariable %_ptr_Function_float Function %41 + %79 = OpAccessChain %_ptr_Private_uint %gl_GlobalInvocationID %uint_0 + %80 = OpLoad %uint %79 + %81 = OpBitcast %int %80 + OpStore %index %81 + %82 = OpLoad %int %index + %85 = OpAccessChain %_ptr_Uniform_int %x_24 %uint_0 %uint_4 + %86 = OpLoad %int %85 + %87 = OpSLessThan %bool %82 %86 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %88 + %89 = OpLabel + %90 = OpFunctionCall %float %getAAtOutCoords_ + OpStore %a_1 %90 + %91 = OpLoad %float %a_1 + OpStore %param %91 + %92 = OpFunctionCall %float %unaryOperation_f1_ %param + %94 = OpLoad %int %index + OpStore %param_1 %94 + OpStore %param_2 %92 + %95 = OpFunctionCall %void %setOutput_i1_f1_ %param_1 %param_2 + OpBranch %88 %88 = OpLabel - %89 = OpFunctionCall %float %getAAtOutCoords_ - OpStore %a_1 %89 - %90 = OpLoad %float %a_1 - OpStore %param %90 - %91 = OpFunctionCall %float %unaryOperation_f1_ %param - %93 = OpLoad %int %index - OpStore %param_1 %93 - OpStore %param_2 %91 - %94 = OpFunctionCall %void %setOutput_i1_f1_ %param_1 %param_2 - OpBranch %87 - %87 = OpLabel OpReturn OpFunctionEnd - %main_inner = OpFunction %void None %97 + %main_inner = OpFunction %void None %98 %gl_GlobalInvocationID_param = OpFunctionParameter %v3uint - %100 = OpLabel + %101 = OpLabel OpStore %gl_GlobalInvocationID %gl_GlobalInvocationID_param - %101 = OpFunctionCall %void %main_1 + %102 = OpFunctionCall %void %main_1 OpReturn OpFunctionEnd - %main = OpFunction %void None %69 - %103 = OpLabel - %105 = OpLoad %v3uint %gl_GlobalInvocationID_param_1 - %104 = OpFunctionCall %void %main_inner %105 + %main = OpFunction %void None %70 + %104 = OpLabel + %106 = OpLoad %v3uint %gl_GlobalInvocationID_param_1 + %105 = OpFunctionCall %void %main_inner %106 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/959.wgsl.expected.glsl b/test/tint/bug/tint/959.wgsl.expected.glsl index d0639e473c..805695b305 100644 --- a/test/tint/bug/tint/959.wgsl.expected.glsl +++ b/test/tint/bug/tint/959.wgsl.expected.glsl @@ -1,116 +1,75 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer S_ssbo { +struct S { float a; uint pad; uint pad_1; uint pad_2; +}; + +layout(binding = 0, std430) buffer b0_block_ssbo { + S inner; } b0; -layout(binding = 0, std430) buffer S_ssbo_1 { - float a; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 0, std430) buffer b0_block_ssbo_1 { + S inner; } b1; -layout(binding = 0, std430) buffer S_ssbo_2 { - float a; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 0, std430) buffer b0_block_ssbo_2 { + S inner; } b2; -layout(binding = 0, std430) buffer S_ssbo_3 { - float a; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 0, std430) buffer b0_block_ssbo_3 { + S inner; } b3; -layout(binding = 0, std430) buffer S_ssbo_4 { - float a; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 0, std430) buffer b0_block_ssbo_4 { + S inner; } b4; -layout(binding = 0, std430) buffer S_ssbo_5 { - float a; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 0, std430) buffer b0_block_ssbo_5 { + S inner; } b5; -layout(binding = 0, std430) buffer S_ssbo_6 { - float a; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 0, std430) buffer b0_block_ssbo_6 { + S inner; } b6; -layout(binding = 0, std430) buffer S_ssbo_7 { - float a; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 0, std430) buffer b0_block_ssbo_7 { + S inner; } b7; -layout(binding = 1, std140) uniform S_ubo { - float a; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 1, std140) uniform b0_block_ubo { + S inner; } b8; -layout(binding = 1, std140) uniform S_ubo_1 { - float a; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 1, std140) uniform b0_block_ubo_1 { + S inner; } b9; -layout(binding = 1, std140) uniform S_ubo_2 { - float a; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 1, std140) uniform b0_block_ubo_2 { + S inner; } b10; -layout(binding = 1, std140) uniform S_ubo_3 { - float a; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 1, std140) uniform b0_block_ubo_3 { + S inner; } b11; -layout(binding = 1, std140) uniform S_ubo_4 { - float a; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 1, std140) uniform b0_block_ubo_4 { + S inner; } b12; -layout(binding = 1, std140) uniform S_ubo_5 { - float a; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 1, std140) uniform b0_block_ubo_5 { + S inner; } b13; -layout(binding = 1, std140) uniform S_ubo_6 { - float a; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 1, std140) uniform b0_block_ubo_6 { + S inner; } b14; -layout(binding = 1, std140) uniform S_ubo_7 { - float a; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 1, std140) uniform b0_block_ubo_7 { + S inner; } b15; void tint_symbol() { diff --git a/test/tint/bug/tint/959.wgsl.expected.spvasm b/test/tint/bug/tint/959.wgsl.expected.spvasm index a6f6c354a0..43c70c2e67 100644 --- a/test/tint/bug/tint/959.wgsl.expected.spvasm +++ b/test/tint/bug/tint/959.wgsl.expected.spvasm @@ -1,12 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 63 +; Bound: 64 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %main "main" OpExecutionMode %main OriginUpperLeft + OpName %b0_block "b0_block" + OpMemberName %b0_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %b0 "b0" @@ -58,7 +60,8 @@ OpName %s14 "s14" OpName %s15 "s15" OpName %main "main" - OpDecorate %S Block + OpDecorate %b0_block Block + OpMemberDecorate %b0_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %b0 NonWritable OpDecorate %b0 DescriptorSet 0 @@ -174,65 +177,66 @@ OpDecorate %s15 Binding 300 %float = OpTypeFloat 32 %S = OpTypeStruct %float -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %b0 = OpVariable %_ptr_StorageBuffer_S StorageBuffer - %b1 = OpVariable %_ptr_StorageBuffer_S StorageBuffer - %b2 = OpVariable %_ptr_StorageBuffer_S StorageBuffer - %b3 = OpVariable %_ptr_StorageBuffer_S StorageBuffer - %b4 = OpVariable %_ptr_StorageBuffer_S StorageBuffer - %b5 = OpVariable %_ptr_StorageBuffer_S StorageBuffer - %b6 = OpVariable %_ptr_StorageBuffer_S StorageBuffer - %b7 = OpVariable %_ptr_StorageBuffer_S StorageBuffer -%_ptr_Uniform_S = OpTypePointer Uniform %S - %b8 = OpVariable %_ptr_Uniform_S Uniform - %b9 = OpVariable %_ptr_Uniform_S Uniform - %b10 = OpVariable %_ptr_Uniform_S Uniform - %b11 = OpVariable %_ptr_Uniform_S Uniform - %b12 = OpVariable %_ptr_Uniform_S Uniform - %b13 = OpVariable %_ptr_Uniform_S Uniform - %b14 = OpVariable %_ptr_Uniform_S Uniform - %b15 = OpVariable %_ptr_Uniform_S Uniform - %23 = OpTypeImage %float 2D 0 0 0 1 Unknown -%_ptr_UniformConstant_23 = OpTypePointer UniformConstant %23 - %t0 = OpVariable %_ptr_UniformConstant_23 UniformConstant - %t1 = OpVariable %_ptr_UniformConstant_23 UniformConstant - %t2 = OpVariable %_ptr_UniformConstant_23 UniformConstant - %t3 = OpVariable %_ptr_UniformConstant_23 UniformConstant - %t4 = OpVariable %_ptr_UniformConstant_23 UniformConstant - %t5 = OpVariable %_ptr_UniformConstant_23 UniformConstant - %t6 = OpVariable %_ptr_UniformConstant_23 UniformConstant - %t7 = OpVariable %_ptr_UniformConstant_23 UniformConstant -%_ptr_UniformConstant_23_0 = OpTypePointer UniformConstant %23 - %t8 = OpVariable %_ptr_UniformConstant_23_0 UniformConstant - %t9 = OpVariable %_ptr_UniformConstant_23_0 UniformConstant - %t10 = OpVariable %_ptr_UniformConstant_23_0 UniformConstant - %t11 = OpVariable %_ptr_UniformConstant_23_0 UniformConstant - %t12 = OpVariable %_ptr_UniformConstant_23_0 UniformConstant - %t13 = OpVariable %_ptr_UniformConstant_23_0 UniformConstant - %t14 = OpVariable %_ptr_UniformConstant_23_0 UniformConstant - %t15 = OpVariable %_ptr_UniformConstant_23_0 UniformConstant - %42 = OpTypeSampler -%_ptr_UniformConstant_42 = OpTypePointer UniformConstant %42 - %s0 = OpVariable %_ptr_UniformConstant_42 UniformConstant - %s1 = OpVariable %_ptr_UniformConstant_42 UniformConstant - %s2 = OpVariable %_ptr_UniformConstant_42 UniformConstant - %s3 = OpVariable %_ptr_UniformConstant_42 UniformConstant - %s4 = OpVariable %_ptr_UniformConstant_42 UniformConstant - %s5 = OpVariable %_ptr_UniformConstant_42 UniformConstant - %s6 = OpVariable %_ptr_UniformConstant_42 UniformConstant - %s7 = OpVariable %_ptr_UniformConstant_42 UniformConstant -%_ptr_UniformConstant_42_0 = OpTypePointer UniformConstant %42 - %s8 = OpVariable %_ptr_UniformConstant_42_0 UniformConstant - %s9 = OpVariable %_ptr_UniformConstant_42_0 UniformConstant - %s10 = OpVariable %_ptr_UniformConstant_42_0 UniformConstant - %s11 = OpVariable %_ptr_UniformConstant_42_0 UniformConstant - %s12 = OpVariable %_ptr_UniformConstant_42_0 UniformConstant - %s13 = OpVariable %_ptr_UniformConstant_42_0 UniformConstant - %s14 = OpVariable %_ptr_UniformConstant_42_0 UniformConstant - %s15 = OpVariable %_ptr_UniformConstant_42_0 UniformConstant + %b0_block = OpTypeStruct %S +%_ptr_StorageBuffer_b0_block = OpTypePointer StorageBuffer %b0_block + %b0 = OpVariable %_ptr_StorageBuffer_b0_block StorageBuffer + %b1 = OpVariable %_ptr_StorageBuffer_b0_block StorageBuffer + %b2 = OpVariable %_ptr_StorageBuffer_b0_block StorageBuffer + %b3 = OpVariable %_ptr_StorageBuffer_b0_block StorageBuffer + %b4 = OpVariable %_ptr_StorageBuffer_b0_block StorageBuffer + %b5 = OpVariable %_ptr_StorageBuffer_b0_block StorageBuffer + %b6 = OpVariable %_ptr_StorageBuffer_b0_block StorageBuffer + %b7 = OpVariable %_ptr_StorageBuffer_b0_block StorageBuffer +%_ptr_Uniform_b0_block = OpTypePointer Uniform %b0_block + %b8 = OpVariable %_ptr_Uniform_b0_block Uniform + %b9 = OpVariable %_ptr_Uniform_b0_block Uniform + %b10 = OpVariable %_ptr_Uniform_b0_block Uniform + %b11 = OpVariable %_ptr_Uniform_b0_block Uniform + %b12 = OpVariable %_ptr_Uniform_b0_block Uniform + %b13 = OpVariable %_ptr_Uniform_b0_block Uniform + %b14 = OpVariable %_ptr_Uniform_b0_block Uniform + %b15 = OpVariable %_ptr_Uniform_b0_block Uniform + %24 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_24 = OpTypePointer UniformConstant %24 + %t0 = OpVariable %_ptr_UniformConstant_24 UniformConstant + %t1 = OpVariable %_ptr_UniformConstant_24 UniformConstant + %t2 = OpVariable %_ptr_UniformConstant_24 UniformConstant + %t3 = OpVariable %_ptr_UniformConstant_24 UniformConstant + %t4 = OpVariable %_ptr_UniformConstant_24 UniformConstant + %t5 = OpVariable %_ptr_UniformConstant_24 UniformConstant + %t6 = OpVariable %_ptr_UniformConstant_24 UniformConstant + %t7 = OpVariable %_ptr_UniformConstant_24 UniformConstant +%_ptr_UniformConstant_24_0 = OpTypePointer UniformConstant %24 + %t8 = OpVariable %_ptr_UniformConstant_24_0 UniformConstant + %t9 = OpVariable %_ptr_UniformConstant_24_0 UniformConstant + %t10 = OpVariable %_ptr_UniformConstant_24_0 UniformConstant + %t11 = OpVariable %_ptr_UniformConstant_24_0 UniformConstant + %t12 = OpVariable %_ptr_UniformConstant_24_0 UniformConstant + %t13 = OpVariable %_ptr_UniformConstant_24_0 UniformConstant + %t14 = OpVariable %_ptr_UniformConstant_24_0 UniformConstant + %t15 = OpVariable %_ptr_UniformConstant_24_0 UniformConstant + %43 = OpTypeSampler +%_ptr_UniformConstant_43 = OpTypePointer UniformConstant %43 + %s0 = OpVariable %_ptr_UniformConstant_43 UniformConstant + %s1 = OpVariable %_ptr_UniformConstant_43 UniformConstant + %s2 = OpVariable %_ptr_UniformConstant_43 UniformConstant + %s3 = OpVariable %_ptr_UniformConstant_43 UniformConstant + %s4 = OpVariable %_ptr_UniformConstant_43 UniformConstant + %s5 = OpVariable %_ptr_UniformConstant_43 UniformConstant + %s6 = OpVariable %_ptr_UniformConstant_43 UniformConstant + %s7 = OpVariable %_ptr_UniformConstant_43 UniformConstant +%_ptr_UniformConstant_43_0 = OpTypePointer UniformConstant %43 + %s8 = OpVariable %_ptr_UniformConstant_43_0 UniformConstant + %s9 = OpVariable %_ptr_UniformConstant_43_0 UniformConstant + %s10 = OpVariable %_ptr_UniformConstant_43_0 UniformConstant + %s11 = OpVariable %_ptr_UniformConstant_43_0 UniformConstant + %s12 = OpVariable %_ptr_UniformConstant_43_0 UniformConstant + %s13 = OpVariable %_ptr_UniformConstant_43_0 UniformConstant + %s14 = OpVariable %_ptr_UniformConstant_43_0 UniformConstant + %s15 = OpVariable %_ptr_UniformConstant_43_0 UniformConstant %void = OpTypeVoid - %59 = OpTypeFunction %void - %main = OpFunction %void None %59 - %62 = OpLabel + %60 = OpTypeFunction %void + %main = OpFunction %void None %60 + %63 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/977.spvasm.expected.spvasm b/test/tint/bug/tint/977.spvasm.expected.spvasm index 22076fce7b..77a92b854d 100644 --- a/test/tint/bug/tint/977.spvasm.expected.spvasm +++ b/test/tint/bug/tint/977.spvasm.expected.spvasm @@ -1,10 +1,10 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 112 +; Bound: 113 ; Schema: 0 OpCapability Shader - %51 = OpExtInstImport "GLSL.std.450" + %52 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID_param_1 OpExecutionMode %main LocalSize 1 1 1 @@ -19,6 +19,8 @@ OpName %SecondMatrix "SecondMatrix" OpMemberName %SecondMatrix 0 "numbers" OpName %secondMatrix "secondMatrix" + OpName %x_46_block "x_46_block" + OpMemberName %x_46_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "NAN" OpMemberName %Uniforms 1 "sizeA" @@ -54,7 +56,8 @@ OpDecorate %secondMatrix NonWritable OpDecorate %secondMatrix DescriptorSet 0 OpDecorate %secondMatrix Binding 1 - OpDecorate %Uniforms Block + OpDecorate %x_46_block Block + OpMemberDecorate %x_46_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 1 Offset 4 OpMemberDecorate %Uniforms 2 Offset 8 @@ -81,114 +84,115 @@ %secondMatrix = OpVariable %_ptr_StorageBuffer_SecondMatrix StorageBuffer %int = OpTypeInt 32 1 %Uniforms = OpTypeStruct %float %int %int -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %x_46 = OpVariable %_ptr_Uniform_Uniforms Uniform + %x_46_block = OpTypeStruct %Uniforms +%_ptr_Uniform_x_46_block = OpTypePointer Uniform %x_46_block + %x_46 = OpVariable %_ptr_Uniform_x_46_block Uniform %_ptr_Function_float = OpTypePointer Function %float - %23 = OpTypeFunction %float %_ptr_Function_float %_ptr_Function_float + %24 = OpTypeFunction %float %_ptr_Function_float %_ptr_Function_float %bool = OpTypeBool %_ptr_Function_bool = OpTypePointer Function %bool - %32 = OpConstantNull %bool - %34 = OpConstantNull %float + %33 = OpConstantNull %bool + %35 = OpConstantNull %float %true = OpConstantTrue %bool %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 %void = OpTypeVoid - %79 = OpTypeFunction %void + %80 = OpTypeFunction %void %_ptr_Function_int = OpTypePointer Function %int - %85 = OpConstantNull %int + %86 = OpConstantNull %int %uint_0 = OpConstant %uint 0 %_ptr_Private_uint = OpTypePointer Private %uint %int_n10 = OpConstant %int -10 %float_n4 = OpConstant %float -4 %float_n3 = OpConstant %float -3 %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float - %103 = OpTypeFunction %void %v3uint -%binaryOperation_f1_f1_ = OpFunction %float None %23 + %104 = OpTypeFunction %void %v3uint +%binaryOperation_f1_f1_ = OpFunction %float None %24 %a = OpFunctionParameter %_ptr_Function_float %b = OpFunctionParameter %_ptr_Function_float - %28 = OpLabel -%tint_return_flag = OpVariable %_ptr_Function_bool Function %32 -%tint_return_value = OpVariable %_ptr_Function_float Function %34 - %x_26 = OpVariable %_ptr_Function_float Function %34 - %37 = OpLoad %float %b - %38 = OpFOrdEqual %bool %37 %34 - OpSelectionMerge %39 None - OpBranchConditional %38 %40 %39 - %40 = OpLabel + %29 = OpLabel +%tint_return_flag = OpVariable %_ptr_Function_bool Function %33 +%tint_return_value = OpVariable %_ptr_Function_float Function %35 + %x_26 = OpVariable %_ptr_Function_float Function %35 + %38 = OpLoad %float %b + %39 = OpFOrdEqual %bool %38 %35 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %40 + %41 = OpLabel OpStore %tint_return_flag %true OpStore %tint_return_value %float_1 - OpBranch %39 - %39 = OpLabel - %44 = OpLoad %bool %tint_return_flag - %43 = OpLogicalNot %bool %44 - OpSelectionMerge %45 None - OpBranchConditional %43 %46 %45 - %46 = OpLabel - %48 = OpLoad %float %b - %54 = OpFDiv %float %48 %float_2 - %53 = OpExtInst %float %51 Floor %54 - %55 = OpFMul %float %float_2 %53 - %56 = OpFSub %float %48 %55 - %50 = OpExtInst %float %51 RoundEven %56 - %57 = OpFOrdEqual %bool %50 %float_1 - %49 = OpLogicalNot %bool %57 - OpSelectionMerge %58 None - OpBranchConditional %49 %59 %60 - %59 = OpLabel - %62 = OpLoad %float %a - %64 = OpLoad %float %b - %66 = OpExtInst %float %51 FAbs %62 - %65 = OpExtInst %float %51 Pow %66 %64 - OpStore %x_26 %65 - OpBranch %58 + OpBranch %40 + %40 = OpLabel + %45 = OpLoad %bool %tint_return_flag + %44 = OpLogicalNot %bool %45 + OpSelectionMerge %46 None + OpBranchConditional %44 %47 %46 + %47 = OpLabel + %49 = OpLoad %float %b + %55 = OpFDiv %float %49 %float_2 + %54 = OpExtInst %float %52 Floor %55 + %56 = OpFMul %float %float_2 %54 + %57 = OpFSub %float %49 %56 + %51 = OpExtInst %float %52 RoundEven %57 + %58 = OpFOrdEqual %bool %51 %float_1 + %50 = OpLogicalNot %bool %58 + OpSelectionMerge %59 None + OpBranchConditional %50 %60 %61 %60 = OpLabel - %68 = OpLoad %float %a - %70 = OpLoad %float %a - %72 = OpLoad %float %b - %73 = OpExtInst %float %51 FSign %68 - %75 = OpExtInst %float %51 FAbs %70 - %74 = OpExtInst %float %51 Pow %75 %72 - %76 = OpFMul %float %73 %74 - OpStore %x_26 %76 - OpBranch %58 - %58 = OpLabel - %77 = OpLoad %float %x_26 + %63 = OpLoad %float %a + %65 = OpLoad %float %b + %67 = OpExtInst %float %52 FAbs %63 + %66 = OpExtInst %float %52 Pow %67 %65 + OpStore %x_26 %66 + OpBranch %59 + %61 = OpLabel + %69 = OpLoad %float %a + %71 = OpLoad %float %a + %73 = OpLoad %float %b + %74 = OpExtInst %float %52 FSign %69 + %76 = OpExtInst %float %52 FAbs %71 + %75 = OpExtInst %float %52 Pow %76 %73 + %77 = OpFMul %float %74 %75 + OpStore %x_26 %77 + OpBranch %59 + %59 = OpLabel + %78 = OpLoad %float %x_26 OpStore %tint_return_flag %true - OpStore %tint_return_value %77 - OpBranch %45 - %45 = OpLabel - %78 = OpLoad %float %tint_return_value - OpReturnValue %78 + OpStore %tint_return_value %78 + OpBranch %46 + %46 = OpLabel + %79 = OpLoad %float %tint_return_value + OpReturnValue %79 OpFunctionEnd - %main_1 = OpFunction %void None %79 - %82 = OpLabel - %index = OpVariable %_ptr_Function_int Function %85 - %a_1 = OpVariable %_ptr_Function_int Function %85 - %param = OpVariable %_ptr_Function_float Function %34 - %param_1 = OpVariable %_ptr_Function_float Function %34 - %91 = OpAccessChain %_ptr_Private_uint %gl_GlobalInvocationID %uint_0 - %92 = OpLoad %uint %91 - %93 = OpBitcast %int %92 - OpStore %index %93 + %main_1 = OpFunction %void None %80 + %83 = OpLabel + %index = OpVariable %_ptr_Function_int Function %86 + %a_1 = OpVariable %_ptr_Function_int Function %86 + %param = OpVariable %_ptr_Function_float Function %35 + %param_1 = OpVariable %_ptr_Function_float Function %35 + %92 = OpAccessChain %_ptr_Private_uint %gl_GlobalInvocationID %uint_0 + %93 = OpLoad %uint %92 + %94 = OpBitcast %int %93 + OpStore %index %94 OpStore %a_1 %int_n10 - %95 = OpLoad %int %index + %96 = OpLoad %int %index OpStore %param %float_n4 OpStore %param_1 %float_n3 - %98 = OpFunctionCall %float %binaryOperation_f1_f1_ %param %param_1 - %102 = OpAccessChain %_ptr_StorageBuffer_float %resultMatrix %uint_0 %95 - OpStore %102 %98 + %99 = OpFunctionCall %float %binaryOperation_f1_f1_ %param %param_1 + %103 = OpAccessChain %_ptr_StorageBuffer_float %resultMatrix %uint_0 %96 + OpStore %103 %99 OpReturn OpFunctionEnd - %main_inner = OpFunction %void None %103 + %main_inner = OpFunction %void None %104 %gl_GlobalInvocationID_param = OpFunctionParameter %v3uint - %106 = OpLabel + %107 = OpLabel OpStore %gl_GlobalInvocationID %gl_GlobalInvocationID_param - %107 = OpFunctionCall %void %main_1 + %108 = OpFunctionCall %void %main_1 OpReturn OpFunctionEnd - %main = OpFunction %void None %79 - %109 = OpLabel - %111 = OpLoad %v3uint %gl_GlobalInvocationID_param_1 - %110 = OpFunctionCall %void %main_inner %111 + %main = OpFunction %void None %80 + %110 = OpLabel + %112 = OpLoad %v3uint %gl_GlobalInvocationID_param_1 + %111 = OpFunctionCall %void %main_inner %112 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/980.wgsl.expected.glsl b/test/tint/bug/tint/980.wgsl.expected.glsl index cfe795c6bc..8b59164ab7 100644 --- a/test/tint/bug/tint/980.wgsl.expected.glsl +++ b/test/tint/bug/tint/980.wgsl.expected.glsl @@ -6,14 +6,18 @@ vec3 Bad(uint index, vec3 rd) { return normalize(normal); } -layout(binding = 0, std430) buffer S_ssbo { +struct S { vec3 v; uint i; +}; + +layout(binding = 0, std430) buffer io_block_ssbo { + S inner; } io; void tint_symbol(uint idx) { - vec3 tint_symbol_1 = Bad(io.i, io.v); - io.v = tint_symbol_1; + vec3 tint_symbol_1 = Bad(io.inner.i, io.inner.v); + io.inner.v = tint_symbol_1; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/tint/980.wgsl.expected.spvasm b/test/tint/bug/tint/980.wgsl.expected.spvasm index 8eb0c28adf..68c365025b 100644 --- a/test/tint/bug/tint/980.wgsl.expected.spvasm +++ b/test/tint/bug/tint/980.wgsl.expected.spvasm @@ -1,14 +1,16 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 45 +; Bound: 46 ; Schema: 0 OpCapability Shader - %21 = OpExtInstImport "GLSL.std.450" + %22 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" %idx_1 OpExecutionMode %main LocalSize 1 1 1 OpName %idx_1 "idx_1" + OpName %io_block "io_block" + OpMemberName %io_block 0 "inner" OpName %S "S" OpMemberName %S 0 "v" OpMemberName %S 1 "i" @@ -21,7 +23,8 @@ OpName %idx "idx" OpName %main "main" OpDecorate %idx_1 BuiltIn LocalInvocationIndex - OpDecorate %S Block + OpDecorate %io_block Block + OpMemberDecorate %io_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpMemberDecorate %S 1 Offset 12 OpDecorate %io Binding 0 @@ -32,49 +35,50 @@ %float = OpTypeFloat 32 %v3float = OpTypeVector %float 3 %S = OpTypeStruct %v3float %uint -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %io = OpVariable %_ptr_StorageBuffer_S StorageBuffer - %9 = OpTypeFunction %v3float %uint %v3float - %14 = OpConstantNull %v3float + %io_block = OpTypeStruct %S +%_ptr_StorageBuffer_io_block = OpTypePointer StorageBuffer %io_block + %io = OpVariable %_ptr_StorageBuffer_io_block StorageBuffer + %10 = OpTypeFunction %v3float %uint %v3float + %15 = OpConstantNull %v3float %_ptr_Function_v3float = OpTypePointer Function %v3float %_ptr_Function_float = OpTypePointer Function %float %void = OpTypeVoid - %25 = OpTypeFunction %void %uint + %26 = OpTypeFunction %void %uint + %uint_0 = OpConstant %uint 0 %uint_1 = OpConstant %uint 1 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint - %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float - %40 = OpTypeFunction %void - %Bad = OpFunction %v3float None %9 + %41 = OpTypeFunction %void + %Bad = OpFunction %v3float None %10 %index = OpFunctionParameter %uint %rd = OpFunctionParameter %v3float - %13 = OpLabel - %normal = OpVariable %_ptr_Function_v3float Function %14 - OpStore %normal %14 - %18 = OpAccessChain %_ptr_Function_float %normal %index - %22 = OpVectorExtractDynamic %float %rd %index - %20 = OpExtInst %float %21 FSign %22 - %19 = OpFNegate %float %20 - OpStore %18 %19 - %24 = OpLoad %v3float %normal - %23 = OpExtInst %v3float %21 Normalize %24 - OpReturnValue %23 + %14 = OpLabel + %normal = OpVariable %_ptr_Function_v3float Function %15 + OpStore %normal %15 + %19 = OpAccessChain %_ptr_Function_float %normal %index + %23 = OpVectorExtractDynamic %float %rd %index + %21 = OpExtInst %float %22 FSign %23 + %20 = OpFNegate %float %21 + OpStore %19 %20 + %25 = OpLoad %v3float %normal + %24 = OpExtInst %v3float %22 Normalize %25 + OpReturnValue %24 OpFunctionEnd - %main_inner = OpFunction %void None %25 + %main_inner = OpFunction %void None %26 %idx = OpFunctionParameter %uint - %29 = OpLabel - %33 = OpAccessChain %_ptr_StorageBuffer_uint %io %uint_1 - %34 = OpLoad %uint %33 - %37 = OpAccessChain %_ptr_StorageBuffer_v3float %io %uint_0 - %38 = OpLoad %v3float %37 - %30 = OpFunctionCall %v3float %Bad %34 %38 - %39 = OpAccessChain %_ptr_StorageBuffer_v3float %io %uint_0 - OpStore %39 %30 + %30 = OpLabel + %35 = OpAccessChain %_ptr_StorageBuffer_uint %io %uint_0 %uint_1 + %36 = OpLoad %uint %35 + %38 = OpAccessChain %_ptr_StorageBuffer_v3float %io %uint_0 %uint_0 + %39 = OpLoad %v3float %38 + %31 = OpFunctionCall %v3float %Bad %36 %39 + %40 = OpAccessChain %_ptr_StorageBuffer_v3float %io %uint_0 %uint_0 + OpStore %40 %31 OpReturn OpFunctionEnd - %main = OpFunction %void None %40 - %42 = OpLabel - %44 = OpLoad %uint %idx_1 - %43 = OpFunctionCall %void %main_inner %44 + %main = OpFunction %void None %41 + %43 = OpLabel + %45 = OpLoad %uint %idx_1 + %44 = OpFunctionCall %void %main_inner %45 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/993.wgsl.expected.glsl b/test/tint/bug/tint/993.wgsl.expected.glsl index c3ca8de754..3c64f4e965 100644 --- a/test/tint/bug/tint/993.wgsl.expected.glsl +++ b/test/tint/bug/tint/993.wgsl.expected.glsl @@ -1,28 +1,40 @@ #version 310 es -layout(binding = 0, std140) uniform Constants_ubo { +struct Constants { uint zero; uint pad; uint pad_1; uint pad_2; +}; + +layout(binding = 0, std140) uniform constants_block_ubo { + Constants inner; } constants; -layout(binding = 1, std430) buffer Result_ssbo { +struct Result { uint value; +}; + +layout(binding = 1, std430) buffer result_block_ssbo { + Result inner; } result; -layout(binding = 0, std430) buffer TestData_ssbo { +struct TestData { int data[3]; +}; + +layout(binding = 0, std430) buffer s_block_ssbo { + TestData inner; } s; int runTest() { - return atomicOr(s.data[(0u + uint(constants.zero))], 0); + return atomicOr(s.inner.data[(0u + uint(constants.inner.zero))], 0); } void tint_symbol() { int tint_symbol_1 = runTest(); uint tint_symbol_2 = uint(tint_symbol_1); - result.value = tint_symbol_2; + result.inner.value = tint_symbol_2; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/tint/993.wgsl.expected.spvasm b/test/tint/bug/tint/993.wgsl.expected.spvasm index 9abd51a6db..9c131290cb 100644 --- a/test/tint/bug/tint/993.wgsl.expected.spvasm +++ b/test/tint/bug/tint/993.wgsl.expected.spvasm @@ -1,73 +1,85 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 37 +; Bound: 40 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %constants_block "constants_block" + OpMemberName %constants_block 0 "inner" OpName %Constants "Constants" OpMemberName %Constants 0 "zero" OpName %constants "constants" + OpName %result_block "result_block" + OpMemberName %result_block 0 "inner" OpName %Result "Result" OpMemberName %Result 0 "value" OpName %result "result" + OpName %s_block "s_block" + OpMemberName %s_block 0 "inner" OpName %TestData "TestData" OpMemberName %TestData 0 "data" OpName %s "s" OpName %runTest "runTest" OpName %main "main" - OpDecorate %Constants Block + OpDecorate %constants_block Block + OpMemberDecorate %constants_block 0 Offset 0 OpMemberDecorate %Constants 0 Offset 0 OpDecorate %constants NonWritable OpDecorate %constants DescriptorSet 1 OpDecorate %constants Binding 0 - OpDecorate %Result Block + OpDecorate %result_block Block + OpMemberDecorate %result_block 0 Offset 0 OpMemberDecorate %Result 0 Offset 0 OpDecorate %result DescriptorSet 1 OpDecorate %result Binding 1 - OpDecorate %TestData Block + OpDecorate %s_block Block + OpMemberDecorate %s_block 0 Offset 0 OpMemberDecorate %TestData 0 Offset 0 OpDecorate %_arr_int_uint_3 ArrayStride 4 OpDecorate %s DescriptorSet 0 OpDecorate %s Binding 0 %uint = OpTypeInt 32 0 %Constants = OpTypeStruct %uint -%_ptr_Uniform_Constants = OpTypePointer Uniform %Constants - %constants = OpVariable %_ptr_Uniform_Constants Uniform +%constants_block = OpTypeStruct %Constants +%_ptr_Uniform_constants_block = OpTypePointer Uniform %constants_block + %constants = OpVariable %_ptr_Uniform_constants_block Uniform %Result = OpTypeStruct %uint -%_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result - %result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer +%result_block = OpTypeStruct %Result +%_ptr_StorageBuffer_result_block = OpTypePointer StorageBuffer %result_block + %result = OpVariable %_ptr_StorageBuffer_result_block StorageBuffer %int = OpTypeInt 32 1 %uint_3 = OpConstant %uint 3 %_arr_int_uint_3 = OpTypeArray %int %uint_3 %TestData = OpTypeStruct %_arr_int_uint_3 -%_ptr_StorageBuffer_TestData = OpTypePointer StorageBuffer %TestData - %s = OpVariable %_ptr_StorageBuffer_TestData StorageBuffer - %14 = OpTypeFunction %int + %s_block = OpTypeStruct %TestData +%_ptr_StorageBuffer_s_block = OpTypePointer StorageBuffer %s_block + %s = OpVariable %_ptr_StorageBuffer_s_block StorageBuffer + %17 = OpTypeFunction %int %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 - %21 = OpConstantNull %uint + %24 = OpConstantNull %uint %_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %void = OpTypeVoid - %29 = OpTypeFunction %void + %32 = OpTypeFunction %void %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint - %runTest = OpFunction %int None %14 - %16 = OpLabel - %24 = OpAccessChain %_ptr_Uniform_uint %constants %uint_0 - %25 = OpLoad %uint %24 - %26 = OpIAdd %uint %21 %25 - %28 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %26 - %17 = OpAtomicLoad %int %28 %uint_1 %uint_0 - OpReturnValue %17 + %runTest = OpFunction %int None %17 + %19 = OpLabel + %27 = OpAccessChain %_ptr_Uniform_uint %constants %uint_0 %uint_0 + %28 = OpLoad %uint %27 + %29 = OpIAdd %uint %24 %28 + %31 = OpAccessChain %_ptr_StorageBuffer_int %s %uint_0 %uint_0 %29 + %20 = OpAtomicLoad %int %31 %uint_1 %uint_0 + OpReturnValue %20 OpFunctionEnd - %main = OpFunction %void None %29 - %32 = OpLabel - %33 = OpFunctionCall %int %runTest - %34 = OpBitcast %uint %33 - %36 = OpAccessChain %_ptr_StorageBuffer_uint %result %uint_0 - OpStore %36 %34 + %main = OpFunction %void None %32 + %35 = OpLabel + %36 = OpFunctionCall %int %runTest + %37 = OpBitcast %uint %36 + %39 = OpAccessChain %_ptr_StorageBuffer_uint %result %uint_0 %uint_0 + OpStore %39 %37 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/998.wgsl.expected.glsl b/test/tint/bug/tint/998.wgsl.expected.glsl index 2aa26427c5..9601c729aa 100644 --- a/test/tint/bug/tint/998.wgsl.expected.glsl +++ b/test/tint/bug/tint/998.wgsl.expected.glsl @@ -1,10 +1,14 @@ #version 310 es -layout(binding = 0, std140) uniform Constants_ubo { +struct Constants { uint zero; uint pad; uint pad_1; uint pad_2; +}; + +layout(binding = 0, std140) uniform constants_block_ubo { + Constants inner; } constants; struct Result { @@ -17,7 +21,7 @@ struct S { S s = S(uint[3](0u, 0u, 0u)); void tint_symbol() { - s.data[constants.zero] = 0u; + s.data[constants.inner.zero] = 0u; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/tint/998.wgsl.expected.spvasm b/test/tint/bug/tint/998.wgsl.expected.spvasm index 82231fbc02..7c58398a34 100644 --- a/test/tint/bug/tint/998.wgsl.expected.spvasm +++ b/test/tint/bug/tint/998.wgsl.expected.spvasm @@ -1,15 +1,19 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 25 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %constants_block "constants_block" + OpMemberName %constants_block 0 "inner" OpName %Constants "Constants" OpMemberName %Constants 0 "zero" OpName %constants "constants" + OpName %result_block "result_block" + OpMemberName %result_block 0 "inner" OpName %Result "Result" OpMemberName %Result 0 "value" OpName %result "result" @@ -17,12 +21,14 @@ OpMemberName %S 0 "data" OpName %s "s" OpName %main "main" - OpDecorate %Constants Block + OpDecorate %constants_block Block + OpMemberDecorate %constants_block 0 Offset 0 OpMemberDecorate %Constants 0 Offset 0 OpDecorate %constants NonWritable OpDecorate %constants DescriptorSet 1 OpDecorate %constants Binding 0 - OpDecorate %Result Block + OpDecorate %result_block Block + OpMemberDecorate %result_block 0 Offset 0 OpMemberDecorate %Result 0 Offset 0 OpDecorate %result DescriptorSet 1 OpDecorate %result Binding 1 @@ -30,28 +36,30 @@ OpDecorate %_arr_uint_uint_3 ArrayStride 4 %uint = OpTypeInt 32 0 %Constants = OpTypeStruct %uint -%_ptr_Uniform_Constants = OpTypePointer Uniform %Constants - %constants = OpVariable %_ptr_Uniform_Constants Uniform +%constants_block = OpTypeStruct %Constants +%_ptr_Uniform_constants_block = OpTypePointer Uniform %constants_block + %constants = OpVariable %_ptr_Uniform_constants_block Uniform %Result = OpTypeStruct %uint -%_ptr_StorageBuffer_Result = OpTypePointer StorageBuffer %Result - %result = OpVariable %_ptr_StorageBuffer_Result StorageBuffer +%result_block = OpTypeStruct %Result +%_ptr_StorageBuffer_result_block = OpTypePointer StorageBuffer %result_block + %result = OpVariable %_ptr_StorageBuffer_result_block StorageBuffer %uint_3 = OpConstant %uint 3 %_arr_uint_uint_3 = OpTypeArray %uint %uint_3 %S = OpTypeStruct %_arr_uint_uint_3 %_ptr_Private_S = OpTypePointer Private %S - %13 = OpConstantNull %S - %s = OpVariable %_ptr_Private_S Private %13 + %15 = OpConstantNull %S + %s = OpVariable %_ptr_Private_S Private %15 %void = OpTypeVoid - %14 = OpTypeFunction %void + %16 = OpTypeFunction %void %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Private_uint = OpTypePointer Private %uint - %24 = OpConstantNull %uint - %main = OpFunction %void None %14 - %17 = OpLabel - %20 = OpAccessChain %_ptr_Uniform_uint %constants %uint_0 - %21 = OpLoad %uint %20 - %23 = OpAccessChain %_ptr_Private_uint %s %uint_0 %21 - OpStore %23 %24 + %26 = OpConstantNull %uint + %main = OpFunction %void None %16 + %19 = OpLabel + %22 = OpAccessChain %_ptr_Uniform_uint %constants %uint_0 %uint_0 + %23 = OpLoad %uint %22 + %25 = OpAccessChain %_ptr_Private_uint %s %uint_0 %23 + OpStore %25 %26 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_i32.spvasm.expected.glsl index ca2a7f9e69..970460ad69 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_i32.spvasm.expected.glsl @@ -1,17 +1,21 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAdd_d32fe4() { int res = 0; - int x_9 = atomicAdd(sb_rw.arg_0, 1); + int x_9 = atomicAdd(sb_rw.inner.arg_0, 1); res = x_9; return; } @@ -31,17 +35,21 @@ void main() { } #version 310 es +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAdd_d32fe4() { int res = 0; - int x_9 = atomicAdd(sb_rw.arg_0, 1); + int x_9 = atomicAdd(sb_rw.inner.arg_0, 1); res = x_9; return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_i32.spvasm.expected.spvasm index 13f287aef1..f665c68a61 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_i32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 32 +; Bound: 33 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -18,49 +20,51 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW_atomic = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %int + %6 = OpTypeFunction %void + %10 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_1 = OpConstant %int 1 -%atomicAdd_d32fe4 = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_int Function %9 - OpStore %res %9 - %18 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %12 = OpAtomicIAdd %int %18 %uint_1 %uint_0 %int_1 - OpStore %res %12 +%atomicAdd_d32fe4 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_int Function %10 + OpStore %res %10 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %13 = OpAtomicIAdd %int %19 %uint_1 %uint_0 %int_1 + OpStore %res %13 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicAdd_d32fe4 +%fragment_main_1 = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicAdd_d32fe4 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %27 = OpLabel - %28 = OpFunctionCall %void %atomicAdd_d32fe4 +%compute_main_1 = OpFunction %void None %6 + %28 = OpLabel + %29 = OpFunctionCall %void %atomicAdd_d32fe4 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %30 = OpLabel - %31 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %31 = OpLabel + %32 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_u32.spvasm.expected.glsl index 7ffe8487a6..c2fa55a02a 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_u32.spvasm.expected.glsl @@ -1,17 +1,21 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAdd_8a199a() { uint res = 0u; - uint x_9 = atomicAdd(sb_rw.arg_0, 1u); + uint x_9 = atomicAdd(sb_rw.inner.arg_0, 1u); res = x_9; return; } @@ -31,17 +35,21 @@ void main() { } #version 310 es +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAdd_8a199a() { uint res = 0u; - uint x_9 = atomicAdd(sb_rw.arg_0, 1u); + uint x_9 = atomicAdd(sb_rw.inner.arg_0, 1u); res = x_9; return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_u32.spvasm.expected.spvasm index e1bf1e996e..b8b0561f74 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_u32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAdd/storage_u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 30 +; Bound: 31 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -18,47 +20,49 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW_atomic = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %uint + %6 = OpTypeFunction %void + %10 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicAdd_8a199a = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %9 - OpStore %res %9 - %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %12 = OpAtomicIAdd %uint %17 %uint_1 %uint_0 %uint_1 - OpStore %res %12 +%atomicAdd_8a199a = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %10 + OpStore %res %10 + %18 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %13 = OpAtomicIAdd %uint %18 %uint_1 %uint_0 %uint_1 + OpStore %res %13 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %19 = OpLabel - %20 = OpFunctionCall %void %atomicAdd_8a199a +%fragment_main_1 = OpFunction %void None %6 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicAdd_8a199a OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %22 = OpLabel - %23 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %23 = OpLabel + %24 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %25 = OpLabel - %26 = OpFunctionCall %void %atomicAdd_8a199a +%compute_main_1 = OpFunction %void None %6 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicAdd_8a199a OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %28 = OpLabel - %29 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %29 = OpLabel + %30 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_i32.spvasm.expected.glsl index 20ff9c8e68..45b311186c 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_i32.spvasm.expected.glsl @@ -1,17 +1,21 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAnd_152966() { int res = 0; - int x_9 = atomicAnd(sb_rw.arg_0, 1); + int x_9 = atomicAnd(sb_rw.inner.arg_0, 1); res = x_9; return; } @@ -31,17 +35,21 @@ void main() { } #version 310 es +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAnd_152966() { int res = 0; - int x_9 = atomicAnd(sb_rw.arg_0, 1); + int x_9 = atomicAnd(sb_rw.inner.arg_0, 1); res = x_9; return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_i32.spvasm.expected.spvasm index 0c6eb12ea0..7eaee5ff7b 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_i32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 32 +; Bound: 33 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -18,49 +20,51 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW_atomic = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %int + %6 = OpTypeFunction %void + %10 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_1 = OpConstant %int 1 -%atomicAnd_152966 = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_int Function %9 - OpStore %res %9 - %18 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %12 = OpAtomicAnd %int %18 %uint_1 %uint_0 %int_1 - OpStore %res %12 +%atomicAnd_152966 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_int Function %10 + OpStore %res %10 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %13 = OpAtomicAnd %int %19 %uint_1 %uint_0 %int_1 + OpStore %res %13 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicAnd_152966 +%fragment_main_1 = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicAnd_152966 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %27 = OpLabel - %28 = OpFunctionCall %void %atomicAnd_152966 +%compute_main_1 = OpFunction %void None %6 + %28 = OpLabel + %29 = OpFunctionCall %void %atomicAnd_152966 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %30 = OpLabel - %31 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %31 = OpLabel + %32 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_u32.spvasm.expected.glsl index 362308c8bb..38d40724c5 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_u32.spvasm.expected.glsl @@ -1,17 +1,21 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAnd_85a8d9() { uint res = 0u; - uint x_9 = atomicAnd(sb_rw.arg_0, 1u); + uint x_9 = atomicAnd(sb_rw.inner.arg_0, 1u); res = x_9; return; } @@ -31,17 +35,21 @@ void main() { } #version 310 es +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAnd_85a8d9() { uint res = 0u; - uint x_9 = atomicAnd(sb_rw.arg_0, 1u); + uint x_9 = atomicAnd(sb_rw.inner.arg_0, 1u); res = x_9; return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_u32.spvasm.expected.spvasm index 25da8d5d1c..97f289752f 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_u32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/literal/atomicAnd/storage_u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 30 +; Bound: 31 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -18,47 +20,49 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW_atomic = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %uint + %6 = OpTypeFunction %void + %10 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicAnd_85a8d9 = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %9 - OpStore %res %9 - %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %12 = OpAtomicAnd %uint %17 %uint_1 %uint_0 %uint_1 - OpStore %res %12 +%atomicAnd_85a8d9 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %10 + OpStore %res %10 + %18 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %13 = OpAtomicAnd %uint %18 %uint_1 %uint_0 %uint_1 + OpStore %res %13 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %19 = OpLabel - %20 = OpFunctionCall %void %atomicAnd_85a8d9 +%fragment_main_1 = OpFunction %void None %6 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicAnd_85a8d9 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %22 = OpLabel - %23 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %23 = OpLabel + %24 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %25 = OpLabel - %26 = OpFunctionCall %void %atomicAnd_85a8d9 +%compute_main_1 = OpFunction %void None %6 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicAnd_85a8d9 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %28 = OpLabel - %29 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %29 = OpLabel + %30 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.glsl index f26f67a30f..12dea1358e 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.glsl @@ -7,6 +7,10 @@ struct atomic_compare_exchange_resulti32 { }; +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; @@ -16,14 +20,14 @@ struct x__atomic_compare_exchange_resulti32 { bool exchanged; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicCompareExchangeWeak_1bd40a() { x__atomic_compare_exchange_resulti32 res = x__atomic_compare_exchange_resulti32(0, false); atomic_compare_exchange_resulti32 atomic_compare_result; - atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, 1, 1); + atomic_compare_result.old_value = atomicCompSwap(sb_rw.inner.arg_0, 1, 1); atomic_compare_result.exchanged = atomic_compare_result.old_value == 1; atomic_compare_exchange_resulti32 tint_symbol = atomic_compare_result; int old_value_1 = tint_symbol.old_value; @@ -54,6 +58,10 @@ struct atomic_compare_exchange_resulti32 { }; +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; @@ -63,14 +71,14 @@ struct x__atomic_compare_exchange_resulti32 { bool exchanged; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicCompareExchangeWeak_1bd40a() { x__atomic_compare_exchange_resulti32 res = x__atomic_compare_exchange_resulti32(0, false); atomic_compare_exchange_resulti32 atomic_compare_result; - atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, 1, 1); + atomic_compare_result.old_value = atomicCompSwap(sb_rw.inner.arg_0, 1, 1); atomic_compare_result.exchanged = atomic_compare_result.old_value == 1; atomic_compare_exchange_resulti32 tint_symbol = atomic_compare_result; int old_value_1 = tint_symbol.old_value; diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.spvasm index f32384324b..6b85b45492 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 40 +; Bound: 41 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -24,7 +26,8 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 @@ -34,13 +37,14 @@ OpMemberDecorate %__atomic_compare_exchange_resulti32 1 Offset 4 %int = OpTypeInt 32 1 %SB_RW_atomic = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %bool = OpTypeBool %x__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool - %11 = OpConstantNull %x__atomic_compare_exchange_resulti32 + %12 = OpConstantNull %x__atomic_compare_exchange_resulti32 %_ptr_Function_x__atomic_compare_exchange_resulti32 = OpTypePointer Function %x__atomic_compare_exchange_resulti32 %__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool %uint = OpTypeInt 32 0 @@ -48,37 +52,37 @@ %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_1 = OpConstant %int 1 -%atomicCompareExchangeWeak_1bd40a = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_x__atomic_compare_exchange_resulti32 Function %11 - OpStore %res %11 - %21 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %23 = OpAtomicCompareExchange %int %21 %uint_1 %uint_0 %uint_0 %int_1 %int_1 - %24 = OpIEqual %bool %23 %int_1 - %14 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %23 %24 - %25 = OpCompositeExtract %int %14 0 - %26 = OpIEqual %bool %25 %int_1 - %27 = OpCompositeConstruct %x__atomic_compare_exchange_resulti32 %25 %26 - OpStore %res %27 +%atomicCompareExchangeWeak_1bd40a = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_x__atomic_compare_exchange_resulti32 Function %12 + OpStore %res %12 + %22 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %24 = OpAtomicCompareExchange %int %22 %uint_1 %uint_0 %uint_0 %int_1 %int_1 + %25 = OpIEqual %bool %24 %int_1 + %15 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %24 %25 + %26 = OpCompositeExtract %int %15 0 + %27 = OpIEqual %bool %26 %int_1 + %28 = OpCompositeConstruct %x__atomic_compare_exchange_resulti32 %26 %27 + OpStore %res %28 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %29 = OpLabel - %30 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a +%fragment_main_1 = OpFunction %void None %6 + %30 = OpLabel + %31 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %32 = OpLabel - %33 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %33 = OpLabel + %34 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %35 = OpLabel - %36 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a +%compute_main_1 = OpFunction %void None %6 + %36 = OpLabel + %37 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %38 = OpLabel - %39 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %39 = OpLabel + %40 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.glsl index 79a81acf97..aeca748406 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.glsl @@ -7,6 +7,10 @@ struct atomic_compare_exchange_resultu32 { }; +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; @@ -16,14 +20,14 @@ struct x__atomic_compare_exchange_resultu32 { bool exchanged; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicCompareExchangeWeak_63d8e6() { x__atomic_compare_exchange_resultu32 res = x__atomic_compare_exchange_resultu32(0u, false); atomic_compare_exchange_resultu32 atomic_compare_result; - atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, 1u, 1u); + atomic_compare_result.old_value = atomicCompSwap(sb_rw.inner.arg_0, 1u, 1u); atomic_compare_result.exchanged = atomic_compare_result.old_value == 1u; atomic_compare_exchange_resultu32 tint_symbol = atomic_compare_result; uint old_value_1 = tint_symbol.old_value; @@ -54,6 +58,10 @@ struct atomic_compare_exchange_resultu32 { }; +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; @@ -63,14 +71,14 @@ struct x__atomic_compare_exchange_resultu32 { bool exchanged; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicCompareExchangeWeak_63d8e6() { x__atomic_compare_exchange_resultu32 res = x__atomic_compare_exchange_resultu32(0u, false); atomic_compare_exchange_resultu32 atomic_compare_result; - atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, 1u, 1u); + atomic_compare_result.old_value = atomicCompSwap(sb_rw.inner.arg_0, 1u, 1u); atomic_compare_result.exchanged = atomic_compare_result.old_value == 1u; atomic_compare_exchange_resultu32 tint_symbol = atomic_compare_result; uint old_value_1 = tint_symbol.old_value; diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.spvasm index 2070e93cf2..b133b0adc1 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 38 +; Bound: 39 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -24,7 +26,8 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 @@ -34,49 +37,50 @@ OpMemberDecorate %__atomic_compare_exchange_resultu32 1 Offset 4 %uint = OpTypeInt 32 0 %SB_RW_atomic = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %bool = OpTypeBool %x__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool - %11 = OpConstantNull %x__atomic_compare_exchange_resultu32 + %12 = OpConstantNull %x__atomic_compare_exchange_resultu32 %_ptr_Function_x__atomic_compare_exchange_resultu32 = OpTypePointer Function %x__atomic_compare_exchange_resultu32 %__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicCompareExchangeWeak_63d8e6 = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_x__atomic_compare_exchange_resultu32 Function %11 - OpStore %res %11 - %20 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %21 = OpAtomicCompareExchange %uint %20 %uint_1 %uint_0 %uint_0 %uint_1 %uint_1 - %22 = OpIEqual %bool %21 %uint_1 - %14 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %21 %22 - %23 = OpCompositeExtract %uint %14 0 - %24 = OpIEqual %bool %23 %uint_1 - %25 = OpCompositeConstruct %x__atomic_compare_exchange_resultu32 %23 %24 - OpStore %res %25 +%atomicCompareExchangeWeak_63d8e6 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_x__atomic_compare_exchange_resultu32 Function %12 + OpStore %res %12 + %21 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %22 = OpAtomicCompareExchange %uint %21 %uint_1 %uint_0 %uint_0 %uint_1 %uint_1 + %23 = OpIEqual %bool %22 %uint_1 + %15 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %22 %23 + %24 = OpCompositeExtract %uint %15 0 + %25 = OpIEqual %bool %24 %uint_1 + %26 = OpCompositeConstruct %x__atomic_compare_exchange_resultu32 %24 %25 + OpStore %res %26 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %27 = OpLabel - %28 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 +%fragment_main_1 = OpFunction %void None %6 + %28 = OpLabel + %29 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %30 = OpLabel - %31 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %31 = OpLabel + %32 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %33 = OpLabel - %34 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 +%compute_main_1 = OpFunction %void None %6 + %34 = OpLabel + %35 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %36 = OpLabel - %37 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %37 = OpLabel + %38 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_i32.spvasm.expected.glsl index cb759e766a..6bc2032fc7 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_i32.spvasm.expected.glsl @@ -1,17 +1,21 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicExchange_f2e22f() { int res = 0; - int x_9 = atomicExchange(sb_rw.arg_0, 1); + int x_9 = atomicExchange(sb_rw.inner.arg_0, 1); res = x_9; return; } @@ -31,17 +35,21 @@ void main() { } #version 310 es +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicExchange_f2e22f() { int res = 0; - int x_9 = atomicExchange(sb_rw.arg_0, 1); + int x_9 = atomicExchange(sb_rw.inner.arg_0, 1); res = x_9; return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_i32.spvasm.expected.spvasm index 10fd286e8a..c49d732284 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_i32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 32 +; Bound: 33 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -18,49 +20,51 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW_atomic = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %int + %6 = OpTypeFunction %void + %10 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_1 = OpConstant %int 1 -%atomicExchange_f2e22f = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_int Function %9 - OpStore %res %9 - %18 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %12 = OpAtomicExchange %int %18 %uint_1 %uint_0 %int_1 - OpStore %res %12 +%atomicExchange_f2e22f = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_int Function %10 + OpStore %res %10 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %13 = OpAtomicExchange %int %19 %uint_1 %uint_0 %int_1 + OpStore %res %13 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicExchange_f2e22f +%fragment_main_1 = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicExchange_f2e22f OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %27 = OpLabel - %28 = OpFunctionCall %void %atomicExchange_f2e22f +%compute_main_1 = OpFunction %void None %6 + %28 = OpLabel + %29 = OpFunctionCall %void %atomicExchange_f2e22f OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %30 = OpLabel - %31 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %31 = OpLabel + %32 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_u32.spvasm.expected.glsl index ae7c7a45c8..99f3404e05 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_u32.spvasm.expected.glsl @@ -1,17 +1,21 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicExchange_d59712() { uint res = 0u; - uint x_9 = atomicExchange(sb_rw.arg_0, 1u); + uint x_9 = atomicExchange(sb_rw.inner.arg_0, 1u); res = x_9; return; } @@ -31,17 +35,21 @@ void main() { } #version 310 es +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicExchange_d59712() { uint res = 0u; - uint x_9 = atomicExchange(sb_rw.arg_0, 1u); + uint x_9 = atomicExchange(sb_rw.inner.arg_0, 1u); res = x_9; return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_u32.spvasm.expected.spvasm index d282cbfdfd..229d1845d4 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_u32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/literal/atomicExchange/storage_u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 30 +; Bound: 31 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -18,47 +20,49 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW_atomic = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %uint + %6 = OpTypeFunction %void + %10 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicExchange_d59712 = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %9 - OpStore %res %9 - %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %12 = OpAtomicExchange %uint %17 %uint_1 %uint_0 %uint_1 - OpStore %res %12 +%atomicExchange_d59712 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %10 + OpStore %res %10 + %18 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %13 = OpAtomicExchange %uint %18 %uint_1 %uint_0 %uint_1 + OpStore %res %13 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %19 = OpLabel - %20 = OpFunctionCall %void %atomicExchange_d59712 +%fragment_main_1 = OpFunction %void None %6 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicExchange_d59712 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %22 = OpLabel - %23 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %23 = OpLabel + %24 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %25 = OpLabel - %26 = OpFunctionCall %void %atomicExchange_d59712 +%compute_main_1 = OpFunction %void None %6 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicExchange_d59712 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %28 = OpLabel - %29 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %29 = OpLabel + %30 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_i32.spvasm.expected.glsl index c5f15b176e..a15c00f2f9 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_i32.spvasm.expected.glsl @@ -1,17 +1,21 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicLoad_0806ad() { int res = 0; - int x_9 = atomicOr(sb_rw.arg_0, 0); + int x_9 = atomicOr(sb_rw.inner.arg_0, 0); res = x_9; return; } @@ -31,17 +35,21 @@ void main() { } #version 310 es +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicLoad_0806ad() { int res = 0; - int x_9 = atomicOr(sb_rw.arg_0, 0); + int x_9 = atomicOr(sb_rw.inner.arg_0, 0); res = x_9; return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_i32.spvasm.expected.spvasm index 40034c7744..097c22211c 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_i32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 31 +; Bound: 32 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -18,48 +20,50 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW_atomic = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %int + %6 = OpTypeFunction %void + %10 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int -%atomicLoad_0806ad = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_int Function %9 - OpStore %res %9 - %18 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %12 = OpAtomicLoad %int %18 %uint_1 %uint_0 - OpStore %res %12 +%atomicLoad_0806ad = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_int Function %10 + OpStore %res %10 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %13 = OpAtomicLoad %int %19 %uint_1 %uint_0 + OpStore %res %13 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %20 = OpLabel - %21 = OpFunctionCall %void %atomicLoad_0806ad +%fragment_main_1 = OpFunction %void None %6 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicLoad_0806ad OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %23 = OpLabel - %24 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %24 = OpLabel + %25 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %26 = OpLabel - %27 = OpFunctionCall %void %atomicLoad_0806ad +%compute_main_1 = OpFunction %void None %6 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicLoad_0806ad OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %29 = OpLabel - %30 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %31 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_u32.spvasm.expected.glsl index 8bddccedeb..d9a37ea520 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_u32.spvasm.expected.glsl @@ -1,17 +1,21 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicLoad_fe6cc3() { uint res = 0u; - uint x_9 = atomicOr(sb_rw.arg_0, 0u); + uint x_9 = atomicOr(sb_rw.inner.arg_0, 0u); res = x_9; return; } @@ -31,17 +35,21 @@ void main() { } #version 310 es +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicLoad_fe6cc3() { uint res = 0u; - uint x_9 = atomicOr(sb_rw.arg_0, 0u); + uint x_9 = atomicOr(sb_rw.inner.arg_0, 0u); res = x_9; return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_u32.spvasm.expected.spvasm index e12b47bae3..e4fa90f9fc 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_u32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/literal/atomicLoad/storage_u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 30 +; Bound: 31 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -18,47 +20,49 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW_atomic = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %uint + %6 = OpTypeFunction %void + %10 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicLoad_fe6cc3 = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %9 - OpStore %res %9 - %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %12 = OpAtomicLoad %uint %17 %uint_1 %uint_0 - OpStore %res %12 +%atomicLoad_fe6cc3 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %10 + OpStore %res %10 + %18 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %13 = OpAtomicLoad %uint %18 %uint_1 %uint_0 + OpStore %res %13 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %19 = OpLabel - %20 = OpFunctionCall %void %atomicLoad_fe6cc3 +%fragment_main_1 = OpFunction %void None %6 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicLoad_fe6cc3 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %22 = OpLabel - %23 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %23 = OpLabel + %24 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %25 = OpLabel - %26 = OpFunctionCall %void %atomicLoad_fe6cc3 +%compute_main_1 = OpFunction %void None %6 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicLoad_fe6cc3 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %28 = OpLabel - %29 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %29 = OpLabel + %30 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_i32.spvasm.expected.glsl index 388ccf7a97..d4c8a81892 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_i32.spvasm.expected.glsl @@ -1,17 +1,21 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicMax_92aa72() { int res = 0; - int x_9 = atomicMax(sb_rw.arg_0, 1); + int x_9 = atomicMax(sb_rw.inner.arg_0, 1); res = x_9; return; } @@ -31,17 +35,21 @@ void main() { } #version 310 es +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicMax_92aa72() { int res = 0; - int x_9 = atomicMax(sb_rw.arg_0, 1); + int x_9 = atomicMax(sb_rw.inner.arg_0, 1); res = x_9; return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_i32.spvasm.expected.spvasm index 34dd4c3704..d9b4dd3955 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_i32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 32 +; Bound: 33 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -18,49 +20,51 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW_atomic = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %int + %6 = OpTypeFunction %void + %10 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_1 = OpConstant %int 1 -%atomicMax_92aa72 = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_int Function %9 - OpStore %res %9 - %18 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %12 = OpAtomicSMax %int %18 %uint_1 %uint_0 %int_1 - OpStore %res %12 +%atomicMax_92aa72 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_int Function %10 + OpStore %res %10 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %13 = OpAtomicSMax %int %19 %uint_1 %uint_0 %int_1 + OpStore %res %13 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicMax_92aa72 +%fragment_main_1 = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicMax_92aa72 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %27 = OpLabel - %28 = OpFunctionCall %void %atomicMax_92aa72 +%compute_main_1 = OpFunction %void None %6 + %28 = OpLabel + %29 = OpFunctionCall %void %atomicMax_92aa72 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %30 = OpLabel - %31 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %31 = OpLabel + %32 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_u32.spvasm.expected.glsl index 9cdec378f7..a9b7e0b047 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_u32.spvasm.expected.glsl @@ -1,17 +1,21 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicMax_51b9be() { uint res = 0u; - uint x_9 = atomicMax(sb_rw.arg_0, 1u); + uint x_9 = atomicMax(sb_rw.inner.arg_0, 1u); res = x_9; return; } @@ -31,17 +35,21 @@ void main() { } #version 310 es +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicMax_51b9be() { uint res = 0u; - uint x_9 = atomicMax(sb_rw.arg_0, 1u); + uint x_9 = atomicMax(sb_rw.inner.arg_0, 1u); res = x_9; return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_u32.spvasm.expected.spvasm index be00498bd0..2965521fc9 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_u32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMax/storage_u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 30 +; Bound: 31 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -18,47 +20,49 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW_atomic = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %uint + %6 = OpTypeFunction %void + %10 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicMax_51b9be = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %9 - OpStore %res %9 - %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %12 = OpAtomicUMax %uint %17 %uint_1 %uint_0 %uint_1 - OpStore %res %12 +%atomicMax_51b9be = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %10 + OpStore %res %10 + %18 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %13 = OpAtomicUMax %uint %18 %uint_1 %uint_0 %uint_1 + OpStore %res %13 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %19 = OpLabel - %20 = OpFunctionCall %void %atomicMax_51b9be +%fragment_main_1 = OpFunction %void None %6 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicMax_51b9be OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %22 = OpLabel - %23 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %23 = OpLabel + %24 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %25 = OpLabel - %26 = OpFunctionCall %void %atomicMax_51b9be +%compute_main_1 = OpFunction %void None %6 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicMax_51b9be OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %28 = OpLabel - %29 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %29 = OpLabel + %30 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_i32.spvasm.expected.glsl index 5aad3bee68..ff509745b6 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_i32.spvasm.expected.glsl @@ -1,17 +1,21 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicMin_8e38dc() { int res = 0; - int x_9 = atomicMin(sb_rw.arg_0, 1); + int x_9 = atomicMin(sb_rw.inner.arg_0, 1); res = x_9; return; } @@ -31,17 +35,21 @@ void main() { } #version 310 es +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicMin_8e38dc() { int res = 0; - int x_9 = atomicMin(sb_rw.arg_0, 1); + int x_9 = atomicMin(sb_rw.inner.arg_0, 1); res = x_9; return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_i32.spvasm.expected.spvasm index 42e5312df3..558ed748b7 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_i32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 32 +; Bound: 33 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -18,49 +20,51 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW_atomic = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %int + %6 = OpTypeFunction %void + %10 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_1 = OpConstant %int 1 -%atomicMin_8e38dc = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_int Function %9 - OpStore %res %9 - %18 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %12 = OpAtomicSMin %int %18 %uint_1 %uint_0 %int_1 - OpStore %res %12 +%atomicMin_8e38dc = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_int Function %10 + OpStore %res %10 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %13 = OpAtomicSMin %int %19 %uint_1 %uint_0 %int_1 + OpStore %res %13 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicMin_8e38dc +%fragment_main_1 = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicMin_8e38dc OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %27 = OpLabel - %28 = OpFunctionCall %void %atomicMin_8e38dc +%compute_main_1 = OpFunction %void None %6 + %28 = OpLabel + %29 = OpFunctionCall %void %atomicMin_8e38dc OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %30 = OpLabel - %31 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %31 = OpLabel + %32 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_u32.spvasm.expected.glsl index 90d76b8596..33d3edd41b 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_u32.spvasm.expected.glsl @@ -1,17 +1,21 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicMin_c67a74() { uint res = 0u; - uint x_9 = atomicMin(sb_rw.arg_0, 1u); + uint x_9 = atomicMin(sb_rw.inner.arg_0, 1u); res = x_9; return; } @@ -31,17 +35,21 @@ void main() { } #version 310 es +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicMin_c67a74() { uint res = 0u; - uint x_9 = atomicMin(sb_rw.arg_0, 1u); + uint x_9 = atomicMin(sb_rw.inner.arg_0, 1u); res = x_9; return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_u32.spvasm.expected.spvasm index c1fc0dcbf5..ec259f01d8 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_u32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/literal/atomicMin/storage_u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 30 +; Bound: 31 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -18,47 +20,49 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW_atomic = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %uint + %6 = OpTypeFunction %void + %10 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicMin_c67a74 = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %9 - OpStore %res %9 - %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %12 = OpAtomicUMin %uint %17 %uint_1 %uint_0 %uint_1 - OpStore %res %12 +%atomicMin_c67a74 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %10 + OpStore %res %10 + %18 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %13 = OpAtomicUMin %uint %18 %uint_1 %uint_0 %uint_1 + OpStore %res %13 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %19 = OpLabel - %20 = OpFunctionCall %void %atomicMin_c67a74 +%fragment_main_1 = OpFunction %void None %6 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicMin_c67a74 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %22 = OpLabel - %23 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %23 = OpLabel + %24 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %25 = OpLabel - %26 = OpFunctionCall %void %atomicMin_c67a74 +%compute_main_1 = OpFunction %void None %6 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicMin_c67a74 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %28 = OpLabel - %29 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %29 = OpLabel + %30 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_i32.spvasm.expected.glsl index 2874145ce7..887734781c 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_i32.spvasm.expected.glsl @@ -1,17 +1,21 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicOr_8d96a0() { int res = 0; - int x_9 = atomicOr(sb_rw.arg_0, 1); + int x_9 = atomicOr(sb_rw.inner.arg_0, 1); res = x_9; return; } @@ -31,17 +35,21 @@ void main() { } #version 310 es +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicOr_8d96a0() { int res = 0; - int x_9 = atomicOr(sb_rw.arg_0, 1); + int x_9 = atomicOr(sb_rw.inner.arg_0, 1); res = x_9; return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_i32.spvasm.expected.spvasm index a971056f77..5d67a16101 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_i32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 32 +; Bound: 33 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -18,49 +20,51 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW_atomic = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %int + %6 = OpTypeFunction %void + %10 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_1 = OpConstant %int 1 -%atomicOr_8d96a0 = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_int Function %9 - OpStore %res %9 - %18 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %12 = OpAtomicOr %int %18 %uint_1 %uint_0 %int_1 - OpStore %res %12 +%atomicOr_8d96a0 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_int Function %10 + OpStore %res %10 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %13 = OpAtomicOr %int %19 %uint_1 %uint_0 %int_1 + OpStore %res %13 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicOr_8d96a0 +%fragment_main_1 = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicOr_8d96a0 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %27 = OpLabel - %28 = OpFunctionCall %void %atomicOr_8d96a0 +%compute_main_1 = OpFunction %void None %6 + %28 = OpLabel + %29 = OpFunctionCall %void %atomicOr_8d96a0 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %30 = OpLabel - %31 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %31 = OpLabel + %32 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_u32.spvasm.expected.glsl index dafd141847..c93e4d99f7 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_u32.spvasm.expected.glsl @@ -1,17 +1,21 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicOr_5e95d4() { uint res = 0u; - uint x_9 = atomicOr(sb_rw.arg_0, 1u); + uint x_9 = atomicOr(sb_rw.inner.arg_0, 1u); res = x_9; return; } @@ -31,17 +35,21 @@ void main() { } #version 310 es +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicOr_5e95d4() { uint res = 0u; - uint x_9 = atomicOr(sb_rw.arg_0, 1u); + uint x_9 = atomicOr(sb_rw.inner.arg_0, 1u); res = x_9; return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_u32.spvasm.expected.spvasm index a46ca1d0c6..f94d0620c5 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_u32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/literal/atomicOr/storage_u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 30 +; Bound: 31 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -18,47 +20,49 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW_atomic = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %uint + %6 = OpTypeFunction %void + %10 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicOr_5e95d4 = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %9 - OpStore %res %9 - %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %12 = OpAtomicOr %uint %17 %uint_1 %uint_0 %uint_1 - OpStore %res %12 +%atomicOr_5e95d4 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %10 + OpStore %res %10 + %18 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %13 = OpAtomicOr %uint %18 %uint_1 %uint_0 %uint_1 + OpStore %res %13 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %19 = OpLabel - %20 = OpFunctionCall %void %atomicOr_5e95d4 +%fragment_main_1 = OpFunction %void None %6 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicOr_5e95d4 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %22 = OpLabel - %23 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %23 = OpLabel + %24 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %25 = OpLabel - %26 = OpFunctionCall %void %atomicOr_5e95d4 +%compute_main_1 = OpFunction %void None %6 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicOr_5e95d4 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %28 = OpLabel - %29 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %29 = OpLabel + %30 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_i32.spvasm.expected.glsl index f8778d9b59..e21ea33de8 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_i32.spvasm.expected.glsl @@ -1,16 +1,20 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicStore_d1e9a6() { - atomicExchange(sb_rw.arg_0, 1); + atomicExchange(sb_rw.inner.arg_0, 1); return; } @@ -29,16 +33,20 @@ void main() { } #version 310 es +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicStore_d1e9a6() { - atomicExchange(sb_rw.arg_0, 1); + atomicExchange(sb_rw.inner.arg_0, 1); return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_i32.spvasm.expected.spvasm index cabaea35a0..357d6b7cd4 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_i32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 29 +; Bound: 30 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -17,44 +19,46 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW_atomic = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_1 = OpConstant %int 1 -%atomicStore_d1e9a6 = OpFunction %void None %5 - %8 = OpLabel - %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - OpAtomicStore %15 %uint_1 %uint_0 %int_1 +%atomicStore_d1e9a6 = OpFunction %void None %6 + %9 = OpLabel + %16 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + OpAtomicStore %16 %uint_1 %uint_0 %int_1 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %18 = OpLabel - %19 = OpFunctionCall %void %atomicStore_d1e9a6 +%fragment_main_1 = OpFunction %void None %6 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicStore_d1e9a6 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %atomicStore_d1e9a6 +%compute_main_1 = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicStore_d1e9a6 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %27 = OpLabel - %28 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %28 = OpLabel + %29 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_u32.spvasm.expected.glsl index 588fac670c..bcb300477b 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_u32.spvasm.expected.glsl @@ -1,16 +1,20 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicStore_cdc29e() { - atomicExchange(sb_rw.arg_0, 1u); + atomicExchange(sb_rw.inner.arg_0, 1u); return; } @@ -29,16 +33,20 @@ void main() { } #version 310 es +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicStore_cdc29e() { - atomicExchange(sb_rw.arg_0, 1u); + atomicExchange(sb_rw.inner.arg_0, 1u); return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_u32.spvasm.expected.spvasm index bcda0e7f9b..ae4de7b1f7 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_u32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/literal/atomicStore/storage_u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 27 +; Bound: 28 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -17,42 +19,44 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW_atomic = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicStore_cdc29e = OpFunction %void None %5 - %8 = OpLabel - %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - OpAtomicStore %14 %uint_1 %uint_0 %uint_1 +%atomicStore_cdc29e = OpFunction %void None %6 + %9 = OpLabel + %15 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + OpAtomicStore %15 %uint_1 %uint_0 %uint_1 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %16 = OpLabel - %17 = OpFunctionCall %void %atomicStore_cdc29e +%fragment_main_1 = OpFunction %void None %6 + %17 = OpLabel + %18 = OpFunctionCall %void %atomicStore_cdc29e OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %19 = OpLabel - %20 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %20 = OpLabel + %21 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %22 = OpLabel - %23 = OpFunctionCall %void %atomicStore_cdc29e +%compute_main_1 = OpFunction %void None %6 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicStore_cdc29e OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %25 = OpLabel - %26 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %26 = OpLabel + %27 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_i32.spvasm.expected.glsl index c3538ae0cd..b1da171764 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_i32.spvasm.expected.glsl @@ -1,17 +1,21 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicSub_051100() { int res = 0; - int x_9 = atomicAdd(sb_rw.arg_0, 1); + int x_9 = atomicAdd(sb_rw.inner.arg_0, 1); res = x_9; return; } @@ -31,17 +35,21 @@ void main() { } #version 310 es +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicSub_051100() { int res = 0; - int x_9 = atomicAdd(sb_rw.arg_0, 1); + int x_9 = atomicAdd(sb_rw.inner.arg_0, 1); res = x_9; return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_i32.spvasm.expected.spvasm index 9ada74b558..cbc42aa491 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_i32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 32 +; Bound: 33 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -18,49 +20,51 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW_atomic = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %int + %6 = OpTypeFunction %void + %10 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_1 = OpConstant %int 1 -%atomicSub_051100 = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_int Function %9 - OpStore %res %9 - %18 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %12 = OpAtomicISub %int %18 %uint_1 %uint_0 %int_1 - OpStore %res %12 +%atomicSub_051100 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_int Function %10 + OpStore %res %10 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %13 = OpAtomicISub %int %19 %uint_1 %uint_0 %int_1 + OpStore %res %13 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicSub_051100 +%fragment_main_1 = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicSub_051100 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %27 = OpLabel - %28 = OpFunctionCall %void %atomicSub_051100 +%compute_main_1 = OpFunction %void None %6 + %28 = OpLabel + %29 = OpFunctionCall %void %atomicSub_051100 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %30 = OpLabel - %31 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %31 = OpLabel + %32 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_u32.spvasm.expected.glsl index b2eccbc241..58aaf8d2b4 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_u32.spvasm.expected.glsl @@ -1,17 +1,21 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicSub_15bfc9() { uint res = 0u; - uint x_9 = atomicAdd(sb_rw.arg_0, 1u); + uint x_9 = atomicAdd(sb_rw.inner.arg_0, 1u); res = x_9; return; } @@ -31,17 +35,21 @@ void main() { } #version 310 es +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicSub_15bfc9() { uint res = 0u; - uint x_9 = atomicAdd(sb_rw.arg_0, 1u); + uint x_9 = atomicAdd(sb_rw.inner.arg_0, 1u); res = x_9; return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_u32.spvasm.expected.spvasm index 885f7035b1..61b924318b 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_u32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/literal/atomicSub/storage_u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 30 +; Bound: 31 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -18,47 +20,49 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW_atomic = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %uint + %6 = OpTypeFunction %void + %10 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicSub_15bfc9 = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %9 - OpStore %res %9 - %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %12 = OpAtomicISub %uint %17 %uint_1 %uint_0 %uint_1 - OpStore %res %12 +%atomicSub_15bfc9 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %10 + OpStore %res %10 + %18 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %13 = OpAtomicISub %uint %18 %uint_1 %uint_0 %uint_1 + OpStore %res %13 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %19 = OpLabel - %20 = OpFunctionCall %void %atomicSub_15bfc9 +%fragment_main_1 = OpFunction %void None %6 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicSub_15bfc9 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %22 = OpLabel - %23 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %23 = OpLabel + %24 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %25 = OpLabel - %26 = OpFunctionCall %void %atomicSub_15bfc9 +%compute_main_1 = OpFunction %void None %6 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicSub_15bfc9 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %28 = OpLabel - %29 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %29 = OpLabel + %30 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_i32.spvasm.expected.glsl index 1c83583f41..6d076ed13f 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_i32.spvasm.expected.glsl @@ -1,17 +1,21 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicXor_c1b78c() { int res = 0; - int x_9 = atomicXor(sb_rw.arg_0, 1); + int x_9 = atomicXor(sb_rw.inner.arg_0, 1); res = x_9; return; } @@ -31,17 +35,21 @@ void main() { } #version 310 es +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicXor_c1b78c() { int res = 0; - int x_9 = atomicXor(sb_rw.arg_0, 1); + int x_9 = atomicXor(sb_rw.inner.arg_0, 1); res = x_9; return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_i32.spvasm.expected.spvasm index 1302c1abc7..a89b0cc5a5 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_i32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 32 +; Bound: 33 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -18,49 +20,51 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW_atomic = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %int + %6 = OpTypeFunction %void + %10 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_1 = OpConstant %int 1 -%atomicXor_c1b78c = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_int Function %9 - OpStore %res %9 - %18 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %12 = OpAtomicXor %int %18 %uint_1 %uint_0 %int_1 - OpStore %res %12 +%atomicXor_c1b78c = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_int Function %10 + OpStore %res %10 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %13 = OpAtomicXor %int %19 %uint_1 %uint_0 %int_1 + OpStore %res %13 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicXor_c1b78c +%fragment_main_1 = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicXor_c1b78c OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %27 = OpLabel - %28 = OpFunctionCall %void %atomicXor_c1b78c +%compute_main_1 = OpFunction %void None %6 + %28 = OpLabel + %29 = OpFunctionCall %void %atomicXor_c1b78c OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %30 = OpLabel - %31 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %31 = OpLabel + %32 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_u32.spvasm.expected.glsl index 09295d7e70..71b9ebcae6 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_u32.spvasm.expected.glsl @@ -1,17 +1,21 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicXor_54510e() { uint res = 0u; - uint x_9 = atomicXor(sb_rw.arg_0, 1u); + uint x_9 = atomicXor(sb_rw.inner.arg_0, 1u); res = x_9; return; } @@ -31,17 +35,21 @@ void main() { } #version 310 es +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicXor_54510e() { uint res = 0u; - uint x_9 = atomicXor(sb_rw.arg_0, 1u); + uint x_9 = atomicXor(sb_rw.inner.arg_0, 1u); res = x_9; return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_u32.spvasm.expected.spvasm index 1fb9bcc141..ad43af1444 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_u32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/literal/atomicXor/storage_u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 30 +; Bound: 31 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -18,47 +20,49 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW_atomic = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %uint + %6 = OpTypeFunction %void + %10 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicXor_54510e = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %9 - OpStore %res %9 - %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %12 = OpAtomicXor %uint %17 %uint_1 %uint_0 %uint_1 - OpStore %res %12 +%atomicXor_54510e = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %10 + OpStore %res %10 + %18 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %13 = OpAtomicXor %uint %18 %uint_1 %uint_0 %uint_1 + OpStore %res %13 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %19 = OpLabel - %20 = OpFunctionCall %void %atomicXor_54510e +%fragment_main_1 = OpFunction %void None %6 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicXor_54510e OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %22 = OpLabel - %23 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %23 = OpLabel + %24 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %25 = OpLabel - %26 = OpFunctionCall %void %atomicXor_54510e +%compute_main_1 = OpFunction %void None %6 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicXor_54510e OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %28 = OpLabel - %29 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %29 = OpLabel + %30 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm.expected.glsl index ca2a7f9e69..970460ad69 100644 --- a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm.expected.glsl @@ -1,17 +1,21 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAdd_d32fe4() { int res = 0; - int x_9 = atomicAdd(sb_rw.arg_0, 1); + int x_9 = atomicAdd(sb_rw.inner.arg_0, 1); res = x_9; return; } @@ -31,17 +35,21 @@ void main() { } #version 310 es +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAdd_d32fe4() { int res = 0; - int x_9 = atomicAdd(sb_rw.arg_0, 1); + int x_9 = atomicAdd(sb_rw.inner.arg_0, 1); res = x_9; return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm.expected.spvasm index 97fa9d7095..1011166afc 100644 --- a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 32 +; Bound: 33 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -18,49 +20,51 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW_atomic = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %int + %6 = OpTypeFunction %void + %10 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_1 = OpConstant %int 1 -%atomicAdd_d32fe4 = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_int Function %9 - OpStore %res %9 - %18 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %12 = OpAtomicISub %int %18 %uint_1 %uint_0 %int_1 - OpStore %res %12 +%atomicAdd_d32fe4 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_int Function %10 + OpStore %res %10 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %13 = OpAtomicISub %int %19 %uint_1 %uint_0 %int_1 + OpStore %res %13 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicAdd_d32fe4 +%fragment_main_1 = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicAdd_d32fe4 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %27 = OpLabel - %28 = OpFunctionCall %void %atomicAdd_d32fe4 +%compute_main_1 = OpFunction %void None %6 + %28 = OpLabel + %29 = OpFunctionCall %void %atomicAdd_d32fe4 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %30 = OpLabel - %31 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %31 = OpLabel + %32 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm.expected.glsl index 7ffe8487a6..c2fa55a02a 100644 --- a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm.expected.glsl @@ -1,17 +1,21 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAdd_8a199a() { uint res = 0u; - uint x_9 = atomicAdd(sb_rw.arg_0, 1u); + uint x_9 = atomicAdd(sb_rw.inner.arg_0, 1u); res = x_9; return; } @@ -31,17 +35,21 @@ void main() { } #version 310 es +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAdd_8a199a() { uint res = 0u; - uint x_9 = atomicAdd(sb_rw.arg_0, 1u); + uint x_9 = atomicAdd(sb_rw.inner.arg_0, 1u); res = x_9; return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm.expected.spvasm index 4ea9dce7fc..6472924dc1 100644 --- a/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicDecrement/storage_u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 30 +; Bound: 31 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -18,47 +20,49 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW_atomic = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %uint + %6 = OpTypeFunction %void + %10 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicAdd_8a199a = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %9 - OpStore %res %9 - %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %12 = OpAtomicISub %uint %17 %uint_1 %uint_0 %uint_1 - OpStore %res %12 +%atomicAdd_8a199a = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %10 + OpStore %res %10 + %18 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %13 = OpAtomicISub %uint %18 %uint_1 %uint_0 %uint_1 + OpStore %res %13 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %19 = OpLabel - %20 = OpFunctionCall %void %atomicAdd_8a199a +%fragment_main_1 = OpFunction %void None %6 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicAdd_8a199a OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %22 = OpLabel - %23 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %23 = OpLabel + %24 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %25 = OpLabel - %26 = OpFunctionCall %void %atomicAdd_8a199a +%compute_main_1 = OpFunction %void None %6 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicAdd_8a199a OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %28 = OpLabel - %29 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %29 = OpLabel + %30 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm.expected.glsl index ca2a7f9e69..970460ad69 100644 --- a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm.expected.glsl @@ -1,17 +1,21 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAdd_d32fe4() { int res = 0; - int x_9 = atomicAdd(sb_rw.arg_0, 1); + int x_9 = atomicAdd(sb_rw.inner.arg_0, 1); res = x_9; return; } @@ -31,17 +35,21 @@ void main() { } #version 310 es +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAdd_d32fe4() { int res = 0; - int x_9 = atomicAdd(sb_rw.arg_0, 1); + int x_9 = atomicAdd(sb_rw.inner.arg_0, 1); res = x_9; return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm.expected.spvasm index 13f287aef1..f665c68a61 100644 --- a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 32 +; Bound: 33 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -18,49 +20,51 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW_atomic = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %int + %6 = OpTypeFunction %void + %10 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_1 = OpConstant %int 1 -%atomicAdd_d32fe4 = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_int Function %9 - OpStore %res %9 - %18 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %12 = OpAtomicIAdd %int %18 %uint_1 %uint_0 %int_1 - OpStore %res %12 +%atomicAdd_d32fe4 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_int Function %10 + OpStore %res %10 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %13 = OpAtomicIAdd %int %19 %uint_1 %uint_0 %int_1 + OpStore %res %13 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicAdd_d32fe4 +%fragment_main_1 = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicAdd_d32fe4 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %27 = OpLabel - %28 = OpFunctionCall %void %atomicAdd_d32fe4 +%compute_main_1 = OpFunction %void None %6 + %28 = OpLabel + %29 = OpFunctionCall %void %atomicAdd_d32fe4 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %30 = OpLabel - %31 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %31 = OpLabel + %32 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm.expected.glsl index 7ffe8487a6..c2fa55a02a 100644 --- a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm.expected.glsl @@ -1,17 +1,21 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAdd_8a199a() { uint res = 0u; - uint x_9 = atomicAdd(sb_rw.arg_0, 1u); + uint x_9 = atomicAdd(sb_rw.inner.arg_0, 1u); res = x_9; return; } @@ -31,17 +35,21 @@ void main() { } #version 310 es +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAdd_8a199a() { uint res = 0u; - uint x_9 = atomicAdd(sb_rw.arg_0, 1u); + uint x_9 = atomicAdd(sb_rw.inner.arg_0, 1u); res = x_9; return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm.expected.spvasm index e1bf1e996e..b8b0561f74 100644 --- a/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/literal/spvAtomicIncrement/storage_u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 30 +; Bound: 31 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -18,47 +20,49 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW_atomic = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %uint + %6 = OpTypeFunction %void + %10 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicAdd_8a199a = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %9 - OpStore %res %9 - %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %12 = OpAtomicIAdd %uint %17 %uint_1 %uint_0 %uint_1 - OpStore %res %12 +%atomicAdd_8a199a = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %10 + OpStore %res %10 + %18 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %13 = OpAtomicIAdd %uint %18 %uint_1 %uint_0 %uint_1 + OpStore %res %13 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %19 = OpLabel - %20 = OpFunctionCall %void %atomicAdd_8a199a +%fragment_main_1 = OpFunction %void None %6 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicAdd_8a199a OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %22 = OpLabel - %23 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %23 = OpLabel + %24 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %25 = OpLabel - %26 = OpFunctionCall %void %atomicAdd_8a199a +%compute_main_1 = OpFunction %void None %6 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicAdd_8a199a OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %28 = OpLabel - %29 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %29 = OpLabel + %30 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm.expected.glsl index 631f6f9238..3f9182f1b1 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAdd_d32fe4() { @@ -14,7 +18,7 @@ void atomicAdd_d32fe4() { int res = 0; arg_1 = 1; int x_20 = arg_1; - int x_13 = atomicAdd(sb_rw.arg_0, x_20); + int x_13 = atomicAdd(sb_rw.inner.arg_0, x_20); res = x_13; return; } @@ -34,12 +38,16 @@ void main() { } #version 310 es +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAdd_d32fe4() { @@ -47,7 +55,7 @@ void atomicAdd_d32fe4() { int res = 0; arg_1 = 1; int x_20 = arg_1; - int x_13 = atomicAdd(sb_rw.arg_0, x_20); + int x_13 = atomicAdd(sb_rw.inner.arg_0, x_20); res = x_13; return; } diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm.expected.spvasm index c38ab553f1..3e0908c012 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 34 +; Bound: 35 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -19,53 +21,55 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW_atomic = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %int + %6 = OpTypeFunction %void + %10 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %int_1 = OpConstant %int 1 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int -%atomicAdd_d32fe4 = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_int Function %9 - %res = OpVariable %_ptr_Function_int Function %9 - OpStore %arg_1 %9 - OpStore %res %9 +%atomicAdd_d32fe4 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %10 + %res = OpVariable %_ptr_Function_int Function %10 + OpStore %arg_1 %10 + OpStore %res %10 OpStore %arg_1 %int_1 - %14 = OpLoad %int %arg_1 - %21 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %15 = OpAtomicIAdd %int %21 %uint_1 %uint_0 %14 - OpStore %res %15 + %15 = OpLoad %int %arg_1 + %22 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %16 = OpAtomicIAdd %int %22 %uint_1 %uint_0 %15 + OpStore %res %16 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %23 = OpLabel - %24 = OpFunctionCall %void %atomicAdd_d32fe4 +%fragment_main_1 = OpFunction %void None %6 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicAdd_d32fe4 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %26 = OpLabel - %27 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %27 = OpLabel + %28 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %29 = OpLabel - %30 = OpFunctionCall %void %atomicAdd_d32fe4 +%compute_main_1 = OpFunction %void None %6 + %30 = OpLabel + %31 = OpFunctionCall %void %atomicAdd_d32fe4 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %32 = OpLabel - %33 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %33 = OpLabel + %34 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm.expected.glsl index eaa04437e1..5e2cf88131 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAdd_8a199a() { @@ -14,7 +18,7 @@ void atomicAdd_8a199a() { uint res = 0u; arg_1 = 1u; uint x_18 = arg_1; - uint x_13 = atomicAdd(sb_rw.arg_0, x_18); + uint x_13 = atomicAdd(sb_rw.inner.arg_0, x_18); res = x_13; return; } @@ -34,12 +38,16 @@ void main() { } #version 310 es +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAdd_8a199a() { @@ -47,7 +55,7 @@ void atomicAdd_8a199a() { uint res = 0u; arg_1 = 1u; uint x_18 = arg_1; - uint x_13 = atomicAdd(sb_rw.arg_0, x_18); + uint x_13 = atomicAdd(sb_rw.inner.arg_0, x_18); res = x_13; return; } diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm.expected.spvasm index d015d498c5..c7c43c52b5 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/var/atomicAdd/storage_u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 32 +; Bound: 33 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -19,51 +21,53 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW_atomic = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %uint + %6 = OpTypeFunction %void + %10 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicAdd_8a199a = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_uint Function %9 - %res = OpVariable %_ptr_Function_uint Function %9 - OpStore %arg_1 %9 - OpStore %res %9 +%atomicAdd_8a199a = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %10 + %res = OpVariable %_ptr_Function_uint Function %10 + OpStore %arg_1 %10 + OpStore %res %10 OpStore %arg_1 %uint_1 - %14 = OpLoad %uint %arg_1 - %19 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %15 = OpAtomicIAdd %uint %19 %uint_1 %uint_0 %14 - OpStore %res %15 + %15 = OpLoad %uint %arg_1 + %20 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %16 = OpAtomicIAdd %uint %20 %uint_1 %uint_0 %15 + OpStore %res %16 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicAdd_8a199a +%fragment_main_1 = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicAdd_8a199a OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %27 = OpLabel - %28 = OpFunctionCall %void %atomicAdd_8a199a +%compute_main_1 = OpFunction %void None %6 + %28 = OpLabel + %29 = OpFunctionCall %void %atomicAdd_8a199a OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %30 = OpLabel - %31 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %31 = OpLabel + %32 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm.expected.glsl index 732aecc99f..86e1543a5a 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAnd_152966() { @@ -14,7 +18,7 @@ void atomicAnd_152966() { int res = 0; arg_1 = 1; int x_20 = arg_1; - int x_13 = atomicAnd(sb_rw.arg_0, x_20); + int x_13 = atomicAnd(sb_rw.inner.arg_0, x_20); res = x_13; return; } @@ -34,12 +38,16 @@ void main() { } #version 310 es +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAnd_152966() { @@ -47,7 +55,7 @@ void atomicAnd_152966() { int res = 0; arg_1 = 1; int x_20 = arg_1; - int x_13 = atomicAnd(sb_rw.arg_0, x_20); + int x_13 = atomicAnd(sb_rw.inner.arg_0, x_20); res = x_13; return; } diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm.expected.spvasm index 3257d23881..71441859a4 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 34 +; Bound: 35 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -19,53 +21,55 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW_atomic = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %int + %6 = OpTypeFunction %void + %10 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %int_1 = OpConstant %int 1 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int -%atomicAnd_152966 = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_int Function %9 - %res = OpVariable %_ptr_Function_int Function %9 - OpStore %arg_1 %9 - OpStore %res %9 +%atomicAnd_152966 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %10 + %res = OpVariable %_ptr_Function_int Function %10 + OpStore %arg_1 %10 + OpStore %res %10 OpStore %arg_1 %int_1 - %14 = OpLoad %int %arg_1 - %21 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %15 = OpAtomicAnd %int %21 %uint_1 %uint_0 %14 - OpStore %res %15 + %15 = OpLoad %int %arg_1 + %22 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %16 = OpAtomicAnd %int %22 %uint_1 %uint_0 %15 + OpStore %res %16 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %23 = OpLabel - %24 = OpFunctionCall %void %atomicAnd_152966 +%fragment_main_1 = OpFunction %void None %6 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicAnd_152966 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %26 = OpLabel - %27 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %27 = OpLabel + %28 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %29 = OpLabel - %30 = OpFunctionCall %void %atomicAnd_152966 +%compute_main_1 = OpFunction %void None %6 + %30 = OpLabel + %31 = OpFunctionCall %void %atomicAnd_152966 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %32 = OpLabel - %33 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %33 = OpLabel + %34 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm.expected.glsl index 9ca31265c5..3f520640b4 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAnd_85a8d9() { @@ -14,7 +18,7 @@ void atomicAnd_85a8d9() { uint res = 0u; arg_1 = 1u; uint x_18 = arg_1; - uint x_13 = atomicAnd(sb_rw.arg_0, x_18); + uint x_13 = atomicAnd(sb_rw.inner.arg_0, x_18); res = x_13; return; } @@ -34,12 +38,16 @@ void main() { } #version 310 es +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAnd_85a8d9() { @@ -47,7 +55,7 @@ void atomicAnd_85a8d9() { uint res = 0u; arg_1 = 1u; uint x_18 = arg_1; - uint x_13 = atomicAnd(sb_rw.arg_0, x_18); + uint x_13 = atomicAnd(sb_rw.inner.arg_0, x_18); res = x_13; return; } diff --git a/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm.expected.spvasm index 668f193c41..46320b6dbe 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/var/atomicAnd/storage_u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 32 +; Bound: 33 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -19,51 +21,53 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW_atomic = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %uint + %6 = OpTypeFunction %void + %10 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicAnd_85a8d9 = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_uint Function %9 - %res = OpVariable %_ptr_Function_uint Function %9 - OpStore %arg_1 %9 - OpStore %res %9 +%atomicAnd_85a8d9 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %10 + %res = OpVariable %_ptr_Function_uint Function %10 + OpStore %arg_1 %10 + OpStore %res %10 OpStore %arg_1 %uint_1 - %14 = OpLoad %uint %arg_1 - %19 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %15 = OpAtomicAnd %uint %19 %uint_1 %uint_0 %14 - OpStore %res %15 + %15 = OpLoad %uint %arg_1 + %20 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %16 = OpAtomicAnd %uint %20 %uint_1 %uint_0 %15 + OpStore %res %16 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicAnd_85a8d9 +%fragment_main_1 = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicAnd_85a8d9 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %27 = OpLabel - %28 = OpFunctionCall %void %atomicAnd_85a8d9 +%compute_main_1 = OpFunction %void None %6 + %28 = OpLabel + %29 = OpFunctionCall %void %atomicAnd_85a8d9 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %30 = OpLabel - %31 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %31 = OpLabel + %32 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.glsl index 9a5806f924..cfc3554e20 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.glsl @@ -7,6 +7,10 @@ struct atomic_compare_exchange_resulti32 { }; +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; @@ -16,8 +20,8 @@ struct x__atomic_compare_exchange_resulti32 { bool exchanged; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicCompareExchangeWeak_1bd40a() { @@ -29,7 +33,7 @@ void atomicCompareExchangeWeak_1bd40a() { int x_23 = arg_2; int x_24 = arg_1; atomic_compare_exchange_resulti32 atomic_compare_result; - atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, x_24, x_23); + atomic_compare_result.old_value = atomicCompSwap(sb_rw.inner.arg_0, x_24, x_23); atomic_compare_result.exchanged = atomic_compare_result.old_value == x_24; atomic_compare_exchange_resulti32 tint_symbol = atomic_compare_result; int old_value_1 = tint_symbol.old_value; @@ -60,6 +64,10 @@ struct atomic_compare_exchange_resulti32 { }; +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; @@ -69,8 +77,8 @@ struct x__atomic_compare_exchange_resulti32 { bool exchanged; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicCompareExchangeWeak_1bd40a() { @@ -82,7 +90,7 @@ void atomicCompareExchangeWeak_1bd40a() { int x_23 = arg_2; int x_24 = arg_1; atomic_compare_exchange_resulti32 atomic_compare_result; - atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, x_24, x_23); + atomic_compare_result.old_value = atomicCompSwap(sb_rw.inner.arg_0, x_24, x_23); atomic_compare_result.exchanged = atomic_compare_result.old_value == x_24; atomic_compare_exchange_resulti32 tint_symbol = atomic_compare_result; int old_value_1 = tint_symbol.old_value; diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.spvasm index b7e5639134..c90584f806 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 46 +; Bound: 47 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -26,7 +28,8 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 @@ -36,15 +39,16 @@ OpMemberDecorate %__atomic_compare_exchange_resulti32 1 Offset 4 %int = OpTypeInt 32 1 %SB_RW_atomic = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %int + %6 = OpTypeFunction %void + %10 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %bool = OpTypeBool %x__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool - %15 = OpConstantNull %x__atomic_compare_exchange_resulti32 + %16 = OpConstantNull %x__atomic_compare_exchange_resulti32 %_ptr_Function_x__atomic_compare_exchange_resulti32 = OpTypePointer Function %x__atomic_compare_exchange_resulti32 %int_1 = OpConstant %int 1 %__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool @@ -52,45 +56,45 @@ %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int -%atomicCompareExchangeWeak_1bd40a = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_int Function %9 - %arg_2 = OpVariable %_ptr_Function_int Function %9 - %res = OpVariable %_ptr_Function_x__atomic_compare_exchange_resulti32 Function %15 - OpStore %arg_1 %9 - OpStore %arg_2 %9 - OpStore %res %15 +%atomicCompareExchangeWeak_1bd40a = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %10 + %arg_2 = OpVariable %_ptr_Function_int Function %10 + %res = OpVariable %_ptr_Function_x__atomic_compare_exchange_resulti32 Function %16 + OpStore %arg_1 %10 + OpStore %arg_2 %10 + OpStore %res %16 OpStore %arg_1 %int_1 OpStore %arg_2 %int_1 - %19 = OpLoad %int %arg_2 - %20 = OpLoad %int %arg_1 - %28 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %29 = OpAtomicCompareExchange %int %28 %uint_1 %uint_0 %uint_0 %19 %20 - %30 = OpIEqual %bool %29 %20 - %21 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %29 %30 - %31 = OpCompositeExtract %int %21 0 - %32 = OpIEqual %bool %31 %19 - %33 = OpCompositeConstruct %x__atomic_compare_exchange_resulti32 %31 %32 - OpStore %res %33 + %20 = OpLoad %int %arg_2 + %21 = OpLoad %int %arg_1 + %29 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %30 = OpAtomicCompareExchange %int %29 %uint_1 %uint_0 %uint_0 %20 %21 + %31 = OpIEqual %bool %30 %21 + %22 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %30 %31 + %32 = OpCompositeExtract %int %22 0 + %33 = OpIEqual %bool %32 %20 + %34 = OpCompositeConstruct %x__atomic_compare_exchange_resulti32 %32 %33 + OpStore %res %34 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %35 = OpLabel - %36 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a +%fragment_main_1 = OpFunction %void None %6 + %36 = OpLabel + %37 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %38 = OpLabel - %39 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %39 = OpLabel + %40 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %41 = OpLabel - %42 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a +%compute_main_1 = OpFunction %void None %6 + %42 = OpLabel + %43 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %44 = OpLabel - %45 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %45 = OpLabel + %46 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.glsl index 56d14547c6..d27b779a70 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.glsl @@ -7,6 +7,10 @@ struct atomic_compare_exchange_resultu32 { }; +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; @@ -16,8 +20,8 @@ struct x__atomic_compare_exchange_resultu32 { bool exchanged; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicCompareExchangeWeak_63d8e6() { @@ -29,7 +33,7 @@ void atomicCompareExchangeWeak_63d8e6() { uint x_21 = arg_2; uint x_22 = arg_1; atomic_compare_exchange_resultu32 atomic_compare_result; - atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, x_22, x_21); + atomic_compare_result.old_value = atomicCompSwap(sb_rw.inner.arg_0, x_22, x_21); atomic_compare_result.exchanged = atomic_compare_result.old_value == x_22; atomic_compare_exchange_resultu32 tint_symbol = atomic_compare_result; uint old_value_1 = tint_symbol.old_value; @@ -60,6 +64,10 @@ struct atomic_compare_exchange_resultu32 { }; +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; @@ -69,8 +77,8 @@ struct x__atomic_compare_exchange_resultu32 { bool exchanged; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicCompareExchangeWeak_63d8e6() { @@ -82,7 +90,7 @@ void atomicCompareExchangeWeak_63d8e6() { uint x_21 = arg_2; uint x_22 = arg_1; atomic_compare_exchange_resultu32 atomic_compare_result; - atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, x_22, x_21); + atomic_compare_result.old_value = atomicCompSwap(sb_rw.inner.arg_0, x_22, x_21); atomic_compare_result.exchanged = atomic_compare_result.old_value == x_22; atomic_compare_exchange_resultu32 tint_symbol = atomic_compare_result; uint old_value_1 = tint_symbol.old_value; diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.spvasm index 4ea59127a2..ee2758aade 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 44 +; Bound: 45 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -26,7 +28,8 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 @@ -36,59 +39,60 @@ OpMemberDecorate %__atomic_compare_exchange_resultu32 1 Offset 4 %uint = OpTypeInt 32 0 %SB_RW_atomic = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %uint + %6 = OpTypeFunction %void + %10 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint %bool = OpTypeBool %x__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool - %15 = OpConstantNull %x__atomic_compare_exchange_resultu32 + %16 = OpConstantNull %x__atomic_compare_exchange_resultu32 %_ptr_Function_x__atomic_compare_exchange_resultu32 = OpTypePointer Function %x__atomic_compare_exchange_resultu32 %uint_1 = OpConstant %uint 1 %__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicCompareExchangeWeak_63d8e6 = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_uint Function %9 - %arg_2 = OpVariable %_ptr_Function_uint Function %9 - %res = OpVariable %_ptr_Function_x__atomic_compare_exchange_resultu32 Function %15 - OpStore %arg_1 %9 - OpStore %arg_2 %9 - OpStore %res %15 +%atomicCompareExchangeWeak_63d8e6 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %10 + %arg_2 = OpVariable %_ptr_Function_uint Function %10 + %res = OpVariable %_ptr_Function_x__atomic_compare_exchange_resultu32 Function %16 + OpStore %arg_1 %10 + OpStore %arg_2 %10 + OpStore %res %16 OpStore %arg_1 %uint_1 OpStore %arg_2 %uint_1 - %19 = OpLoad %uint %arg_2 - %20 = OpLoad %uint %arg_1 - %26 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %27 = OpAtomicCompareExchange %uint %26 %uint_1 %uint_0 %uint_0 %19 %20 - %28 = OpIEqual %bool %27 %20 - %21 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %27 %28 - %29 = OpCompositeExtract %uint %21 0 - %30 = OpIEqual %bool %29 %19 - %31 = OpCompositeConstruct %x__atomic_compare_exchange_resultu32 %29 %30 - OpStore %res %31 + %20 = OpLoad %uint %arg_2 + %21 = OpLoad %uint %arg_1 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %28 = OpAtomicCompareExchange %uint %27 %uint_1 %uint_0 %uint_0 %20 %21 + %29 = OpIEqual %bool %28 %21 + %22 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %28 %29 + %30 = OpCompositeExtract %uint %22 0 + %31 = OpIEqual %bool %30 %20 + %32 = OpCompositeConstruct %x__atomic_compare_exchange_resultu32 %30 %31 + OpStore %res %32 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %33 = OpLabel - %34 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 +%fragment_main_1 = OpFunction %void None %6 + %34 = OpLabel + %35 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %36 = OpLabel - %37 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %37 = OpLabel + %38 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %39 = OpLabel - %40 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 +%compute_main_1 = OpFunction %void None %6 + %40 = OpLabel + %41 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %42 = OpLabel - %43 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %43 = OpLabel + %44 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm.expected.glsl index 712d91def0..7d13189535 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicExchange_f2e22f() { @@ -14,7 +18,7 @@ void atomicExchange_f2e22f() { int res = 0; arg_1 = 1; int x_20 = arg_1; - int x_13 = atomicExchange(sb_rw.arg_0, x_20); + int x_13 = atomicExchange(sb_rw.inner.arg_0, x_20); res = x_13; return; } @@ -34,12 +38,16 @@ void main() { } #version 310 es +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicExchange_f2e22f() { @@ -47,7 +55,7 @@ void atomicExchange_f2e22f() { int res = 0; arg_1 = 1; int x_20 = arg_1; - int x_13 = atomicExchange(sb_rw.arg_0, x_20); + int x_13 = atomicExchange(sb_rw.inner.arg_0, x_20); res = x_13; return; } diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm.expected.spvasm index 2b2b678143..9b2afee39f 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 34 +; Bound: 35 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -19,53 +21,55 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW_atomic = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %int + %6 = OpTypeFunction %void + %10 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %int_1 = OpConstant %int 1 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int -%atomicExchange_f2e22f = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_int Function %9 - %res = OpVariable %_ptr_Function_int Function %9 - OpStore %arg_1 %9 - OpStore %res %9 +%atomicExchange_f2e22f = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %10 + %res = OpVariable %_ptr_Function_int Function %10 + OpStore %arg_1 %10 + OpStore %res %10 OpStore %arg_1 %int_1 - %14 = OpLoad %int %arg_1 - %21 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %15 = OpAtomicExchange %int %21 %uint_1 %uint_0 %14 - OpStore %res %15 + %15 = OpLoad %int %arg_1 + %22 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %16 = OpAtomicExchange %int %22 %uint_1 %uint_0 %15 + OpStore %res %16 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %23 = OpLabel - %24 = OpFunctionCall %void %atomicExchange_f2e22f +%fragment_main_1 = OpFunction %void None %6 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicExchange_f2e22f OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %26 = OpLabel - %27 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %27 = OpLabel + %28 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %29 = OpLabel - %30 = OpFunctionCall %void %atomicExchange_f2e22f +%compute_main_1 = OpFunction %void None %6 + %30 = OpLabel + %31 = OpFunctionCall %void %atomicExchange_f2e22f OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %32 = OpLabel - %33 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %33 = OpLabel + %34 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm.expected.glsl index 9e2be9fcfa..9e60138861 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicExchange_d59712() { @@ -14,7 +18,7 @@ void atomicExchange_d59712() { uint res = 0u; arg_1 = 1u; uint x_18 = arg_1; - uint x_13 = atomicExchange(sb_rw.arg_0, x_18); + uint x_13 = atomicExchange(sb_rw.inner.arg_0, x_18); res = x_13; return; } @@ -34,12 +38,16 @@ void main() { } #version 310 es +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicExchange_d59712() { @@ -47,7 +55,7 @@ void atomicExchange_d59712() { uint res = 0u; arg_1 = 1u; uint x_18 = arg_1; - uint x_13 = atomicExchange(sb_rw.arg_0, x_18); + uint x_13 = atomicExchange(sb_rw.inner.arg_0, x_18); res = x_13; return; } diff --git a/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm.expected.spvasm index 7e620f005e..ccd2f93911 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/var/atomicExchange/storage_u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 32 +; Bound: 33 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -19,51 +21,53 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW_atomic = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %uint + %6 = OpTypeFunction %void + %10 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicExchange_d59712 = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_uint Function %9 - %res = OpVariable %_ptr_Function_uint Function %9 - OpStore %arg_1 %9 - OpStore %res %9 +%atomicExchange_d59712 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %10 + %res = OpVariable %_ptr_Function_uint Function %10 + OpStore %arg_1 %10 + OpStore %res %10 OpStore %arg_1 %uint_1 - %14 = OpLoad %uint %arg_1 - %19 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %15 = OpAtomicExchange %uint %19 %uint_1 %uint_0 %14 - OpStore %res %15 + %15 = OpLoad %uint %arg_1 + %20 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %16 = OpAtomicExchange %uint %20 %uint_1 %uint_0 %15 + OpStore %res %16 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicExchange_d59712 +%fragment_main_1 = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicExchange_d59712 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %27 = OpLabel - %28 = OpFunctionCall %void %atomicExchange_d59712 +%compute_main_1 = OpFunction %void None %6 + %28 = OpLabel + %29 = OpFunctionCall %void %atomicExchange_d59712 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %30 = OpLabel - %31 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %31 = OpLabel + %32 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm.expected.glsl index c5f15b176e..a15c00f2f9 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm.expected.glsl @@ -1,17 +1,21 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicLoad_0806ad() { int res = 0; - int x_9 = atomicOr(sb_rw.arg_0, 0); + int x_9 = atomicOr(sb_rw.inner.arg_0, 0); res = x_9; return; } @@ -31,17 +35,21 @@ void main() { } #version 310 es +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicLoad_0806ad() { int res = 0; - int x_9 = atomicOr(sb_rw.arg_0, 0); + int x_9 = atomicOr(sb_rw.inner.arg_0, 0); res = x_9; return; } diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm.expected.spvasm index 40034c7744..097c22211c 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 31 +; Bound: 32 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -18,48 +20,50 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW_atomic = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %int + %6 = OpTypeFunction %void + %10 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int -%atomicLoad_0806ad = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_int Function %9 - OpStore %res %9 - %18 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %12 = OpAtomicLoad %int %18 %uint_1 %uint_0 - OpStore %res %12 +%atomicLoad_0806ad = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_int Function %10 + OpStore %res %10 + %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %13 = OpAtomicLoad %int %19 %uint_1 %uint_0 + OpStore %res %13 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %20 = OpLabel - %21 = OpFunctionCall %void %atomicLoad_0806ad +%fragment_main_1 = OpFunction %void None %6 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicLoad_0806ad OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %23 = OpLabel - %24 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %24 = OpLabel + %25 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %26 = OpLabel - %27 = OpFunctionCall %void %atomicLoad_0806ad +%compute_main_1 = OpFunction %void None %6 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicLoad_0806ad OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %29 = OpLabel - %30 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %31 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm.expected.glsl index 8bddccedeb..d9a37ea520 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm.expected.glsl @@ -1,17 +1,21 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicLoad_fe6cc3() { uint res = 0u; - uint x_9 = atomicOr(sb_rw.arg_0, 0u); + uint x_9 = atomicOr(sb_rw.inner.arg_0, 0u); res = x_9; return; } @@ -31,17 +35,21 @@ void main() { } #version 310 es +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicLoad_fe6cc3() { uint res = 0u; - uint x_9 = atomicOr(sb_rw.arg_0, 0u); + uint x_9 = atomicOr(sb_rw.inner.arg_0, 0u); res = x_9; return; } diff --git a/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm.expected.spvasm index e12b47bae3..e4fa90f9fc 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/var/atomicLoad/storage_u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 30 +; Bound: 31 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -18,47 +20,49 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW_atomic = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %uint + %6 = OpTypeFunction %void + %10 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicLoad_fe6cc3 = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %9 - OpStore %res %9 - %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %12 = OpAtomicLoad %uint %17 %uint_1 %uint_0 - OpStore %res %12 +%atomicLoad_fe6cc3 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %10 + OpStore %res %10 + %18 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %13 = OpAtomicLoad %uint %18 %uint_1 %uint_0 + OpStore %res %13 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %19 = OpLabel - %20 = OpFunctionCall %void %atomicLoad_fe6cc3 +%fragment_main_1 = OpFunction %void None %6 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicLoad_fe6cc3 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %22 = OpLabel - %23 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %23 = OpLabel + %24 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %25 = OpLabel - %26 = OpFunctionCall %void %atomicLoad_fe6cc3 +%compute_main_1 = OpFunction %void None %6 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicLoad_fe6cc3 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %28 = OpLabel - %29 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %29 = OpLabel + %30 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm.expected.glsl index d47f3bb58f..42acd6ef11 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicMax_92aa72() { @@ -14,7 +18,7 @@ void atomicMax_92aa72() { int res = 0; arg_1 = 1; int x_20 = arg_1; - int x_13 = atomicMax(sb_rw.arg_0, x_20); + int x_13 = atomicMax(sb_rw.inner.arg_0, x_20); res = x_13; return; } @@ -34,12 +38,16 @@ void main() { } #version 310 es +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicMax_92aa72() { @@ -47,7 +55,7 @@ void atomicMax_92aa72() { int res = 0; arg_1 = 1; int x_20 = arg_1; - int x_13 = atomicMax(sb_rw.arg_0, x_20); + int x_13 = atomicMax(sb_rw.inner.arg_0, x_20); res = x_13; return; } diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm.expected.spvasm index c0a4470ffb..e0f3a71da8 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 34 +; Bound: 35 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -19,53 +21,55 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW_atomic = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %int + %6 = OpTypeFunction %void + %10 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %int_1 = OpConstant %int 1 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int -%atomicMax_92aa72 = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_int Function %9 - %res = OpVariable %_ptr_Function_int Function %9 - OpStore %arg_1 %9 - OpStore %res %9 +%atomicMax_92aa72 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %10 + %res = OpVariable %_ptr_Function_int Function %10 + OpStore %arg_1 %10 + OpStore %res %10 OpStore %arg_1 %int_1 - %14 = OpLoad %int %arg_1 - %21 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %15 = OpAtomicSMax %int %21 %uint_1 %uint_0 %14 - OpStore %res %15 + %15 = OpLoad %int %arg_1 + %22 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %16 = OpAtomicSMax %int %22 %uint_1 %uint_0 %15 + OpStore %res %16 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %23 = OpLabel - %24 = OpFunctionCall %void %atomicMax_92aa72 +%fragment_main_1 = OpFunction %void None %6 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicMax_92aa72 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %26 = OpLabel - %27 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %27 = OpLabel + %28 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %29 = OpLabel - %30 = OpFunctionCall %void %atomicMax_92aa72 +%compute_main_1 = OpFunction %void None %6 + %30 = OpLabel + %31 = OpFunctionCall %void %atomicMax_92aa72 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %32 = OpLabel - %33 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %33 = OpLabel + %34 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm.expected.glsl index 2df58c3117..304432bf25 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicMax_51b9be() { @@ -14,7 +18,7 @@ void atomicMax_51b9be() { uint res = 0u; arg_1 = 1u; uint x_18 = arg_1; - uint x_13 = atomicMax(sb_rw.arg_0, x_18); + uint x_13 = atomicMax(sb_rw.inner.arg_0, x_18); res = x_13; return; } @@ -34,12 +38,16 @@ void main() { } #version 310 es +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicMax_51b9be() { @@ -47,7 +55,7 @@ void atomicMax_51b9be() { uint res = 0u; arg_1 = 1u; uint x_18 = arg_1; - uint x_13 = atomicMax(sb_rw.arg_0, x_18); + uint x_13 = atomicMax(sb_rw.inner.arg_0, x_18); res = x_13; return; } diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm.expected.spvasm index 4ed13b0a3c..7c28540462 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/var/atomicMax/storage_u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 32 +; Bound: 33 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -19,51 +21,53 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW_atomic = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %uint + %6 = OpTypeFunction %void + %10 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicMax_51b9be = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_uint Function %9 - %res = OpVariable %_ptr_Function_uint Function %9 - OpStore %arg_1 %9 - OpStore %res %9 +%atomicMax_51b9be = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %10 + %res = OpVariable %_ptr_Function_uint Function %10 + OpStore %arg_1 %10 + OpStore %res %10 OpStore %arg_1 %uint_1 - %14 = OpLoad %uint %arg_1 - %19 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %15 = OpAtomicUMax %uint %19 %uint_1 %uint_0 %14 - OpStore %res %15 + %15 = OpLoad %uint %arg_1 + %20 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %16 = OpAtomicUMax %uint %20 %uint_1 %uint_0 %15 + OpStore %res %16 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicMax_51b9be +%fragment_main_1 = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicMax_51b9be OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %27 = OpLabel - %28 = OpFunctionCall %void %atomicMax_51b9be +%compute_main_1 = OpFunction %void None %6 + %28 = OpLabel + %29 = OpFunctionCall %void %atomicMax_51b9be OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %30 = OpLabel - %31 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %31 = OpLabel + %32 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm.expected.glsl index 04a49bbacd..b288ab41a2 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicMin_8e38dc() { @@ -14,7 +18,7 @@ void atomicMin_8e38dc() { int res = 0; arg_1 = 1; int x_20 = arg_1; - int x_13 = atomicMin(sb_rw.arg_0, x_20); + int x_13 = atomicMin(sb_rw.inner.arg_0, x_20); res = x_13; return; } @@ -34,12 +38,16 @@ void main() { } #version 310 es +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicMin_8e38dc() { @@ -47,7 +55,7 @@ void atomicMin_8e38dc() { int res = 0; arg_1 = 1; int x_20 = arg_1; - int x_13 = atomicMin(sb_rw.arg_0, x_20); + int x_13 = atomicMin(sb_rw.inner.arg_0, x_20); res = x_13; return; } diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm.expected.spvasm index 7e5e670ac5..31d004ba81 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 34 +; Bound: 35 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -19,53 +21,55 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW_atomic = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %int + %6 = OpTypeFunction %void + %10 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %int_1 = OpConstant %int 1 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int -%atomicMin_8e38dc = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_int Function %9 - %res = OpVariable %_ptr_Function_int Function %9 - OpStore %arg_1 %9 - OpStore %res %9 +%atomicMin_8e38dc = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %10 + %res = OpVariable %_ptr_Function_int Function %10 + OpStore %arg_1 %10 + OpStore %res %10 OpStore %arg_1 %int_1 - %14 = OpLoad %int %arg_1 - %21 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %15 = OpAtomicSMin %int %21 %uint_1 %uint_0 %14 - OpStore %res %15 + %15 = OpLoad %int %arg_1 + %22 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %16 = OpAtomicSMin %int %22 %uint_1 %uint_0 %15 + OpStore %res %16 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %23 = OpLabel - %24 = OpFunctionCall %void %atomicMin_8e38dc +%fragment_main_1 = OpFunction %void None %6 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicMin_8e38dc OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %26 = OpLabel - %27 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %27 = OpLabel + %28 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %29 = OpLabel - %30 = OpFunctionCall %void %atomicMin_8e38dc +%compute_main_1 = OpFunction %void None %6 + %30 = OpLabel + %31 = OpFunctionCall %void %atomicMin_8e38dc OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %32 = OpLabel - %33 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %33 = OpLabel + %34 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm.expected.glsl index f5333a75f3..2f72f036ff 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicMin_c67a74() { @@ -14,7 +18,7 @@ void atomicMin_c67a74() { uint res = 0u; arg_1 = 1u; uint x_18 = arg_1; - uint x_13 = atomicMin(sb_rw.arg_0, x_18); + uint x_13 = atomicMin(sb_rw.inner.arg_0, x_18); res = x_13; return; } @@ -34,12 +38,16 @@ void main() { } #version 310 es +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicMin_c67a74() { @@ -47,7 +55,7 @@ void atomicMin_c67a74() { uint res = 0u; arg_1 = 1u; uint x_18 = arg_1; - uint x_13 = atomicMin(sb_rw.arg_0, x_18); + uint x_13 = atomicMin(sb_rw.inner.arg_0, x_18); res = x_13; return; } diff --git a/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm.expected.spvasm index 309f258a47..18670b5ad9 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/var/atomicMin/storage_u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 32 +; Bound: 33 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -19,51 +21,53 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW_atomic = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %uint + %6 = OpTypeFunction %void + %10 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicMin_c67a74 = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_uint Function %9 - %res = OpVariable %_ptr_Function_uint Function %9 - OpStore %arg_1 %9 - OpStore %res %9 +%atomicMin_c67a74 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %10 + %res = OpVariable %_ptr_Function_uint Function %10 + OpStore %arg_1 %10 + OpStore %res %10 OpStore %arg_1 %uint_1 - %14 = OpLoad %uint %arg_1 - %19 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %15 = OpAtomicUMin %uint %19 %uint_1 %uint_0 %14 - OpStore %res %15 + %15 = OpLoad %uint %arg_1 + %20 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %16 = OpAtomicUMin %uint %20 %uint_1 %uint_0 %15 + OpStore %res %16 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicMin_c67a74 +%fragment_main_1 = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicMin_c67a74 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %27 = OpLabel - %28 = OpFunctionCall %void %atomicMin_c67a74 +%compute_main_1 = OpFunction %void None %6 + %28 = OpLabel + %29 = OpFunctionCall %void %atomicMin_c67a74 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %30 = OpLabel - %31 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %31 = OpLabel + %32 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm.expected.glsl index d351cf949a..ea2372810d 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicOr_8d96a0() { @@ -14,7 +18,7 @@ void atomicOr_8d96a0() { int res = 0; arg_1 = 1; int x_20 = arg_1; - int x_13 = atomicOr(sb_rw.arg_0, x_20); + int x_13 = atomicOr(sb_rw.inner.arg_0, x_20); res = x_13; return; } @@ -34,12 +38,16 @@ void main() { } #version 310 es +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicOr_8d96a0() { @@ -47,7 +55,7 @@ void atomicOr_8d96a0() { int res = 0; arg_1 = 1; int x_20 = arg_1; - int x_13 = atomicOr(sb_rw.arg_0, x_20); + int x_13 = atomicOr(sb_rw.inner.arg_0, x_20); res = x_13; return; } diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm.expected.spvasm index a5753a7dab..1638b94cce 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 34 +; Bound: 35 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -19,53 +21,55 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW_atomic = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %int + %6 = OpTypeFunction %void + %10 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %int_1 = OpConstant %int 1 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int -%atomicOr_8d96a0 = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_int Function %9 - %res = OpVariable %_ptr_Function_int Function %9 - OpStore %arg_1 %9 - OpStore %res %9 +%atomicOr_8d96a0 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %10 + %res = OpVariable %_ptr_Function_int Function %10 + OpStore %arg_1 %10 + OpStore %res %10 OpStore %arg_1 %int_1 - %14 = OpLoad %int %arg_1 - %21 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %15 = OpAtomicOr %int %21 %uint_1 %uint_0 %14 - OpStore %res %15 + %15 = OpLoad %int %arg_1 + %22 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %16 = OpAtomicOr %int %22 %uint_1 %uint_0 %15 + OpStore %res %16 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %23 = OpLabel - %24 = OpFunctionCall %void %atomicOr_8d96a0 +%fragment_main_1 = OpFunction %void None %6 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicOr_8d96a0 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %26 = OpLabel - %27 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %27 = OpLabel + %28 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %29 = OpLabel - %30 = OpFunctionCall %void %atomicOr_8d96a0 +%compute_main_1 = OpFunction %void None %6 + %30 = OpLabel + %31 = OpFunctionCall %void %atomicOr_8d96a0 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %32 = OpLabel - %33 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %33 = OpLabel + %34 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm.expected.glsl index 32c5ab61c2..900558603a 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicOr_5e95d4() { @@ -14,7 +18,7 @@ void atomicOr_5e95d4() { uint res = 0u; arg_1 = 1u; uint x_18 = arg_1; - uint x_13 = atomicOr(sb_rw.arg_0, x_18); + uint x_13 = atomicOr(sb_rw.inner.arg_0, x_18); res = x_13; return; } @@ -34,12 +38,16 @@ void main() { } #version 310 es +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicOr_5e95d4() { @@ -47,7 +55,7 @@ void atomicOr_5e95d4() { uint res = 0u; arg_1 = 1u; uint x_18 = arg_1; - uint x_13 = atomicOr(sb_rw.arg_0, x_18); + uint x_13 = atomicOr(sb_rw.inner.arg_0, x_18); res = x_13; return; } diff --git a/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm.expected.spvasm index 2d2a230427..1546903e50 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/var/atomicOr/storage_u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 32 +; Bound: 33 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -19,51 +21,53 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW_atomic = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %uint + %6 = OpTypeFunction %void + %10 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicOr_5e95d4 = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_uint Function %9 - %res = OpVariable %_ptr_Function_uint Function %9 - OpStore %arg_1 %9 - OpStore %res %9 +%atomicOr_5e95d4 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %10 + %res = OpVariable %_ptr_Function_uint Function %10 + OpStore %arg_1 %10 + OpStore %res %10 OpStore %arg_1 %uint_1 - %14 = OpLoad %uint %arg_1 - %19 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %15 = OpAtomicOr %uint %19 %uint_1 %uint_0 %14 - OpStore %res %15 + %15 = OpLoad %uint %arg_1 + %20 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %16 = OpAtomicOr %uint %20 %uint_1 %uint_0 %15 + OpStore %res %16 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicOr_5e95d4 +%fragment_main_1 = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicOr_5e95d4 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %27 = OpLabel - %28 = OpFunctionCall %void %atomicOr_5e95d4 +%compute_main_1 = OpFunction %void None %6 + %28 = OpLabel + %29 = OpFunctionCall %void %atomicOr_5e95d4 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %30 = OpLabel - %31 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %31 = OpLabel + %32 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm.expected.glsl index f0bb2824f5..c01168769c 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm.expected.glsl @@ -1,19 +1,23 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicStore_d1e9a6() { int arg_1 = 0; arg_1 = 1; int x_20 = arg_1; - atomicExchange(sb_rw.arg_0, x_20); + atomicExchange(sb_rw.inner.arg_0, x_20); return; } @@ -32,19 +36,23 @@ void main() { } #version 310 es +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicStore_d1e9a6() { int arg_1 = 0; arg_1 = 1; int x_20 = arg_1; - atomicExchange(sb_rw.arg_0, x_20); + atomicExchange(sb_rw.inner.arg_0, x_20); return; } diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm.expected.spvasm index 77ab9b09e1..07a164d9d5 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 33 +; Bound: 34 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -18,50 +20,52 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW_atomic = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %int + %6 = OpTypeFunction %void + %10 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %int_1 = OpConstant %int 1 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int -%atomicStore_d1e9a6 = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_int Function %9 - OpStore %arg_1 %9 +%atomicStore_d1e9a6 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %10 + OpStore %arg_1 %10 OpStore %arg_1 %int_1 - %13 = OpLoad %int %arg_1 - %20 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - OpAtomicStore %20 %uint_1 %uint_0 %13 + %14 = OpLoad %int %arg_1 + %21 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + OpAtomicStore %21 %uint_1 %uint_0 %14 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %22 = OpLabel - %23 = OpFunctionCall %void %atomicStore_d1e9a6 +%fragment_main_1 = OpFunction %void None %6 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicStore_d1e9a6 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %25 = OpLabel - %26 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %26 = OpLabel + %27 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %28 = OpLabel - %29 = OpFunctionCall %void %atomicStore_d1e9a6 +%compute_main_1 = OpFunction %void None %6 + %29 = OpLabel + %30 = OpFunctionCall %void %atomicStore_d1e9a6 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %31 = OpLabel - %32 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %32 = OpLabel + %33 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm.expected.glsl index a6c5b1f473..db0f562a20 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm.expected.glsl @@ -1,19 +1,23 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicStore_cdc29e() { uint arg_1 = 0u; arg_1 = 1u; uint x_18 = arg_1; - atomicExchange(sb_rw.arg_0, x_18); + atomicExchange(sb_rw.inner.arg_0, x_18); return; } @@ -32,19 +36,23 @@ void main() { } #version 310 es +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicStore_cdc29e() { uint arg_1 = 0u; arg_1 = 1u; uint x_18 = arg_1; - atomicExchange(sb_rw.arg_0, x_18); + atomicExchange(sb_rw.inner.arg_0, x_18); return; } diff --git a/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm.expected.spvasm index ababfa4ef8..aeb7cca74e 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/var/atomicStore/storage_u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 31 +; Bound: 32 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -18,48 +20,50 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW_atomic = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %uint + %6 = OpTypeFunction %void + %10 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicStore_cdc29e = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_uint Function %9 - OpStore %arg_1 %9 +%atomicStore_cdc29e = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %10 + OpStore %arg_1 %10 OpStore %arg_1 %uint_1 - %13 = OpLoad %uint %arg_1 - %18 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - OpAtomicStore %18 %uint_1 %uint_0 %13 + %14 = OpLoad %uint %arg_1 + %19 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + OpAtomicStore %19 %uint_1 %uint_0 %14 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %20 = OpLabel - %21 = OpFunctionCall %void %atomicStore_cdc29e +%fragment_main_1 = OpFunction %void None %6 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicStore_cdc29e OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %23 = OpLabel - %24 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %24 = OpLabel + %25 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %26 = OpLabel - %27 = OpFunctionCall %void %atomicStore_cdc29e +%compute_main_1 = OpFunction %void None %6 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicStore_cdc29e OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %29 = OpLabel - %30 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %31 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm.expected.glsl index cb32a5c0c6..f74d0b8264 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicSub_051100() { @@ -14,7 +18,7 @@ void atomicSub_051100() { int res = 0; arg_1 = 1; int x_20 = arg_1; - int x_13 = atomicAdd(sb_rw.arg_0, x_20); + int x_13 = atomicAdd(sb_rw.inner.arg_0, x_20); res = x_13; return; } @@ -34,12 +38,16 @@ void main() { } #version 310 es +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicSub_051100() { @@ -47,7 +55,7 @@ void atomicSub_051100() { int res = 0; arg_1 = 1; int x_20 = arg_1; - int x_13 = atomicAdd(sb_rw.arg_0, x_20); + int x_13 = atomicAdd(sb_rw.inner.arg_0, x_20); res = x_13; return; } diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm.expected.spvasm index c40bebac32..6c0e5d9484 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 34 +; Bound: 35 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -19,53 +21,55 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW_atomic = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %int + %6 = OpTypeFunction %void + %10 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %int_1 = OpConstant %int 1 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int -%atomicSub_051100 = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_int Function %9 - %res = OpVariable %_ptr_Function_int Function %9 - OpStore %arg_1 %9 - OpStore %res %9 +%atomicSub_051100 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %10 + %res = OpVariable %_ptr_Function_int Function %10 + OpStore %arg_1 %10 + OpStore %res %10 OpStore %arg_1 %int_1 - %14 = OpLoad %int %arg_1 - %21 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %15 = OpAtomicISub %int %21 %uint_1 %uint_0 %14 - OpStore %res %15 + %15 = OpLoad %int %arg_1 + %22 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %16 = OpAtomicISub %int %22 %uint_1 %uint_0 %15 + OpStore %res %16 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %23 = OpLabel - %24 = OpFunctionCall %void %atomicSub_051100 +%fragment_main_1 = OpFunction %void None %6 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicSub_051100 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %26 = OpLabel - %27 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %27 = OpLabel + %28 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %29 = OpLabel - %30 = OpFunctionCall %void %atomicSub_051100 +%compute_main_1 = OpFunction %void None %6 + %30 = OpLabel + %31 = OpFunctionCall %void %atomicSub_051100 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %32 = OpLabel - %33 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %33 = OpLabel + %34 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm.expected.glsl index 850f62feca..1d6f90fca9 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicSub_15bfc9() { @@ -14,7 +18,7 @@ void atomicSub_15bfc9() { uint res = 0u; arg_1 = 1u; uint x_18 = arg_1; - uint x_13 = atomicAdd(sb_rw.arg_0, x_18); + uint x_13 = atomicAdd(sb_rw.inner.arg_0, x_18); res = x_13; return; } @@ -34,12 +38,16 @@ void main() { } #version 310 es +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicSub_15bfc9() { @@ -47,7 +55,7 @@ void atomicSub_15bfc9() { uint res = 0u; arg_1 = 1u; uint x_18 = arg_1; - uint x_13 = atomicAdd(sb_rw.arg_0, x_18); + uint x_13 = atomicAdd(sb_rw.inner.arg_0, x_18); res = x_13; return; } diff --git a/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm.expected.spvasm index 6704485521..0242fab9d2 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/var/atomicSub/storage_u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 32 +; Bound: 33 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -19,51 +21,53 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW_atomic = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %uint + %6 = OpTypeFunction %void + %10 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicSub_15bfc9 = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_uint Function %9 - %res = OpVariable %_ptr_Function_uint Function %9 - OpStore %arg_1 %9 - OpStore %res %9 +%atomicSub_15bfc9 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %10 + %res = OpVariable %_ptr_Function_uint Function %10 + OpStore %arg_1 %10 + OpStore %res %10 OpStore %arg_1 %uint_1 - %14 = OpLoad %uint %arg_1 - %19 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %15 = OpAtomicISub %uint %19 %uint_1 %uint_0 %14 - OpStore %res %15 + %15 = OpLoad %uint %arg_1 + %20 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %16 = OpAtomicISub %uint %20 %uint_1 %uint_0 %15 + OpStore %res %16 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicSub_15bfc9 +%fragment_main_1 = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicSub_15bfc9 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %27 = OpLabel - %28 = OpFunctionCall %void %atomicSub_15bfc9 +%compute_main_1 = OpFunction %void None %6 + %28 = OpLabel + %29 = OpFunctionCall %void %atomicSub_15bfc9 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %30 = OpLabel - %31 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %31 = OpLabel + %32 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm.expected.glsl index f599a8fd4b..dae9988c73 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicXor_c1b78c() { @@ -14,7 +18,7 @@ void atomicXor_c1b78c() { int res = 0; arg_1 = 1; int x_20 = arg_1; - int x_13 = atomicXor(sb_rw.arg_0, x_20); + int x_13 = atomicXor(sb_rw.inner.arg_0, x_20); res = x_13; return; } @@ -34,12 +38,16 @@ void main() { } #version 310 es +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicXor_c1b78c() { @@ -47,7 +55,7 @@ void atomicXor_c1b78c() { int res = 0; arg_1 = 1; int x_20 = arg_1; - int x_13 = atomicXor(sb_rw.arg_0, x_20); + int x_13 = atomicXor(sb_rw.inner.arg_0, x_20); res = x_13; return; } diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm.expected.spvasm index 74a9caa4c6..ef8a0af0a4 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 34 +; Bound: 35 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -19,53 +21,55 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW_atomic = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %int + %6 = OpTypeFunction %void + %10 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %int_1 = OpConstant %int 1 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int -%atomicXor_c1b78c = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_int Function %9 - %res = OpVariable %_ptr_Function_int Function %9 - OpStore %arg_1 %9 - OpStore %res %9 +%atomicXor_c1b78c = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %10 + %res = OpVariable %_ptr_Function_int Function %10 + OpStore %arg_1 %10 + OpStore %res %10 OpStore %arg_1 %int_1 - %14 = OpLoad %int %arg_1 - %21 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %15 = OpAtomicXor %int %21 %uint_1 %uint_0 %14 - OpStore %res %15 + %15 = OpLoad %int %arg_1 + %22 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %16 = OpAtomicXor %int %22 %uint_1 %uint_0 %15 + OpStore %res %16 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %23 = OpLabel - %24 = OpFunctionCall %void %atomicXor_c1b78c +%fragment_main_1 = OpFunction %void None %6 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicXor_c1b78c OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %26 = OpLabel - %27 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %27 = OpLabel + %28 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %29 = OpLabel - %30 = OpFunctionCall %void %atomicXor_c1b78c +%compute_main_1 = OpFunction %void None %6 + %30 = OpLabel + %31 = OpFunctionCall %void %atomicXor_c1b78c OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %32 = OpLabel - %33 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %33 = OpLabel + %34 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm.expected.glsl index 71759fa09a..bcff0d886a 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicXor_54510e() { @@ -14,7 +18,7 @@ void atomicXor_54510e() { uint res = 0u; arg_1 = 1u; uint x_18 = arg_1; - uint x_13 = atomicXor(sb_rw.arg_0, x_18); + uint x_13 = atomicXor(sb_rw.inner.arg_0, x_18); res = x_13; return; } @@ -34,12 +38,16 @@ void main() { } #version 310 es +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicXor_54510e() { @@ -47,7 +55,7 @@ void atomicXor_54510e() { uint res = 0u; arg_1 = 1u; uint x_18 = arg_1; - uint x_13 = atomicXor(sb_rw.arg_0, x_18); + uint x_13 = atomicXor(sb_rw.inner.arg_0, x_18); res = x_13; return; } diff --git a/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm.expected.spvasm index 786b9f608c..f9a4905110 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/var/atomicXor/storage_u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 32 +; Bound: 33 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -19,51 +21,53 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW_atomic = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %uint + %6 = OpTypeFunction %void + %10 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicXor_54510e = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_uint Function %9 - %res = OpVariable %_ptr_Function_uint Function %9 - OpStore %arg_1 %9 - OpStore %res %9 +%atomicXor_54510e = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %10 + %res = OpVariable %_ptr_Function_uint Function %10 + OpStore %arg_1 %10 + OpStore %res %10 OpStore %arg_1 %uint_1 - %14 = OpLoad %uint %arg_1 - %19 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %15 = OpAtomicXor %uint %19 %uint_1 %uint_0 %14 - OpStore %res %15 + %15 = OpLoad %uint %arg_1 + %20 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %16 = OpAtomicXor %uint %20 %uint_1 %uint_0 %15 + OpStore %res %16 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicXor_54510e +%fragment_main_1 = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicXor_54510e OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %27 = OpLabel - %28 = OpFunctionCall %void %atomicXor_54510e +%compute_main_1 = OpFunction %void None %6 + %28 = OpLabel + %29 = OpFunctionCall %void %atomicXor_54510e OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %30 = OpLabel - %31 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %31 = OpLabel + %32 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm.expected.glsl index 9d593d46f9..48ad3c6656 100644 --- a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm.expected.glsl @@ -1,19 +1,23 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAdd_d32fe4() { int arg_1 = 0; int res = 0; arg_1 = 1; - int x_13 = atomicAdd(sb_rw.arg_0, 1); + int x_13 = atomicAdd(sb_rw.inner.arg_0, 1); res = x_13; return; } @@ -33,19 +37,23 @@ void main() { } #version 310 es +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAdd_d32fe4() { int arg_1 = 0; int res = 0; arg_1 = 1; - int x_13 = atomicAdd(sb_rw.arg_0, 1); + int x_13 = atomicAdd(sb_rw.inner.arg_0, 1); res = x_13; return; } diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm.expected.spvasm index 870704eaac..e069c9258d 100644 --- a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 33 +; Bound: 34 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -19,52 +21,54 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW_atomic = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %int + %6 = OpTypeFunction %void + %10 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %int_1 = OpConstant %int 1 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int -%atomicAdd_d32fe4 = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_int Function %9 - %res = OpVariable %_ptr_Function_int Function %9 - OpStore %arg_1 %9 - OpStore %res %9 +%atomicAdd_d32fe4 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %10 + %res = OpVariable %_ptr_Function_int Function %10 + OpStore %arg_1 %10 + OpStore %res %10 OpStore %arg_1 %int_1 - %20 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %14 = OpAtomicISub %int %20 %uint_1 %uint_0 %int_1 - OpStore %res %14 + %21 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %15 = OpAtomicISub %int %21 %uint_1 %uint_0 %int_1 + OpStore %res %15 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %22 = OpLabel - %23 = OpFunctionCall %void %atomicAdd_d32fe4 +%fragment_main_1 = OpFunction %void None %6 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicAdd_d32fe4 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %25 = OpLabel - %26 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %26 = OpLabel + %27 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %28 = OpLabel - %29 = OpFunctionCall %void %atomicAdd_d32fe4 +%compute_main_1 = OpFunction %void None %6 + %29 = OpLabel + %30 = OpFunctionCall %void %atomicAdd_d32fe4 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %31 = OpLabel - %32 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %32 = OpLabel + %33 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm.expected.glsl index baaa2cc917..1914b10f24 100644 --- a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm.expected.glsl @@ -1,19 +1,23 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAdd_8a199a() { uint arg_1 = 0u; uint res = 0u; arg_1 = 1u; - uint x_13 = atomicAdd(sb_rw.arg_0, 1u); + uint x_13 = atomicAdd(sb_rw.inner.arg_0, 1u); res = x_13; return; } @@ -33,19 +37,23 @@ void main() { } #version 310 es +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAdd_8a199a() { uint arg_1 = 0u; uint res = 0u; arg_1 = 1u; - uint x_13 = atomicAdd(sb_rw.arg_0, 1u); + uint x_13 = atomicAdd(sb_rw.inner.arg_0, 1u); res = x_13; return; } diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm.expected.spvasm index 63b3eebfdb..a70cbc1888 100644 --- a/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicDecrement/storage_u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 31 +; Bound: 32 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -19,50 +21,52 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW_atomic = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %uint + %6 = OpTypeFunction %void + %10 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicAdd_8a199a = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_uint Function %9 - %res = OpVariable %_ptr_Function_uint Function %9 - OpStore %arg_1 %9 - OpStore %res %9 +%atomicAdd_8a199a = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %10 + %res = OpVariable %_ptr_Function_uint Function %10 + OpStore %arg_1 %10 + OpStore %res %10 OpStore %arg_1 %uint_1 - %18 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %14 = OpAtomicISub %uint %18 %uint_1 %uint_0 %uint_1 - OpStore %res %14 + %19 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %15 = OpAtomicISub %uint %19 %uint_1 %uint_0 %uint_1 + OpStore %res %15 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %20 = OpLabel - %21 = OpFunctionCall %void %atomicAdd_8a199a +%fragment_main_1 = OpFunction %void None %6 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicAdd_8a199a OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %23 = OpLabel - %24 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %24 = OpLabel + %25 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %26 = OpLabel - %27 = OpFunctionCall %void %atomicAdd_8a199a +%compute_main_1 = OpFunction %void None %6 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicAdd_8a199a OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %29 = OpLabel - %30 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %31 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm.expected.glsl index 9d593d46f9..48ad3c6656 100644 --- a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm.expected.glsl @@ -1,19 +1,23 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAdd_d32fe4() { int arg_1 = 0; int res = 0; arg_1 = 1; - int x_13 = atomicAdd(sb_rw.arg_0, 1); + int x_13 = atomicAdd(sb_rw.inner.arg_0, 1); res = x_13; return; } @@ -33,19 +37,23 @@ void main() { } #version 310 es +struct SB_RW_atomic { + int arg_0; +}; + struct SB_RW { int arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - int arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAdd_d32fe4() { int arg_1 = 0; int res = 0; arg_1 = 1; - int x_13 = atomicAdd(sb_rw.arg_0, 1); + int x_13 = atomicAdd(sb_rw.inner.arg_0, 1); res = x_13; return; } diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm.expected.spvasm index f206f17221..ec87e33fa4 100644 --- a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_i32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 33 +; Bound: 34 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -19,52 +21,54 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW_atomic = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %int + %6 = OpTypeFunction %void + %10 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %int_1 = OpConstant %int 1 %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int -%atomicAdd_d32fe4 = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_int Function %9 - %res = OpVariable %_ptr_Function_int Function %9 - OpStore %arg_1 %9 - OpStore %res %9 +%atomicAdd_d32fe4 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %10 + %res = OpVariable %_ptr_Function_int Function %10 + OpStore %arg_1 %10 + OpStore %res %10 OpStore %arg_1 %int_1 - %20 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %14 = OpAtomicIAdd %int %20 %uint_1 %uint_0 %int_1 - OpStore %res %14 + %21 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %15 = OpAtomicIAdd %int %21 %uint_1 %uint_0 %int_1 + OpStore %res %15 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %22 = OpLabel - %23 = OpFunctionCall %void %atomicAdd_d32fe4 +%fragment_main_1 = OpFunction %void None %6 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicAdd_d32fe4 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %25 = OpLabel - %26 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %26 = OpLabel + %27 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %28 = OpLabel - %29 = OpFunctionCall %void %atomicAdd_d32fe4 +%compute_main_1 = OpFunction %void None %6 + %29 = OpLabel + %30 = OpFunctionCall %void %atomicAdd_d32fe4 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %31 = OpLabel - %32 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %32 = OpLabel + %33 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm.expected.glsl index baaa2cc917..1914b10f24 100644 --- a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm.expected.glsl @@ -1,19 +1,23 @@ #version 310 es precision mediump float; +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAdd_8a199a() { uint arg_1 = 0u; uint res = 0u; arg_1 = 1u; - uint x_13 = atomicAdd(sb_rw.arg_0, 1u); + uint x_13 = atomicAdd(sb_rw.inner.arg_0, 1u); res = x_13; return; } @@ -33,19 +37,23 @@ void main() { } #version 310 es +struct SB_RW_atomic { + uint arg_0; +}; + struct SB_RW { uint arg_0; }; -layout(binding = 0, std430) buffer SB_RW_atomic_ssbo { - uint arg_0; +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW_atomic inner; } sb_rw; void atomicAdd_8a199a() { uint arg_1 = 0u; uint res = 0u; arg_1 = 1u; - uint x_13 = atomicAdd(sb_rw.arg_0, 1u); + uint x_13 = atomicAdd(sb_rw.inner.arg_0, 1u); res = x_13; return; } diff --git a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm.expected.spvasm b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm.expected.spvasm index 17ebf7b797..182984faee 100644 --- a/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm.expected.spvasm +++ b/test/tint/builtins/atomics/from_gen/var/spvAtomicIncrement/storage_u32.spvasm.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 31 +; Bound: 32 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW_atomic "SB_RW_atomic" OpMemberName %SB_RW_atomic 0 "arg_0" OpName %sb_rw "sb_rw" @@ -19,50 +21,52 @@ OpName %fragment_main "fragment_main" OpName %compute_main_1 "compute_main_1" OpName %compute_main "compute_main" - OpDecorate %SB_RW_atomic Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW_atomic 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW_atomic = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW_atomic = OpTypePointer StorageBuffer %SB_RW_atomic - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW_atomic StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW_atomic +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %9 = OpConstantNull %uint + %6 = OpTypeFunction %void + %10 = OpConstantNull %uint %_ptr_Function_uint = OpTypePointer Function %uint %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicAdd_8a199a = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_uint Function %9 - %res = OpVariable %_ptr_Function_uint Function %9 - OpStore %arg_1 %9 - OpStore %res %9 +%atomicAdd_8a199a = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %10 + %res = OpVariable %_ptr_Function_uint Function %10 + OpStore %arg_1 %10 + OpStore %res %10 OpStore %arg_1 %uint_1 - %18 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %14 = OpAtomicIAdd %uint %18 %uint_1 %uint_0 %uint_1 - OpStore %res %14 + %19 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %15 = OpAtomicIAdd %uint %19 %uint_1 %uint_0 %uint_1 + OpStore %res %15 OpReturn OpFunctionEnd -%fragment_main_1 = OpFunction %void None %5 - %20 = OpLabel - %21 = OpFunctionCall %void %atomicAdd_8a199a +%fragment_main_1 = OpFunction %void None %6 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicAdd_8a199a OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %23 = OpLabel - %24 = OpFunctionCall %void %fragment_main_1 +%fragment_main = OpFunction %void None %6 + %24 = OpLabel + %25 = OpFunctionCall %void %fragment_main_1 OpReturn OpFunctionEnd -%compute_main_1 = OpFunction %void None %5 - %26 = OpLabel - %27 = OpFunctionCall %void %atomicAdd_8a199a +%compute_main_1 = OpFunction %void None %6 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicAdd_8a199a OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %29 = OpLabel - %30 = OpFunctionCall %void %compute_main_1 +%compute_main = OpFunction %void None %6 + %30 = OpLabel + %31 = OpFunctionCall %void %compute_main_1 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicAdd/8a199a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicAdd/8a199a.wgsl.expected.glsl index 17d00401e9..2eb8995336 100644 --- a/test/tint/builtins/gen/literal/atomicAdd/8a199a.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/atomicAdd/8a199a.wgsl.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicAdd_8a199a() { - uint res = atomicAdd(sb_rw.arg_0, 1u); + uint res = atomicAdd(sb_rw.inner.arg_0, 1u); } void fragment_main() { @@ -19,12 +23,16 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicAdd_8a199a() { - uint res = atomicAdd(sb_rw.arg_0, 1u); + uint res = atomicAdd(sb_rw.inner.arg_0, 1u); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/atomicAdd/8a199a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicAdd/8a199a.wgsl.expected.spvasm index 399663595f..76f0c18fc7 100644 --- a/test/tint/builtins/gen/literal/atomicAdd/8a199a.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/atomicAdd/8a199a.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 25 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -16,36 +18,38 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %_ptr_Function_uint = OpTypePointer Function %uint - %17 = OpConstantNull %uint -%atomicAdd_8a199a = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %17 - %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %9 = OpAtomicIAdd %uint %14 %uint_1 %uint_0 %uint_1 - OpStore %res %9 + %18 = OpConstantNull %uint +%atomicAdd_8a199a = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %18 + %15 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %10 = OpAtomicIAdd %uint %15 %uint_1 %uint_0 %uint_1 + OpStore %res %10 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %19 = OpLabel - %20 = OpFunctionCall %void %atomicAdd_8a199a +%fragment_main = OpFunction %void None %6 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicAdd_8a199a OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %22 = OpLabel - %23 = OpFunctionCall %void %atomicAdd_8a199a +%compute_main = OpFunction %void None %6 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicAdd_8a199a OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicAdd/d32fe4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicAdd/d32fe4.wgsl.expected.glsl index 494e26cb56..e2bf8cba96 100644 --- a/test/tint/builtins/gen/literal/atomicAdd/d32fe4.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/atomicAdd/d32fe4.wgsl.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicAdd_d32fe4() { - int res = atomicAdd(sb_rw.arg_0, 1); + int res = atomicAdd(sb_rw.inner.arg_0, 1); } void fragment_main() { @@ -19,12 +23,16 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicAdd_d32fe4() { - int res = atomicAdd(sb_rw.arg_0, 1); + int res = atomicAdd(sb_rw.inner.arg_0, 1); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/atomicAdd/d32fe4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicAdd/d32fe4.wgsl.expected.spvasm index 11672382dd..05c10590a0 100644 --- a/test/tint/builtins/gen/literal/atomicAdd/d32fe4.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/atomicAdd/d32fe4.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 26 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -16,38 +18,40 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_1 = OpConstant %int 1 %_ptr_Function_int = OpTypePointer Function %int - %19 = OpConstantNull %int -%atomicAdd_d32fe4 = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_int Function %19 - %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %9 = OpAtomicIAdd %int %15 %uint_1 %uint_0 %int_1 - OpStore %res %9 + %20 = OpConstantNull %int +%atomicAdd_d32fe4 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_int Function %20 + %16 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %10 = OpAtomicIAdd %int %16 %uint_1 %uint_0 %int_1 + OpStore %res %10 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicAdd_d32fe4 +%fragment_main = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicAdd_d32fe4 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %atomicAdd_d32fe4 +%compute_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicAdd_d32fe4 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicAnd/152966.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicAnd/152966.wgsl.expected.glsl index d1d9eeedc5..9a0182c5c6 100644 --- a/test/tint/builtins/gen/literal/atomicAnd/152966.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/atomicAnd/152966.wgsl.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicAnd_152966() { - int res = atomicAnd(sb_rw.arg_0, 1); + int res = atomicAnd(sb_rw.inner.arg_0, 1); } void fragment_main() { @@ -19,12 +23,16 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicAnd_152966() { - int res = atomicAnd(sb_rw.arg_0, 1); + int res = atomicAnd(sb_rw.inner.arg_0, 1); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/atomicAnd/152966.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicAnd/152966.wgsl.expected.spvasm index ee4f5dc18f..7c9d531ed4 100644 --- a/test/tint/builtins/gen/literal/atomicAnd/152966.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/atomicAnd/152966.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 26 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -16,38 +18,40 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_1 = OpConstant %int 1 %_ptr_Function_int = OpTypePointer Function %int - %19 = OpConstantNull %int -%atomicAnd_152966 = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_int Function %19 - %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %9 = OpAtomicAnd %int %15 %uint_1 %uint_0 %int_1 - OpStore %res %9 + %20 = OpConstantNull %int +%atomicAnd_152966 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_int Function %20 + %16 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %10 = OpAtomicAnd %int %16 %uint_1 %uint_0 %int_1 + OpStore %res %10 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicAnd_152966 +%fragment_main = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicAnd_152966 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %atomicAnd_152966 +%compute_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicAnd_152966 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicAnd/85a8d9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicAnd/85a8d9.wgsl.expected.glsl index 4a93dfbc49..44a7103a50 100644 --- a/test/tint/builtins/gen/literal/atomicAnd/85a8d9.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/atomicAnd/85a8d9.wgsl.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicAnd_85a8d9() { - uint res = atomicAnd(sb_rw.arg_0, 1u); + uint res = atomicAnd(sb_rw.inner.arg_0, 1u); } void fragment_main() { @@ -19,12 +23,16 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicAnd_85a8d9() { - uint res = atomicAnd(sb_rw.arg_0, 1u); + uint res = atomicAnd(sb_rw.inner.arg_0, 1u); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/atomicAnd/85a8d9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicAnd/85a8d9.wgsl.expected.spvasm index e45402c051..a53fd942e2 100644 --- a/test/tint/builtins/gen/literal/atomicAnd/85a8d9.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/atomicAnd/85a8d9.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 25 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -16,36 +18,38 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %_ptr_Function_uint = OpTypePointer Function %uint - %17 = OpConstantNull %uint -%atomicAnd_85a8d9 = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %17 - %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %9 = OpAtomicAnd %uint %14 %uint_1 %uint_0 %uint_1 - OpStore %res %9 + %18 = OpConstantNull %uint +%atomicAnd_85a8d9 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %18 + %15 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %10 = OpAtomicAnd %uint %15 %uint_1 %uint_0 %uint_1 + OpStore %res %10 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %19 = OpLabel - %20 = OpFunctionCall %void %atomicAnd_85a8d9 +%fragment_main = OpFunction %void None %6 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicAnd_85a8d9 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %22 = OpLabel - %23 = OpFunctionCall %void %atomicAnd_85a8d9 +%compute_main = OpFunction %void None %6 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicAnd_85a8d9 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl.expected.glsl index 6823d69449..1689b5975e 100644 --- a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl.expected.glsl @@ -7,13 +7,17 @@ struct atomic_compare_exchange_resulti32 { }; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicCompareExchangeWeak_1bd40a() { atomic_compare_exchange_resulti32 atomic_compare_result; - atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, 1, 1); + atomic_compare_result.old_value = atomicCompSwap(sb_rw.inner.arg_0, 1, 1); atomic_compare_result.exchanged = atomic_compare_result.old_value == 1; atomic_compare_exchange_resulti32 res = atomic_compare_result; } @@ -34,13 +38,17 @@ struct atomic_compare_exchange_resulti32 { }; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicCompareExchangeWeak_1bd40a() { atomic_compare_exchange_resulti32 atomic_compare_result; - atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, 1, 1); + atomic_compare_result.old_value = atomicCompSwap(sb_rw.inner.arg_0, 1, 1); atomic_compare_result.exchanged = atomic_compare_result.old_value == 1; atomic_compare_exchange_resulti32 res = atomic_compare_result; } diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl.expected.spvasm index 454abb1a57..597b8974ea 100644 --- a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/1bd40a.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 30 +; Bound: 31 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -19,7 +21,8 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 @@ -27,10 +30,11 @@ OpMemberDecorate %__atomic_compare_exchange_resulti32 1 Offset 4 %int = OpTypeInt 32 1 %SB_RW = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %bool = OpTypeBool %__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool %uint = OpTypeInt 32 0 @@ -39,24 +43,24 @@ %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_1 = OpConstant %int 1 %_ptr_Function___atomic_compare_exchange_resulti32 = OpTypePointer Function %__atomic_compare_exchange_resulti32 - %23 = OpConstantNull %__atomic_compare_exchange_resulti32 -%atomicCompareExchangeWeak_1bd40a = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function___atomic_compare_exchange_resulti32 Function %23 - %17 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %19 = OpAtomicCompareExchange %int %17 %uint_1 %uint_0 %uint_0 %int_1 %int_1 - %20 = OpIEqual %bool %19 %int_1 - %9 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %19 %20 - OpStore %res %9 + %24 = OpConstantNull %__atomic_compare_exchange_resulti32 +%atomicCompareExchangeWeak_1bd40a = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function___atomic_compare_exchange_resulti32 Function %24 + %18 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %20 = OpAtomicCompareExchange %int %18 %uint_1 %uint_0 %uint_0 %int_1 %int_1 + %21 = OpIEqual %bool %20 %int_1 + %10 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %20 %21 + OpStore %res %10 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %25 = OpLabel - %26 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a +%fragment_main = OpFunction %void None %6 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %28 = OpLabel - %29 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a +%compute_main = OpFunction %void None %6 + %29 = OpLabel + %30 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl.expected.glsl index e27f02e291..387962706f 100644 --- a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl.expected.glsl @@ -7,13 +7,17 @@ struct atomic_compare_exchange_resultu32 { }; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicCompareExchangeWeak_63d8e6() { atomic_compare_exchange_resultu32 atomic_compare_result; - atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, 1u, 1u); + atomic_compare_result.old_value = atomicCompSwap(sb_rw.inner.arg_0, 1u, 1u); atomic_compare_result.exchanged = atomic_compare_result.old_value == 1u; atomic_compare_exchange_resultu32 res = atomic_compare_result; } @@ -34,13 +38,17 @@ struct atomic_compare_exchange_resultu32 { }; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicCompareExchangeWeak_63d8e6() { atomic_compare_exchange_resultu32 atomic_compare_result; - atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, 1u, 1u); + atomic_compare_result.old_value = atomicCompSwap(sb_rw.inner.arg_0, 1u, 1u); atomic_compare_result.exchanged = atomic_compare_result.old_value == 1u; atomic_compare_exchange_resultu32 res = atomic_compare_result; } diff --git a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl.expected.spvasm index 09e83a0ae1..6d95811d6c 100644 --- a/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/atomicCompareExchangeWeak/63d8e6.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 28 +; Bound: 29 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -19,7 +21,8 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 @@ -27,34 +30,35 @@ OpMemberDecorate %__atomic_compare_exchange_resultu32 1 Offset 4 %uint = OpTypeInt 32 0 %SB_RW = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %bool = OpTypeBool %__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %_ptr_Function___atomic_compare_exchange_resultu32 = OpTypePointer Function %__atomic_compare_exchange_resultu32 - %21 = OpConstantNull %__atomic_compare_exchange_resultu32 -%atomicCompareExchangeWeak_63d8e6 = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function___atomic_compare_exchange_resultu32 Function %21 - %16 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %17 = OpAtomicCompareExchange %uint %16 %uint_1 %uint_0 %uint_0 %uint_1 %uint_1 - %18 = OpIEqual %bool %17 %uint_1 - %9 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %17 %18 - OpStore %res %9 + %22 = OpConstantNull %__atomic_compare_exchange_resultu32 +%atomicCompareExchangeWeak_63d8e6 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function___atomic_compare_exchange_resultu32 Function %22 + %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %18 = OpAtomicCompareExchange %uint %17 %uint_1 %uint_0 %uint_0 %uint_1 %uint_1 + %19 = OpIEqual %bool %18 %uint_1 + %10 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %18 %19 + OpStore %res %10 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %23 = OpLabel - %24 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 +%fragment_main = OpFunction %void None %6 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %26 = OpLabel - %27 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 +%compute_main = OpFunction %void None %6 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicExchange/d59712.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicExchange/d59712.wgsl.expected.glsl index 12b23de8be..9e347a95f6 100644 --- a/test/tint/builtins/gen/literal/atomicExchange/d59712.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/atomicExchange/d59712.wgsl.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicExchange_d59712() { - uint res = atomicExchange(sb_rw.arg_0, 1u); + uint res = atomicExchange(sb_rw.inner.arg_0, 1u); } void fragment_main() { @@ -19,12 +23,16 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicExchange_d59712() { - uint res = atomicExchange(sb_rw.arg_0, 1u); + uint res = atomicExchange(sb_rw.inner.arg_0, 1u); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/atomicExchange/d59712.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicExchange/d59712.wgsl.expected.spvasm index bdd9e1de57..02192b5159 100644 --- a/test/tint/builtins/gen/literal/atomicExchange/d59712.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/atomicExchange/d59712.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 25 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -16,36 +18,38 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %_ptr_Function_uint = OpTypePointer Function %uint - %17 = OpConstantNull %uint -%atomicExchange_d59712 = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %17 - %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %9 = OpAtomicExchange %uint %14 %uint_1 %uint_0 %uint_1 - OpStore %res %9 + %18 = OpConstantNull %uint +%atomicExchange_d59712 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %18 + %15 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %10 = OpAtomicExchange %uint %15 %uint_1 %uint_0 %uint_1 + OpStore %res %10 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %19 = OpLabel - %20 = OpFunctionCall %void %atomicExchange_d59712 +%fragment_main = OpFunction %void None %6 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicExchange_d59712 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %22 = OpLabel - %23 = OpFunctionCall %void %atomicExchange_d59712 +%compute_main = OpFunction %void None %6 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicExchange_d59712 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicExchange/f2e22f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicExchange/f2e22f.wgsl.expected.glsl index c9131e2257..f9f85dbc36 100644 --- a/test/tint/builtins/gen/literal/atomicExchange/f2e22f.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/atomicExchange/f2e22f.wgsl.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicExchange_f2e22f() { - int res = atomicExchange(sb_rw.arg_0, 1); + int res = atomicExchange(sb_rw.inner.arg_0, 1); } void fragment_main() { @@ -19,12 +23,16 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicExchange_f2e22f() { - int res = atomicExchange(sb_rw.arg_0, 1); + int res = atomicExchange(sb_rw.inner.arg_0, 1); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/atomicExchange/f2e22f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicExchange/f2e22f.wgsl.expected.spvasm index c4f71e9285..5ab9322e3d 100644 --- a/test/tint/builtins/gen/literal/atomicExchange/f2e22f.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/atomicExchange/f2e22f.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 26 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -16,38 +18,40 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_1 = OpConstant %int 1 %_ptr_Function_int = OpTypePointer Function %int - %19 = OpConstantNull %int -%atomicExchange_f2e22f = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_int Function %19 - %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %9 = OpAtomicExchange %int %15 %uint_1 %uint_0 %int_1 - OpStore %res %9 + %20 = OpConstantNull %int +%atomicExchange_f2e22f = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_int Function %20 + %16 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %10 = OpAtomicExchange %int %16 %uint_1 %uint_0 %int_1 + OpStore %res %10 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicExchange_f2e22f +%fragment_main = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicExchange_f2e22f OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %atomicExchange_f2e22f +%compute_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicExchange_f2e22f OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicLoad/0806ad.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicLoad/0806ad.wgsl.expected.glsl index 64291f3d3b..f9f7949b2e 100644 --- a/test/tint/builtins/gen/literal/atomicLoad/0806ad.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/atomicLoad/0806ad.wgsl.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicLoad_0806ad() { - int res = atomicOr(sb_rw.arg_0, 0); + int res = atomicOr(sb_rw.inner.arg_0, 0); } void fragment_main() { @@ -19,12 +23,16 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicLoad_0806ad() { - int res = atomicOr(sb_rw.arg_0, 0); + int res = atomicOr(sb_rw.inner.arg_0, 0); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/atomicLoad/0806ad.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicLoad/0806ad.wgsl.expected.spvasm index d961ea5c86..0a09d9dbb9 100644 --- a/test/tint/builtins/gen/literal/atomicLoad/0806ad.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/atomicLoad/0806ad.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 25 +; Bound: 26 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -16,37 +18,39 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_Function_int = OpTypePointer Function %int - %18 = OpConstantNull %int -%atomicLoad_0806ad = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_int Function %18 - %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %9 = OpAtomicLoad %int %15 %uint_1 %uint_0 - OpStore %res %9 + %19 = OpConstantNull %int +%atomicLoad_0806ad = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_int Function %19 + %16 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %10 = OpAtomicLoad %int %16 %uint_1 %uint_0 + OpStore %res %10 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %20 = OpLabel - %21 = OpFunctionCall %void %atomicLoad_0806ad +%fragment_main = OpFunction %void None %6 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicLoad_0806ad OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %23 = OpLabel - %24 = OpFunctionCall %void %atomicLoad_0806ad +%compute_main = OpFunction %void None %6 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicLoad_0806ad OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicLoad/fe6cc3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicLoad/fe6cc3.wgsl.expected.glsl index f17c51888b..eaede54c90 100644 --- a/test/tint/builtins/gen/literal/atomicLoad/fe6cc3.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/atomicLoad/fe6cc3.wgsl.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicLoad_fe6cc3() { - uint res = atomicOr(sb_rw.arg_0, 0u); + uint res = atomicOr(sb_rw.inner.arg_0, 0u); } void fragment_main() { @@ -19,12 +23,16 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicLoad_fe6cc3() { - uint res = atomicOr(sb_rw.arg_0, 0u); + uint res = atomicOr(sb_rw.inner.arg_0, 0u); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/atomicLoad/fe6cc3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicLoad/fe6cc3.wgsl.expected.spvasm index 776c62c09f..d1efbaa63a 100644 --- a/test/tint/builtins/gen/literal/atomicLoad/fe6cc3.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/atomicLoad/fe6cc3.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 25 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -16,36 +18,38 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %_ptr_Function_uint = OpTypePointer Function %uint - %17 = OpConstantNull %uint -%atomicLoad_fe6cc3 = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %17 - %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %9 = OpAtomicLoad %uint %14 %uint_1 %uint_0 - OpStore %res %9 + %18 = OpConstantNull %uint +%atomicLoad_fe6cc3 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %18 + %15 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %10 = OpAtomicLoad %uint %15 %uint_1 %uint_0 + OpStore %res %10 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %19 = OpLabel - %20 = OpFunctionCall %void %atomicLoad_fe6cc3 +%fragment_main = OpFunction %void None %6 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicLoad_fe6cc3 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %22 = OpLabel - %23 = OpFunctionCall %void %atomicLoad_fe6cc3 +%compute_main = OpFunction %void None %6 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicLoad_fe6cc3 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicMax/51b9be.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicMax/51b9be.wgsl.expected.glsl index 3f16d51e66..ff65321923 100644 --- a/test/tint/builtins/gen/literal/atomicMax/51b9be.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/atomicMax/51b9be.wgsl.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicMax_51b9be() { - uint res = atomicMax(sb_rw.arg_0, 1u); + uint res = atomicMax(sb_rw.inner.arg_0, 1u); } void fragment_main() { @@ -19,12 +23,16 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicMax_51b9be() { - uint res = atomicMax(sb_rw.arg_0, 1u); + uint res = atomicMax(sb_rw.inner.arg_0, 1u); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/atomicMax/51b9be.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicMax/51b9be.wgsl.expected.spvasm index 7fb135e806..f4de1ba39f 100644 --- a/test/tint/builtins/gen/literal/atomicMax/51b9be.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/atomicMax/51b9be.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 25 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -16,36 +18,38 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %_ptr_Function_uint = OpTypePointer Function %uint - %17 = OpConstantNull %uint -%atomicMax_51b9be = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %17 - %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %9 = OpAtomicUMax %uint %14 %uint_1 %uint_0 %uint_1 - OpStore %res %9 + %18 = OpConstantNull %uint +%atomicMax_51b9be = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %18 + %15 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %10 = OpAtomicUMax %uint %15 %uint_1 %uint_0 %uint_1 + OpStore %res %10 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %19 = OpLabel - %20 = OpFunctionCall %void %atomicMax_51b9be +%fragment_main = OpFunction %void None %6 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicMax_51b9be OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %22 = OpLabel - %23 = OpFunctionCall %void %atomicMax_51b9be +%compute_main = OpFunction %void None %6 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicMax_51b9be OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicMax/92aa72.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicMax/92aa72.wgsl.expected.glsl index 1b3e247fcc..1bc71bdeb8 100644 --- a/test/tint/builtins/gen/literal/atomicMax/92aa72.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/atomicMax/92aa72.wgsl.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicMax_92aa72() { - int res = atomicMax(sb_rw.arg_0, 1); + int res = atomicMax(sb_rw.inner.arg_0, 1); } void fragment_main() { @@ -19,12 +23,16 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicMax_92aa72() { - int res = atomicMax(sb_rw.arg_0, 1); + int res = atomicMax(sb_rw.inner.arg_0, 1); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/atomicMax/92aa72.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicMax/92aa72.wgsl.expected.spvasm index 82be997072..5d953fa60b 100644 --- a/test/tint/builtins/gen/literal/atomicMax/92aa72.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/atomicMax/92aa72.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 26 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -16,38 +18,40 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_1 = OpConstant %int 1 %_ptr_Function_int = OpTypePointer Function %int - %19 = OpConstantNull %int -%atomicMax_92aa72 = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_int Function %19 - %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %9 = OpAtomicSMax %int %15 %uint_1 %uint_0 %int_1 - OpStore %res %9 + %20 = OpConstantNull %int +%atomicMax_92aa72 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_int Function %20 + %16 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %10 = OpAtomicSMax %int %16 %uint_1 %uint_0 %int_1 + OpStore %res %10 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicMax_92aa72 +%fragment_main = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicMax_92aa72 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %atomicMax_92aa72 +%compute_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicMax_92aa72 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicMin/8e38dc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicMin/8e38dc.wgsl.expected.glsl index ea043dd1b3..e4f42fc730 100644 --- a/test/tint/builtins/gen/literal/atomicMin/8e38dc.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/atomicMin/8e38dc.wgsl.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicMin_8e38dc() { - int res = atomicMin(sb_rw.arg_0, 1); + int res = atomicMin(sb_rw.inner.arg_0, 1); } void fragment_main() { @@ -19,12 +23,16 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicMin_8e38dc() { - int res = atomicMin(sb_rw.arg_0, 1); + int res = atomicMin(sb_rw.inner.arg_0, 1); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/atomicMin/8e38dc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicMin/8e38dc.wgsl.expected.spvasm index 660547b5d5..390d1ad2d4 100644 --- a/test/tint/builtins/gen/literal/atomicMin/8e38dc.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/atomicMin/8e38dc.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 26 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -16,38 +18,40 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_1 = OpConstant %int 1 %_ptr_Function_int = OpTypePointer Function %int - %19 = OpConstantNull %int -%atomicMin_8e38dc = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_int Function %19 - %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %9 = OpAtomicSMin %int %15 %uint_1 %uint_0 %int_1 - OpStore %res %9 + %20 = OpConstantNull %int +%atomicMin_8e38dc = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_int Function %20 + %16 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %10 = OpAtomicSMin %int %16 %uint_1 %uint_0 %int_1 + OpStore %res %10 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicMin_8e38dc +%fragment_main = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicMin_8e38dc OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %atomicMin_8e38dc +%compute_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicMin_8e38dc OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicMin/c67a74.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicMin/c67a74.wgsl.expected.glsl index 588b83fcd1..ebca96615c 100644 --- a/test/tint/builtins/gen/literal/atomicMin/c67a74.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/atomicMin/c67a74.wgsl.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicMin_c67a74() { - uint res = atomicMin(sb_rw.arg_0, 1u); + uint res = atomicMin(sb_rw.inner.arg_0, 1u); } void fragment_main() { @@ -19,12 +23,16 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicMin_c67a74() { - uint res = atomicMin(sb_rw.arg_0, 1u); + uint res = atomicMin(sb_rw.inner.arg_0, 1u); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/atomicMin/c67a74.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicMin/c67a74.wgsl.expected.spvasm index 0ed9315fd9..9f8faeee21 100644 --- a/test/tint/builtins/gen/literal/atomicMin/c67a74.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/atomicMin/c67a74.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 25 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -16,36 +18,38 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %_ptr_Function_uint = OpTypePointer Function %uint - %17 = OpConstantNull %uint -%atomicMin_c67a74 = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %17 - %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %9 = OpAtomicUMin %uint %14 %uint_1 %uint_0 %uint_1 - OpStore %res %9 + %18 = OpConstantNull %uint +%atomicMin_c67a74 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %18 + %15 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %10 = OpAtomicUMin %uint %15 %uint_1 %uint_0 %uint_1 + OpStore %res %10 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %19 = OpLabel - %20 = OpFunctionCall %void %atomicMin_c67a74 +%fragment_main = OpFunction %void None %6 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicMin_c67a74 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %22 = OpLabel - %23 = OpFunctionCall %void %atomicMin_c67a74 +%compute_main = OpFunction %void None %6 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicMin_c67a74 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicOr/5e95d4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicOr/5e95d4.wgsl.expected.glsl index 7bc55f0b93..e33106572b 100644 --- a/test/tint/builtins/gen/literal/atomicOr/5e95d4.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/atomicOr/5e95d4.wgsl.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicOr_5e95d4() { - uint res = atomicOr(sb_rw.arg_0, 1u); + uint res = atomicOr(sb_rw.inner.arg_0, 1u); } void fragment_main() { @@ -19,12 +23,16 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicOr_5e95d4() { - uint res = atomicOr(sb_rw.arg_0, 1u); + uint res = atomicOr(sb_rw.inner.arg_0, 1u); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/atomicOr/5e95d4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicOr/5e95d4.wgsl.expected.spvasm index 4778bc871a..8827ecb8f3 100644 --- a/test/tint/builtins/gen/literal/atomicOr/5e95d4.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/atomicOr/5e95d4.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 25 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -16,36 +18,38 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %_ptr_Function_uint = OpTypePointer Function %uint - %17 = OpConstantNull %uint -%atomicOr_5e95d4 = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %17 - %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %9 = OpAtomicOr %uint %14 %uint_1 %uint_0 %uint_1 - OpStore %res %9 + %18 = OpConstantNull %uint +%atomicOr_5e95d4 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %18 + %15 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %10 = OpAtomicOr %uint %15 %uint_1 %uint_0 %uint_1 + OpStore %res %10 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %19 = OpLabel - %20 = OpFunctionCall %void %atomicOr_5e95d4 +%fragment_main = OpFunction %void None %6 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicOr_5e95d4 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %22 = OpLabel - %23 = OpFunctionCall %void %atomicOr_5e95d4 +%compute_main = OpFunction %void None %6 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicOr_5e95d4 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicOr/8d96a0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicOr/8d96a0.wgsl.expected.glsl index baad60df00..5e69601fa1 100644 --- a/test/tint/builtins/gen/literal/atomicOr/8d96a0.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/atomicOr/8d96a0.wgsl.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicOr_8d96a0() { - int res = atomicOr(sb_rw.arg_0, 1); + int res = atomicOr(sb_rw.inner.arg_0, 1); } void fragment_main() { @@ -19,12 +23,16 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicOr_8d96a0() { - int res = atomicOr(sb_rw.arg_0, 1); + int res = atomicOr(sb_rw.inner.arg_0, 1); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/atomicOr/8d96a0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicOr/8d96a0.wgsl.expected.spvasm index 1bf00f2122..3d6d68f466 100644 --- a/test/tint/builtins/gen/literal/atomicOr/8d96a0.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/atomicOr/8d96a0.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 26 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -16,38 +18,40 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_1 = OpConstant %int 1 %_ptr_Function_int = OpTypePointer Function %int - %19 = OpConstantNull %int -%atomicOr_8d96a0 = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_int Function %19 - %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %9 = OpAtomicOr %int %15 %uint_1 %uint_0 %int_1 - OpStore %res %9 + %20 = OpConstantNull %int +%atomicOr_8d96a0 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_int Function %20 + %16 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %10 = OpAtomicOr %int %16 %uint_1 %uint_0 %int_1 + OpStore %res %10 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicOr_8d96a0 +%fragment_main = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicOr_8d96a0 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %atomicOr_8d96a0 +%compute_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicOr_8d96a0 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicStore/cdc29e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicStore/cdc29e.wgsl.expected.glsl index f1b5526fb7..ae57eaa58d 100644 --- a/test/tint/builtins/gen/literal/atomicStore/cdc29e.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/atomicStore/cdc29e.wgsl.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicStore_cdc29e() { - atomicExchange(sb_rw.arg_0, 1u); + atomicExchange(sb_rw.inner.arg_0, 1u); } void fragment_main() { @@ -19,12 +23,16 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicStore_cdc29e() { - atomicExchange(sb_rw.arg_0, 1u); + atomicExchange(sb_rw.inner.arg_0, 1u); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/atomicStore/cdc29e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicStore/cdc29e.wgsl.expected.spvasm index 97adea0c19..340f0a1cc8 100644 --- a/test/tint/builtins/gen/literal/atomicStore/cdc29e.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/atomicStore/cdc29e.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 21 +; Bound: 22 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,38 +9,42 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" OpName %atomicStore_cdc29e "atomicStore_cdc29e" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicStore_cdc29e = OpFunction %void None %5 - %8 = OpLabel - %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - OpAtomicStore %14 %uint_1 %uint_0 %uint_1 +%atomicStore_cdc29e = OpFunction %void None %6 + %9 = OpLabel + %15 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + OpAtomicStore %15 %uint_1 %uint_0 %uint_1 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %16 = OpLabel - %17 = OpFunctionCall %void %atomicStore_cdc29e +%fragment_main = OpFunction %void None %6 + %17 = OpLabel + %18 = OpFunctionCall %void %atomicStore_cdc29e OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %19 = OpLabel - %20 = OpFunctionCall %void %atomicStore_cdc29e +%compute_main = OpFunction %void None %6 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicStore_cdc29e OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicStore/d1e9a6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicStore/d1e9a6.wgsl.expected.glsl index 95dc6eacc6..8dc900ebf7 100644 --- a/test/tint/builtins/gen/literal/atomicStore/d1e9a6.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/atomicStore/d1e9a6.wgsl.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicStore_d1e9a6() { - atomicExchange(sb_rw.arg_0, 1); + atomicExchange(sb_rw.inner.arg_0, 1); } void fragment_main() { @@ -19,12 +23,16 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicStore_d1e9a6() { - atomicExchange(sb_rw.arg_0, 1); + atomicExchange(sb_rw.inner.arg_0, 1); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/atomicStore/d1e9a6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicStore/d1e9a6.wgsl.expected.spvasm index a4714333c3..56551ad29a 100644 --- a/test/tint/builtins/gen/literal/atomicStore/d1e9a6.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/atomicStore/d1e9a6.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 23 +; Bound: 24 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,40 +9,44 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" OpName %atomicStore_d1e9a6 "atomicStore_d1e9a6" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_1 = OpConstant %int 1 -%atomicStore_d1e9a6 = OpFunction %void None %5 - %8 = OpLabel - %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - OpAtomicStore %15 %uint_1 %uint_0 %int_1 +%atomicStore_d1e9a6 = OpFunction %void None %6 + %9 = OpLabel + %16 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + OpAtomicStore %16 %uint_1 %uint_0 %int_1 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %18 = OpLabel - %19 = OpFunctionCall %void %atomicStore_d1e9a6 +%fragment_main = OpFunction %void None %6 + %19 = OpLabel + %20 = OpFunctionCall %void %atomicStore_d1e9a6 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicStore_d1e9a6 +%compute_main = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicStore_d1e9a6 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicSub/051100.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicSub/051100.wgsl.expected.glsl index 1969c4857c..427252a92d 100644 --- a/test/tint/builtins/gen/literal/atomicSub/051100.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/atomicSub/051100.wgsl.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicSub_051100() { - int res = atomicAdd(sb_rw.arg_0, 1); + int res = atomicAdd(sb_rw.inner.arg_0, 1); } void fragment_main() { @@ -19,12 +23,16 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicSub_051100() { - int res = atomicAdd(sb_rw.arg_0, 1); + int res = atomicAdd(sb_rw.inner.arg_0, 1); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/atomicSub/051100.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicSub/051100.wgsl.expected.spvasm index f4b9264241..3172c31876 100644 --- a/test/tint/builtins/gen/literal/atomicSub/051100.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/atomicSub/051100.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 26 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -16,38 +18,40 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_1 = OpConstant %int 1 %_ptr_Function_int = OpTypePointer Function %int - %19 = OpConstantNull %int -%atomicSub_051100 = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_int Function %19 - %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %9 = OpAtomicISub %int %15 %uint_1 %uint_0 %int_1 - OpStore %res %9 + %20 = OpConstantNull %int +%atomicSub_051100 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_int Function %20 + %16 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %10 = OpAtomicISub %int %16 %uint_1 %uint_0 %int_1 + OpStore %res %10 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicSub_051100 +%fragment_main = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicSub_051100 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %atomicSub_051100 +%compute_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicSub_051100 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicSub/15bfc9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicSub/15bfc9.wgsl.expected.glsl index 9881ff1806..2f798a807f 100644 --- a/test/tint/builtins/gen/literal/atomicSub/15bfc9.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/atomicSub/15bfc9.wgsl.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicSub_15bfc9() { - uint res = atomicAdd(sb_rw.arg_0, 1u); + uint res = atomicAdd(sb_rw.inner.arg_0, 1u); } void fragment_main() { @@ -19,12 +23,16 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicSub_15bfc9() { - uint res = atomicAdd(sb_rw.arg_0, 1u); + uint res = atomicAdd(sb_rw.inner.arg_0, 1u); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/atomicSub/15bfc9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicSub/15bfc9.wgsl.expected.spvasm index b7cd92d87a..2398ff06b2 100644 --- a/test/tint/builtins/gen/literal/atomicSub/15bfc9.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/atomicSub/15bfc9.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 25 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -16,36 +18,38 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %_ptr_Function_uint = OpTypePointer Function %uint - %17 = OpConstantNull %uint -%atomicSub_15bfc9 = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %17 - %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %9 = OpAtomicISub %uint %14 %uint_1 %uint_0 %uint_1 - OpStore %res %9 + %18 = OpConstantNull %uint +%atomicSub_15bfc9 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %18 + %15 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %10 = OpAtomicISub %uint %15 %uint_1 %uint_0 %uint_1 + OpStore %res %10 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %19 = OpLabel - %20 = OpFunctionCall %void %atomicSub_15bfc9 +%fragment_main = OpFunction %void None %6 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicSub_15bfc9 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %22 = OpLabel - %23 = OpFunctionCall %void %atomicSub_15bfc9 +%compute_main = OpFunction %void None %6 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicSub_15bfc9 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicXor/54510e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicXor/54510e.wgsl.expected.glsl index a69ee2d96f..ce9a83b1c7 100644 --- a/test/tint/builtins/gen/literal/atomicXor/54510e.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/atomicXor/54510e.wgsl.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicXor_54510e() { - uint res = atomicXor(sb_rw.arg_0, 1u); + uint res = atomicXor(sb_rw.inner.arg_0, 1u); } void fragment_main() { @@ -19,12 +23,16 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicXor_54510e() { - uint res = atomicXor(sb_rw.arg_0, 1u); + uint res = atomicXor(sb_rw.inner.arg_0, 1u); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/atomicXor/54510e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicXor/54510e.wgsl.expected.spvasm index 8b4ef2178f..58743e584e 100644 --- a/test/tint/builtins/gen/literal/atomicXor/54510e.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/atomicXor/54510e.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 25 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -16,36 +18,38 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %_ptr_Function_uint = OpTypePointer Function %uint - %17 = OpConstantNull %uint -%atomicXor_54510e = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %17 - %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %9 = OpAtomicXor %uint %14 %uint_1 %uint_0 %uint_1 - OpStore %res %9 + %18 = OpConstantNull %uint +%atomicXor_54510e = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %18 + %15 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %10 = OpAtomicXor %uint %15 %uint_1 %uint_0 %uint_1 + OpStore %res %10 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %19 = OpLabel - %20 = OpFunctionCall %void %atomicXor_54510e +%fragment_main = OpFunction %void None %6 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicXor_54510e OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %22 = OpLabel - %23 = OpFunctionCall %void %atomicXor_54510e +%compute_main = OpFunction %void None %6 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicXor_54510e OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/atomicXor/c1b78c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atomicXor/c1b78c.wgsl.expected.glsl index 4f11212d3b..5e44127c98 100644 --- a/test/tint/builtins/gen/literal/atomicXor/c1b78c.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/atomicXor/c1b78c.wgsl.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicXor_c1b78c() { - int res = atomicXor(sb_rw.arg_0, 1); + int res = atomicXor(sb_rw.inner.arg_0, 1); } void fragment_main() { @@ -19,12 +23,16 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicXor_c1b78c() { - int res = atomicXor(sb_rw.arg_0, 1); + int res = atomicXor(sb_rw.inner.arg_0, 1); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/atomicXor/c1b78c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atomicXor/c1b78c.wgsl.expected.spvasm index 98ac9c2b98..64443fd051 100644 --- a/test/tint/builtins/gen/literal/atomicXor/c1b78c.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/atomicXor/c1b78c.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 26 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -16,38 +18,40 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_1 = OpConstant %int 1 %_ptr_Function_int = OpTypePointer Function %int - %19 = OpConstantNull %int -%atomicXor_c1b78c = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_int Function %19 - %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %9 = OpAtomicXor %int %15 %uint_1 %uint_0 %int_1 - OpStore %res %9 + %20 = OpConstantNull %int +%atomicXor_c1b78c = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_int Function %20 + %16 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %10 = OpAtomicXor %int %16 %uint_1 %uint_0 %int_1 + OpStore %res %10 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicXor_c1b78c +%fragment_main = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicXor_c1b78c OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %atomicXor_c1b78c +%compute_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicXor_c1b78c OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/textureDimensions/cdc6c9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/cdc6c9.wgsl.expected.glsl index 61f4523d76..194a4bfa75 100644 --- a/test/tint/builtins/gen/literal/textureDimensions/cdc6c9.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/textureDimensions/cdc6c9.wgsl.expected.glsl @@ -11,13 +11,17 @@ struct GammaTransferParams { uint padding; }; -layout(binding = 2, std140) uniform ExternalTextureParams_ubo { +struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; +}; + +layout(binding = 2, std140) uniform ext_tex_params_block_ubo { + ExternalTextureParams inner; } ext_tex_params; uniform highp sampler2D arg_0_1; @@ -52,13 +56,17 @@ struct GammaTransferParams { uint padding; }; -layout(binding = 2, std140) uniform ExternalTextureParams_ubo { +struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; +}; + +layout(binding = 2, std140) uniform ext_tex_params_block_ubo { + ExternalTextureParams inner; } ext_tex_params; uniform highp sampler2D arg_0_1; @@ -87,13 +95,17 @@ struct GammaTransferParams { uint padding; }; -layout(binding = 2, std140) uniform ExternalTextureParams_ubo { +struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; +}; + +layout(binding = 2, std140) uniform ext_tex_params_block_ubo { + ExternalTextureParams inner; } ext_tex_params; uniform highp sampler2D arg_0_1; diff --git a/test/tint/builtins/gen/literal/textureDimensions/cdc6c9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureDimensions/cdc6c9.wgsl.expected.spvasm index a2f0f9468b..da1f2ab4bc 100644 --- a/test/tint/builtins/gen/literal/textureDimensions/cdc6c9.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/textureDimensions/cdc6c9.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 47 +; Bound: 48 ; Schema: 0 OpCapability Shader OpCapability ImageQuery @@ -14,6 +14,8 @@ OpName %value "value" OpName %vertex_point_size "vertex_point_size" OpName %ext_tex_plane_1 "ext_tex_plane_1" + OpName %ext_tex_params_block "ext_tex_params_block" + OpMemberName %ext_tex_params_block 0 "inner" OpName %ExternalTextureParams "ExternalTextureParams" OpMemberName %ExternalTextureParams 0 "numPlanes" OpMemberName %ExternalTextureParams 1 "doYuvToRgbConversionOnly" @@ -42,7 +44,8 @@ OpDecorate %vertex_point_size BuiltIn PointSize OpDecorate %ext_tex_plane_1 DescriptorSet 1 OpDecorate %ext_tex_plane_1 Binding 1 - OpDecorate %ExternalTextureParams Block + OpDecorate %ext_tex_params_block Block + OpMemberDecorate %ext_tex_params_block 0 Offset 0 OpMemberDecorate %ExternalTextureParams 0 Offset 0 OpMemberDecorate %ExternalTextureParams 1 Offset 4 OpMemberDecorate %ExternalTextureParams 2 Offset 16 @@ -83,45 +86,46 @@ %v3float = OpTypeVector %float 3 %mat3v3float = OpTypeMatrix %v3float 3 %ExternalTextureParams = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float -%_ptr_Uniform_ExternalTextureParams = OpTypePointer Uniform %ExternalTextureParams -%ext_tex_params = OpVariable %_ptr_Uniform_ExternalTextureParams Uniform +%ext_tex_params_block = OpTypeStruct %ExternalTextureParams +%_ptr_Uniform_ext_tex_params_block = OpTypePointer Uniform %ext_tex_params_block +%ext_tex_params = OpVariable %_ptr_Uniform_ext_tex_params_block Uniform %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant %void = OpTypeVoid - %21 = OpTypeFunction %void + %22 = OpTypeFunction %void %v2uint = OpTypeVector %uint 2 %int = OpTypeInt 32 1 %int_0 = OpConstant %int 0 %_ptr_Function_v2uint = OpTypePointer Function %v2uint - %32 = OpConstantNull %v2uint - %33 = OpTypeFunction %v4float + %33 = OpConstantNull %v2uint + %34 = OpTypeFunction %v4float %float_1 = OpConstant %float 1 -%textureDimensions_cdc6c9 = OpFunction %void None %21 - %24 = OpLabel - %res = OpVariable %_ptr_Function_v2uint Function %32 - %27 = OpLoad %11 %arg_0 - %25 = OpImageQuerySizeLod %v2uint %27 %int_0 - OpStore %res %25 +%textureDimensions_cdc6c9 = OpFunction %void None %22 + %25 = OpLabel + %res = OpVariable %_ptr_Function_v2uint Function %33 + %28 = OpLoad %11 %arg_0 + %26 = OpImageQuerySizeLod %v2uint %28 %int_0 + OpStore %res %26 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %33 - %35 = OpLabel - %36 = OpFunctionCall %void %textureDimensions_cdc6c9 +%vertex_main_inner = OpFunction %v4float None %34 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_cdc6c9 OpReturnValue %5 OpFunctionEnd -%vertex_main = OpFunction %void None %21 - %38 = OpLabel - %39 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %39 +%vertex_main = OpFunction %void None %22 + %39 = OpLabel + %40 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %40 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %21 - %42 = OpLabel - %43 = OpFunctionCall %void %textureDimensions_cdc6c9 +%fragment_main = OpFunction %void None %22 + %43 = OpLabel + %44 = OpFunctionCall %void %textureDimensions_cdc6c9 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %21 - %45 = OpLabel - %46 = OpFunctionCall %void %textureDimensions_cdc6c9 +%compute_main = OpFunction %void None %22 + %46 = OpLabel + %47 = OpFunctionCall %void %textureDimensions_cdc6c9 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.glsl index 1d00210884..97960c2ce3 100644 --- a/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.glsl @@ -1,13 +1,17 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicAdd_8a199a() { uint arg_1 = 1u; - uint res = atomicAdd(sb_rw.arg_0, arg_1); + uint res = atomicAdd(sb_rw.inner.arg_0, arg_1); } void fragment_main() { @@ -20,13 +24,17 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicAdd_8a199a() { uint arg_1 = 1u; - uint res = atomicAdd(sb_rw.arg_0, arg_1); + uint res = atomicAdd(sb_rw.inner.arg_0, arg_1); } void compute_main() { diff --git a/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.spvasm index 98d9690d34..6a83c18c5f 100644 --- a/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 26 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -17,39 +19,41 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint_1 = OpConstant %uint 1 %_ptr_Function_uint = OpTypePointer Function %uint - %12 = OpConstantNull %uint + %13 = OpConstantNull %uint %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicAdd_8a199a = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_uint Function %12 - %res = OpVariable %_ptr_Function_uint Function %12 +%atomicAdd_8a199a = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 OpStore %arg_1 %uint_1 - %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %18 = OpLoad %uint %arg_1 - %13 = OpAtomicIAdd %uint %17 %uint_1 %uint_0 %18 - OpStore %res %13 + %18 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %19 = OpLoad %uint %arg_1 + %14 = OpAtomicIAdd %uint %18 %uint_1 %uint_0 %19 + OpStore %res %14 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicAdd_8a199a +%fragment_main = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicAdd_8a199a OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %atomicAdd_8a199a +%compute_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicAdd_8a199a OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.glsl index 35d22b2def..ca204686bb 100644 --- a/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.glsl @@ -1,13 +1,17 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicAdd_d32fe4() { int arg_1 = 1; - int res = atomicAdd(sb_rw.arg_0, arg_1); + int res = atomicAdd(sb_rw.inner.arg_0, arg_1); } void fragment_main() { @@ -20,13 +24,17 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicAdd_d32fe4() { int arg_1 = 1; - int res = atomicAdd(sb_rw.arg_0, arg_1); + int res = atomicAdd(sb_rw.inner.arg_0, arg_1); } void compute_main() { diff --git a/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.spvasm index 2fd0e19721..875f46b4fd 100644 --- a/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 28 +; Bound: 29 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -17,41 +19,43 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %int_1 = OpConstant %int 1 %_ptr_Function_int = OpTypePointer Function %int - %12 = OpConstantNull %int + %13 = OpConstantNull %int %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int -%atomicAdd_d32fe4 = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_int Function %12 - %res = OpVariable %_ptr_Function_int Function %12 +%atomicAdd_d32fe4 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %13 + %res = OpVariable %_ptr_Function_int Function %13 OpStore %arg_1 %int_1 - %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %20 = OpLoad %int %arg_1 - %13 = OpAtomicIAdd %int %19 %uint_1 %uint_0 %20 - OpStore %res %13 + %20 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %21 = OpLoad %int %arg_1 + %14 = OpAtomicIAdd %int %20 %uint_1 %uint_0 %21 + OpStore %res %14 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %23 = OpLabel - %24 = OpFunctionCall %void %atomicAdd_d32fe4 +%fragment_main = OpFunction %void None %6 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicAdd_d32fe4 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %26 = OpLabel - %27 = OpFunctionCall %void %atomicAdd_d32fe4 +%compute_main = OpFunction %void None %6 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicAdd_d32fe4 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.glsl index 79b77f1072..d0e90c430f 100644 --- a/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.glsl @@ -1,13 +1,17 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicAnd_152966() { int arg_1 = 1; - int res = atomicAnd(sb_rw.arg_0, arg_1); + int res = atomicAnd(sb_rw.inner.arg_0, arg_1); } void fragment_main() { @@ -20,13 +24,17 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicAnd_152966() { int arg_1 = 1; - int res = atomicAnd(sb_rw.arg_0, arg_1); + int res = atomicAnd(sb_rw.inner.arg_0, arg_1); } void compute_main() { diff --git a/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.spvasm index 18408ba002..2fc09b443c 100644 --- a/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 28 +; Bound: 29 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -17,41 +19,43 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %int_1 = OpConstant %int 1 %_ptr_Function_int = OpTypePointer Function %int - %12 = OpConstantNull %int + %13 = OpConstantNull %int %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int -%atomicAnd_152966 = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_int Function %12 - %res = OpVariable %_ptr_Function_int Function %12 +%atomicAnd_152966 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %13 + %res = OpVariable %_ptr_Function_int Function %13 OpStore %arg_1 %int_1 - %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %20 = OpLoad %int %arg_1 - %13 = OpAtomicAnd %int %19 %uint_1 %uint_0 %20 - OpStore %res %13 + %20 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %21 = OpLoad %int %arg_1 + %14 = OpAtomicAnd %int %20 %uint_1 %uint_0 %21 + OpStore %res %14 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %23 = OpLabel - %24 = OpFunctionCall %void %atomicAnd_152966 +%fragment_main = OpFunction %void None %6 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicAnd_152966 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %26 = OpLabel - %27 = OpFunctionCall %void %atomicAnd_152966 +%compute_main = OpFunction %void None %6 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicAnd_152966 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.glsl index 66ed6093c5..03ef72029a 100644 --- a/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.glsl @@ -1,13 +1,17 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicAnd_85a8d9() { uint arg_1 = 1u; - uint res = atomicAnd(sb_rw.arg_0, arg_1); + uint res = atomicAnd(sb_rw.inner.arg_0, arg_1); } void fragment_main() { @@ -20,13 +24,17 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicAnd_85a8d9() { uint arg_1 = 1u; - uint res = atomicAnd(sb_rw.arg_0, arg_1); + uint res = atomicAnd(sb_rw.inner.arg_0, arg_1); } void compute_main() { diff --git a/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.spvasm index d8c4b78793..7bfd7fffe6 100644 --- a/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 26 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -17,39 +19,41 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint_1 = OpConstant %uint 1 %_ptr_Function_uint = OpTypePointer Function %uint - %12 = OpConstantNull %uint + %13 = OpConstantNull %uint %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicAnd_85a8d9 = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_uint Function %12 - %res = OpVariable %_ptr_Function_uint Function %12 +%atomicAnd_85a8d9 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 OpStore %arg_1 %uint_1 - %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %18 = OpLoad %uint %arg_1 - %13 = OpAtomicAnd %uint %17 %uint_1 %uint_0 %18 - OpStore %res %13 + %18 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %19 = OpLoad %uint %arg_1 + %14 = OpAtomicAnd %uint %18 %uint_1 %uint_0 %19 + OpStore %res %14 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicAnd_85a8d9 +%fragment_main = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicAnd_85a8d9 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %atomicAnd_85a8d9 +%compute_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicAnd_85a8d9 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.glsl index ff8a3b2de1..0fda56289f 100644 --- a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.glsl @@ -7,15 +7,19 @@ struct atomic_compare_exchange_resulti32 { }; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicCompareExchangeWeak_1bd40a() { int arg_1 = 1; int arg_2 = 1; atomic_compare_exchange_resulti32 atomic_compare_result; - atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, arg_1, arg_2); + atomic_compare_result.old_value = atomicCompSwap(sb_rw.inner.arg_0, arg_1, arg_2); atomic_compare_result.exchanged = atomic_compare_result.old_value == arg_1; atomic_compare_exchange_resulti32 res = atomic_compare_result; } @@ -36,15 +40,19 @@ struct atomic_compare_exchange_resulti32 { }; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicCompareExchangeWeak_1bd40a() { int arg_1 = 1; int arg_2 = 1; atomic_compare_exchange_resulti32 atomic_compare_result; - atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, arg_1, arg_2); + atomic_compare_result.old_value = atomicCompSwap(sb_rw.inner.arg_0, arg_1, arg_2); atomic_compare_result.exchanged = atomic_compare_result.old_value == arg_1; atomic_compare_exchange_resulti32 res = atomic_compare_result; } diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.spvasm index 5ae726d031..b4bd3edf42 100644 --- a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 36 +; Bound: 37 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -21,7 +23,8 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 @@ -29,13 +32,14 @@ OpMemberDecorate %__atomic_compare_exchange_resulti32 1 Offset 4 %int = OpTypeInt 32 1 %SB_RW = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %int_1 = OpConstant %int 1 %_ptr_Function_int = OpTypePointer Function %int - %12 = OpConstantNull %int + %13 = OpConstantNull %int %bool = OpTypeBool %__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool %uint = OpTypeInt 32 0 @@ -43,30 +47,30 @@ %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_Function___atomic_compare_exchange_resulti32 = OpTypePointer Function %__atomic_compare_exchange_resulti32 - %29 = OpConstantNull %__atomic_compare_exchange_resulti32 -%atomicCompareExchangeWeak_1bd40a = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_int Function %12 - %arg_2 = OpVariable %_ptr_Function_int Function %12 - %res = OpVariable %_ptr_Function___atomic_compare_exchange_resulti32 Function %29 + %30 = OpConstantNull %__atomic_compare_exchange_resulti32 +%atomicCompareExchangeWeak_1bd40a = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %13 + %arg_2 = OpVariable %_ptr_Function_int Function %13 + %res = OpVariable %_ptr_Function___atomic_compare_exchange_resulti32 Function %30 OpStore %arg_1 %int_1 OpStore %arg_2 %int_1 - %22 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %23 = OpLoad %int %arg_2 - %24 = OpLoad %int %arg_1 - %25 = OpAtomicCompareExchange %int %22 %uint_1 %uint_0 %uint_0 %23 %24 - %26 = OpIEqual %bool %25 %24 - %14 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %25 %26 - OpStore %res %14 + %23 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %24 = OpLoad %int %arg_2 + %25 = OpLoad %int %arg_1 + %26 = OpAtomicCompareExchange %int %23 %uint_1 %uint_0 %uint_0 %24 %25 + %27 = OpIEqual %bool %26 %25 + %15 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %26 %27 + OpStore %res %15 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %31 = OpLabel - %32 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a +%fragment_main = OpFunction %void None %6 + %32 = OpLabel + %33 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %34 = OpLabel - %35 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a +%compute_main = OpFunction %void None %6 + %35 = OpLabel + %36 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.glsl index d976990e04..9054347682 100644 --- a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.glsl @@ -7,15 +7,19 @@ struct atomic_compare_exchange_resultu32 { }; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicCompareExchangeWeak_63d8e6() { uint arg_1 = 1u; uint arg_2 = 1u; atomic_compare_exchange_resultu32 atomic_compare_result; - atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, arg_1, arg_2); + atomic_compare_result.old_value = atomicCompSwap(sb_rw.inner.arg_0, arg_1, arg_2); atomic_compare_result.exchanged = atomic_compare_result.old_value == arg_1; atomic_compare_exchange_resultu32 res = atomic_compare_result; } @@ -36,15 +40,19 @@ struct atomic_compare_exchange_resultu32 { }; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicCompareExchangeWeak_63d8e6() { uint arg_1 = 1u; uint arg_2 = 1u; atomic_compare_exchange_resultu32 atomic_compare_result; - atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, arg_1, arg_2); + atomic_compare_result.old_value = atomicCompSwap(sb_rw.inner.arg_0, arg_1, arg_2); atomic_compare_result.exchanged = atomic_compare_result.old_value == arg_1; atomic_compare_exchange_resultu32 res = atomic_compare_result; } diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.spvasm index 57368c472e..1bd3a82469 100644 --- a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 34 +; Bound: 35 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -21,7 +23,8 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 @@ -29,42 +32,43 @@ OpMemberDecorate %__atomic_compare_exchange_resultu32 1 Offset 4 %uint = OpTypeInt 32 0 %SB_RW = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint_1 = OpConstant %uint 1 %_ptr_Function_uint = OpTypePointer Function %uint - %12 = OpConstantNull %uint + %13 = OpConstantNull %uint %bool = OpTypeBool %__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %_ptr_Function___atomic_compare_exchange_resultu32 = OpTypePointer Function %__atomic_compare_exchange_resultu32 - %27 = OpConstantNull %__atomic_compare_exchange_resultu32 -%atomicCompareExchangeWeak_63d8e6 = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_uint Function %12 - %arg_2 = OpVariable %_ptr_Function_uint Function %12 - %res = OpVariable %_ptr_Function___atomic_compare_exchange_resultu32 Function %27 + %28 = OpConstantNull %__atomic_compare_exchange_resultu32 +%atomicCompareExchangeWeak_63d8e6 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %arg_2 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function___atomic_compare_exchange_resultu32 Function %28 OpStore %arg_1 %uint_1 OpStore %arg_2 %uint_1 - %20 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %21 = OpLoad %uint %arg_2 - %22 = OpLoad %uint %arg_1 - %23 = OpAtomicCompareExchange %uint %20 %uint_1 %uint_0 %uint_0 %21 %22 - %24 = OpIEqual %bool %23 %22 - %14 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %23 %24 - OpStore %res %14 + %21 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %22 = OpLoad %uint %arg_2 + %23 = OpLoad %uint %arg_1 + %24 = OpAtomicCompareExchange %uint %21 %uint_1 %uint_0 %uint_0 %22 %23 + %25 = OpIEqual %bool %24 %23 + %15 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %24 %25 + OpStore %res %15 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %29 = OpLabel - %30 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 +%fragment_main = OpFunction %void None %6 + %30 = OpLabel + %31 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %32 = OpLabel - %33 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 +%compute_main = OpFunction %void None %6 + %33 = OpLabel + %34 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.glsl index 96a02b87d5..0b5c70d5f2 100644 --- a/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.glsl @@ -1,13 +1,17 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicExchange_d59712() { uint arg_1 = 1u; - uint res = atomicExchange(sb_rw.arg_0, arg_1); + uint res = atomicExchange(sb_rw.inner.arg_0, arg_1); } void fragment_main() { @@ -20,13 +24,17 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicExchange_d59712() { uint arg_1 = 1u; - uint res = atomicExchange(sb_rw.arg_0, arg_1); + uint res = atomicExchange(sb_rw.inner.arg_0, arg_1); } void compute_main() { diff --git a/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.spvasm index 2ec90f3908..c43ee4f9d2 100644 --- a/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 26 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -17,39 +19,41 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint_1 = OpConstant %uint 1 %_ptr_Function_uint = OpTypePointer Function %uint - %12 = OpConstantNull %uint + %13 = OpConstantNull %uint %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicExchange_d59712 = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_uint Function %12 - %res = OpVariable %_ptr_Function_uint Function %12 +%atomicExchange_d59712 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 OpStore %arg_1 %uint_1 - %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %18 = OpLoad %uint %arg_1 - %13 = OpAtomicExchange %uint %17 %uint_1 %uint_0 %18 - OpStore %res %13 + %18 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %19 = OpLoad %uint %arg_1 + %14 = OpAtomicExchange %uint %18 %uint_1 %uint_0 %19 + OpStore %res %14 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicExchange_d59712 +%fragment_main = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicExchange_d59712 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %atomicExchange_d59712 +%compute_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicExchange_d59712 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.glsl index b4dcaadaf3..5092d33918 100644 --- a/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.glsl @@ -1,13 +1,17 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicExchange_f2e22f() { int arg_1 = 1; - int res = atomicExchange(sb_rw.arg_0, arg_1); + int res = atomicExchange(sb_rw.inner.arg_0, arg_1); } void fragment_main() { @@ -20,13 +24,17 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicExchange_f2e22f() { int arg_1 = 1; - int res = atomicExchange(sb_rw.arg_0, arg_1); + int res = atomicExchange(sb_rw.inner.arg_0, arg_1); } void compute_main() { diff --git a/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.spvasm index 755a537b01..c7e014ecf5 100644 --- a/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 28 +; Bound: 29 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -17,41 +19,43 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %int_1 = OpConstant %int 1 %_ptr_Function_int = OpTypePointer Function %int - %12 = OpConstantNull %int + %13 = OpConstantNull %int %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int -%atomicExchange_f2e22f = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_int Function %12 - %res = OpVariable %_ptr_Function_int Function %12 +%atomicExchange_f2e22f = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %13 + %res = OpVariable %_ptr_Function_int Function %13 OpStore %arg_1 %int_1 - %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %20 = OpLoad %int %arg_1 - %13 = OpAtomicExchange %int %19 %uint_1 %uint_0 %20 - OpStore %res %13 + %20 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %21 = OpLoad %int %arg_1 + %14 = OpAtomicExchange %int %20 %uint_1 %uint_0 %21 + OpStore %res %14 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %23 = OpLabel - %24 = OpFunctionCall %void %atomicExchange_f2e22f +%fragment_main = OpFunction %void None %6 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicExchange_f2e22f OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %26 = OpLabel - %27 = OpFunctionCall %void %atomicExchange_f2e22f +%compute_main = OpFunction %void None %6 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicExchange_f2e22f OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.glsl index 64291f3d3b..f9f7949b2e 100644 --- a/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicLoad_0806ad() { - int res = atomicOr(sb_rw.arg_0, 0); + int res = atomicOr(sb_rw.inner.arg_0, 0); } void fragment_main() { @@ -19,12 +23,16 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicLoad_0806ad() { - int res = atomicOr(sb_rw.arg_0, 0); + int res = atomicOr(sb_rw.inner.arg_0, 0); } void compute_main() { diff --git a/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.spvasm index d961ea5c86..0a09d9dbb9 100644 --- a/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 25 +; Bound: 26 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -16,37 +18,39 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %_ptr_Function_int = OpTypePointer Function %int - %18 = OpConstantNull %int -%atomicLoad_0806ad = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_int Function %18 - %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %9 = OpAtomicLoad %int %15 %uint_1 %uint_0 - OpStore %res %9 + %19 = OpConstantNull %int +%atomicLoad_0806ad = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_int Function %19 + %16 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %10 = OpAtomicLoad %int %16 %uint_1 %uint_0 + OpStore %res %10 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %20 = OpLabel - %21 = OpFunctionCall %void %atomicLoad_0806ad +%fragment_main = OpFunction %void None %6 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicLoad_0806ad OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %23 = OpLabel - %24 = OpFunctionCall %void %atomicLoad_0806ad +%compute_main = OpFunction %void None %6 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicLoad_0806ad OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.glsl index f17c51888b..eaede54c90 100644 --- a/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.glsl @@ -1,12 +1,16 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicLoad_fe6cc3() { - uint res = atomicOr(sb_rw.arg_0, 0u); + uint res = atomicOr(sb_rw.inner.arg_0, 0u); } void fragment_main() { @@ -19,12 +23,16 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicLoad_fe6cc3() { - uint res = atomicOr(sb_rw.arg_0, 0u); + uint res = atomicOr(sb_rw.inner.arg_0, 0u); } void compute_main() { diff --git a/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.spvasm index 776c62c09f..d1efbaa63a 100644 --- a/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 25 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -16,36 +18,38 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint %_ptr_Function_uint = OpTypePointer Function %uint - %17 = OpConstantNull %uint -%atomicLoad_fe6cc3 = OpFunction %void None %5 - %8 = OpLabel - %res = OpVariable %_ptr_Function_uint Function %17 - %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %9 = OpAtomicLoad %uint %14 %uint_1 %uint_0 - OpStore %res %9 + %18 = OpConstantNull %uint +%atomicLoad_fe6cc3 = OpFunction %void None %6 + %9 = OpLabel + %res = OpVariable %_ptr_Function_uint Function %18 + %15 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %10 = OpAtomicLoad %uint %15 %uint_1 %uint_0 + OpStore %res %10 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %19 = OpLabel - %20 = OpFunctionCall %void %atomicLoad_fe6cc3 +%fragment_main = OpFunction %void None %6 + %20 = OpLabel + %21 = OpFunctionCall %void %atomicLoad_fe6cc3 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %22 = OpLabel - %23 = OpFunctionCall %void %atomicLoad_fe6cc3 +%compute_main = OpFunction %void None %6 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicLoad_fe6cc3 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.glsl index 6a0431feca..daca80c717 100644 --- a/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.glsl @@ -1,13 +1,17 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicMax_51b9be() { uint arg_1 = 1u; - uint res = atomicMax(sb_rw.arg_0, arg_1); + uint res = atomicMax(sb_rw.inner.arg_0, arg_1); } void fragment_main() { @@ -20,13 +24,17 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicMax_51b9be() { uint arg_1 = 1u; - uint res = atomicMax(sb_rw.arg_0, arg_1); + uint res = atomicMax(sb_rw.inner.arg_0, arg_1); } void compute_main() { diff --git a/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.spvasm index 97bae6a5c4..52b100ec15 100644 --- a/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 26 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -17,39 +19,41 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint_1 = OpConstant %uint 1 %_ptr_Function_uint = OpTypePointer Function %uint - %12 = OpConstantNull %uint + %13 = OpConstantNull %uint %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicMax_51b9be = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_uint Function %12 - %res = OpVariable %_ptr_Function_uint Function %12 +%atomicMax_51b9be = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 OpStore %arg_1 %uint_1 - %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %18 = OpLoad %uint %arg_1 - %13 = OpAtomicUMax %uint %17 %uint_1 %uint_0 %18 - OpStore %res %13 + %18 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %19 = OpLoad %uint %arg_1 + %14 = OpAtomicUMax %uint %18 %uint_1 %uint_0 %19 + OpStore %res %14 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicMax_51b9be +%fragment_main = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicMax_51b9be OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %atomicMax_51b9be +%compute_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicMax_51b9be OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.glsl index 43570a4060..c03079121c 100644 --- a/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.glsl @@ -1,13 +1,17 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicMax_92aa72() { int arg_1 = 1; - int res = atomicMax(sb_rw.arg_0, arg_1); + int res = atomicMax(sb_rw.inner.arg_0, arg_1); } void fragment_main() { @@ -20,13 +24,17 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicMax_92aa72() { int arg_1 = 1; - int res = atomicMax(sb_rw.arg_0, arg_1); + int res = atomicMax(sb_rw.inner.arg_0, arg_1); } void compute_main() { diff --git a/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.spvasm index e6ff30ef3a..fd7d25bcaa 100644 --- a/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 28 +; Bound: 29 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -17,41 +19,43 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %int_1 = OpConstant %int 1 %_ptr_Function_int = OpTypePointer Function %int - %12 = OpConstantNull %int + %13 = OpConstantNull %int %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int -%atomicMax_92aa72 = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_int Function %12 - %res = OpVariable %_ptr_Function_int Function %12 +%atomicMax_92aa72 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %13 + %res = OpVariable %_ptr_Function_int Function %13 OpStore %arg_1 %int_1 - %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %20 = OpLoad %int %arg_1 - %13 = OpAtomicSMax %int %19 %uint_1 %uint_0 %20 - OpStore %res %13 + %20 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %21 = OpLoad %int %arg_1 + %14 = OpAtomicSMax %int %20 %uint_1 %uint_0 %21 + OpStore %res %14 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %23 = OpLabel - %24 = OpFunctionCall %void %atomicMax_92aa72 +%fragment_main = OpFunction %void None %6 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicMax_92aa72 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %26 = OpLabel - %27 = OpFunctionCall %void %atomicMax_92aa72 +%compute_main = OpFunction %void None %6 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicMax_92aa72 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.glsl index 2ed6f591e7..0440e774d4 100644 --- a/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.glsl @@ -1,13 +1,17 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicMin_8e38dc() { int arg_1 = 1; - int res = atomicMin(sb_rw.arg_0, arg_1); + int res = atomicMin(sb_rw.inner.arg_0, arg_1); } void fragment_main() { @@ -20,13 +24,17 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicMin_8e38dc() { int arg_1 = 1; - int res = atomicMin(sb_rw.arg_0, arg_1); + int res = atomicMin(sb_rw.inner.arg_0, arg_1); } void compute_main() { diff --git a/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.spvasm index f2ca9b8e59..db6642c5c8 100644 --- a/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 28 +; Bound: 29 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -17,41 +19,43 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %int_1 = OpConstant %int 1 %_ptr_Function_int = OpTypePointer Function %int - %12 = OpConstantNull %int + %13 = OpConstantNull %int %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int -%atomicMin_8e38dc = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_int Function %12 - %res = OpVariable %_ptr_Function_int Function %12 +%atomicMin_8e38dc = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %13 + %res = OpVariable %_ptr_Function_int Function %13 OpStore %arg_1 %int_1 - %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %20 = OpLoad %int %arg_1 - %13 = OpAtomicSMin %int %19 %uint_1 %uint_0 %20 - OpStore %res %13 + %20 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %21 = OpLoad %int %arg_1 + %14 = OpAtomicSMin %int %20 %uint_1 %uint_0 %21 + OpStore %res %14 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %23 = OpLabel - %24 = OpFunctionCall %void %atomicMin_8e38dc +%fragment_main = OpFunction %void None %6 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicMin_8e38dc OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %26 = OpLabel - %27 = OpFunctionCall %void %atomicMin_8e38dc +%compute_main = OpFunction %void None %6 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicMin_8e38dc OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.glsl index 8324f1589a..c065703eae 100644 --- a/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.glsl @@ -1,13 +1,17 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicMin_c67a74() { uint arg_1 = 1u; - uint res = atomicMin(sb_rw.arg_0, arg_1); + uint res = atomicMin(sb_rw.inner.arg_0, arg_1); } void fragment_main() { @@ -20,13 +24,17 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicMin_c67a74() { uint arg_1 = 1u; - uint res = atomicMin(sb_rw.arg_0, arg_1); + uint res = atomicMin(sb_rw.inner.arg_0, arg_1); } void compute_main() { diff --git a/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.spvasm index f3cc67b6e6..3816db2e7c 100644 --- a/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 26 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -17,39 +19,41 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint_1 = OpConstant %uint 1 %_ptr_Function_uint = OpTypePointer Function %uint - %12 = OpConstantNull %uint + %13 = OpConstantNull %uint %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicMin_c67a74 = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_uint Function %12 - %res = OpVariable %_ptr_Function_uint Function %12 +%atomicMin_c67a74 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 OpStore %arg_1 %uint_1 - %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %18 = OpLoad %uint %arg_1 - %13 = OpAtomicUMin %uint %17 %uint_1 %uint_0 %18 - OpStore %res %13 + %18 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %19 = OpLoad %uint %arg_1 + %14 = OpAtomicUMin %uint %18 %uint_1 %uint_0 %19 + OpStore %res %14 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicMin_c67a74 +%fragment_main = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicMin_c67a74 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %atomicMin_c67a74 +%compute_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicMin_c67a74 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.glsl index 65ecce1760..7d9ec029f9 100644 --- a/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.glsl @@ -1,13 +1,17 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicOr_5e95d4() { uint arg_1 = 1u; - uint res = atomicOr(sb_rw.arg_0, arg_1); + uint res = atomicOr(sb_rw.inner.arg_0, arg_1); } void fragment_main() { @@ -20,13 +24,17 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicOr_5e95d4() { uint arg_1 = 1u; - uint res = atomicOr(sb_rw.arg_0, arg_1); + uint res = atomicOr(sb_rw.inner.arg_0, arg_1); } void compute_main() { diff --git a/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.spvasm index c38fc528ec..e5533faa88 100644 --- a/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 26 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -17,39 +19,41 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint_1 = OpConstant %uint 1 %_ptr_Function_uint = OpTypePointer Function %uint - %12 = OpConstantNull %uint + %13 = OpConstantNull %uint %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicOr_5e95d4 = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_uint Function %12 - %res = OpVariable %_ptr_Function_uint Function %12 +%atomicOr_5e95d4 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 OpStore %arg_1 %uint_1 - %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %18 = OpLoad %uint %arg_1 - %13 = OpAtomicOr %uint %17 %uint_1 %uint_0 %18 - OpStore %res %13 + %18 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %19 = OpLoad %uint %arg_1 + %14 = OpAtomicOr %uint %18 %uint_1 %uint_0 %19 + OpStore %res %14 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicOr_5e95d4 +%fragment_main = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicOr_5e95d4 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %atomicOr_5e95d4 +%compute_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicOr_5e95d4 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.glsl index dcb69859d6..7b14ac95de 100644 --- a/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.glsl @@ -1,13 +1,17 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicOr_8d96a0() { int arg_1 = 1; - int res = atomicOr(sb_rw.arg_0, arg_1); + int res = atomicOr(sb_rw.inner.arg_0, arg_1); } void fragment_main() { @@ -20,13 +24,17 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicOr_8d96a0() { int arg_1 = 1; - int res = atomicOr(sb_rw.arg_0, arg_1); + int res = atomicOr(sb_rw.inner.arg_0, arg_1); } void compute_main() { diff --git a/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.spvasm index 978e4ad7b2..e44b318659 100644 --- a/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 28 +; Bound: 29 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -17,41 +19,43 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %int_1 = OpConstant %int 1 %_ptr_Function_int = OpTypePointer Function %int - %12 = OpConstantNull %int + %13 = OpConstantNull %int %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int -%atomicOr_8d96a0 = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_int Function %12 - %res = OpVariable %_ptr_Function_int Function %12 +%atomicOr_8d96a0 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %13 + %res = OpVariable %_ptr_Function_int Function %13 OpStore %arg_1 %int_1 - %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %20 = OpLoad %int %arg_1 - %13 = OpAtomicOr %int %19 %uint_1 %uint_0 %20 - OpStore %res %13 + %20 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %21 = OpLoad %int %arg_1 + %14 = OpAtomicOr %int %20 %uint_1 %uint_0 %21 + OpStore %res %14 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %23 = OpLabel - %24 = OpFunctionCall %void %atomicOr_8d96a0 +%fragment_main = OpFunction %void None %6 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicOr_8d96a0 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %26 = OpLabel - %27 = OpFunctionCall %void %atomicOr_8d96a0 +%compute_main = OpFunction %void None %6 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicOr_8d96a0 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.glsl index d9e75bf294..09b5b8dbbc 100644 --- a/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.glsl @@ -1,13 +1,17 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicStore_cdc29e() { uint arg_1 = 1u; - atomicExchange(sb_rw.arg_0, arg_1); + atomicExchange(sb_rw.inner.arg_0, arg_1); } void fragment_main() { @@ -20,13 +24,17 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicStore_cdc29e() { uint arg_1 = 1u; - atomicExchange(sb_rw.arg_0, arg_1); + atomicExchange(sb_rw.inner.arg_0, arg_1); } void compute_main() { diff --git a/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.spvasm index f0d74fe1cf..896327ae88 100644 --- a/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 25 +; Bound: 26 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -16,37 +18,39 @@ OpName %arg_1 "arg_1" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint_1 = OpConstant %uint 1 %_ptr_Function_uint = OpTypePointer Function %uint - %12 = OpConstantNull %uint + %13 = OpConstantNull %uint %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicStore_cdc29e = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_uint Function %12 +%atomicStore_cdc29e = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 OpStore %arg_1 %uint_1 - %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %18 = OpLoad %uint %arg_1 - OpAtomicStore %17 %uint_1 %uint_0 %18 + %18 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %19 = OpLoad %uint %arg_1 + OpAtomicStore %18 %uint_1 %uint_0 %19 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %20 = OpLabel - %21 = OpFunctionCall %void %atomicStore_cdc29e +%fragment_main = OpFunction %void None %6 + %21 = OpLabel + %22 = OpFunctionCall %void %atomicStore_cdc29e OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %23 = OpLabel - %24 = OpFunctionCall %void %atomicStore_cdc29e +%compute_main = OpFunction %void None %6 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicStore_cdc29e OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.glsl index e4c98e069f..6a5e49b203 100644 --- a/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.glsl @@ -1,13 +1,17 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicStore_d1e9a6() { int arg_1 = 1; - atomicExchange(sb_rw.arg_0, arg_1); + atomicExchange(sb_rw.inner.arg_0, arg_1); } void fragment_main() { @@ -20,13 +24,17 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicStore_d1e9a6() { int arg_1 = 1; - atomicExchange(sb_rw.arg_0, arg_1); + atomicExchange(sb_rw.inner.arg_0, arg_1); } void compute_main() { diff --git a/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.spvasm index 5d03e4ee54..3fe6d81fd4 100644 --- a/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 27 +; Bound: 28 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -16,39 +18,41 @@ OpName %arg_1 "arg_1" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %int_1 = OpConstant %int 1 %_ptr_Function_int = OpTypePointer Function %int - %12 = OpConstantNull %int + %13 = OpConstantNull %int %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int -%atomicStore_d1e9a6 = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_int Function %12 +%atomicStore_d1e9a6 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %13 OpStore %arg_1 %int_1 - %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %20 = OpLoad %int %arg_1 - OpAtomicStore %19 %uint_1 %uint_0 %20 + %20 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %21 = OpLoad %int %arg_1 + OpAtomicStore %20 %uint_1 %uint_0 %21 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %22 = OpLabel - %23 = OpFunctionCall %void %atomicStore_d1e9a6 +%fragment_main = OpFunction %void None %6 + %23 = OpLabel + %24 = OpFunctionCall %void %atomicStore_d1e9a6 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %25 = OpLabel - %26 = OpFunctionCall %void %atomicStore_d1e9a6 +%compute_main = OpFunction %void None %6 + %26 = OpLabel + %27 = OpFunctionCall %void %atomicStore_d1e9a6 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.glsl index 6ea56f6aac..3b0d5037c6 100644 --- a/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.glsl @@ -1,13 +1,17 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicSub_051100() { int arg_1 = 1; - int res = atomicAdd(sb_rw.arg_0, arg_1); + int res = atomicAdd(sb_rw.inner.arg_0, arg_1); } void fragment_main() { @@ -20,13 +24,17 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicSub_051100() { int arg_1 = 1; - int res = atomicAdd(sb_rw.arg_0, arg_1); + int res = atomicAdd(sb_rw.inner.arg_0, arg_1); } void compute_main() { diff --git a/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.spvasm index 3bbf26a4b0..8bdad3304d 100644 --- a/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 28 +; Bound: 29 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -17,41 +19,43 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %int_1 = OpConstant %int 1 %_ptr_Function_int = OpTypePointer Function %int - %12 = OpConstantNull %int + %13 = OpConstantNull %int %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int -%atomicSub_051100 = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_int Function %12 - %res = OpVariable %_ptr_Function_int Function %12 +%atomicSub_051100 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %13 + %res = OpVariable %_ptr_Function_int Function %13 OpStore %arg_1 %int_1 - %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %20 = OpLoad %int %arg_1 - %13 = OpAtomicISub %int %19 %uint_1 %uint_0 %20 - OpStore %res %13 + %20 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %21 = OpLoad %int %arg_1 + %14 = OpAtomicISub %int %20 %uint_1 %uint_0 %21 + OpStore %res %14 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %23 = OpLabel - %24 = OpFunctionCall %void %atomicSub_051100 +%fragment_main = OpFunction %void None %6 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicSub_051100 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %26 = OpLabel - %27 = OpFunctionCall %void %atomicSub_051100 +%compute_main = OpFunction %void None %6 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicSub_051100 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.glsl index e5d348c1f9..9613271f70 100644 --- a/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.glsl @@ -1,13 +1,17 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicSub_15bfc9() { uint arg_1 = 1u; - uint res = atomicAdd(sb_rw.arg_0, arg_1); + uint res = atomicAdd(sb_rw.inner.arg_0, arg_1); } void fragment_main() { @@ -20,13 +24,17 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicSub_15bfc9() { uint arg_1 = 1u; - uint res = atomicAdd(sb_rw.arg_0, arg_1); + uint res = atomicAdd(sb_rw.inner.arg_0, arg_1); } void compute_main() { diff --git a/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.spvasm index 4d20c6d426..becb22281f 100644 --- a/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 26 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -17,39 +19,41 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint_1 = OpConstant %uint 1 %_ptr_Function_uint = OpTypePointer Function %uint - %12 = OpConstantNull %uint + %13 = OpConstantNull %uint %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicSub_15bfc9 = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_uint Function %12 - %res = OpVariable %_ptr_Function_uint Function %12 +%atomicSub_15bfc9 = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 OpStore %arg_1 %uint_1 - %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %18 = OpLoad %uint %arg_1 - %13 = OpAtomicISub %uint %17 %uint_1 %uint_0 %18 - OpStore %res %13 + %18 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %19 = OpLoad %uint %arg_1 + %14 = OpAtomicISub %uint %18 %uint_1 %uint_0 %19 + OpStore %res %14 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicSub_15bfc9 +%fragment_main = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicSub_15bfc9 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %atomicSub_15bfc9 +%compute_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicSub_15bfc9 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.glsl index 9ac7f7a2b5..c32a892130 100644 --- a/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.glsl @@ -1,13 +1,17 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicXor_54510e() { uint arg_1 = 1u; - uint res = atomicXor(sb_rw.arg_0, arg_1); + uint res = atomicXor(sb_rw.inner.arg_0, arg_1); } void fragment_main() { @@ -20,13 +24,17 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { uint arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicXor_54510e() { uint arg_1 = 1u; - uint res = atomicXor(sb_rw.arg_0, arg_1); + uint res = atomicXor(sb_rw.inner.arg_0, arg_1); } void compute_main() { diff --git a/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.spvasm index a16daff5f6..6c64a5df1a 100644 --- a/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 26 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -17,39 +19,41 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %uint = OpTypeInt 32 0 %SB_RW = OpTypeStruct %uint -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint_1 = OpConstant %uint 1 %_ptr_Function_uint = OpTypePointer Function %uint - %12 = OpConstantNull %uint + %13 = OpConstantNull %uint %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%atomicXor_54510e = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_uint Function %12 - %res = OpVariable %_ptr_Function_uint Function %12 +%atomicXor_54510e = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_uint Function %13 + %res = OpVariable %_ptr_Function_uint Function %13 OpStore %arg_1 %uint_1 - %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 - %18 = OpLoad %uint %arg_1 - %13 = OpAtomicXor %uint %17 %uint_1 %uint_0 %18 - OpStore %res %13 + %18 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0 %uint_0 + %19 = OpLoad %uint %arg_1 + %14 = OpAtomicXor %uint %18 %uint_1 %uint_0 %19 + OpStore %res %14 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %21 = OpLabel - %22 = OpFunctionCall %void %atomicXor_54510e +%fragment_main = OpFunction %void None %6 + %22 = OpLabel + %23 = OpFunctionCall %void %atomicXor_54510e OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %24 = OpLabel - %25 = OpFunctionCall %void %atomicXor_54510e +%compute_main = OpFunction %void None %6 + %25 = OpLabel + %26 = OpFunctionCall %void %atomicXor_54510e OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.glsl index 113781d877..b2a942560a 100644 --- a/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.glsl @@ -1,13 +1,17 @@ #version 310 es precision mediump float; -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicXor_c1b78c() { int arg_1 = 1; - int res = atomicXor(sb_rw.arg_0, arg_1); + int res = atomicXor(sb_rw.inner.arg_0, arg_1); } void fragment_main() { @@ -20,13 +24,17 @@ void main() { } #version 310 es -layout(binding = 0, std430) buffer SB_RW_ssbo { +struct SB_RW { int arg_0; +}; + +layout(binding = 0, std430) buffer sb_rw_block_ssbo { + SB_RW inner; } sb_rw; void atomicXor_c1b78c() { int arg_1 = 1; - int res = atomicXor(sb_rw.arg_0, arg_1); + int res = atomicXor(sb_rw.inner.arg_0, arg_1); } void compute_main() { diff --git a/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.spvasm index cff5564090..dff9f26201 100644 --- a/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 28 +; Bound: 29 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -9,6 +9,8 @@ OpEntryPoint GLCompute %compute_main "compute_main" OpExecutionMode %fragment_main OriginUpperLeft OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %sb_rw_block "sb_rw_block" + OpMemberName %sb_rw_block 0 "inner" OpName %SB_RW "SB_RW" OpMemberName %SB_RW 0 "arg_0" OpName %sb_rw "sb_rw" @@ -17,41 +19,43 @@ OpName %res "res" OpName %fragment_main "fragment_main" OpName %compute_main "compute_main" - OpDecorate %SB_RW Block + OpDecorate %sb_rw_block Block + OpMemberDecorate %sb_rw_block 0 Offset 0 OpMemberDecorate %SB_RW 0 Offset 0 OpDecorate %sb_rw DescriptorSet 0 OpDecorate %sb_rw Binding 0 %int = OpTypeInt 32 1 %SB_RW = OpTypeStruct %int -%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW - %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer +%sb_rw_block = OpTypeStruct %SB_RW +%_ptr_StorageBuffer_sb_rw_block = OpTypePointer StorageBuffer %sb_rw_block + %sb_rw = OpVariable %_ptr_StorageBuffer_sb_rw_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %int_1 = OpConstant %int 1 %_ptr_Function_int = OpTypePointer Function %int - %12 = OpConstantNull %int + %13 = OpConstantNull %int %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int -%atomicXor_c1b78c = OpFunction %void None %5 - %8 = OpLabel - %arg_1 = OpVariable %_ptr_Function_int Function %12 - %res = OpVariable %_ptr_Function_int Function %12 +%atomicXor_c1b78c = OpFunction %void None %6 + %9 = OpLabel + %arg_1 = OpVariable %_ptr_Function_int Function %13 + %res = OpVariable %_ptr_Function_int Function %13 OpStore %arg_1 %int_1 - %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 - %20 = OpLoad %int %arg_1 - %13 = OpAtomicXor %int %19 %uint_1 %uint_0 %20 - OpStore %res %13 + %20 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0 %uint_0 + %21 = OpLoad %int %arg_1 + %14 = OpAtomicXor %int %20 %uint_1 %uint_0 %21 + OpStore %res %14 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %5 - %23 = OpLabel - %24 = OpFunctionCall %void %atomicXor_c1b78c +%fragment_main = OpFunction %void None %6 + %24 = OpLabel + %25 = OpFunctionCall %void %atomicXor_c1b78c OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %5 - %26 = OpLabel - %27 = OpFunctionCall %void %atomicXor_c1b78c +%compute_main = OpFunction %void None %6 + %27 = OpLabel + %28 = OpFunctionCall %void %atomicXor_c1b78c OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/textureDimensions/cdc6c9.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/cdc6c9.wgsl.expected.glsl index 61f4523d76..194a4bfa75 100644 --- a/test/tint/builtins/gen/var/textureDimensions/cdc6c9.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/textureDimensions/cdc6c9.wgsl.expected.glsl @@ -11,13 +11,17 @@ struct GammaTransferParams { uint padding; }; -layout(binding = 2, std140) uniform ExternalTextureParams_ubo { +struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; +}; + +layout(binding = 2, std140) uniform ext_tex_params_block_ubo { + ExternalTextureParams inner; } ext_tex_params; uniform highp sampler2D arg_0_1; @@ -52,13 +56,17 @@ struct GammaTransferParams { uint padding; }; -layout(binding = 2, std140) uniform ExternalTextureParams_ubo { +struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; +}; + +layout(binding = 2, std140) uniform ext_tex_params_block_ubo { + ExternalTextureParams inner; } ext_tex_params; uniform highp sampler2D arg_0_1; @@ -87,13 +95,17 @@ struct GammaTransferParams { uint padding; }; -layout(binding = 2, std140) uniform ExternalTextureParams_ubo { +struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; +}; + +layout(binding = 2, std140) uniform ext_tex_params_block_ubo { + ExternalTextureParams inner; } ext_tex_params; uniform highp sampler2D arg_0_1; diff --git a/test/tint/builtins/gen/var/textureDimensions/cdc6c9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/cdc6c9.wgsl.expected.spvasm index a2f0f9468b..da1f2ab4bc 100644 --- a/test/tint/builtins/gen/var/textureDimensions/cdc6c9.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/textureDimensions/cdc6c9.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 47 +; Bound: 48 ; Schema: 0 OpCapability Shader OpCapability ImageQuery @@ -14,6 +14,8 @@ OpName %value "value" OpName %vertex_point_size "vertex_point_size" OpName %ext_tex_plane_1 "ext_tex_plane_1" + OpName %ext_tex_params_block "ext_tex_params_block" + OpMemberName %ext_tex_params_block 0 "inner" OpName %ExternalTextureParams "ExternalTextureParams" OpMemberName %ExternalTextureParams 0 "numPlanes" OpMemberName %ExternalTextureParams 1 "doYuvToRgbConversionOnly" @@ -42,7 +44,8 @@ OpDecorate %vertex_point_size BuiltIn PointSize OpDecorate %ext_tex_plane_1 DescriptorSet 1 OpDecorate %ext_tex_plane_1 Binding 1 - OpDecorate %ExternalTextureParams Block + OpDecorate %ext_tex_params_block Block + OpMemberDecorate %ext_tex_params_block 0 Offset 0 OpMemberDecorate %ExternalTextureParams 0 Offset 0 OpMemberDecorate %ExternalTextureParams 1 Offset 4 OpMemberDecorate %ExternalTextureParams 2 Offset 16 @@ -83,45 +86,46 @@ %v3float = OpTypeVector %float 3 %mat3v3float = OpTypeMatrix %v3float 3 %ExternalTextureParams = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float -%_ptr_Uniform_ExternalTextureParams = OpTypePointer Uniform %ExternalTextureParams -%ext_tex_params = OpVariable %_ptr_Uniform_ExternalTextureParams Uniform +%ext_tex_params_block = OpTypeStruct %ExternalTextureParams +%_ptr_Uniform_ext_tex_params_block = OpTypePointer Uniform %ext_tex_params_block +%ext_tex_params = OpVariable %_ptr_Uniform_ext_tex_params_block Uniform %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant %void = OpTypeVoid - %21 = OpTypeFunction %void + %22 = OpTypeFunction %void %v2uint = OpTypeVector %uint 2 %int = OpTypeInt 32 1 %int_0 = OpConstant %int 0 %_ptr_Function_v2uint = OpTypePointer Function %v2uint - %32 = OpConstantNull %v2uint - %33 = OpTypeFunction %v4float + %33 = OpConstantNull %v2uint + %34 = OpTypeFunction %v4float %float_1 = OpConstant %float 1 -%textureDimensions_cdc6c9 = OpFunction %void None %21 - %24 = OpLabel - %res = OpVariable %_ptr_Function_v2uint Function %32 - %27 = OpLoad %11 %arg_0 - %25 = OpImageQuerySizeLod %v2uint %27 %int_0 - OpStore %res %25 +%textureDimensions_cdc6c9 = OpFunction %void None %22 + %25 = OpLabel + %res = OpVariable %_ptr_Function_v2uint Function %33 + %28 = OpLoad %11 %arg_0 + %26 = OpImageQuerySizeLod %v2uint %28 %int_0 + OpStore %res %26 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %33 - %35 = OpLabel - %36 = OpFunctionCall %void %textureDimensions_cdc6c9 +%vertex_main_inner = OpFunction %v4float None %34 + %36 = OpLabel + %37 = OpFunctionCall %void %textureDimensions_cdc6c9 OpReturnValue %5 OpFunctionEnd -%vertex_main = OpFunction %void None %21 - %38 = OpLabel - %39 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %39 +%vertex_main = OpFunction %void None %22 + %39 = OpLabel + %40 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %40 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd -%fragment_main = OpFunction %void None %21 - %42 = OpLabel - %43 = OpFunctionCall %void %textureDimensions_cdc6c9 +%fragment_main = OpFunction %void None %22 + %43 = OpLabel + %44 = OpFunctionCall %void %textureDimensions_cdc6c9 OpReturn OpFunctionEnd -%compute_main = OpFunction %void None %21 - %45 = OpLabel - %46 = OpFunctionCall %void %textureDimensions_cdc6c9 +%compute_main = OpFunction %void None %22 + %46 = OpLabel + %47 = OpFunctionCall %void %textureDimensions_cdc6c9 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.glsl b/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.glsl index 808bc8fa5e..fd54bf3ecb 100644 --- a/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.glsl +++ b/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.glsl @@ -1,7 +1,15 @@ #version 310 es precision mediump float; -layout(binding = 0, std140) uniform S_std140_ubo { +struct S { + mat3x2 matrix; + uint pad; + uint pad_1; + vec3 vector; + uint pad_2; +}; + +struct S_std140 { vec2 matrix_0; vec2 matrix_1; vec2 matrix_2; @@ -9,14 +17,18 @@ layout(binding = 0, std140) uniform S_std140_ubo { uint pad_1; vec3 vector; uint pad_2; +}; + +layout(binding = 0, std140) uniform data_block_std140_ubo { + S_std140 inner; } data; -mat3x2 load_data_matrix() { - return mat3x2(data.matrix_0, data.matrix_1, data.matrix_2); +mat3x2 load_data_inner_matrix() { + return mat3x2(data.inner.matrix_0, data.inner.matrix_1, data.inner.matrix_2); } void tint_symbol() { - vec2 x = (load_data_matrix() * data.vector); + vec2 x = (load_data_inner_matrix() * data.inner.vector); } void main() { diff --git a/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.spvasm b/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.spvasm index 574781ee85..c387015031 100644 --- a/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mul/mat3x2-vec3/f32.wgsl.expected.spvasm @@ -1,21 +1,24 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 37 +; Bound: 40 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %main "main" OpExecutionMode %main OriginUpperLeft + OpName %data_block_std140 "data_block_std140" + OpMemberName %data_block_std140 0 "inner" OpName %S_std140 "S_std140" OpMemberName %S_std140 0 "matrix_0" OpMemberName %S_std140 1 "matrix_1" OpMemberName %S_std140 2 "matrix_2" OpMemberName %S_std140 3 "vector" OpName %data "data" - OpName %load_data_matrix "load_data_matrix" + OpName %load_data_inner_matrix "load_data_inner_matrix" OpName %main "main" - OpDecorate %S_std140 Block + OpDecorate %data_block_std140 Block + OpMemberDecorate %data_block_std140 0 Offset 0 OpMemberDecorate %S_std140 0 Offset 0 OpMemberDecorate %S_std140 1 Offset 8 OpMemberDecorate %S_std140 2 Offset 16 @@ -27,35 +30,38 @@ %v2float = OpTypeVector %float 2 %v3float = OpTypeVector %float 3 %S_std140 = OpTypeStruct %v2float %v2float %v2float %v3float -%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140 - %data = OpVariable %_ptr_Uniform_S_std140 Uniform +%data_block_std140 = OpTypeStruct %S_std140 +%_ptr_Uniform_data_block_std140 = OpTypePointer Uniform %data_block_std140 + %data = OpVariable %_ptr_Uniform_data_block_std140 Uniform %mat3v2float = OpTypeMatrix %v2float 3 - %7 = OpTypeFunction %mat3v2float + %8 = OpTypeFunction %mat3v2float %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_S_std140 = OpTypePointer Uniform %S_std140 %_ptr_Uniform_v2float = OpTypePointer Uniform %v2float %uint_1 = OpConstant %uint 1 %uint_2 = OpConstant %uint 2 %void = OpTypeVoid - %27 = OpTypeFunction %void + %30 = OpTypeFunction %void %uint_3 = OpConstant %uint 3 %_ptr_Uniform_v3float = OpTypePointer Uniform %v3float -%load_data_matrix = OpFunction %mat3v2float None %7 - %10 = OpLabel - %16 = OpAccessChain %_ptr_Uniform_v2float %data %uint_0 - %17 = OpLoad %v2float %16 - %20 = OpAccessChain %_ptr_Uniform_v2float %data %uint_1 - %21 = OpLoad %v2float %20 - %24 = OpAccessChain %_ptr_Uniform_v2float %data %uint_2 - %25 = OpLoad %v2float %24 - %26 = OpCompositeConstruct %mat3v2float %17 %21 %25 - OpReturnValue %26 +%load_data_inner_matrix = OpFunction %mat3v2float None %8 + %11 = OpLabel + %16 = OpAccessChain %_ptr_Uniform_S_std140 %data %uint_0 + %19 = OpAccessChain %_ptr_Uniform_v2float %16 %uint_0 + %20 = OpLoad %v2float %19 + %23 = OpAccessChain %_ptr_Uniform_v2float %16 %uint_1 + %24 = OpLoad %v2float %23 + %27 = OpAccessChain %_ptr_Uniform_v2float %16 %uint_2 + %28 = OpLoad %v2float %27 + %29 = OpCompositeConstruct %mat3v2float %20 %24 %28 + OpReturnValue %29 OpFunctionEnd - %main = OpFunction %void None %27 - %30 = OpLabel - %31 = OpFunctionCall %mat3v2float %load_data_matrix - %34 = OpAccessChain %_ptr_Uniform_v3float %data %uint_3 - %35 = OpLoad %v3float %34 - %36 = OpMatrixTimesVector %v2float %31 %35 + %main = OpFunction %void None %30 + %33 = OpLabel + %34 = OpFunctionCall %mat3v2float %load_data_inner_matrix + %37 = OpAccessChain %_ptr_Uniform_v3float %data %uint_0 %uint_3 + %38 = OpLoad %v3float %37 + %39 = OpMatrixTimesVector %v2float %34 %38 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mul/mat3x3-vec3/f32.wgsl.expected.glsl b/test/tint/expressions/binary/mul/mat3x3-vec3/f32.wgsl.expected.glsl index f8f1b37fc5..40229c1dc1 100644 --- a/test/tint/expressions/binary/mul/mat3x3-vec3/f32.wgsl.expected.glsl +++ b/test/tint/expressions/binary/mul/mat3x3-vec3/f32.wgsl.expected.glsl @@ -1,14 +1,18 @@ #version 310 es precision mediump float; -layout(binding = 0, std140) uniform S_ubo { +struct S { mat3 matrix; vec3 vector; uint pad; +}; + +layout(binding = 0, std140) uniform data_block_ubo { + S inner; } data; void tint_symbol() { - vec3 x = (data.matrix * data.vector); + vec3 x = (data.inner.matrix * data.inner.vector); } void main() { diff --git a/test/tint/expressions/binary/mul/mat3x3-vec3/f32.wgsl.expected.spvasm b/test/tint/expressions/binary/mul/mat3x3-vec3/f32.wgsl.expected.spvasm index 468d2e9c11..30ed04c264 100644 --- a/test/tint/expressions/binary/mul/mat3x3-vec3/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mul/mat3x3-vec3/f32.wgsl.expected.spvasm @@ -1,18 +1,21 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 21 +; Bound: 22 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %main "main" OpExecutionMode %main OriginUpperLeft + OpName %data_block "data_block" + OpMemberName %data_block 0 "inner" OpName %S "S" OpMemberName %S 0 "matrix" OpMemberName %S 1 "vector" OpName %data "data" OpName %main "main" - OpDecorate %S Block + OpDecorate %data_block Block + OpMemberDecorate %data_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpMemberDecorate %S 0 ColMajor OpMemberDecorate %S 0 MatrixStride 16 @@ -24,21 +27,22 @@ %v3float = OpTypeVector %float 3 %mat3v3float = OpTypeMatrix %v3float 3 %S = OpTypeStruct %mat3v3float %v3float -%_ptr_Uniform_S = OpTypePointer Uniform %S - %data = OpVariable %_ptr_Uniform_S Uniform + %data_block = OpTypeStruct %S +%_ptr_Uniform_data_block = OpTypePointer Uniform %data_block + %data = OpVariable %_ptr_Uniform_data_block Uniform %void = OpTypeVoid - %7 = OpTypeFunction %void + %8 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_Uniform_mat3v3float = OpTypePointer Uniform %mat3v3float %uint_1 = OpConstant %uint 1 %_ptr_Uniform_v3float = OpTypePointer Uniform %v3float - %main = OpFunction %void None %7 - %10 = OpLabel - %14 = OpAccessChain %_ptr_Uniform_mat3v3float %data %uint_0 - %15 = OpLoad %mat3v3float %14 - %18 = OpAccessChain %_ptr_Uniform_v3float %data %uint_1 - %19 = OpLoad %v3float %18 - %20 = OpMatrixTimesVector %v3float %15 %19 + %main = OpFunction %void None %8 + %11 = OpLabel + %15 = OpAccessChain %_ptr_Uniform_mat3v3float %data %uint_0 %uint_0 + %16 = OpLoad %mat3v3float %15 + %19 = OpAccessChain %_ptr_Uniform_v3float %data %uint_0 %uint_1 + %20 = OpLoad %v3float %19 + %21 = OpMatrixTimesVector %v3float %16 %20 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mul/vec3-mat3x3/f32.wgsl.expected.glsl b/test/tint/expressions/binary/mul/vec3-mat3x3/f32.wgsl.expected.glsl index 1d17cf7dd8..f9ccbd779f 100644 --- a/test/tint/expressions/binary/mul/vec3-mat3x3/f32.wgsl.expected.glsl +++ b/test/tint/expressions/binary/mul/vec3-mat3x3/f32.wgsl.expected.glsl @@ -1,14 +1,18 @@ #version 310 es precision mediump float; -layout(binding = 0, std140) uniform S_ubo { +struct S { mat3 matrix; vec3 vector; uint pad; +}; + +layout(binding = 0, std140) uniform data_block_ubo { + S inner; } data; void tint_symbol() { - vec3 x = (data.vector * data.matrix); + vec3 x = (data.inner.vector * data.inner.matrix); } void main() { diff --git a/test/tint/expressions/binary/mul/vec3-mat3x3/f32.wgsl.expected.spvasm b/test/tint/expressions/binary/mul/vec3-mat3x3/f32.wgsl.expected.spvasm index 1820ed869a..5c918c4759 100644 --- a/test/tint/expressions/binary/mul/vec3-mat3x3/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mul/vec3-mat3x3/f32.wgsl.expected.spvasm @@ -1,18 +1,21 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 21 +; Bound: 22 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %main "main" OpExecutionMode %main OriginUpperLeft + OpName %data_block "data_block" + OpMemberName %data_block 0 "inner" OpName %S "S" OpMemberName %S 0 "matrix" OpMemberName %S 1 "vector" OpName %data "data" OpName %main "main" - OpDecorate %S Block + OpDecorate %data_block Block + OpMemberDecorate %data_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpMemberDecorate %S 0 ColMajor OpMemberDecorate %S 0 MatrixStride 16 @@ -24,21 +27,22 @@ %v3float = OpTypeVector %float 3 %mat3v3float = OpTypeMatrix %v3float 3 %S = OpTypeStruct %mat3v3float %v3float -%_ptr_Uniform_S = OpTypePointer Uniform %S - %data = OpVariable %_ptr_Uniform_S Uniform + %data_block = OpTypeStruct %S +%_ptr_Uniform_data_block = OpTypePointer Uniform %data_block + %data = OpVariable %_ptr_Uniform_data_block Uniform %void = OpTypeVoid - %7 = OpTypeFunction %void + %8 = OpTypeFunction %void %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 %uint_1 = OpConstant %uint 1 %_ptr_Uniform_v3float = OpTypePointer Uniform %v3float - %uint_0 = OpConstant %uint 0 %_ptr_Uniform_mat3v3float = OpTypePointer Uniform %mat3v3float - %main = OpFunction %void None %7 - %10 = OpLabel - %14 = OpAccessChain %_ptr_Uniform_v3float %data %uint_1 - %15 = OpLoad %v3float %14 - %18 = OpAccessChain %_ptr_Uniform_mat3v3float %data %uint_0 - %19 = OpLoad %mat3v3float %18 - %20 = OpVectorTimesMatrix %v3float %15 %19 + %main = OpFunction %void None %8 + %11 = OpLabel + %16 = OpAccessChain %_ptr_Uniform_v3float %data %uint_0 %uint_1 + %17 = OpLoad %v3float %16 + %19 = OpAccessChain %_ptr_Uniform_mat3v3float %data %uint_0 %uint_0 + %20 = OpLoad %mat3v3float %19 + %21 = OpVectorTimesMatrix %v3float %17 %20 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mul/vec3-mat4x3/f32.wgsl.expected.glsl b/test/tint/expressions/binary/mul/vec3-mat4x3/f32.wgsl.expected.glsl index 149b5e09b1..fc84920add 100644 --- a/test/tint/expressions/binary/mul/vec3-mat4x3/f32.wgsl.expected.glsl +++ b/test/tint/expressions/binary/mul/vec3-mat4x3/f32.wgsl.expected.glsl @@ -1,14 +1,18 @@ #version 310 es precision mediump float; -layout(binding = 0, std140) uniform S_ubo { +struct S { mat4x3 matrix; vec3 vector; uint pad; +}; + +layout(binding = 0, std140) uniform data_block_ubo { + S inner; } data; void tint_symbol() { - vec4 x = (data.vector * data.matrix); + vec4 x = (data.inner.vector * data.inner.matrix); } void main() { diff --git a/test/tint/expressions/binary/mul/vec3-mat4x3/f32.wgsl.expected.spvasm b/test/tint/expressions/binary/mul/vec3-mat4x3/f32.wgsl.expected.spvasm index 2efe5701c8..a5f1a76920 100644 --- a/test/tint/expressions/binary/mul/vec3-mat4x3/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mul/vec3-mat4x3/f32.wgsl.expected.spvasm @@ -1,18 +1,21 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 22 +; Bound: 23 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %main "main" OpExecutionMode %main OriginUpperLeft + OpName %data_block "data_block" + OpMemberName %data_block 0 "inner" OpName %S "S" OpMemberName %S 0 "matrix" OpMemberName %S 1 "vector" OpName %data "data" OpName %main "main" - OpDecorate %S Block + OpDecorate %data_block Block + OpMemberDecorate %data_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpMemberDecorate %S 0 ColMajor OpMemberDecorate %S 0 MatrixStride 16 @@ -24,22 +27,23 @@ %v3float = OpTypeVector %float 3 %mat4v3float = OpTypeMatrix %v3float 4 %S = OpTypeStruct %mat4v3float %v3float -%_ptr_Uniform_S = OpTypePointer Uniform %S - %data = OpVariable %_ptr_Uniform_S Uniform + %data_block = OpTypeStruct %S +%_ptr_Uniform_data_block = OpTypePointer Uniform %data_block + %data = OpVariable %_ptr_Uniform_data_block Uniform %void = OpTypeVoid - %7 = OpTypeFunction %void + %8 = OpTypeFunction %void %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 %uint_1 = OpConstant %uint 1 %_ptr_Uniform_v3float = OpTypePointer Uniform %v3float - %uint_0 = OpConstant %uint 0 %_ptr_Uniform_mat4v3float = OpTypePointer Uniform %mat4v3float %v4float = OpTypeVector %float 4 - %main = OpFunction %void None %7 - %10 = OpLabel - %14 = OpAccessChain %_ptr_Uniform_v3float %data %uint_1 - %15 = OpLoad %v3float %14 - %18 = OpAccessChain %_ptr_Uniform_mat4v3float %data %uint_0 - %19 = OpLoad %mat4v3float %18 - %20 = OpVectorTimesMatrix %v4float %15 %19 + %main = OpFunction %void None %8 + %11 = OpLabel + %16 = OpAccessChain %_ptr_Uniform_v3float %data %uint_0 %uint_1 + %17 = OpLoad %v3float %16 + %19 = OpAccessChain %_ptr_Uniform_mat4v3float %data %uint_0 %uint_0 + %20 = OpLoad %mat4v3float %19 + %21 = OpVectorTimesMatrix %v4float %17 %20 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/swizzle/read/packed_vec3/f32.wgsl.expected.glsl b/test/tint/expressions/swizzle/read/packed_vec3/f32.wgsl.expected.glsl index e72cd13ae6..559e3af277 100644 --- a/test/tint/expressions/swizzle/read/packed_vec3/f32.wgsl.expected.glsl +++ b/test/tint/expressions/swizzle/read/packed_vec3/f32.wgsl.expected.glsl @@ -4,132 +4,136 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std140) uniform S_ubo { +struct S { vec3 v; uint pad; +}; + +layout(binding = 0, std140) uniform U_block_ubo { + S inner; } U; void f() { - vec3 v = U.v; - float x = U.v.x; - float y = U.v.y; - float z = U.v.z; - vec2 xx = U.v.xx; - vec2 xy = U.v.xy; - vec2 xz = U.v.xz; - vec2 yx = U.v.yx; - vec2 yy = U.v.yy; - vec2 yz = U.v.yz; - vec2 zx = U.v.zx; - vec2 zy = U.v.zy; - vec2 zz = U.v.zz; - vec3 xxx = U.v.xxx; - vec3 xxy = U.v.xxy; - vec3 xxz = U.v.xxz; - vec3 xyx = U.v.xyx; - vec3 xyy = U.v.xyy; - vec3 xyz = U.v.xyz; - vec3 xzx = U.v.xzx; - vec3 xzy = U.v.xzy; - vec3 xzz = U.v.xzz; - vec3 yxx = U.v.yxx; - vec3 yxy = U.v.yxy; - vec3 yxz = U.v.yxz; - vec3 yyx = U.v.yyx; - vec3 yyy = U.v.yyy; - vec3 yyz = U.v.yyz; - vec3 yzx = U.v.yzx; - vec3 yzy = U.v.yzy; - vec3 yzz = U.v.yzz; - vec3 zxx = U.v.zxx; - vec3 zxy = U.v.zxy; - vec3 zxz = U.v.zxz; - vec3 zyx = U.v.zyx; - vec3 zyy = U.v.zyy; - vec3 zyz = U.v.zyz; - vec3 zzx = U.v.zzx; - vec3 zzy = U.v.zzy; - vec3 zzz = U.v.zzz; - vec4 xxxx = U.v.xxxx; - vec4 xxxy = U.v.xxxy; - vec4 xxxz = U.v.xxxz; - vec4 xxyx = U.v.xxyx; - vec4 xxyy = U.v.xxyy; - vec4 xxyz = U.v.xxyz; - vec4 xxzx = U.v.xxzx; - vec4 xxzy = U.v.xxzy; - vec4 xxzz = U.v.xxzz; - vec4 xyxx = U.v.xyxx; - vec4 xyxy = U.v.xyxy; - vec4 xyxz = U.v.xyxz; - vec4 xyyx = U.v.xyyx; - vec4 xyyy = U.v.xyyy; - vec4 xyyz = U.v.xyyz; - vec4 xyzx = U.v.xyzx; - vec4 xyzy = U.v.xyzy; - vec4 xyzz = U.v.xyzz; - vec4 xzxx = U.v.xzxx; - vec4 xzxy = U.v.xzxy; - vec4 xzxz = U.v.xzxz; - vec4 xzyx = U.v.xzyx; - vec4 xzyy = U.v.xzyy; - vec4 xzyz = U.v.xzyz; - vec4 xzzx = U.v.xzzx; - vec4 xzzy = U.v.xzzy; - vec4 xzzz = U.v.xzzz; - vec4 yxxx = U.v.yxxx; - vec4 yxxy = U.v.yxxy; - vec4 yxxz = U.v.yxxz; - vec4 yxyx = U.v.yxyx; - vec4 yxyy = U.v.yxyy; - vec4 yxyz = U.v.yxyz; - vec4 yxzx = U.v.yxzx; - vec4 yxzy = U.v.yxzy; - vec4 yxzz = U.v.yxzz; - vec4 yyxx = U.v.yyxx; - vec4 yyxy = U.v.yyxy; - vec4 yyxz = U.v.yyxz; - vec4 yyyx = U.v.yyyx; - vec4 yyyy = U.v.yyyy; - vec4 yyyz = U.v.yyyz; - vec4 yyzx = U.v.yyzx; - vec4 yyzy = U.v.yyzy; - vec4 yyzz = U.v.yyzz; - vec4 yzxx = U.v.yzxx; - vec4 yzxy = U.v.yzxy; - vec4 yzxz = U.v.yzxz; - vec4 yzyx = U.v.yzyx; - vec4 yzyy = U.v.yzyy; - vec4 yzyz = U.v.yzyz; - vec4 yzzx = U.v.yzzx; - vec4 yzzy = U.v.yzzy; - vec4 yzzz = U.v.yzzz; - vec4 zxxx = U.v.zxxx; - vec4 zxxy = U.v.zxxy; - vec4 zxxz = U.v.zxxz; - vec4 zxyx = U.v.zxyx; - vec4 zxyy = U.v.zxyy; - vec4 zxyz = U.v.zxyz; - vec4 zxzx = U.v.zxzx; - vec4 zxzy = U.v.zxzy; - vec4 zxzz = U.v.zxzz; - vec4 zyxx = U.v.zyxx; - vec4 zyxy = U.v.zyxy; - vec4 zyxz = U.v.zyxz; - vec4 zyyx = U.v.zyyx; - vec4 zyyy = U.v.zyyy; - vec4 zyyz = U.v.zyyz; - vec4 zyzx = U.v.zyzx; - vec4 zyzy = U.v.zyzy; - vec4 zyzz = U.v.zyzz; - vec4 zzxx = U.v.zzxx; - vec4 zzxy = U.v.zzxy; - vec4 zzxz = U.v.zzxz; - vec4 zzyx = U.v.zzyx; - vec4 zzyy = U.v.zzyy; - vec4 zzyz = U.v.zzyz; - vec4 zzzx = U.v.zzzx; - vec4 zzzy = U.v.zzzy; - vec4 zzzz = U.v.zzzz; + vec3 v = U.inner.v; + float x = U.inner.v.x; + float y = U.inner.v.y; + float z = U.inner.v.z; + vec2 xx = U.inner.v.xx; + vec2 xy = U.inner.v.xy; + vec2 xz = U.inner.v.xz; + vec2 yx = U.inner.v.yx; + vec2 yy = U.inner.v.yy; + vec2 yz = U.inner.v.yz; + vec2 zx = U.inner.v.zx; + vec2 zy = U.inner.v.zy; + vec2 zz = U.inner.v.zz; + vec3 xxx = U.inner.v.xxx; + vec3 xxy = U.inner.v.xxy; + vec3 xxz = U.inner.v.xxz; + vec3 xyx = U.inner.v.xyx; + vec3 xyy = U.inner.v.xyy; + vec3 xyz = U.inner.v.xyz; + vec3 xzx = U.inner.v.xzx; + vec3 xzy = U.inner.v.xzy; + vec3 xzz = U.inner.v.xzz; + vec3 yxx = U.inner.v.yxx; + vec3 yxy = U.inner.v.yxy; + vec3 yxz = U.inner.v.yxz; + vec3 yyx = U.inner.v.yyx; + vec3 yyy = U.inner.v.yyy; + vec3 yyz = U.inner.v.yyz; + vec3 yzx = U.inner.v.yzx; + vec3 yzy = U.inner.v.yzy; + vec3 yzz = U.inner.v.yzz; + vec3 zxx = U.inner.v.zxx; + vec3 zxy = U.inner.v.zxy; + vec3 zxz = U.inner.v.zxz; + vec3 zyx = U.inner.v.zyx; + vec3 zyy = U.inner.v.zyy; + vec3 zyz = U.inner.v.zyz; + vec3 zzx = U.inner.v.zzx; + vec3 zzy = U.inner.v.zzy; + vec3 zzz = U.inner.v.zzz; + vec4 xxxx = U.inner.v.xxxx; + vec4 xxxy = U.inner.v.xxxy; + vec4 xxxz = U.inner.v.xxxz; + vec4 xxyx = U.inner.v.xxyx; + vec4 xxyy = U.inner.v.xxyy; + vec4 xxyz = U.inner.v.xxyz; + vec4 xxzx = U.inner.v.xxzx; + vec4 xxzy = U.inner.v.xxzy; + vec4 xxzz = U.inner.v.xxzz; + vec4 xyxx = U.inner.v.xyxx; + vec4 xyxy = U.inner.v.xyxy; + vec4 xyxz = U.inner.v.xyxz; + vec4 xyyx = U.inner.v.xyyx; + vec4 xyyy = U.inner.v.xyyy; + vec4 xyyz = U.inner.v.xyyz; + vec4 xyzx = U.inner.v.xyzx; + vec4 xyzy = U.inner.v.xyzy; + vec4 xyzz = U.inner.v.xyzz; + vec4 xzxx = U.inner.v.xzxx; + vec4 xzxy = U.inner.v.xzxy; + vec4 xzxz = U.inner.v.xzxz; + vec4 xzyx = U.inner.v.xzyx; + vec4 xzyy = U.inner.v.xzyy; + vec4 xzyz = U.inner.v.xzyz; + vec4 xzzx = U.inner.v.xzzx; + vec4 xzzy = U.inner.v.xzzy; + vec4 xzzz = U.inner.v.xzzz; + vec4 yxxx = U.inner.v.yxxx; + vec4 yxxy = U.inner.v.yxxy; + vec4 yxxz = U.inner.v.yxxz; + vec4 yxyx = U.inner.v.yxyx; + vec4 yxyy = U.inner.v.yxyy; + vec4 yxyz = U.inner.v.yxyz; + vec4 yxzx = U.inner.v.yxzx; + vec4 yxzy = U.inner.v.yxzy; + vec4 yxzz = U.inner.v.yxzz; + vec4 yyxx = U.inner.v.yyxx; + vec4 yyxy = U.inner.v.yyxy; + vec4 yyxz = U.inner.v.yyxz; + vec4 yyyx = U.inner.v.yyyx; + vec4 yyyy = U.inner.v.yyyy; + vec4 yyyz = U.inner.v.yyyz; + vec4 yyzx = U.inner.v.yyzx; + vec4 yyzy = U.inner.v.yyzy; + vec4 yyzz = U.inner.v.yyzz; + vec4 yzxx = U.inner.v.yzxx; + vec4 yzxy = U.inner.v.yzxy; + vec4 yzxz = U.inner.v.yzxz; + vec4 yzyx = U.inner.v.yzyx; + vec4 yzyy = U.inner.v.yzyy; + vec4 yzyz = U.inner.v.yzyz; + vec4 yzzx = U.inner.v.yzzx; + vec4 yzzy = U.inner.v.yzzy; + vec4 yzzz = U.inner.v.yzzz; + vec4 zxxx = U.inner.v.zxxx; + vec4 zxxy = U.inner.v.zxxy; + vec4 zxxz = U.inner.v.zxxz; + vec4 zxyx = U.inner.v.zxyx; + vec4 zxyy = U.inner.v.zxyy; + vec4 zxyz = U.inner.v.zxyz; + vec4 zxzx = U.inner.v.zxzx; + vec4 zxzy = U.inner.v.zxzy; + vec4 zxzz = U.inner.v.zxzz; + vec4 zyxx = U.inner.v.zyxx; + vec4 zyxy = U.inner.v.zyxy; + vec4 zyxz = U.inner.v.zyxz; + vec4 zyyx = U.inner.v.zyyx; + vec4 zyyy = U.inner.v.zyyy; + vec4 zyyz = U.inner.v.zyyz; + vec4 zyzx = U.inner.v.zyzx; + vec4 zyzy = U.inner.v.zyzy; + vec4 zyzz = U.inner.v.zyzz; + vec4 zzxx = U.inner.v.zzxx; + vec4 zzxy = U.inner.v.zzxy; + vec4 zzxz = U.inner.v.zzxz; + vec4 zzyx = U.inner.v.zzyx; + vec4 zzyy = U.inner.v.zzyy; + vec4 zzyz = U.inner.v.zzyz; + vec4 zzzx = U.inner.v.zzzx; + vec4 zzzy = U.inner.v.zzzy; + vec4 zzzz = U.inner.v.zzzz; } diff --git a/test/tint/expressions/swizzle/read/packed_vec3/f32.wgsl.expected.spvasm b/test/tint/expressions/swizzle/read/packed_vec3/f32.wgsl.expected.spvasm index eaadf004cd..5d01d2301e 100644 --- a/test/tint/expressions/swizzle/read/packed_vec3/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/swizzle/read/packed_vec3/f32.wgsl.expected.spvasm @@ -1,12 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 508 +; Bound: 509 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %U_block "U_block" + OpMemberName %U_block 0 "inner" OpName %S "S" OpMemberName %S 0 "v" OpName %U "U" @@ -133,7 +135,8 @@ OpName %zzzx "zzzx" OpName %zzzy "zzzy" OpName %zzzz "zzzz" - OpDecorate %S Block + OpDecorate %U_block Block + OpMemberDecorate %U_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %U NonWritable OpDecorate %U DescriptorSet 0 @@ -141,632 +144,633 @@ %float = OpTypeFloat 32 %v3float = OpTypeVector %float 3 %S = OpTypeStruct %v3float -%_ptr_Uniform_S = OpTypePointer Uniform %S - %U = OpVariable %_ptr_Uniform_S Uniform + %U_block = OpTypeStruct %S +%_ptr_Uniform_U_block = OpTypePointer Uniform %U_block + %U = OpVariable %_ptr_Uniform_U_block Uniform %void = OpTypeVoid - %6 = OpTypeFunction %void + %7 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_Uniform_v3float = OpTypePointer Uniform %v3float %_ptr_Function_v3float = OpTypePointer Function %v3float - %19 = OpConstantNull %v3float + %20 = OpConstantNull %v3float %_ptr_Uniform_float = OpTypePointer Uniform %float %_ptr_Function_float = OpTypePointer Function %float - %25 = OpConstantNull %float + %26 = OpConstantNull %float %uint_1 = OpConstant %uint 1 %uint_2 = OpConstant %uint 2 %v2float = OpTypeVector %float 2 %_ptr_Function_v2float = OpTypePointer Function %v2float - %40 = OpConstantNull %v2float + %41 = OpConstantNull %v2float %v4float = OpTypeVector %float 4 %_ptr_Function_v4float = OpTypePointer Function %v4float - %187 = OpConstantNull %v4float -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel + %188 = OpConstantNull %v4float +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel OpReturn OpFunctionEnd - %f = OpFunction %void None %6 - %11 = OpLabel - %v = OpVariable %_ptr_Function_v3float Function %19 - %x = OpVariable %_ptr_Function_float Function %25 - %y = OpVariable %_ptr_Function_float Function %25 - %z = OpVariable %_ptr_Function_float Function %25 - %xx = OpVariable %_ptr_Function_v2float Function %40 - %xy = OpVariable %_ptr_Function_v2float Function %40 - %xz = OpVariable %_ptr_Function_v2float Function %40 - %yx = OpVariable %_ptr_Function_v2float Function %40 - %yy = OpVariable %_ptr_Function_v2float Function %40 - %yz = OpVariable %_ptr_Function_v2float Function %40 - %zx = OpVariable %_ptr_Function_v2float Function %40 - %zy = OpVariable %_ptr_Function_v2float Function %40 - %zz = OpVariable %_ptr_Function_v2float Function %40 - %xxx = OpVariable %_ptr_Function_v3float Function %19 - %xxy = OpVariable %_ptr_Function_v3float Function %19 - %xxz = OpVariable %_ptr_Function_v3float Function %19 - %xyx = OpVariable %_ptr_Function_v3float Function %19 - %xyy = OpVariable %_ptr_Function_v3float Function %19 - %xyz = OpVariable %_ptr_Function_v3float Function %19 - %xzx = OpVariable %_ptr_Function_v3float Function %19 - %xzy = OpVariable %_ptr_Function_v3float Function %19 - %xzz = OpVariable %_ptr_Function_v3float Function %19 - %yxx = OpVariable %_ptr_Function_v3float Function %19 - %yxy = OpVariable %_ptr_Function_v3float Function %19 - %yxz = OpVariable %_ptr_Function_v3float Function %19 - %yyx = OpVariable %_ptr_Function_v3float Function %19 - %yyy = OpVariable %_ptr_Function_v3float Function %19 - %yyz = OpVariable %_ptr_Function_v3float Function %19 - %yzx = OpVariable %_ptr_Function_v3float Function %19 - %yzy = OpVariable %_ptr_Function_v3float Function %19 - %yzz = OpVariable %_ptr_Function_v3float Function %19 - %zxx = OpVariable %_ptr_Function_v3float Function %19 - %zxy = OpVariable %_ptr_Function_v3float Function %19 - %zxz = OpVariable %_ptr_Function_v3float Function %19 - %zyx = OpVariable %_ptr_Function_v3float Function %19 - %zyy = OpVariable %_ptr_Function_v3float Function %19 - %zyz = OpVariable %_ptr_Function_v3float Function %19 - %zzx = OpVariable %_ptr_Function_v3float Function %19 - %zzy = OpVariable %_ptr_Function_v3float Function %19 - %zzz = OpVariable %_ptr_Function_v3float Function %19 - %xxxx = OpVariable %_ptr_Function_v4float Function %187 - %xxxy = OpVariable %_ptr_Function_v4float Function %187 - %xxxz = OpVariable %_ptr_Function_v4float Function %187 - %xxyx = OpVariable %_ptr_Function_v4float Function %187 - %xxyy = OpVariable %_ptr_Function_v4float Function %187 - %xxyz = OpVariable %_ptr_Function_v4float Function %187 - %xxzx = OpVariable %_ptr_Function_v4float Function %187 - %xxzy = OpVariable %_ptr_Function_v4float Function %187 - %xxzz = OpVariable %_ptr_Function_v4float Function %187 - %xyxx = OpVariable %_ptr_Function_v4float Function %187 - %xyxy = OpVariable %_ptr_Function_v4float Function %187 - %xyxz = OpVariable %_ptr_Function_v4float Function %187 - %xyyx = OpVariable %_ptr_Function_v4float Function %187 - %xyyy = OpVariable %_ptr_Function_v4float Function %187 - %xyyz = OpVariable %_ptr_Function_v4float Function %187 - %xyzx = OpVariable %_ptr_Function_v4float Function %187 - %xyzy = OpVariable %_ptr_Function_v4float Function %187 - %xyzz = OpVariable %_ptr_Function_v4float Function %187 - %xzxx = OpVariable %_ptr_Function_v4float Function %187 - %xzxy = OpVariable %_ptr_Function_v4float Function %187 - %xzxz = OpVariable %_ptr_Function_v4float Function %187 - %xzyx = OpVariable %_ptr_Function_v4float Function %187 - %xzyy = OpVariable %_ptr_Function_v4float Function %187 - %xzyz = OpVariable %_ptr_Function_v4float Function %187 - %xzzx = OpVariable %_ptr_Function_v4float Function %187 - %xzzy = OpVariable %_ptr_Function_v4float Function %187 - %xzzz = OpVariable %_ptr_Function_v4float Function %187 - %yxxx = OpVariable %_ptr_Function_v4float Function %187 - %yxxy = OpVariable %_ptr_Function_v4float Function %187 - %yxxz = OpVariable %_ptr_Function_v4float Function %187 - %yxyx = OpVariable %_ptr_Function_v4float Function %187 - %yxyy = OpVariable %_ptr_Function_v4float Function %187 - %yxyz = OpVariable %_ptr_Function_v4float Function %187 - %yxzx = OpVariable %_ptr_Function_v4float Function %187 - %yxzy = OpVariable %_ptr_Function_v4float Function %187 - %yxzz = OpVariable %_ptr_Function_v4float Function %187 - %yyxx = OpVariable %_ptr_Function_v4float Function %187 - %yyxy = OpVariable %_ptr_Function_v4float Function %187 - %yyxz = OpVariable %_ptr_Function_v4float Function %187 - %yyyx = OpVariable %_ptr_Function_v4float Function %187 - %yyyy = OpVariable %_ptr_Function_v4float Function %187 - %yyyz = OpVariable %_ptr_Function_v4float Function %187 - %yyzx = OpVariable %_ptr_Function_v4float Function %187 - %yyzy = OpVariable %_ptr_Function_v4float Function %187 - %yyzz = OpVariable %_ptr_Function_v4float Function %187 - %yzxx = OpVariable %_ptr_Function_v4float Function %187 - %yzxy = OpVariable %_ptr_Function_v4float Function %187 - %yzxz = OpVariable %_ptr_Function_v4float Function %187 - %yzyx = OpVariable %_ptr_Function_v4float Function %187 - %yzyy = OpVariable %_ptr_Function_v4float Function %187 - %yzyz = OpVariable %_ptr_Function_v4float Function %187 - %yzzx = OpVariable %_ptr_Function_v4float Function %187 - %yzzy = OpVariable %_ptr_Function_v4float Function %187 - %yzzz = OpVariable %_ptr_Function_v4float Function %187 - %zxxx = OpVariable %_ptr_Function_v4float Function %187 - %zxxy = OpVariable %_ptr_Function_v4float Function %187 - %zxxz = OpVariable %_ptr_Function_v4float Function %187 - %zxyx = OpVariable %_ptr_Function_v4float Function %187 - %zxyy = OpVariable %_ptr_Function_v4float Function %187 - %zxyz = OpVariable %_ptr_Function_v4float Function %187 - %zxzx = OpVariable %_ptr_Function_v4float Function %187 - %zxzy = OpVariable %_ptr_Function_v4float Function %187 - %zxzz = OpVariable %_ptr_Function_v4float Function %187 - %zyxx = OpVariable %_ptr_Function_v4float Function %187 - %zyxy = OpVariable %_ptr_Function_v4float Function %187 - %zyxz = OpVariable %_ptr_Function_v4float Function %187 - %zyyx = OpVariable %_ptr_Function_v4float Function %187 - %zyyy = OpVariable %_ptr_Function_v4float Function %187 - %zyyz = OpVariable %_ptr_Function_v4float Function %187 - %zyzx = OpVariable %_ptr_Function_v4float Function %187 - %zyzy = OpVariable %_ptr_Function_v4float Function %187 - %zyzz = OpVariable %_ptr_Function_v4float Function %187 - %zzxx = OpVariable %_ptr_Function_v4float Function %187 - %zzxy = OpVariable %_ptr_Function_v4float Function %187 - %zzxz = OpVariable %_ptr_Function_v4float Function %187 - %zzyx = OpVariable %_ptr_Function_v4float Function %187 - %zzyy = OpVariable %_ptr_Function_v4float Function %187 - %zzyz = OpVariable %_ptr_Function_v4float Function %187 - %zzzx = OpVariable %_ptr_Function_v4float Function %187 - %zzzy = OpVariable %_ptr_Function_v4float Function %187 - %zzzz = OpVariable %_ptr_Function_v4float Function %187 - %15 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %16 = OpLoad %v3float %15 - OpStore %v %16 - %21 = OpAccessChain %_ptr_Uniform_float %U %uint_0 %uint_0 - %22 = OpLoad %float %21 - OpStore %x %22 - %27 = OpAccessChain %_ptr_Uniform_float %U %uint_0 %uint_1 - %28 = OpLoad %float %27 - OpStore %y %28 - %31 = OpAccessChain %_ptr_Uniform_float %U %uint_0 %uint_2 - %32 = OpLoad %float %31 - OpStore %z %32 - %34 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %36 = OpLoad %v3float %34 - %37 = OpVectorShuffle %v2float %36 %36 0 0 - OpStore %xx %37 - %41 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %42 = OpLoad %v3float %41 - %43 = OpVectorShuffle %v2float %42 %42 0 1 - OpStore %xy %43 - %45 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %46 = OpLoad %v3float %45 - %47 = OpVectorShuffle %v2float %46 %46 0 2 - OpStore %xz %47 - %49 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %50 = OpLoad %v3float %49 - %51 = OpVectorShuffle %v2float %50 %50 1 0 - OpStore %yx %51 - %53 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %54 = OpLoad %v3float %53 - %55 = OpVectorShuffle %v2float %54 %54 1 1 - OpStore %yy %55 - %57 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %58 = OpLoad %v3float %57 - %59 = OpVectorShuffle %v2float %58 %58 1 2 - OpStore %yz %59 - %61 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %62 = OpLoad %v3float %61 - %63 = OpVectorShuffle %v2float %62 %62 2 0 - OpStore %zx %63 - %65 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %66 = OpLoad %v3float %65 - %67 = OpVectorShuffle %v2float %66 %66 2 1 - OpStore %zy %67 - %69 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %70 = OpLoad %v3float %69 - %71 = OpVectorShuffle %v2float %70 %70 2 2 - OpStore %zz %71 - %73 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %74 = OpLoad %v3float %73 - %75 = OpVectorShuffle %v3float %74 %74 0 0 0 - OpStore %xxx %75 - %77 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %78 = OpLoad %v3float %77 - %79 = OpVectorShuffle %v3float %78 %78 0 0 1 - OpStore %xxy %79 - %81 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %82 = OpLoad %v3float %81 - %83 = OpVectorShuffle %v3float %82 %82 0 0 2 - OpStore %xxz %83 - %85 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %86 = OpLoad %v3float %85 - %87 = OpVectorShuffle %v3float %86 %86 0 1 0 - OpStore %xyx %87 - %89 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %90 = OpLoad %v3float %89 - %91 = OpVectorShuffle %v3float %90 %90 0 1 1 - OpStore %xyy %91 - %93 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %94 = OpLoad %v3float %93 - %95 = OpVectorShuffle %v3float %94 %94 0 1 2 - OpStore %xyz %95 - %97 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %98 = OpLoad %v3float %97 - %99 = OpVectorShuffle %v3float %98 %98 0 2 0 - OpStore %xzx %99 - %101 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %102 = OpLoad %v3float %101 - %103 = OpVectorShuffle %v3float %102 %102 0 2 1 - OpStore %xzy %103 - %105 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %106 = OpLoad %v3float %105 - %107 = OpVectorShuffle %v3float %106 %106 0 2 2 - OpStore %xzz %107 - %109 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %110 = OpLoad %v3float %109 - %111 = OpVectorShuffle %v3float %110 %110 1 0 0 - OpStore %yxx %111 - %113 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %114 = OpLoad %v3float %113 - %115 = OpVectorShuffle %v3float %114 %114 1 0 1 - OpStore %yxy %115 - %117 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %118 = OpLoad %v3float %117 - %119 = OpVectorShuffle %v3float %118 %118 1 0 2 - OpStore %yxz %119 - %121 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %122 = OpLoad %v3float %121 - %123 = OpVectorShuffle %v3float %122 %122 1 1 0 - OpStore %yyx %123 - %125 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %126 = OpLoad %v3float %125 - %127 = OpVectorShuffle %v3float %126 %126 1 1 1 - OpStore %yyy %127 - %129 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %130 = OpLoad %v3float %129 - %131 = OpVectorShuffle %v3float %130 %130 1 1 2 - OpStore %yyz %131 - %133 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %134 = OpLoad %v3float %133 - %135 = OpVectorShuffle %v3float %134 %134 1 2 0 - OpStore %yzx %135 - %137 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %138 = OpLoad %v3float %137 - %139 = OpVectorShuffle %v3float %138 %138 1 2 1 - OpStore %yzy %139 - %141 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %142 = OpLoad %v3float %141 - %143 = OpVectorShuffle %v3float %142 %142 1 2 2 - OpStore %yzz %143 - %145 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %146 = OpLoad %v3float %145 - %147 = OpVectorShuffle %v3float %146 %146 2 0 0 - OpStore %zxx %147 - %149 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %150 = OpLoad %v3float %149 - %151 = OpVectorShuffle %v3float %150 %150 2 0 1 - OpStore %zxy %151 - %153 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %154 = OpLoad %v3float %153 - %155 = OpVectorShuffle %v3float %154 %154 2 0 2 - OpStore %zxz %155 - %157 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %158 = OpLoad %v3float %157 - %159 = OpVectorShuffle %v3float %158 %158 2 1 0 - OpStore %zyx %159 - %161 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %162 = OpLoad %v3float %161 - %163 = OpVectorShuffle %v3float %162 %162 2 1 1 - OpStore %zyy %163 - %165 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %166 = OpLoad %v3float %165 - %167 = OpVectorShuffle %v3float %166 %166 2 1 2 - OpStore %zyz %167 - %169 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %170 = OpLoad %v3float %169 - %171 = OpVectorShuffle %v3float %170 %170 2 2 0 - OpStore %zzx %171 - %173 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %174 = OpLoad %v3float %173 - %175 = OpVectorShuffle %v3float %174 %174 2 2 1 - OpStore %zzy %175 - %177 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %178 = OpLoad %v3float %177 - %179 = OpVectorShuffle %v3float %178 %178 2 2 2 - OpStore %zzz %179 - %181 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %183 = OpLoad %v3float %181 - %184 = OpVectorShuffle %v4float %183 %183 0 0 0 0 - OpStore %xxxx %184 - %188 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %189 = OpLoad %v3float %188 - %190 = OpVectorShuffle %v4float %189 %189 0 0 0 1 - OpStore %xxxy %190 - %192 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %193 = OpLoad %v3float %192 - %194 = OpVectorShuffle %v4float %193 %193 0 0 0 2 - OpStore %xxxz %194 - %196 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %197 = OpLoad %v3float %196 - %198 = OpVectorShuffle %v4float %197 %197 0 0 1 0 - OpStore %xxyx %198 - %200 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %201 = OpLoad %v3float %200 - %202 = OpVectorShuffle %v4float %201 %201 0 0 1 1 - OpStore %xxyy %202 - %204 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %205 = OpLoad %v3float %204 - %206 = OpVectorShuffle %v4float %205 %205 0 0 1 2 - OpStore %xxyz %206 - %208 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %209 = OpLoad %v3float %208 - %210 = OpVectorShuffle %v4float %209 %209 0 0 2 0 - OpStore %xxzx %210 - %212 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %213 = OpLoad %v3float %212 - %214 = OpVectorShuffle %v4float %213 %213 0 0 2 1 - OpStore %xxzy %214 - %216 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %217 = OpLoad %v3float %216 - %218 = OpVectorShuffle %v4float %217 %217 0 0 2 2 - OpStore %xxzz %218 - %220 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %221 = OpLoad %v3float %220 - %222 = OpVectorShuffle %v4float %221 %221 0 1 0 0 - OpStore %xyxx %222 - %224 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %225 = OpLoad %v3float %224 - %226 = OpVectorShuffle %v4float %225 %225 0 1 0 1 - OpStore %xyxy %226 - %228 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %229 = OpLoad %v3float %228 - %230 = OpVectorShuffle %v4float %229 %229 0 1 0 2 - OpStore %xyxz %230 - %232 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %233 = OpLoad %v3float %232 - %234 = OpVectorShuffle %v4float %233 %233 0 1 1 0 - OpStore %xyyx %234 - %236 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %237 = OpLoad %v3float %236 - %238 = OpVectorShuffle %v4float %237 %237 0 1 1 1 - OpStore %xyyy %238 - %240 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %241 = OpLoad %v3float %240 - %242 = OpVectorShuffle %v4float %241 %241 0 1 1 2 - OpStore %xyyz %242 - %244 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %245 = OpLoad %v3float %244 - %246 = OpVectorShuffle %v4float %245 %245 0 1 2 0 - OpStore %xyzx %246 - %248 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %249 = OpLoad %v3float %248 - %250 = OpVectorShuffle %v4float %249 %249 0 1 2 1 - OpStore %xyzy %250 - %252 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %253 = OpLoad %v3float %252 - %254 = OpVectorShuffle %v4float %253 %253 0 1 2 2 - OpStore %xyzz %254 - %256 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %257 = OpLoad %v3float %256 - %258 = OpVectorShuffle %v4float %257 %257 0 2 0 0 - OpStore %xzxx %258 - %260 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %261 = OpLoad %v3float %260 - %262 = OpVectorShuffle %v4float %261 %261 0 2 0 1 - OpStore %xzxy %262 - %264 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %265 = OpLoad %v3float %264 - %266 = OpVectorShuffle %v4float %265 %265 0 2 0 2 - OpStore %xzxz %266 - %268 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %269 = OpLoad %v3float %268 - %270 = OpVectorShuffle %v4float %269 %269 0 2 1 0 - OpStore %xzyx %270 - %272 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %273 = OpLoad %v3float %272 - %274 = OpVectorShuffle %v4float %273 %273 0 2 1 1 - OpStore %xzyy %274 - %276 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %277 = OpLoad %v3float %276 - %278 = OpVectorShuffle %v4float %277 %277 0 2 1 2 - OpStore %xzyz %278 - %280 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %281 = OpLoad %v3float %280 - %282 = OpVectorShuffle %v4float %281 %281 0 2 2 0 - OpStore %xzzx %282 - %284 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %285 = OpLoad %v3float %284 - %286 = OpVectorShuffle %v4float %285 %285 0 2 2 1 - OpStore %xzzy %286 - %288 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %289 = OpLoad %v3float %288 - %290 = OpVectorShuffle %v4float %289 %289 0 2 2 2 - OpStore %xzzz %290 - %292 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %293 = OpLoad %v3float %292 - %294 = OpVectorShuffle %v4float %293 %293 1 0 0 0 - OpStore %yxxx %294 - %296 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %297 = OpLoad %v3float %296 - %298 = OpVectorShuffle %v4float %297 %297 1 0 0 1 - OpStore %yxxy %298 - %300 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %301 = OpLoad %v3float %300 - %302 = OpVectorShuffle %v4float %301 %301 1 0 0 2 - OpStore %yxxz %302 - %304 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %305 = OpLoad %v3float %304 - %306 = OpVectorShuffle %v4float %305 %305 1 0 1 0 - OpStore %yxyx %306 - %308 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %309 = OpLoad %v3float %308 - %310 = OpVectorShuffle %v4float %309 %309 1 0 1 1 - OpStore %yxyy %310 - %312 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %313 = OpLoad %v3float %312 - %314 = OpVectorShuffle %v4float %313 %313 1 0 1 2 - OpStore %yxyz %314 - %316 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %317 = OpLoad %v3float %316 - %318 = OpVectorShuffle %v4float %317 %317 1 0 2 0 - OpStore %yxzx %318 - %320 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %321 = OpLoad %v3float %320 - %322 = OpVectorShuffle %v4float %321 %321 1 0 2 1 - OpStore %yxzy %322 - %324 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %325 = OpLoad %v3float %324 - %326 = OpVectorShuffle %v4float %325 %325 1 0 2 2 - OpStore %yxzz %326 - %328 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %329 = OpLoad %v3float %328 - %330 = OpVectorShuffle %v4float %329 %329 1 1 0 0 - OpStore %yyxx %330 - %332 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %333 = OpLoad %v3float %332 - %334 = OpVectorShuffle %v4float %333 %333 1 1 0 1 - OpStore %yyxy %334 - %336 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %337 = OpLoad %v3float %336 - %338 = OpVectorShuffle %v4float %337 %337 1 1 0 2 - OpStore %yyxz %338 - %340 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %341 = OpLoad %v3float %340 - %342 = OpVectorShuffle %v4float %341 %341 1 1 1 0 - OpStore %yyyx %342 - %344 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %345 = OpLoad %v3float %344 - %346 = OpVectorShuffle %v4float %345 %345 1 1 1 1 - OpStore %yyyy %346 - %348 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %349 = OpLoad %v3float %348 - %350 = OpVectorShuffle %v4float %349 %349 1 1 1 2 - OpStore %yyyz %350 - %352 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %353 = OpLoad %v3float %352 - %354 = OpVectorShuffle %v4float %353 %353 1 1 2 0 - OpStore %yyzx %354 - %356 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %357 = OpLoad %v3float %356 - %358 = OpVectorShuffle %v4float %357 %357 1 1 2 1 - OpStore %yyzy %358 - %360 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %361 = OpLoad %v3float %360 - %362 = OpVectorShuffle %v4float %361 %361 1 1 2 2 - OpStore %yyzz %362 - %364 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %365 = OpLoad %v3float %364 - %366 = OpVectorShuffle %v4float %365 %365 1 2 0 0 - OpStore %yzxx %366 - %368 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %369 = OpLoad %v3float %368 - %370 = OpVectorShuffle %v4float %369 %369 1 2 0 1 - OpStore %yzxy %370 - %372 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %373 = OpLoad %v3float %372 - %374 = OpVectorShuffle %v4float %373 %373 1 2 0 2 - OpStore %yzxz %374 - %376 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %377 = OpLoad %v3float %376 - %378 = OpVectorShuffle %v4float %377 %377 1 2 1 0 - OpStore %yzyx %378 - %380 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %381 = OpLoad %v3float %380 - %382 = OpVectorShuffle %v4float %381 %381 1 2 1 1 - OpStore %yzyy %382 - %384 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %385 = OpLoad %v3float %384 - %386 = OpVectorShuffle %v4float %385 %385 1 2 1 2 - OpStore %yzyz %386 - %388 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %389 = OpLoad %v3float %388 - %390 = OpVectorShuffle %v4float %389 %389 1 2 2 0 - OpStore %yzzx %390 - %392 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %393 = OpLoad %v3float %392 - %394 = OpVectorShuffle %v4float %393 %393 1 2 2 1 - OpStore %yzzy %394 - %396 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %397 = OpLoad %v3float %396 - %398 = OpVectorShuffle %v4float %397 %397 1 2 2 2 - OpStore %yzzz %398 - %400 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %401 = OpLoad %v3float %400 - %402 = OpVectorShuffle %v4float %401 %401 2 0 0 0 - OpStore %zxxx %402 - %404 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %405 = OpLoad %v3float %404 - %406 = OpVectorShuffle %v4float %405 %405 2 0 0 1 - OpStore %zxxy %406 - %408 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %409 = OpLoad %v3float %408 - %410 = OpVectorShuffle %v4float %409 %409 2 0 0 2 - OpStore %zxxz %410 - %412 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %413 = OpLoad %v3float %412 - %414 = OpVectorShuffle %v4float %413 %413 2 0 1 0 - OpStore %zxyx %414 - %416 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %417 = OpLoad %v3float %416 - %418 = OpVectorShuffle %v4float %417 %417 2 0 1 1 - OpStore %zxyy %418 - %420 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %421 = OpLoad %v3float %420 - %422 = OpVectorShuffle %v4float %421 %421 2 0 1 2 - OpStore %zxyz %422 - %424 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %425 = OpLoad %v3float %424 - %426 = OpVectorShuffle %v4float %425 %425 2 0 2 0 - OpStore %zxzx %426 - %428 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %429 = OpLoad %v3float %428 - %430 = OpVectorShuffle %v4float %429 %429 2 0 2 1 - OpStore %zxzy %430 - %432 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %433 = OpLoad %v3float %432 - %434 = OpVectorShuffle %v4float %433 %433 2 0 2 2 - OpStore %zxzz %434 - %436 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %437 = OpLoad %v3float %436 - %438 = OpVectorShuffle %v4float %437 %437 2 1 0 0 - OpStore %zyxx %438 - %440 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %441 = OpLoad %v3float %440 - %442 = OpVectorShuffle %v4float %441 %441 2 1 0 1 - OpStore %zyxy %442 - %444 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %445 = OpLoad %v3float %444 - %446 = OpVectorShuffle %v4float %445 %445 2 1 0 2 - OpStore %zyxz %446 - %448 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %449 = OpLoad %v3float %448 - %450 = OpVectorShuffle %v4float %449 %449 2 1 1 0 - OpStore %zyyx %450 - %452 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %453 = OpLoad %v3float %452 - %454 = OpVectorShuffle %v4float %453 %453 2 1 1 1 - OpStore %zyyy %454 - %456 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %457 = OpLoad %v3float %456 - %458 = OpVectorShuffle %v4float %457 %457 2 1 1 2 - OpStore %zyyz %458 - %460 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %461 = OpLoad %v3float %460 - %462 = OpVectorShuffle %v4float %461 %461 2 1 2 0 - OpStore %zyzx %462 - %464 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %465 = OpLoad %v3float %464 - %466 = OpVectorShuffle %v4float %465 %465 2 1 2 1 - OpStore %zyzy %466 - %468 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %469 = OpLoad %v3float %468 - %470 = OpVectorShuffle %v4float %469 %469 2 1 2 2 - OpStore %zyzz %470 - %472 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %473 = OpLoad %v3float %472 - %474 = OpVectorShuffle %v4float %473 %473 2 2 0 0 - OpStore %zzxx %474 - %476 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %477 = OpLoad %v3float %476 - %478 = OpVectorShuffle %v4float %477 %477 2 2 0 1 - OpStore %zzxy %478 - %480 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %481 = OpLoad %v3float %480 - %482 = OpVectorShuffle %v4float %481 %481 2 2 0 2 - OpStore %zzxz %482 - %484 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %485 = OpLoad %v3float %484 - %486 = OpVectorShuffle %v4float %485 %485 2 2 1 0 - OpStore %zzyx %486 - %488 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %489 = OpLoad %v3float %488 - %490 = OpVectorShuffle %v4float %489 %489 2 2 1 1 - OpStore %zzyy %490 - %492 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %493 = OpLoad %v3float %492 - %494 = OpVectorShuffle %v4float %493 %493 2 2 1 2 - OpStore %zzyz %494 - %496 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %497 = OpLoad %v3float %496 - %498 = OpVectorShuffle %v4float %497 %497 2 2 2 0 - OpStore %zzzx %498 - %500 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %501 = OpLoad %v3float %500 - %502 = OpVectorShuffle %v4float %501 %501 2 2 2 1 - OpStore %zzzy %502 - %504 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 - %505 = OpLoad %v3float %504 - %506 = OpVectorShuffle %v4float %505 %505 2 2 2 2 - OpStore %zzzz %506 + %f = OpFunction %void None %7 + %12 = OpLabel + %v = OpVariable %_ptr_Function_v3float Function %20 + %x = OpVariable %_ptr_Function_float Function %26 + %y = OpVariable %_ptr_Function_float Function %26 + %z = OpVariable %_ptr_Function_float Function %26 + %xx = OpVariable %_ptr_Function_v2float Function %41 + %xy = OpVariable %_ptr_Function_v2float Function %41 + %xz = OpVariable %_ptr_Function_v2float Function %41 + %yx = OpVariable %_ptr_Function_v2float Function %41 + %yy = OpVariable %_ptr_Function_v2float Function %41 + %yz = OpVariable %_ptr_Function_v2float Function %41 + %zx = OpVariable %_ptr_Function_v2float Function %41 + %zy = OpVariable %_ptr_Function_v2float Function %41 + %zz = OpVariable %_ptr_Function_v2float Function %41 + %xxx = OpVariable %_ptr_Function_v3float Function %20 + %xxy = OpVariable %_ptr_Function_v3float Function %20 + %xxz = OpVariable %_ptr_Function_v3float Function %20 + %xyx = OpVariable %_ptr_Function_v3float Function %20 + %xyy = OpVariable %_ptr_Function_v3float Function %20 + %xyz = OpVariable %_ptr_Function_v3float Function %20 + %xzx = OpVariable %_ptr_Function_v3float Function %20 + %xzy = OpVariable %_ptr_Function_v3float Function %20 + %xzz = OpVariable %_ptr_Function_v3float Function %20 + %yxx = OpVariable %_ptr_Function_v3float Function %20 + %yxy = OpVariable %_ptr_Function_v3float Function %20 + %yxz = OpVariable %_ptr_Function_v3float Function %20 + %yyx = OpVariable %_ptr_Function_v3float Function %20 + %yyy = OpVariable %_ptr_Function_v3float Function %20 + %yyz = OpVariable %_ptr_Function_v3float Function %20 + %yzx = OpVariable %_ptr_Function_v3float Function %20 + %yzy = OpVariable %_ptr_Function_v3float Function %20 + %yzz = OpVariable %_ptr_Function_v3float Function %20 + %zxx = OpVariable %_ptr_Function_v3float Function %20 + %zxy = OpVariable %_ptr_Function_v3float Function %20 + %zxz = OpVariable %_ptr_Function_v3float Function %20 + %zyx = OpVariable %_ptr_Function_v3float Function %20 + %zyy = OpVariable %_ptr_Function_v3float Function %20 + %zyz = OpVariable %_ptr_Function_v3float Function %20 + %zzx = OpVariable %_ptr_Function_v3float Function %20 + %zzy = OpVariable %_ptr_Function_v3float Function %20 + %zzz = OpVariable %_ptr_Function_v3float Function %20 + %xxxx = OpVariable %_ptr_Function_v4float Function %188 + %xxxy = OpVariable %_ptr_Function_v4float Function %188 + %xxxz = OpVariable %_ptr_Function_v4float Function %188 + %xxyx = OpVariable %_ptr_Function_v4float Function %188 + %xxyy = OpVariable %_ptr_Function_v4float Function %188 + %xxyz = OpVariable %_ptr_Function_v4float Function %188 + %xxzx = OpVariable %_ptr_Function_v4float Function %188 + %xxzy = OpVariable %_ptr_Function_v4float Function %188 + %xxzz = OpVariable %_ptr_Function_v4float Function %188 + %xyxx = OpVariable %_ptr_Function_v4float Function %188 + %xyxy = OpVariable %_ptr_Function_v4float Function %188 + %xyxz = OpVariable %_ptr_Function_v4float Function %188 + %xyyx = OpVariable %_ptr_Function_v4float Function %188 + %xyyy = OpVariable %_ptr_Function_v4float Function %188 + %xyyz = OpVariable %_ptr_Function_v4float Function %188 + %xyzx = OpVariable %_ptr_Function_v4float Function %188 + %xyzy = OpVariable %_ptr_Function_v4float Function %188 + %xyzz = OpVariable %_ptr_Function_v4float Function %188 + %xzxx = OpVariable %_ptr_Function_v4float Function %188 + %xzxy = OpVariable %_ptr_Function_v4float Function %188 + %xzxz = OpVariable %_ptr_Function_v4float Function %188 + %xzyx = OpVariable %_ptr_Function_v4float Function %188 + %xzyy = OpVariable %_ptr_Function_v4float Function %188 + %xzyz = OpVariable %_ptr_Function_v4float Function %188 + %xzzx = OpVariable %_ptr_Function_v4float Function %188 + %xzzy = OpVariable %_ptr_Function_v4float Function %188 + %xzzz = OpVariable %_ptr_Function_v4float Function %188 + %yxxx = OpVariable %_ptr_Function_v4float Function %188 + %yxxy = OpVariable %_ptr_Function_v4float Function %188 + %yxxz = OpVariable %_ptr_Function_v4float Function %188 + %yxyx = OpVariable %_ptr_Function_v4float Function %188 + %yxyy = OpVariable %_ptr_Function_v4float Function %188 + %yxyz = OpVariable %_ptr_Function_v4float Function %188 + %yxzx = OpVariable %_ptr_Function_v4float Function %188 + %yxzy = OpVariable %_ptr_Function_v4float Function %188 + %yxzz = OpVariable %_ptr_Function_v4float Function %188 + %yyxx = OpVariable %_ptr_Function_v4float Function %188 + %yyxy = OpVariable %_ptr_Function_v4float Function %188 + %yyxz = OpVariable %_ptr_Function_v4float Function %188 + %yyyx = OpVariable %_ptr_Function_v4float Function %188 + %yyyy = OpVariable %_ptr_Function_v4float Function %188 + %yyyz = OpVariable %_ptr_Function_v4float Function %188 + %yyzx = OpVariable %_ptr_Function_v4float Function %188 + %yyzy = OpVariable %_ptr_Function_v4float Function %188 + %yyzz = OpVariable %_ptr_Function_v4float Function %188 + %yzxx = OpVariable %_ptr_Function_v4float Function %188 + %yzxy = OpVariable %_ptr_Function_v4float Function %188 + %yzxz = OpVariable %_ptr_Function_v4float Function %188 + %yzyx = OpVariable %_ptr_Function_v4float Function %188 + %yzyy = OpVariable %_ptr_Function_v4float Function %188 + %yzyz = OpVariable %_ptr_Function_v4float Function %188 + %yzzx = OpVariable %_ptr_Function_v4float Function %188 + %yzzy = OpVariable %_ptr_Function_v4float Function %188 + %yzzz = OpVariable %_ptr_Function_v4float Function %188 + %zxxx = OpVariable %_ptr_Function_v4float Function %188 + %zxxy = OpVariable %_ptr_Function_v4float Function %188 + %zxxz = OpVariable %_ptr_Function_v4float Function %188 + %zxyx = OpVariable %_ptr_Function_v4float Function %188 + %zxyy = OpVariable %_ptr_Function_v4float Function %188 + %zxyz = OpVariable %_ptr_Function_v4float Function %188 + %zxzx = OpVariable %_ptr_Function_v4float Function %188 + %zxzy = OpVariable %_ptr_Function_v4float Function %188 + %zxzz = OpVariable %_ptr_Function_v4float Function %188 + %zyxx = OpVariable %_ptr_Function_v4float Function %188 + %zyxy = OpVariable %_ptr_Function_v4float Function %188 + %zyxz = OpVariable %_ptr_Function_v4float Function %188 + %zyyx = OpVariable %_ptr_Function_v4float Function %188 + %zyyy = OpVariable %_ptr_Function_v4float Function %188 + %zyyz = OpVariable %_ptr_Function_v4float Function %188 + %zyzx = OpVariable %_ptr_Function_v4float Function %188 + %zyzy = OpVariable %_ptr_Function_v4float Function %188 + %zyzz = OpVariable %_ptr_Function_v4float Function %188 + %zzxx = OpVariable %_ptr_Function_v4float Function %188 + %zzxy = OpVariable %_ptr_Function_v4float Function %188 + %zzxz = OpVariable %_ptr_Function_v4float Function %188 + %zzyx = OpVariable %_ptr_Function_v4float Function %188 + %zzyy = OpVariable %_ptr_Function_v4float Function %188 + %zzyz = OpVariable %_ptr_Function_v4float Function %188 + %zzzx = OpVariable %_ptr_Function_v4float Function %188 + %zzzy = OpVariable %_ptr_Function_v4float Function %188 + %zzzz = OpVariable %_ptr_Function_v4float Function %188 + %16 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %17 = OpLoad %v3float %16 + OpStore %v %17 + %22 = OpAccessChain %_ptr_Uniform_float %U %uint_0 %uint_0 %uint_0 + %23 = OpLoad %float %22 + OpStore %x %23 + %28 = OpAccessChain %_ptr_Uniform_float %U %uint_0 %uint_0 %uint_1 + %29 = OpLoad %float %28 + OpStore %y %29 + %32 = OpAccessChain %_ptr_Uniform_float %U %uint_0 %uint_0 %uint_2 + %33 = OpLoad %float %32 + OpStore %z %33 + %35 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %37 = OpLoad %v3float %35 + %38 = OpVectorShuffle %v2float %37 %37 0 0 + OpStore %xx %38 + %42 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %43 = OpLoad %v3float %42 + %44 = OpVectorShuffle %v2float %43 %43 0 1 + OpStore %xy %44 + %46 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %47 = OpLoad %v3float %46 + %48 = OpVectorShuffle %v2float %47 %47 0 2 + OpStore %xz %48 + %50 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %51 = OpLoad %v3float %50 + %52 = OpVectorShuffle %v2float %51 %51 1 0 + OpStore %yx %52 + %54 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %55 = OpLoad %v3float %54 + %56 = OpVectorShuffle %v2float %55 %55 1 1 + OpStore %yy %56 + %58 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %59 = OpLoad %v3float %58 + %60 = OpVectorShuffle %v2float %59 %59 1 2 + OpStore %yz %60 + %62 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %63 = OpLoad %v3float %62 + %64 = OpVectorShuffle %v2float %63 %63 2 0 + OpStore %zx %64 + %66 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %67 = OpLoad %v3float %66 + %68 = OpVectorShuffle %v2float %67 %67 2 1 + OpStore %zy %68 + %70 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %71 = OpLoad %v3float %70 + %72 = OpVectorShuffle %v2float %71 %71 2 2 + OpStore %zz %72 + %74 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %75 = OpLoad %v3float %74 + %76 = OpVectorShuffle %v3float %75 %75 0 0 0 + OpStore %xxx %76 + %78 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %79 = OpLoad %v3float %78 + %80 = OpVectorShuffle %v3float %79 %79 0 0 1 + OpStore %xxy %80 + %82 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %83 = OpLoad %v3float %82 + %84 = OpVectorShuffle %v3float %83 %83 0 0 2 + OpStore %xxz %84 + %86 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %87 = OpLoad %v3float %86 + %88 = OpVectorShuffle %v3float %87 %87 0 1 0 + OpStore %xyx %88 + %90 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %91 = OpLoad %v3float %90 + %92 = OpVectorShuffle %v3float %91 %91 0 1 1 + OpStore %xyy %92 + %94 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %95 = OpLoad %v3float %94 + %96 = OpVectorShuffle %v3float %95 %95 0 1 2 + OpStore %xyz %96 + %98 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %99 = OpLoad %v3float %98 + %100 = OpVectorShuffle %v3float %99 %99 0 2 0 + OpStore %xzx %100 + %102 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %103 = OpLoad %v3float %102 + %104 = OpVectorShuffle %v3float %103 %103 0 2 1 + OpStore %xzy %104 + %106 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %107 = OpLoad %v3float %106 + %108 = OpVectorShuffle %v3float %107 %107 0 2 2 + OpStore %xzz %108 + %110 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %111 = OpLoad %v3float %110 + %112 = OpVectorShuffle %v3float %111 %111 1 0 0 + OpStore %yxx %112 + %114 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %115 = OpLoad %v3float %114 + %116 = OpVectorShuffle %v3float %115 %115 1 0 1 + OpStore %yxy %116 + %118 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %119 = OpLoad %v3float %118 + %120 = OpVectorShuffle %v3float %119 %119 1 0 2 + OpStore %yxz %120 + %122 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %123 = OpLoad %v3float %122 + %124 = OpVectorShuffle %v3float %123 %123 1 1 0 + OpStore %yyx %124 + %126 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %127 = OpLoad %v3float %126 + %128 = OpVectorShuffle %v3float %127 %127 1 1 1 + OpStore %yyy %128 + %130 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %131 = OpLoad %v3float %130 + %132 = OpVectorShuffle %v3float %131 %131 1 1 2 + OpStore %yyz %132 + %134 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %135 = OpLoad %v3float %134 + %136 = OpVectorShuffle %v3float %135 %135 1 2 0 + OpStore %yzx %136 + %138 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %139 = OpLoad %v3float %138 + %140 = OpVectorShuffle %v3float %139 %139 1 2 1 + OpStore %yzy %140 + %142 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %143 = OpLoad %v3float %142 + %144 = OpVectorShuffle %v3float %143 %143 1 2 2 + OpStore %yzz %144 + %146 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %147 = OpLoad %v3float %146 + %148 = OpVectorShuffle %v3float %147 %147 2 0 0 + OpStore %zxx %148 + %150 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %151 = OpLoad %v3float %150 + %152 = OpVectorShuffle %v3float %151 %151 2 0 1 + OpStore %zxy %152 + %154 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %155 = OpLoad %v3float %154 + %156 = OpVectorShuffle %v3float %155 %155 2 0 2 + OpStore %zxz %156 + %158 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %159 = OpLoad %v3float %158 + %160 = OpVectorShuffle %v3float %159 %159 2 1 0 + OpStore %zyx %160 + %162 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %163 = OpLoad %v3float %162 + %164 = OpVectorShuffle %v3float %163 %163 2 1 1 + OpStore %zyy %164 + %166 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %167 = OpLoad %v3float %166 + %168 = OpVectorShuffle %v3float %167 %167 2 1 2 + OpStore %zyz %168 + %170 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %171 = OpLoad %v3float %170 + %172 = OpVectorShuffle %v3float %171 %171 2 2 0 + OpStore %zzx %172 + %174 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %175 = OpLoad %v3float %174 + %176 = OpVectorShuffle %v3float %175 %175 2 2 1 + OpStore %zzy %176 + %178 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %179 = OpLoad %v3float %178 + %180 = OpVectorShuffle %v3float %179 %179 2 2 2 + OpStore %zzz %180 + %182 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %184 = OpLoad %v3float %182 + %185 = OpVectorShuffle %v4float %184 %184 0 0 0 0 + OpStore %xxxx %185 + %189 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %190 = OpLoad %v3float %189 + %191 = OpVectorShuffle %v4float %190 %190 0 0 0 1 + OpStore %xxxy %191 + %193 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %194 = OpLoad %v3float %193 + %195 = OpVectorShuffle %v4float %194 %194 0 0 0 2 + OpStore %xxxz %195 + %197 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %198 = OpLoad %v3float %197 + %199 = OpVectorShuffle %v4float %198 %198 0 0 1 0 + OpStore %xxyx %199 + %201 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %202 = OpLoad %v3float %201 + %203 = OpVectorShuffle %v4float %202 %202 0 0 1 1 + OpStore %xxyy %203 + %205 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %206 = OpLoad %v3float %205 + %207 = OpVectorShuffle %v4float %206 %206 0 0 1 2 + OpStore %xxyz %207 + %209 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %210 = OpLoad %v3float %209 + %211 = OpVectorShuffle %v4float %210 %210 0 0 2 0 + OpStore %xxzx %211 + %213 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %214 = OpLoad %v3float %213 + %215 = OpVectorShuffle %v4float %214 %214 0 0 2 1 + OpStore %xxzy %215 + %217 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %218 = OpLoad %v3float %217 + %219 = OpVectorShuffle %v4float %218 %218 0 0 2 2 + OpStore %xxzz %219 + %221 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %222 = OpLoad %v3float %221 + %223 = OpVectorShuffle %v4float %222 %222 0 1 0 0 + OpStore %xyxx %223 + %225 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %226 = OpLoad %v3float %225 + %227 = OpVectorShuffle %v4float %226 %226 0 1 0 1 + OpStore %xyxy %227 + %229 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %230 = OpLoad %v3float %229 + %231 = OpVectorShuffle %v4float %230 %230 0 1 0 2 + OpStore %xyxz %231 + %233 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %234 = OpLoad %v3float %233 + %235 = OpVectorShuffle %v4float %234 %234 0 1 1 0 + OpStore %xyyx %235 + %237 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %238 = OpLoad %v3float %237 + %239 = OpVectorShuffle %v4float %238 %238 0 1 1 1 + OpStore %xyyy %239 + %241 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %242 = OpLoad %v3float %241 + %243 = OpVectorShuffle %v4float %242 %242 0 1 1 2 + OpStore %xyyz %243 + %245 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %246 = OpLoad %v3float %245 + %247 = OpVectorShuffle %v4float %246 %246 0 1 2 0 + OpStore %xyzx %247 + %249 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %250 = OpLoad %v3float %249 + %251 = OpVectorShuffle %v4float %250 %250 0 1 2 1 + OpStore %xyzy %251 + %253 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %254 = OpLoad %v3float %253 + %255 = OpVectorShuffle %v4float %254 %254 0 1 2 2 + OpStore %xyzz %255 + %257 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %258 = OpLoad %v3float %257 + %259 = OpVectorShuffle %v4float %258 %258 0 2 0 0 + OpStore %xzxx %259 + %261 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %262 = OpLoad %v3float %261 + %263 = OpVectorShuffle %v4float %262 %262 0 2 0 1 + OpStore %xzxy %263 + %265 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %266 = OpLoad %v3float %265 + %267 = OpVectorShuffle %v4float %266 %266 0 2 0 2 + OpStore %xzxz %267 + %269 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %270 = OpLoad %v3float %269 + %271 = OpVectorShuffle %v4float %270 %270 0 2 1 0 + OpStore %xzyx %271 + %273 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %274 = OpLoad %v3float %273 + %275 = OpVectorShuffle %v4float %274 %274 0 2 1 1 + OpStore %xzyy %275 + %277 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %278 = OpLoad %v3float %277 + %279 = OpVectorShuffle %v4float %278 %278 0 2 1 2 + OpStore %xzyz %279 + %281 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %282 = OpLoad %v3float %281 + %283 = OpVectorShuffle %v4float %282 %282 0 2 2 0 + OpStore %xzzx %283 + %285 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %286 = OpLoad %v3float %285 + %287 = OpVectorShuffle %v4float %286 %286 0 2 2 1 + OpStore %xzzy %287 + %289 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %290 = OpLoad %v3float %289 + %291 = OpVectorShuffle %v4float %290 %290 0 2 2 2 + OpStore %xzzz %291 + %293 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %294 = OpLoad %v3float %293 + %295 = OpVectorShuffle %v4float %294 %294 1 0 0 0 + OpStore %yxxx %295 + %297 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %298 = OpLoad %v3float %297 + %299 = OpVectorShuffle %v4float %298 %298 1 0 0 1 + OpStore %yxxy %299 + %301 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %302 = OpLoad %v3float %301 + %303 = OpVectorShuffle %v4float %302 %302 1 0 0 2 + OpStore %yxxz %303 + %305 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %306 = OpLoad %v3float %305 + %307 = OpVectorShuffle %v4float %306 %306 1 0 1 0 + OpStore %yxyx %307 + %309 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %310 = OpLoad %v3float %309 + %311 = OpVectorShuffle %v4float %310 %310 1 0 1 1 + OpStore %yxyy %311 + %313 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %314 = OpLoad %v3float %313 + %315 = OpVectorShuffle %v4float %314 %314 1 0 1 2 + OpStore %yxyz %315 + %317 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %318 = OpLoad %v3float %317 + %319 = OpVectorShuffle %v4float %318 %318 1 0 2 0 + OpStore %yxzx %319 + %321 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %322 = OpLoad %v3float %321 + %323 = OpVectorShuffle %v4float %322 %322 1 0 2 1 + OpStore %yxzy %323 + %325 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %326 = OpLoad %v3float %325 + %327 = OpVectorShuffle %v4float %326 %326 1 0 2 2 + OpStore %yxzz %327 + %329 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %330 = OpLoad %v3float %329 + %331 = OpVectorShuffle %v4float %330 %330 1 1 0 0 + OpStore %yyxx %331 + %333 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %334 = OpLoad %v3float %333 + %335 = OpVectorShuffle %v4float %334 %334 1 1 0 1 + OpStore %yyxy %335 + %337 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %338 = OpLoad %v3float %337 + %339 = OpVectorShuffle %v4float %338 %338 1 1 0 2 + OpStore %yyxz %339 + %341 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %342 = OpLoad %v3float %341 + %343 = OpVectorShuffle %v4float %342 %342 1 1 1 0 + OpStore %yyyx %343 + %345 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %346 = OpLoad %v3float %345 + %347 = OpVectorShuffle %v4float %346 %346 1 1 1 1 + OpStore %yyyy %347 + %349 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %350 = OpLoad %v3float %349 + %351 = OpVectorShuffle %v4float %350 %350 1 1 1 2 + OpStore %yyyz %351 + %353 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %354 = OpLoad %v3float %353 + %355 = OpVectorShuffle %v4float %354 %354 1 1 2 0 + OpStore %yyzx %355 + %357 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %358 = OpLoad %v3float %357 + %359 = OpVectorShuffle %v4float %358 %358 1 1 2 1 + OpStore %yyzy %359 + %361 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %362 = OpLoad %v3float %361 + %363 = OpVectorShuffle %v4float %362 %362 1 1 2 2 + OpStore %yyzz %363 + %365 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %366 = OpLoad %v3float %365 + %367 = OpVectorShuffle %v4float %366 %366 1 2 0 0 + OpStore %yzxx %367 + %369 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %370 = OpLoad %v3float %369 + %371 = OpVectorShuffle %v4float %370 %370 1 2 0 1 + OpStore %yzxy %371 + %373 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %374 = OpLoad %v3float %373 + %375 = OpVectorShuffle %v4float %374 %374 1 2 0 2 + OpStore %yzxz %375 + %377 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %378 = OpLoad %v3float %377 + %379 = OpVectorShuffle %v4float %378 %378 1 2 1 0 + OpStore %yzyx %379 + %381 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %382 = OpLoad %v3float %381 + %383 = OpVectorShuffle %v4float %382 %382 1 2 1 1 + OpStore %yzyy %383 + %385 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %386 = OpLoad %v3float %385 + %387 = OpVectorShuffle %v4float %386 %386 1 2 1 2 + OpStore %yzyz %387 + %389 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %390 = OpLoad %v3float %389 + %391 = OpVectorShuffle %v4float %390 %390 1 2 2 0 + OpStore %yzzx %391 + %393 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %394 = OpLoad %v3float %393 + %395 = OpVectorShuffle %v4float %394 %394 1 2 2 1 + OpStore %yzzy %395 + %397 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %398 = OpLoad %v3float %397 + %399 = OpVectorShuffle %v4float %398 %398 1 2 2 2 + OpStore %yzzz %399 + %401 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %402 = OpLoad %v3float %401 + %403 = OpVectorShuffle %v4float %402 %402 2 0 0 0 + OpStore %zxxx %403 + %405 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %406 = OpLoad %v3float %405 + %407 = OpVectorShuffle %v4float %406 %406 2 0 0 1 + OpStore %zxxy %407 + %409 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %410 = OpLoad %v3float %409 + %411 = OpVectorShuffle %v4float %410 %410 2 0 0 2 + OpStore %zxxz %411 + %413 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %414 = OpLoad %v3float %413 + %415 = OpVectorShuffle %v4float %414 %414 2 0 1 0 + OpStore %zxyx %415 + %417 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %418 = OpLoad %v3float %417 + %419 = OpVectorShuffle %v4float %418 %418 2 0 1 1 + OpStore %zxyy %419 + %421 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %422 = OpLoad %v3float %421 + %423 = OpVectorShuffle %v4float %422 %422 2 0 1 2 + OpStore %zxyz %423 + %425 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %426 = OpLoad %v3float %425 + %427 = OpVectorShuffle %v4float %426 %426 2 0 2 0 + OpStore %zxzx %427 + %429 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %430 = OpLoad %v3float %429 + %431 = OpVectorShuffle %v4float %430 %430 2 0 2 1 + OpStore %zxzy %431 + %433 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %434 = OpLoad %v3float %433 + %435 = OpVectorShuffle %v4float %434 %434 2 0 2 2 + OpStore %zxzz %435 + %437 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %438 = OpLoad %v3float %437 + %439 = OpVectorShuffle %v4float %438 %438 2 1 0 0 + OpStore %zyxx %439 + %441 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %442 = OpLoad %v3float %441 + %443 = OpVectorShuffle %v4float %442 %442 2 1 0 1 + OpStore %zyxy %443 + %445 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %446 = OpLoad %v3float %445 + %447 = OpVectorShuffle %v4float %446 %446 2 1 0 2 + OpStore %zyxz %447 + %449 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %450 = OpLoad %v3float %449 + %451 = OpVectorShuffle %v4float %450 %450 2 1 1 0 + OpStore %zyyx %451 + %453 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %454 = OpLoad %v3float %453 + %455 = OpVectorShuffle %v4float %454 %454 2 1 1 1 + OpStore %zyyy %455 + %457 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %458 = OpLoad %v3float %457 + %459 = OpVectorShuffle %v4float %458 %458 2 1 1 2 + OpStore %zyyz %459 + %461 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %462 = OpLoad %v3float %461 + %463 = OpVectorShuffle %v4float %462 %462 2 1 2 0 + OpStore %zyzx %463 + %465 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %466 = OpLoad %v3float %465 + %467 = OpVectorShuffle %v4float %466 %466 2 1 2 1 + OpStore %zyzy %467 + %469 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %470 = OpLoad %v3float %469 + %471 = OpVectorShuffle %v4float %470 %470 2 1 2 2 + OpStore %zyzz %471 + %473 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %474 = OpLoad %v3float %473 + %475 = OpVectorShuffle %v4float %474 %474 2 2 0 0 + OpStore %zzxx %475 + %477 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %478 = OpLoad %v3float %477 + %479 = OpVectorShuffle %v4float %478 %478 2 2 0 1 + OpStore %zzxy %479 + %481 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %482 = OpLoad %v3float %481 + %483 = OpVectorShuffle %v4float %482 %482 2 2 0 2 + OpStore %zzxz %483 + %485 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %486 = OpLoad %v3float %485 + %487 = OpVectorShuffle %v4float %486 %486 2 2 1 0 + OpStore %zzyx %487 + %489 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %490 = OpLoad %v3float %489 + %491 = OpVectorShuffle %v4float %490 %490 2 2 1 1 + OpStore %zzyy %491 + %493 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %494 = OpLoad %v3float %493 + %495 = OpVectorShuffle %v4float %494 %494 2 2 1 2 + OpStore %zzyz %495 + %497 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %498 = OpLoad %v3float %497 + %499 = OpVectorShuffle %v4float %498 %498 2 2 2 0 + OpStore %zzzx %499 + %501 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %502 = OpLoad %v3float %501 + %503 = OpVectorShuffle %v4float %502 %502 2 2 2 1 + OpStore %zzzy %503 + %505 = OpAccessChain %_ptr_Uniform_v3float %U %uint_0 %uint_0 + %506 = OpLoad %v3float %505 + %507 = OpVectorShuffle %v4float %506 %506 2 2 2 2 + OpStore %zzzz %507 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/swizzle/read/packed_vec3/i32.wgsl.expected.glsl b/test/tint/expressions/swizzle/read/packed_vec3/i32.wgsl.expected.glsl index 865c502f54..b7700622c4 100644 --- a/test/tint/expressions/swizzle/read/packed_vec3/i32.wgsl.expected.glsl +++ b/test/tint/expressions/swizzle/read/packed_vec3/i32.wgsl.expected.glsl @@ -4,132 +4,136 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std140) uniform S_ubo { +struct S { ivec3 v; uint pad; +}; + +layout(binding = 0, std140) uniform U_block_ubo { + S inner; } U; void f() { - ivec3 v = U.v; - int x = U.v.x; - int y = U.v.y; - int z = U.v.z; - ivec2 xx = U.v.xx; - ivec2 xy = U.v.xy; - ivec2 xz = U.v.xz; - ivec2 yx = U.v.yx; - ivec2 yy = U.v.yy; - ivec2 yz = U.v.yz; - ivec2 zx = U.v.zx; - ivec2 zy = U.v.zy; - ivec2 zz = U.v.zz; - ivec3 xxx = U.v.xxx; - ivec3 xxy = U.v.xxy; - ivec3 xxz = U.v.xxz; - ivec3 xyx = U.v.xyx; - ivec3 xyy = U.v.xyy; - ivec3 xyz = U.v.xyz; - ivec3 xzx = U.v.xzx; - ivec3 xzy = U.v.xzy; - ivec3 xzz = U.v.xzz; - ivec3 yxx = U.v.yxx; - ivec3 yxy = U.v.yxy; - ivec3 yxz = U.v.yxz; - ivec3 yyx = U.v.yyx; - ivec3 yyy = U.v.yyy; - ivec3 yyz = U.v.yyz; - ivec3 yzx = U.v.yzx; - ivec3 yzy = U.v.yzy; - ivec3 yzz = U.v.yzz; - ivec3 zxx = U.v.zxx; - ivec3 zxy = U.v.zxy; - ivec3 zxz = U.v.zxz; - ivec3 zyx = U.v.zyx; - ivec3 zyy = U.v.zyy; - ivec3 zyz = U.v.zyz; - ivec3 zzx = U.v.zzx; - ivec3 zzy = U.v.zzy; - ivec3 zzz = U.v.zzz; - ivec4 xxxx = U.v.xxxx; - ivec4 xxxy = U.v.xxxy; - ivec4 xxxz = U.v.xxxz; - ivec4 xxyx = U.v.xxyx; - ivec4 xxyy = U.v.xxyy; - ivec4 xxyz = U.v.xxyz; - ivec4 xxzx = U.v.xxzx; - ivec4 xxzy = U.v.xxzy; - ivec4 xxzz = U.v.xxzz; - ivec4 xyxx = U.v.xyxx; - ivec4 xyxy = U.v.xyxy; - ivec4 xyxz = U.v.xyxz; - ivec4 xyyx = U.v.xyyx; - ivec4 xyyy = U.v.xyyy; - ivec4 xyyz = U.v.xyyz; - ivec4 xyzx = U.v.xyzx; - ivec4 xyzy = U.v.xyzy; - ivec4 xyzz = U.v.xyzz; - ivec4 xzxx = U.v.xzxx; - ivec4 xzxy = U.v.xzxy; - ivec4 xzxz = U.v.xzxz; - ivec4 xzyx = U.v.xzyx; - ivec4 xzyy = U.v.xzyy; - ivec4 xzyz = U.v.xzyz; - ivec4 xzzx = U.v.xzzx; - ivec4 xzzy = U.v.xzzy; - ivec4 xzzz = U.v.xzzz; - ivec4 yxxx = U.v.yxxx; - ivec4 yxxy = U.v.yxxy; - ivec4 yxxz = U.v.yxxz; - ivec4 yxyx = U.v.yxyx; - ivec4 yxyy = U.v.yxyy; - ivec4 yxyz = U.v.yxyz; - ivec4 yxzx = U.v.yxzx; - ivec4 yxzy = U.v.yxzy; - ivec4 yxzz = U.v.yxzz; - ivec4 yyxx = U.v.yyxx; - ivec4 yyxy = U.v.yyxy; - ivec4 yyxz = U.v.yyxz; - ivec4 yyyx = U.v.yyyx; - ivec4 yyyy = U.v.yyyy; - ivec4 yyyz = U.v.yyyz; - ivec4 yyzx = U.v.yyzx; - ivec4 yyzy = U.v.yyzy; - ivec4 yyzz = U.v.yyzz; - ivec4 yzxx = U.v.yzxx; - ivec4 yzxy = U.v.yzxy; - ivec4 yzxz = U.v.yzxz; - ivec4 yzyx = U.v.yzyx; - ivec4 yzyy = U.v.yzyy; - ivec4 yzyz = U.v.yzyz; - ivec4 yzzx = U.v.yzzx; - ivec4 yzzy = U.v.yzzy; - ivec4 yzzz = U.v.yzzz; - ivec4 zxxx = U.v.zxxx; - ivec4 zxxy = U.v.zxxy; - ivec4 zxxz = U.v.zxxz; - ivec4 zxyx = U.v.zxyx; - ivec4 zxyy = U.v.zxyy; - ivec4 zxyz = U.v.zxyz; - ivec4 zxzx = U.v.zxzx; - ivec4 zxzy = U.v.zxzy; - ivec4 zxzz = U.v.zxzz; - ivec4 zyxx = U.v.zyxx; - ivec4 zyxy = U.v.zyxy; - ivec4 zyxz = U.v.zyxz; - ivec4 zyyx = U.v.zyyx; - ivec4 zyyy = U.v.zyyy; - ivec4 zyyz = U.v.zyyz; - ivec4 zyzx = U.v.zyzx; - ivec4 zyzy = U.v.zyzy; - ivec4 zyzz = U.v.zyzz; - ivec4 zzxx = U.v.zzxx; - ivec4 zzxy = U.v.zzxy; - ivec4 zzxz = U.v.zzxz; - ivec4 zzyx = U.v.zzyx; - ivec4 zzyy = U.v.zzyy; - ivec4 zzyz = U.v.zzyz; - ivec4 zzzx = U.v.zzzx; - ivec4 zzzy = U.v.zzzy; - ivec4 zzzz = U.v.zzzz; + ivec3 v = U.inner.v; + int x = U.inner.v.x; + int y = U.inner.v.y; + int z = U.inner.v.z; + ivec2 xx = U.inner.v.xx; + ivec2 xy = U.inner.v.xy; + ivec2 xz = U.inner.v.xz; + ivec2 yx = U.inner.v.yx; + ivec2 yy = U.inner.v.yy; + ivec2 yz = U.inner.v.yz; + ivec2 zx = U.inner.v.zx; + ivec2 zy = U.inner.v.zy; + ivec2 zz = U.inner.v.zz; + ivec3 xxx = U.inner.v.xxx; + ivec3 xxy = U.inner.v.xxy; + ivec3 xxz = U.inner.v.xxz; + ivec3 xyx = U.inner.v.xyx; + ivec3 xyy = U.inner.v.xyy; + ivec3 xyz = U.inner.v.xyz; + ivec3 xzx = U.inner.v.xzx; + ivec3 xzy = U.inner.v.xzy; + ivec3 xzz = U.inner.v.xzz; + ivec3 yxx = U.inner.v.yxx; + ivec3 yxy = U.inner.v.yxy; + ivec3 yxz = U.inner.v.yxz; + ivec3 yyx = U.inner.v.yyx; + ivec3 yyy = U.inner.v.yyy; + ivec3 yyz = U.inner.v.yyz; + ivec3 yzx = U.inner.v.yzx; + ivec3 yzy = U.inner.v.yzy; + ivec3 yzz = U.inner.v.yzz; + ivec3 zxx = U.inner.v.zxx; + ivec3 zxy = U.inner.v.zxy; + ivec3 zxz = U.inner.v.zxz; + ivec3 zyx = U.inner.v.zyx; + ivec3 zyy = U.inner.v.zyy; + ivec3 zyz = U.inner.v.zyz; + ivec3 zzx = U.inner.v.zzx; + ivec3 zzy = U.inner.v.zzy; + ivec3 zzz = U.inner.v.zzz; + ivec4 xxxx = U.inner.v.xxxx; + ivec4 xxxy = U.inner.v.xxxy; + ivec4 xxxz = U.inner.v.xxxz; + ivec4 xxyx = U.inner.v.xxyx; + ivec4 xxyy = U.inner.v.xxyy; + ivec4 xxyz = U.inner.v.xxyz; + ivec4 xxzx = U.inner.v.xxzx; + ivec4 xxzy = U.inner.v.xxzy; + ivec4 xxzz = U.inner.v.xxzz; + ivec4 xyxx = U.inner.v.xyxx; + ivec4 xyxy = U.inner.v.xyxy; + ivec4 xyxz = U.inner.v.xyxz; + ivec4 xyyx = U.inner.v.xyyx; + ivec4 xyyy = U.inner.v.xyyy; + ivec4 xyyz = U.inner.v.xyyz; + ivec4 xyzx = U.inner.v.xyzx; + ivec4 xyzy = U.inner.v.xyzy; + ivec4 xyzz = U.inner.v.xyzz; + ivec4 xzxx = U.inner.v.xzxx; + ivec4 xzxy = U.inner.v.xzxy; + ivec4 xzxz = U.inner.v.xzxz; + ivec4 xzyx = U.inner.v.xzyx; + ivec4 xzyy = U.inner.v.xzyy; + ivec4 xzyz = U.inner.v.xzyz; + ivec4 xzzx = U.inner.v.xzzx; + ivec4 xzzy = U.inner.v.xzzy; + ivec4 xzzz = U.inner.v.xzzz; + ivec4 yxxx = U.inner.v.yxxx; + ivec4 yxxy = U.inner.v.yxxy; + ivec4 yxxz = U.inner.v.yxxz; + ivec4 yxyx = U.inner.v.yxyx; + ivec4 yxyy = U.inner.v.yxyy; + ivec4 yxyz = U.inner.v.yxyz; + ivec4 yxzx = U.inner.v.yxzx; + ivec4 yxzy = U.inner.v.yxzy; + ivec4 yxzz = U.inner.v.yxzz; + ivec4 yyxx = U.inner.v.yyxx; + ivec4 yyxy = U.inner.v.yyxy; + ivec4 yyxz = U.inner.v.yyxz; + ivec4 yyyx = U.inner.v.yyyx; + ivec4 yyyy = U.inner.v.yyyy; + ivec4 yyyz = U.inner.v.yyyz; + ivec4 yyzx = U.inner.v.yyzx; + ivec4 yyzy = U.inner.v.yyzy; + ivec4 yyzz = U.inner.v.yyzz; + ivec4 yzxx = U.inner.v.yzxx; + ivec4 yzxy = U.inner.v.yzxy; + ivec4 yzxz = U.inner.v.yzxz; + ivec4 yzyx = U.inner.v.yzyx; + ivec4 yzyy = U.inner.v.yzyy; + ivec4 yzyz = U.inner.v.yzyz; + ivec4 yzzx = U.inner.v.yzzx; + ivec4 yzzy = U.inner.v.yzzy; + ivec4 yzzz = U.inner.v.yzzz; + ivec4 zxxx = U.inner.v.zxxx; + ivec4 zxxy = U.inner.v.zxxy; + ivec4 zxxz = U.inner.v.zxxz; + ivec4 zxyx = U.inner.v.zxyx; + ivec4 zxyy = U.inner.v.zxyy; + ivec4 zxyz = U.inner.v.zxyz; + ivec4 zxzx = U.inner.v.zxzx; + ivec4 zxzy = U.inner.v.zxzy; + ivec4 zxzz = U.inner.v.zxzz; + ivec4 zyxx = U.inner.v.zyxx; + ivec4 zyxy = U.inner.v.zyxy; + ivec4 zyxz = U.inner.v.zyxz; + ivec4 zyyx = U.inner.v.zyyx; + ivec4 zyyy = U.inner.v.zyyy; + ivec4 zyyz = U.inner.v.zyyz; + ivec4 zyzx = U.inner.v.zyzx; + ivec4 zyzy = U.inner.v.zyzy; + ivec4 zyzz = U.inner.v.zyzz; + ivec4 zzxx = U.inner.v.zzxx; + ivec4 zzxy = U.inner.v.zzxy; + ivec4 zzxz = U.inner.v.zzxz; + ivec4 zzyx = U.inner.v.zzyx; + ivec4 zzyy = U.inner.v.zzyy; + ivec4 zzyz = U.inner.v.zzyz; + ivec4 zzzx = U.inner.v.zzzx; + ivec4 zzzy = U.inner.v.zzzy; + ivec4 zzzz = U.inner.v.zzzz; } diff --git a/test/tint/expressions/swizzle/read/packed_vec3/i32.wgsl.expected.spvasm b/test/tint/expressions/swizzle/read/packed_vec3/i32.wgsl.expected.spvasm index a71db221d5..e2b25f6bc9 100644 --- a/test/tint/expressions/swizzle/read/packed_vec3/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/swizzle/read/packed_vec3/i32.wgsl.expected.spvasm @@ -1,12 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 508 +; Bound: 509 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %U_block "U_block" + OpMemberName %U_block 0 "inner" OpName %S "S" OpMemberName %S 0 "v" OpName %U "U" @@ -133,7 +135,8 @@ OpName %zzzx "zzzx" OpName %zzzy "zzzy" OpName %zzzz "zzzz" - OpDecorate %S Block + OpDecorate %U_block Block + OpMemberDecorate %U_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %U NonWritable OpDecorate %U DescriptorSet 0 @@ -141,632 +144,633 @@ %int = OpTypeInt 32 1 %v3int = OpTypeVector %int 3 %S = OpTypeStruct %v3int -%_ptr_Uniform_S = OpTypePointer Uniform %S - %U = OpVariable %_ptr_Uniform_S Uniform + %U_block = OpTypeStruct %S +%_ptr_Uniform_U_block = OpTypePointer Uniform %U_block + %U = OpVariable %_ptr_Uniform_U_block Uniform %void = OpTypeVoid - %6 = OpTypeFunction %void + %7 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_Uniform_v3int = OpTypePointer Uniform %v3int %_ptr_Function_v3int = OpTypePointer Function %v3int - %19 = OpConstantNull %v3int + %20 = OpConstantNull %v3int %_ptr_Uniform_int = OpTypePointer Uniform %int %_ptr_Function_int = OpTypePointer Function %int - %25 = OpConstantNull %int + %26 = OpConstantNull %int %uint_1 = OpConstant %uint 1 %uint_2 = OpConstant %uint 2 %v2int = OpTypeVector %int 2 %_ptr_Function_v2int = OpTypePointer Function %v2int - %40 = OpConstantNull %v2int + %41 = OpConstantNull %v2int %v4int = OpTypeVector %int 4 %_ptr_Function_v4int = OpTypePointer Function %v4int - %187 = OpConstantNull %v4int -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel + %188 = OpConstantNull %v4int +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel OpReturn OpFunctionEnd - %f = OpFunction %void None %6 - %11 = OpLabel - %v = OpVariable %_ptr_Function_v3int Function %19 - %x = OpVariable %_ptr_Function_int Function %25 - %y = OpVariable %_ptr_Function_int Function %25 - %z = OpVariable %_ptr_Function_int Function %25 - %xx = OpVariable %_ptr_Function_v2int Function %40 - %xy = OpVariable %_ptr_Function_v2int Function %40 - %xz = OpVariable %_ptr_Function_v2int Function %40 - %yx = OpVariable %_ptr_Function_v2int Function %40 - %yy = OpVariable %_ptr_Function_v2int Function %40 - %yz = OpVariable %_ptr_Function_v2int Function %40 - %zx = OpVariable %_ptr_Function_v2int Function %40 - %zy = OpVariable %_ptr_Function_v2int Function %40 - %zz = OpVariable %_ptr_Function_v2int Function %40 - %xxx = OpVariable %_ptr_Function_v3int Function %19 - %xxy = OpVariable %_ptr_Function_v3int Function %19 - %xxz = OpVariable %_ptr_Function_v3int Function %19 - %xyx = OpVariable %_ptr_Function_v3int Function %19 - %xyy = OpVariable %_ptr_Function_v3int Function %19 - %xyz = OpVariable %_ptr_Function_v3int Function %19 - %xzx = OpVariable %_ptr_Function_v3int Function %19 - %xzy = OpVariable %_ptr_Function_v3int Function %19 - %xzz = OpVariable %_ptr_Function_v3int Function %19 - %yxx = OpVariable %_ptr_Function_v3int Function %19 - %yxy = OpVariable %_ptr_Function_v3int Function %19 - %yxz = OpVariable %_ptr_Function_v3int Function %19 - %yyx = OpVariable %_ptr_Function_v3int Function %19 - %yyy = OpVariable %_ptr_Function_v3int Function %19 - %yyz = OpVariable %_ptr_Function_v3int Function %19 - %yzx = OpVariable %_ptr_Function_v3int Function %19 - %yzy = OpVariable %_ptr_Function_v3int Function %19 - %yzz = OpVariable %_ptr_Function_v3int Function %19 - %zxx = OpVariable %_ptr_Function_v3int Function %19 - %zxy = OpVariable %_ptr_Function_v3int Function %19 - %zxz = OpVariable %_ptr_Function_v3int Function %19 - %zyx = OpVariable %_ptr_Function_v3int Function %19 - %zyy = OpVariable %_ptr_Function_v3int Function %19 - %zyz = OpVariable %_ptr_Function_v3int Function %19 - %zzx = OpVariable %_ptr_Function_v3int Function %19 - %zzy = OpVariable %_ptr_Function_v3int Function %19 - %zzz = OpVariable %_ptr_Function_v3int Function %19 - %xxxx = OpVariable %_ptr_Function_v4int Function %187 - %xxxy = OpVariable %_ptr_Function_v4int Function %187 - %xxxz = OpVariable %_ptr_Function_v4int Function %187 - %xxyx = OpVariable %_ptr_Function_v4int Function %187 - %xxyy = OpVariable %_ptr_Function_v4int Function %187 - %xxyz = OpVariable %_ptr_Function_v4int Function %187 - %xxzx = OpVariable %_ptr_Function_v4int Function %187 - %xxzy = OpVariable %_ptr_Function_v4int Function %187 - %xxzz = OpVariable %_ptr_Function_v4int Function %187 - %xyxx = OpVariable %_ptr_Function_v4int Function %187 - %xyxy = OpVariable %_ptr_Function_v4int Function %187 - %xyxz = OpVariable %_ptr_Function_v4int Function %187 - %xyyx = OpVariable %_ptr_Function_v4int Function %187 - %xyyy = OpVariable %_ptr_Function_v4int Function %187 - %xyyz = OpVariable %_ptr_Function_v4int Function %187 - %xyzx = OpVariable %_ptr_Function_v4int Function %187 - %xyzy = OpVariable %_ptr_Function_v4int Function %187 - %xyzz = OpVariable %_ptr_Function_v4int Function %187 - %xzxx = OpVariable %_ptr_Function_v4int Function %187 - %xzxy = OpVariable %_ptr_Function_v4int Function %187 - %xzxz = OpVariable %_ptr_Function_v4int Function %187 - %xzyx = OpVariable %_ptr_Function_v4int Function %187 - %xzyy = OpVariable %_ptr_Function_v4int Function %187 - %xzyz = OpVariable %_ptr_Function_v4int Function %187 - %xzzx = OpVariable %_ptr_Function_v4int Function %187 - %xzzy = OpVariable %_ptr_Function_v4int Function %187 - %xzzz = OpVariable %_ptr_Function_v4int Function %187 - %yxxx = OpVariable %_ptr_Function_v4int Function %187 - %yxxy = OpVariable %_ptr_Function_v4int Function %187 - %yxxz = OpVariable %_ptr_Function_v4int Function %187 - %yxyx = OpVariable %_ptr_Function_v4int Function %187 - %yxyy = OpVariable %_ptr_Function_v4int Function %187 - %yxyz = OpVariable %_ptr_Function_v4int Function %187 - %yxzx = OpVariable %_ptr_Function_v4int Function %187 - %yxzy = OpVariable %_ptr_Function_v4int Function %187 - %yxzz = OpVariable %_ptr_Function_v4int Function %187 - %yyxx = OpVariable %_ptr_Function_v4int Function %187 - %yyxy = OpVariable %_ptr_Function_v4int Function %187 - %yyxz = OpVariable %_ptr_Function_v4int Function %187 - %yyyx = OpVariable %_ptr_Function_v4int Function %187 - %yyyy = OpVariable %_ptr_Function_v4int Function %187 - %yyyz = OpVariable %_ptr_Function_v4int Function %187 - %yyzx = OpVariable %_ptr_Function_v4int Function %187 - %yyzy = OpVariable %_ptr_Function_v4int Function %187 - %yyzz = OpVariable %_ptr_Function_v4int Function %187 - %yzxx = OpVariable %_ptr_Function_v4int Function %187 - %yzxy = OpVariable %_ptr_Function_v4int Function %187 - %yzxz = OpVariable %_ptr_Function_v4int Function %187 - %yzyx = OpVariable %_ptr_Function_v4int Function %187 - %yzyy = OpVariable %_ptr_Function_v4int Function %187 - %yzyz = OpVariable %_ptr_Function_v4int Function %187 - %yzzx = OpVariable %_ptr_Function_v4int Function %187 - %yzzy = OpVariable %_ptr_Function_v4int Function %187 - %yzzz = OpVariable %_ptr_Function_v4int Function %187 - %zxxx = OpVariable %_ptr_Function_v4int Function %187 - %zxxy = OpVariable %_ptr_Function_v4int Function %187 - %zxxz = OpVariable %_ptr_Function_v4int Function %187 - %zxyx = OpVariable %_ptr_Function_v4int Function %187 - %zxyy = OpVariable %_ptr_Function_v4int Function %187 - %zxyz = OpVariable %_ptr_Function_v4int Function %187 - %zxzx = OpVariable %_ptr_Function_v4int Function %187 - %zxzy = OpVariable %_ptr_Function_v4int Function %187 - %zxzz = OpVariable %_ptr_Function_v4int Function %187 - %zyxx = OpVariable %_ptr_Function_v4int Function %187 - %zyxy = OpVariable %_ptr_Function_v4int Function %187 - %zyxz = OpVariable %_ptr_Function_v4int Function %187 - %zyyx = OpVariable %_ptr_Function_v4int Function %187 - %zyyy = OpVariable %_ptr_Function_v4int Function %187 - %zyyz = OpVariable %_ptr_Function_v4int Function %187 - %zyzx = OpVariable %_ptr_Function_v4int Function %187 - %zyzy = OpVariable %_ptr_Function_v4int Function %187 - %zyzz = OpVariable %_ptr_Function_v4int Function %187 - %zzxx = OpVariable %_ptr_Function_v4int Function %187 - %zzxy = OpVariable %_ptr_Function_v4int Function %187 - %zzxz = OpVariable %_ptr_Function_v4int Function %187 - %zzyx = OpVariable %_ptr_Function_v4int Function %187 - %zzyy = OpVariable %_ptr_Function_v4int Function %187 - %zzyz = OpVariable %_ptr_Function_v4int Function %187 - %zzzx = OpVariable %_ptr_Function_v4int Function %187 - %zzzy = OpVariable %_ptr_Function_v4int Function %187 - %zzzz = OpVariable %_ptr_Function_v4int Function %187 - %15 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %16 = OpLoad %v3int %15 - OpStore %v %16 - %21 = OpAccessChain %_ptr_Uniform_int %U %uint_0 %uint_0 - %22 = OpLoad %int %21 - OpStore %x %22 - %27 = OpAccessChain %_ptr_Uniform_int %U %uint_0 %uint_1 - %28 = OpLoad %int %27 - OpStore %y %28 - %31 = OpAccessChain %_ptr_Uniform_int %U %uint_0 %uint_2 - %32 = OpLoad %int %31 - OpStore %z %32 - %34 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %36 = OpLoad %v3int %34 - %37 = OpVectorShuffle %v2int %36 %36 0 0 - OpStore %xx %37 - %41 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %42 = OpLoad %v3int %41 - %43 = OpVectorShuffle %v2int %42 %42 0 1 - OpStore %xy %43 - %45 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %46 = OpLoad %v3int %45 - %47 = OpVectorShuffle %v2int %46 %46 0 2 - OpStore %xz %47 - %49 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %50 = OpLoad %v3int %49 - %51 = OpVectorShuffle %v2int %50 %50 1 0 - OpStore %yx %51 - %53 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %54 = OpLoad %v3int %53 - %55 = OpVectorShuffle %v2int %54 %54 1 1 - OpStore %yy %55 - %57 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %58 = OpLoad %v3int %57 - %59 = OpVectorShuffle %v2int %58 %58 1 2 - OpStore %yz %59 - %61 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %62 = OpLoad %v3int %61 - %63 = OpVectorShuffle %v2int %62 %62 2 0 - OpStore %zx %63 - %65 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %66 = OpLoad %v3int %65 - %67 = OpVectorShuffle %v2int %66 %66 2 1 - OpStore %zy %67 - %69 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %70 = OpLoad %v3int %69 - %71 = OpVectorShuffle %v2int %70 %70 2 2 - OpStore %zz %71 - %73 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %74 = OpLoad %v3int %73 - %75 = OpVectorShuffle %v3int %74 %74 0 0 0 - OpStore %xxx %75 - %77 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %78 = OpLoad %v3int %77 - %79 = OpVectorShuffle %v3int %78 %78 0 0 1 - OpStore %xxy %79 - %81 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %82 = OpLoad %v3int %81 - %83 = OpVectorShuffle %v3int %82 %82 0 0 2 - OpStore %xxz %83 - %85 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %86 = OpLoad %v3int %85 - %87 = OpVectorShuffle %v3int %86 %86 0 1 0 - OpStore %xyx %87 - %89 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %90 = OpLoad %v3int %89 - %91 = OpVectorShuffle %v3int %90 %90 0 1 1 - OpStore %xyy %91 - %93 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %94 = OpLoad %v3int %93 - %95 = OpVectorShuffle %v3int %94 %94 0 1 2 - OpStore %xyz %95 - %97 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %98 = OpLoad %v3int %97 - %99 = OpVectorShuffle %v3int %98 %98 0 2 0 - OpStore %xzx %99 - %101 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %102 = OpLoad %v3int %101 - %103 = OpVectorShuffle %v3int %102 %102 0 2 1 - OpStore %xzy %103 - %105 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %106 = OpLoad %v3int %105 - %107 = OpVectorShuffle %v3int %106 %106 0 2 2 - OpStore %xzz %107 - %109 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %110 = OpLoad %v3int %109 - %111 = OpVectorShuffle %v3int %110 %110 1 0 0 - OpStore %yxx %111 - %113 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %114 = OpLoad %v3int %113 - %115 = OpVectorShuffle %v3int %114 %114 1 0 1 - OpStore %yxy %115 - %117 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %118 = OpLoad %v3int %117 - %119 = OpVectorShuffle %v3int %118 %118 1 0 2 - OpStore %yxz %119 - %121 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %122 = OpLoad %v3int %121 - %123 = OpVectorShuffle %v3int %122 %122 1 1 0 - OpStore %yyx %123 - %125 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %126 = OpLoad %v3int %125 - %127 = OpVectorShuffle %v3int %126 %126 1 1 1 - OpStore %yyy %127 - %129 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %130 = OpLoad %v3int %129 - %131 = OpVectorShuffle %v3int %130 %130 1 1 2 - OpStore %yyz %131 - %133 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %134 = OpLoad %v3int %133 - %135 = OpVectorShuffle %v3int %134 %134 1 2 0 - OpStore %yzx %135 - %137 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %138 = OpLoad %v3int %137 - %139 = OpVectorShuffle %v3int %138 %138 1 2 1 - OpStore %yzy %139 - %141 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %142 = OpLoad %v3int %141 - %143 = OpVectorShuffle %v3int %142 %142 1 2 2 - OpStore %yzz %143 - %145 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %146 = OpLoad %v3int %145 - %147 = OpVectorShuffle %v3int %146 %146 2 0 0 - OpStore %zxx %147 - %149 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %150 = OpLoad %v3int %149 - %151 = OpVectorShuffle %v3int %150 %150 2 0 1 - OpStore %zxy %151 - %153 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %154 = OpLoad %v3int %153 - %155 = OpVectorShuffle %v3int %154 %154 2 0 2 - OpStore %zxz %155 - %157 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %158 = OpLoad %v3int %157 - %159 = OpVectorShuffle %v3int %158 %158 2 1 0 - OpStore %zyx %159 - %161 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %162 = OpLoad %v3int %161 - %163 = OpVectorShuffle %v3int %162 %162 2 1 1 - OpStore %zyy %163 - %165 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %166 = OpLoad %v3int %165 - %167 = OpVectorShuffle %v3int %166 %166 2 1 2 - OpStore %zyz %167 - %169 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %170 = OpLoad %v3int %169 - %171 = OpVectorShuffle %v3int %170 %170 2 2 0 - OpStore %zzx %171 - %173 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %174 = OpLoad %v3int %173 - %175 = OpVectorShuffle %v3int %174 %174 2 2 1 - OpStore %zzy %175 - %177 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %178 = OpLoad %v3int %177 - %179 = OpVectorShuffle %v3int %178 %178 2 2 2 - OpStore %zzz %179 - %181 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %183 = OpLoad %v3int %181 - %184 = OpVectorShuffle %v4int %183 %183 0 0 0 0 - OpStore %xxxx %184 - %188 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %189 = OpLoad %v3int %188 - %190 = OpVectorShuffle %v4int %189 %189 0 0 0 1 - OpStore %xxxy %190 - %192 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %193 = OpLoad %v3int %192 - %194 = OpVectorShuffle %v4int %193 %193 0 0 0 2 - OpStore %xxxz %194 - %196 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %197 = OpLoad %v3int %196 - %198 = OpVectorShuffle %v4int %197 %197 0 0 1 0 - OpStore %xxyx %198 - %200 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %201 = OpLoad %v3int %200 - %202 = OpVectorShuffle %v4int %201 %201 0 0 1 1 - OpStore %xxyy %202 - %204 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %205 = OpLoad %v3int %204 - %206 = OpVectorShuffle %v4int %205 %205 0 0 1 2 - OpStore %xxyz %206 - %208 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %209 = OpLoad %v3int %208 - %210 = OpVectorShuffle %v4int %209 %209 0 0 2 0 - OpStore %xxzx %210 - %212 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %213 = OpLoad %v3int %212 - %214 = OpVectorShuffle %v4int %213 %213 0 0 2 1 - OpStore %xxzy %214 - %216 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %217 = OpLoad %v3int %216 - %218 = OpVectorShuffle %v4int %217 %217 0 0 2 2 - OpStore %xxzz %218 - %220 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %221 = OpLoad %v3int %220 - %222 = OpVectorShuffle %v4int %221 %221 0 1 0 0 - OpStore %xyxx %222 - %224 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %225 = OpLoad %v3int %224 - %226 = OpVectorShuffle %v4int %225 %225 0 1 0 1 - OpStore %xyxy %226 - %228 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %229 = OpLoad %v3int %228 - %230 = OpVectorShuffle %v4int %229 %229 0 1 0 2 - OpStore %xyxz %230 - %232 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %233 = OpLoad %v3int %232 - %234 = OpVectorShuffle %v4int %233 %233 0 1 1 0 - OpStore %xyyx %234 - %236 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %237 = OpLoad %v3int %236 - %238 = OpVectorShuffle %v4int %237 %237 0 1 1 1 - OpStore %xyyy %238 - %240 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %241 = OpLoad %v3int %240 - %242 = OpVectorShuffle %v4int %241 %241 0 1 1 2 - OpStore %xyyz %242 - %244 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %245 = OpLoad %v3int %244 - %246 = OpVectorShuffle %v4int %245 %245 0 1 2 0 - OpStore %xyzx %246 - %248 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %249 = OpLoad %v3int %248 - %250 = OpVectorShuffle %v4int %249 %249 0 1 2 1 - OpStore %xyzy %250 - %252 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %253 = OpLoad %v3int %252 - %254 = OpVectorShuffle %v4int %253 %253 0 1 2 2 - OpStore %xyzz %254 - %256 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %257 = OpLoad %v3int %256 - %258 = OpVectorShuffle %v4int %257 %257 0 2 0 0 - OpStore %xzxx %258 - %260 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %261 = OpLoad %v3int %260 - %262 = OpVectorShuffle %v4int %261 %261 0 2 0 1 - OpStore %xzxy %262 - %264 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %265 = OpLoad %v3int %264 - %266 = OpVectorShuffle %v4int %265 %265 0 2 0 2 - OpStore %xzxz %266 - %268 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %269 = OpLoad %v3int %268 - %270 = OpVectorShuffle %v4int %269 %269 0 2 1 0 - OpStore %xzyx %270 - %272 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %273 = OpLoad %v3int %272 - %274 = OpVectorShuffle %v4int %273 %273 0 2 1 1 - OpStore %xzyy %274 - %276 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %277 = OpLoad %v3int %276 - %278 = OpVectorShuffle %v4int %277 %277 0 2 1 2 - OpStore %xzyz %278 - %280 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %281 = OpLoad %v3int %280 - %282 = OpVectorShuffle %v4int %281 %281 0 2 2 0 - OpStore %xzzx %282 - %284 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %285 = OpLoad %v3int %284 - %286 = OpVectorShuffle %v4int %285 %285 0 2 2 1 - OpStore %xzzy %286 - %288 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %289 = OpLoad %v3int %288 - %290 = OpVectorShuffle %v4int %289 %289 0 2 2 2 - OpStore %xzzz %290 - %292 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %293 = OpLoad %v3int %292 - %294 = OpVectorShuffle %v4int %293 %293 1 0 0 0 - OpStore %yxxx %294 - %296 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %297 = OpLoad %v3int %296 - %298 = OpVectorShuffle %v4int %297 %297 1 0 0 1 - OpStore %yxxy %298 - %300 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %301 = OpLoad %v3int %300 - %302 = OpVectorShuffle %v4int %301 %301 1 0 0 2 - OpStore %yxxz %302 - %304 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %305 = OpLoad %v3int %304 - %306 = OpVectorShuffle %v4int %305 %305 1 0 1 0 - OpStore %yxyx %306 - %308 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %309 = OpLoad %v3int %308 - %310 = OpVectorShuffle %v4int %309 %309 1 0 1 1 - OpStore %yxyy %310 - %312 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %313 = OpLoad %v3int %312 - %314 = OpVectorShuffle %v4int %313 %313 1 0 1 2 - OpStore %yxyz %314 - %316 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %317 = OpLoad %v3int %316 - %318 = OpVectorShuffle %v4int %317 %317 1 0 2 0 - OpStore %yxzx %318 - %320 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %321 = OpLoad %v3int %320 - %322 = OpVectorShuffle %v4int %321 %321 1 0 2 1 - OpStore %yxzy %322 - %324 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %325 = OpLoad %v3int %324 - %326 = OpVectorShuffle %v4int %325 %325 1 0 2 2 - OpStore %yxzz %326 - %328 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %329 = OpLoad %v3int %328 - %330 = OpVectorShuffle %v4int %329 %329 1 1 0 0 - OpStore %yyxx %330 - %332 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %333 = OpLoad %v3int %332 - %334 = OpVectorShuffle %v4int %333 %333 1 1 0 1 - OpStore %yyxy %334 - %336 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %337 = OpLoad %v3int %336 - %338 = OpVectorShuffle %v4int %337 %337 1 1 0 2 - OpStore %yyxz %338 - %340 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %341 = OpLoad %v3int %340 - %342 = OpVectorShuffle %v4int %341 %341 1 1 1 0 - OpStore %yyyx %342 - %344 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %345 = OpLoad %v3int %344 - %346 = OpVectorShuffle %v4int %345 %345 1 1 1 1 - OpStore %yyyy %346 - %348 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %349 = OpLoad %v3int %348 - %350 = OpVectorShuffle %v4int %349 %349 1 1 1 2 - OpStore %yyyz %350 - %352 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %353 = OpLoad %v3int %352 - %354 = OpVectorShuffle %v4int %353 %353 1 1 2 0 - OpStore %yyzx %354 - %356 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %357 = OpLoad %v3int %356 - %358 = OpVectorShuffle %v4int %357 %357 1 1 2 1 - OpStore %yyzy %358 - %360 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %361 = OpLoad %v3int %360 - %362 = OpVectorShuffle %v4int %361 %361 1 1 2 2 - OpStore %yyzz %362 - %364 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %365 = OpLoad %v3int %364 - %366 = OpVectorShuffle %v4int %365 %365 1 2 0 0 - OpStore %yzxx %366 - %368 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %369 = OpLoad %v3int %368 - %370 = OpVectorShuffle %v4int %369 %369 1 2 0 1 - OpStore %yzxy %370 - %372 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %373 = OpLoad %v3int %372 - %374 = OpVectorShuffle %v4int %373 %373 1 2 0 2 - OpStore %yzxz %374 - %376 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %377 = OpLoad %v3int %376 - %378 = OpVectorShuffle %v4int %377 %377 1 2 1 0 - OpStore %yzyx %378 - %380 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %381 = OpLoad %v3int %380 - %382 = OpVectorShuffle %v4int %381 %381 1 2 1 1 - OpStore %yzyy %382 - %384 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %385 = OpLoad %v3int %384 - %386 = OpVectorShuffle %v4int %385 %385 1 2 1 2 - OpStore %yzyz %386 - %388 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %389 = OpLoad %v3int %388 - %390 = OpVectorShuffle %v4int %389 %389 1 2 2 0 - OpStore %yzzx %390 - %392 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %393 = OpLoad %v3int %392 - %394 = OpVectorShuffle %v4int %393 %393 1 2 2 1 - OpStore %yzzy %394 - %396 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %397 = OpLoad %v3int %396 - %398 = OpVectorShuffle %v4int %397 %397 1 2 2 2 - OpStore %yzzz %398 - %400 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %401 = OpLoad %v3int %400 - %402 = OpVectorShuffle %v4int %401 %401 2 0 0 0 - OpStore %zxxx %402 - %404 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %405 = OpLoad %v3int %404 - %406 = OpVectorShuffle %v4int %405 %405 2 0 0 1 - OpStore %zxxy %406 - %408 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %409 = OpLoad %v3int %408 - %410 = OpVectorShuffle %v4int %409 %409 2 0 0 2 - OpStore %zxxz %410 - %412 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %413 = OpLoad %v3int %412 - %414 = OpVectorShuffle %v4int %413 %413 2 0 1 0 - OpStore %zxyx %414 - %416 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %417 = OpLoad %v3int %416 - %418 = OpVectorShuffle %v4int %417 %417 2 0 1 1 - OpStore %zxyy %418 - %420 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %421 = OpLoad %v3int %420 - %422 = OpVectorShuffle %v4int %421 %421 2 0 1 2 - OpStore %zxyz %422 - %424 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %425 = OpLoad %v3int %424 - %426 = OpVectorShuffle %v4int %425 %425 2 0 2 0 - OpStore %zxzx %426 - %428 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %429 = OpLoad %v3int %428 - %430 = OpVectorShuffle %v4int %429 %429 2 0 2 1 - OpStore %zxzy %430 - %432 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %433 = OpLoad %v3int %432 - %434 = OpVectorShuffle %v4int %433 %433 2 0 2 2 - OpStore %zxzz %434 - %436 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %437 = OpLoad %v3int %436 - %438 = OpVectorShuffle %v4int %437 %437 2 1 0 0 - OpStore %zyxx %438 - %440 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %441 = OpLoad %v3int %440 - %442 = OpVectorShuffle %v4int %441 %441 2 1 0 1 - OpStore %zyxy %442 - %444 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %445 = OpLoad %v3int %444 - %446 = OpVectorShuffle %v4int %445 %445 2 1 0 2 - OpStore %zyxz %446 - %448 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %449 = OpLoad %v3int %448 - %450 = OpVectorShuffle %v4int %449 %449 2 1 1 0 - OpStore %zyyx %450 - %452 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %453 = OpLoad %v3int %452 - %454 = OpVectorShuffle %v4int %453 %453 2 1 1 1 - OpStore %zyyy %454 - %456 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %457 = OpLoad %v3int %456 - %458 = OpVectorShuffle %v4int %457 %457 2 1 1 2 - OpStore %zyyz %458 - %460 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %461 = OpLoad %v3int %460 - %462 = OpVectorShuffle %v4int %461 %461 2 1 2 0 - OpStore %zyzx %462 - %464 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %465 = OpLoad %v3int %464 - %466 = OpVectorShuffle %v4int %465 %465 2 1 2 1 - OpStore %zyzy %466 - %468 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %469 = OpLoad %v3int %468 - %470 = OpVectorShuffle %v4int %469 %469 2 1 2 2 - OpStore %zyzz %470 - %472 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %473 = OpLoad %v3int %472 - %474 = OpVectorShuffle %v4int %473 %473 2 2 0 0 - OpStore %zzxx %474 - %476 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %477 = OpLoad %v3int %476 - %478 = OpVectorShuffle %v4int %477 %477 2 2 0 1 - OpStore %zzxy %478 - %480 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %481 = OpLoad %v3int %480 - %482 = OpVectorShuffle %v4int %481 %481 2 2 0 2 - OpStore %zzxz %482 - %484 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %485 = OpLoad %v3int %484 - %486 = OpVectorShuffle %v4int %485 %485 2 2 1 0 - OpStore %zzyx %486 - %488 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %489 = OpLoad %v3int %488 - %490 = OpVectorShuffle %v4int %489 %489 2 2 1 1 - OpStore %zzyy %490 - %492 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %493 = OpLoad %v3int %492 - %494 = OpVectorShuffle %v4int %493 %493 2 2 1 2 - OpStore %zzyz %494 - %496 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %497 = OpLoad %v3int %496 - %498 = OpVectorShuffle %v4int %497 %497 2 2 2 0 - OpStore %zzzx %498 - %500 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %501 = OpLoad %v3int %500 - %502 = OpVectorShuffle %v4int %501 %501 2 2 2 1 - OpStore %zzzy %502 - %504 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 - %505 = OpLoad %v3int %504 - %506 = OpVectorShuffle %v4int %505 %505 2 2 2 2 - OpStore %zzzz %506 + %f = OpFunction %void None %7 + %12 = OpLabel + %v = OpVariable %_ptr_Function_v3int Function %20 + %x = OpVariable %_ptr_Function_int Function %26 + %y = OpVariable %_ptr_Function_int Function %26 + %z = OpVariable %_ptr_Function_int Function %26 + %xx = OpVariable %_ptr_Function_v2int Function %41 + %xy = OpVariable %_ptr_Function_v2int Function %41 + %xz = OpVariable %_ptr_Function_v2int Function %41 + %yx = OpVariable %_ptr_Function_v2int Function %41 + %yy = OpVariable %_ptr_Function_v2int Function %41 + %yz = OpVariable %_ptr_Function_v2int Function %41 + %zx = OpVariable %_ptr_Function_v2int Function %41 + %zy = OpVariable %_ptr_Function_v2int Function %41 + %zz = OpVariable %_ptr_Function_v2int Function %41 + %xxx = OpVariable %_ptr_Function_v3int Function %20 + %xxy = OpVariable %_ptr_Function_v3int Function %20 + %xxz = OpVariable %_ptr_Function_v3int Function %20 + %xyx = OpVariable %_ptr_Function_v3int Function %20 + %xyy = OpVariable %_ptr_Function_v3int Function %20 + %xyz = OpVariable %_ptr_Function_v3int Function %20 + %xzx = OpVariable %_ptr_Function_v3int Function %20 + %xzy = OpVariable %_ptr_Function_v3int Function %20 + %xzz = OpVariable %_ptr_Function_v3int Function %20 + %yxx = OpVariable %_ptr_Function_v3int Function %20 + %yxy = OpVariable %_ptr_Function_v3int Function %20 + %yxz = OpVariable %_ptr_Function_v3int Function %20 + %yyx = OpVariable %_ptr_Function_v3int Function %20 + %yyy = OpVariable %_ptr_Function_v3int Function %20 + %yyz = OpVariable %_ptr_Function_v3int Function %20 + %yzx = OpVariable %_ptr_Function_v3int Function %20 + %yzy = OpVariable %_ptr_Function_v3int Function %20 + %yzz = OpVariable %_ptr_Function_v3int Function %20 + %zxx = OpVariable %_ptr_Function_v3int Function %20 + %zxy = OpVariable %_ptr_Function_v3int Function %20 + %zxz = OpVariable %_ptr_Function_v3int Function %20 + %zyx = OpVariable %_ptr_Function_v3int Function %20 + %zyy = OpVariable %_ptr_Function_v3int Function %20 + %zyz = OpVariable %_ptr_Function_v3int Function %20 + %zzx = OpVariable %_ptr_Function_v3int Function %20 + %zzy = OpVariable %_ptr_Function_v3int Function %20 + %zzz = OpVariable %_ptr_Function_v3int Function %20 + %xxxx = OpVariable %_ptr_Function_v4int Function %188 + %xxxy = OpVariable %_ptr_Function_v4int Function %188 + %xxxz = OpVariable %_ptr_Function_v4int Function %188 + %xxyx = OpVariable %_ptr_Function_v4int Function %188 + %xxyy = OpVariable %_ptr_Function_v4int Function %188 + %xxyz = OpVariable %_ptr_Function_v4int Function %188 + %xxzx = OpVariable %_ptr_Function_v4int Function %188 + %xxzy = OpVariable %_ptr_Function_v4int Function %188 + %xxzz = OpVariable %_ptr_Function_v4int Function %188 + %xyxx = OpVariable %_ptr_Function_v4int Function %188 + %xyxy = OpVariable %_ptr_Function_v4int Function %188 + %xyxz = OpVariable %_ptr_Function_v4int Function %188 + %xyyx = OpVariable %_ptr_Function_v4int Function %188 + %xyyy = OpVariable %_ptr_Function_v4int Function %188 + %xyyz = OpVariable %_ptr_Function_v4int Function %188 + %xyzx = OpVariable %_ptr_Function_v4int Function %188 + %xyzy = OpVariable %_ptr_Function_v4int Function %188 + %xyzz = OpVariable %_ptr_Function_v4int Function %188 + %xzxx = OpVariable %_ptr_Function_v4int Function %188 + %xzxy = OpVariable %_ptr_Function_v4int Function %188 + %xzxz = OpVariable %_ptr_Function_v4int Function %188 + %xzyx = OpVariable %_ptr_Function_v4int Function %188 + %xzyy = OpVariable %_ptr_Function_v4int Function %188 + %xzyz = OpVariable %_ptr_Function_v4int Function %188 + %xzzx = OpVariable %_ptr_Function_v4int Function %188 + %xzzy = OpVariable %_ptr_Function_v4int Function %188 + %xzzz = OpVariable %_ptr_Function_v4int Function %188 + %yxxx = OpVariable %_ptr_Function_v4int Function %188 + %yxxy = OpVariable %_ptr_Function_v4int Function %188 + %yxxz = OpVariable %_ptr_Function_v4int Function %188 + %yxyx = OpVariable %_ptr_Function_v4int Function %188 + %yxyy = OpVariable %_ptr_Function_v4int Function %188 + %yxyz = OpVariable %_ptr_Function_v4int Function %188 + %yxzx = OpVariable %_ptr_Function_v4int Function %188 + %yxzy = OpVariable %_ptr_Function_v4int Function %188 + %yxzz = OpVariable %_ptr_Function_v4int Function %188 + %yyxx = OpVariable %_ptr_Function_v4int Function %188 + %yyxy = OpVariable %_ptr_Function_v4int Function %188 + %yyxz = OpVariable %_ptr_Function_v4int Function %188 + %yyyx = OpVariable %_ptr_Function_v4int Function %188 + %yyyy = OpVariable %_ptr_Function_v4int Function %188 + %yyyz = OpVariable %_ptr_Function_v4int Function %188 + %yyzx = OpVariable %_ptr_Function_v4int Function %188 + %yyzy = OpVariable %_ptr_Function_v4int Function %188 + %yyzz = OpVariable %_ptr_Function_v4int Function %188 + %yzxx = OpVariable %_ptr_Function_v4int Function %188 + %yzxy = OpVariable %_ptr_Function_v4int Function %188 + %yzxz = OpVariable %_ptr_Function_v4int Function %188 + %yzyx = OpVariable %_ptr_Function_v4int Function %188 + %yzyy = OpVariable %_ptr_Function_v4int Function %188 + %yzyz = OpVariable %_ptr_Function_v4int Function %188 + %yzzx = OpVariable %_ptr_Function_v4int Function %188 + %yzzy = OpVariable %_ptr_Function_v4int Function %188 + %yzzz = OpVariable %_ptr_Function_v4int Function %188 + %zxxx = OpVariable %_ptr_Function_v4int Function %188 + %zxxy = OpVariable %_ptr_Function_v4int Function %188 + %zxxz = OpVariable %_ptr_Function_v4int Function %188 + %zxyx = OpVariable %_ptr_Function_v4int Function %188 + %zxyy = OpVariable %_ptr_Function_v4int Function %188 + %zxyz = OpVariable %_ptr_Function_v4int Function %188 + %zxzx = OpVariable %_ptr_Function_v4int Function %188 + %zxzy = OpVariable %_ptr_Function_v4int Function %188 + %zxzz = OpVariable %_ptr_Function_v4int Function %188 + %zyxx = OpVariable %_ptr_Function_v4int Function %188 + %zyxy = OpVariable %_ptr_Function_v4int Function %188 + %zyxz = OpVariable %_ptr_Function_v4int Function %188 + %zyyx = OpVariable %_ptr_Function_v4int Function %188 + %zyyy = OpVariable %_ptr_Function_v4int Function %188 + %zyyz = OpVariable %_ptr_Function_v4int Function %188 + %zyzx = OpVariable %_ptr_Function_v4int Function %188 + %zyzy = OpVariable %_ptr_Function_v4int Function %188 + %zyzz = OpVariable %_ptr_Function_v4int Function %188 + %zzxx = OpVariable %_ptr_Function_v4int Function %188 + %zzxy = OpVariable %_ptr_Function_v4int Function %188 + %zzxz = OpVariable %_ptr_Function_v4int Function %188 + %zzyx = OpVariable %_ptr_Function_v4int Function %188 + %zzyy = OpVariable %_ptr_Function_v4int Function %188 + %zzyz = OpVariable %_ptr_Function_v4int Function %188 + %zzzx = OpVariable %_ptr_Function_v4int Function %188 + %zzzy = OpVariable %_ptr_Function_v4int Function %188 + %zzzz = OpVariable %_ptr_Function_v4int Function %188 + %16 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %17 = OpLoad %v3int %16 + OpStore %v %17 + %22 = OpAccessChain %_ptr_Uniform_int %U %uint_0 %uint_0 %uint_0 + %23 = OpLoad %int %22 + OpStore %x %23 + %28 = OpAccessChain %_ptr_Uniform_int %U %uint_0 %uint_0 %uint_1 + %29 = OpLoad %int %28 + OpStore %y %29 + %32 = OpAccessChain %_ptr_Uniform_int %U %uint_0 %uint_0 %uint_2 + %33 = OpLoad %int %32 + OpStore %z %33 + %35 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %37 = OpLoad %v3int %35 + %38 = OpVectorShuffle %v2int %37 %37 0 0 + OpStore %xx %38 + %42 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %43 = OpLoad %v3int %42 + %44 = OpVectorShuffle %v2int %43 %43 0 1 + OpStore %xy %44 + %46 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %47 = OpLoad %v3int %46 + %48 = OpVectorShuffle %v2int %47 %47 0 2 + OpStore %xz %48 + %50 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %51 = OpLoad %v3int %50 + %52 = OpVectorShuffle %v2int %51 %51 1 0 + OpStore %yx %52 + %54 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %55 = OpLoad %v3int %54 + %56 = OpVectorShuffle %v2int %55 %55 1 1 + OpStore %yy %56 + %58 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %59 = OpLoad %v3int %58 + %60 = OpVectorShuffle %v2int %59 %59 1 2 + OpStore %yz %60 + %62 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %63 = OpLoad %v3int %62 + %64 = OpVectorShuffle %v2int %63 %63 2 0 + OpStore %zx %64 + %66 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %67 = OpLoad %v3int %66 + %68 = OpVectorShuffle %v2int %67 %67 2 1 + OpStore %zy %68 + %70 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %71 = OpLoad %v3int %70 + %72 = OpVectorShuffle %v2int %71 %71 2 2 + OpStore %zz %72 + %74 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %75 = OpLoad %v3int %74 + %76 = OpVectorShuffle %v3int %75 %75 0 0 0 + OpStore %xxx %76 + %78 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %79 = OpLoad %v3int %78 + %80 = OpVectorShuffle %v3int %79 %79 0 0 1 + OpStore %xxy %80 + %82 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %83 = OpLoad %v3int %82 + %84 = OpVectorShuffle %v3int %83 %83 0 0 2 + OpStore %xxz %84 + %86 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %87 = OpLoad %v3int %86 + %88 = OpVectorShuffle %v3int %87 %87 0 1 0 + OpStore %xyx %88 + %90 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %91 = OpLoad %v3int %90 + %92 = OpVectorShuffle %v3int %91 %91 0 1 1 + OpStore %xyy %92 + %94 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %95 = OpLoad %v3int %94 + %96 = OpVectorShuffle %v3int %95 %95 0 1 2 + OpStore %xyz %96 + %98 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %99 = OpLoad %v3int %98 + %100 = OpVectorShuffle %v3int %99 %99 0 2 0 + OpStore %xzx %100 + %102 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %103 = OpLoad %v3int %102 + %104 = OpVectorShuffle %v3int %103 %103 0 2 1 + OpStore %xzy %104 + %106 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %107 = OpLoad %v3int %106 + %108 = OpVectorShuffle %v3int %107 %107 0 2 2 + OpStore %xzz %108 + %110 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %111 = OpLoad %v3int %110 + %112 = OpVectorShuffle %v3int %111 %111 1 0 0 + OpStore %yxx %112 + %114 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %115 = OpLoad %v3int %114 + %116 = OpVectorShuffle %v3int %115 %115 1 0 1 + OpStore %yxy %116 + %118 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %119 = OpLoad %v3int %118 + %120 = OpVectorShuffle %v3int %119 %119 1 0 2 + OpStore %yxz %120 + %122 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %123 = OpLoad %v3int %122 + %124 = OpVectorShuffle %v3int %123 %123 1 1 0 + OpStore %yyx %124 + %126 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %127 = OpLoad %v3int %126 + %128 = OpVectorShuffle %v3int %127 %127 1 1 1 + OpStore %yyy %128 + %130 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %131 = OpLoad %v3int %130 + %132 = OpVectorShuffle %v3int %131 %131 1 1 2 + OpStore %yyz %132 + %134 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %135 = OpLoad %v3int %134 + %136 = OpVectorShuffle %v3int %135 %135 1 2 0 + OpStore %yzx %136 + %138 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %139 = OpLoad %v3int %138 + %140 = OpVectorShuffle %v3int %139 %139 1 2 1 + OpStore %yzy %140 + %142 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %143 = OpLoad %v3int %142 + %144 = OpVectorShuffle %v3int %143 %143 1 2 2 + OpStore %yzz %144 + %146 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %147 = OpLoad %v3int %146 + %148 = OpVectorShuffle %v3int %147 %147 2 0 0 + OpStore %zxx %148 + %150 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %151 = OpLoad %v3int %150 + %152 = OpVectorShuffle %v3int %151 %151 2 0 1 + OpStore %zxy %152 + %154 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %155 = OpLoad %v3int %154 + %156 = OpVectorShuffle %v3int %155 %155 2 0 2 + OpStore %zxz %156 + %158 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %159 = OpLoad %v3int %158 + %160 = OpVectorShuffle %v3int %159 %159 2 1 0 + OpStore %zyx %160 + %162 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %163 = OpLoad %v3int %162 + %164 = OpVectorShuffle %v3int %163 %163 2 1 1 + OpStore %zyy %164 + %166 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %167 = OpLoad %v3int %166 + %168 = OpVectorShuffle %v3int %167 %167 2 1 2 + OpStore %zyz %168 + %170 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %171 = OpLoad %v3int %170 + %172 = OpVectorShuffle %v3int %171 %171 2 2 0 + OpStore %zzx %172 + %174 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %175 = OpLoad %v3int %174 + %176 = OpVectorShuffle %v3int %175 %175 2 2 1 + OpStore %zzy %176 + %178 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %179 = OpLoad %v3int %178 + %180 = OpVectorShuffle %v3int %179 %179 2 2 2 + OpStore %zzz %180 + %182 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %184 = OpLoad %v3int %182 + %185 = OpVectorShuffle %v4int %184 %184 0 0 0 0 + OpStore %xxxx %185 + %189 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %190 = OpLoad %v3int %189 + %191 = OpVectorShuffle %v4int %190 %190 0 0 0 1 + OpStore %xxxy %191 + %193 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %194 = OpLoad %v3int %193 + %195 = OpVectorShuffle %v4int %194 %194 0 0 0 2 + OpStore %xxxz %195 + %197 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %198 = OpLoad %v3int %197 + %199 = OpVectorShuffle %v4int %198 %198 0 0 1 0 + OpStore %xxyx %199 + %201 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %202 = OpLoad %v3int %201 + %203 = OpVectorShuffle %v4int %202 %202 0 0 1 1 + OpStore %xxyy %203 + %205 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %206 = OpLoad %v3int %205 + %207 = OpVectorShuffle %v4int %206 %206 0 0 1 2 + OpStore %xxyz %207 + %209 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %210 = OpLoad %v3int %209 + %211 = OpVectorShuffle %v4int %210 %210 0 0 2 0 + OpStore %xxzx %211 + %213 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %214 = OpLoad %v3int %213 + %215 = OpVectorShuffle %v4int %214 %214 0 0 2 1 + OpStore %xxzy %215 + %217 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %218 = OpLoad %v3int %217 + %219 = OpVectorShuffle %v4int %218 %218 0 0 2 2 + OpStore %xxzz %219 + %221 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %222 = OpLoad %v3int %221 + %223 = OpVectorShuffle %v4int %222 %222 0 1 0 0 + OpStore %xyxx %223 + %225 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %226 = OpLoad %v3int %225 + %227 = OpVectorShuffle %v4int %226 %226 0 1 0 1 + OpStore %xyxy %227 + %229 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %230 = OpLoad %v3int %229 + %231 = OpVectorShuffle %v4int %230 %230 0 1 0 2 + OpStore %xyxz %231 + %233 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %234 = OpLoad %v3int %233 + %235 = OpVectorShuffle %v4int %234 %234 0 1 1 0 + OpStore %xyyx %235 + %237 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %238 = OpLoad %v3int %237 + %239 = OpVectorShuffle %v4int %238 %238 0 1 1 1 + OpStore %xyyy %239 + %241 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %242 = OpLoad %v3int %241 + %243 = OpVectorShuffle %v4int %242 %242 0 1 1 2 + OpStore %xyyz %243 + %245 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %246 = OpLoad %v3int %245 + %247 = OpVectorShuffle %v4int %246 %246 0 1 2 0 + OpStore %xyzx %247 + %249 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %250 = OpLoad %v3int %249 + %251 = OpVectorShuffle %v4int %250 %250 0 1 2 1 + OpStore %xyzy %251 + %253 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %254 = OpLoad %v3int %253 + %255 = OpVectorShuffle %v4int %254 %254 0 1 2 2 + OpStore %xyzz %255 + %257 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %258 = OpLoad %v3int %257 + %259 = OpVectorShuffle %v4int %258 %258 0 2 0 0 + OpStore %xzxx %259 + %261 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %262 = OpLoad %v3int %261 + %263 = OpVectorShuffle %v4int %262 %262 0 2 0 1 + OpStore %xzxy %263 + %265 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %266 = OpLoad %v3int %265 + %267 = OpVectorShuffle %v4int %266 %266 0 2 0 2 + OpStore %xzxz %267 + %269 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %270 = OpLoad %v3int %269 + %271 = OpVectorShuffle %v4int %270 %270 0 2 1 0 + OpStore %xzyx %271 + %273 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %274 = OpLoad %v3int %273 + %275 = OpVectorShuffle %v4int %274 %274 0 2 1 1 + OpStore %xzyy %275 + %277 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %278 = OpLoad %v3int %277 + %279 = OpVectorShuffle %v4int %278 %278 0 2 1 2 + OpStore %xzyz %279 + %281 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %282 = OpLoad %v3int %281 + %283 = OpVectorShuffle %v4int %282 %282 0 2 2 0 + OpStore %xzzx %283 + %285 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %286 = OpLoad %v3int %285 + %287 = OpVectorShuffle %v4int %286 %286 0 2 2 1 + OpStore %xzzy %287 + %289 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %290 = OpLoad %v3int %289 + %291 = OpVectorShuffle %v4int %290 %290 0 2 2 2 + OpStore %xzzz %291 + %293 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %294 = OpLoad %v3int %293 + %295 = OpVectorShuffle %v4int %294 %294 1 0 0 0 + OpStore %yxxx %295 + %297 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %298 = OpLoad %v3int %297 + %299 = OpVectorShuffle %v4int %298 %298 1 0 0 1 + OpStore %yxxy %299 + %301 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %302 = OpLoad %v3int %301 + %303 = OpVectorShuffle %v4int %302 %302 1 0 0 2 + OpStore %yxxz %303 + %305 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %306 = OpLoad %v3int %305 + %307 = OpVectorShuffle %v4int %306 %306 1 0 1 0 + OpStore %yxyx %307 + %309 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %310 = OpLoad %v3int %309 + %311 = OpVectorShuffle %v4int %310 %310 1 0 1 1 + OpStore %yxyy %311 + %313 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %314 = OpLoad %v3int %313 + %315 = OpVectorShuffle %v4int %314 %314 1 0 1 2 + OpStore %yxyz %315 + %317 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %318 = OpLoad %v3int %317 + %319 = OpVectorShuffle %v4int %318 %318 1 0 2 0 + OpStore %yxzx %319 + %321 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %322 = OpLoad %v3int %321 + %323 = OpVectorShuffle %v4int %322 %322 1 0 2 1 + OpStore %yxzy %323 + %325 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %326 = OpLoad %v3int %325 + %327 = OpVectorShuffle %v4int %326 %326 1 0 2 2 + OpStore %yxzz %327 + %329 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %330 = OpLoad %v3int %329 + %331 = OpVectorShuffle %v4int %330 %330 1 1 0 0 + OpStore %yyxx %331 + %333 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %334 = OpLoad %v3int %333 + %335 = OpVectorShuffle %v4int %334 %334 1 1 0 1 + OpStore %yyxy %335 + %337 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %338 = OpLoad %v3int %337 + %339 = OpVectorShuffle %v4int %338 %338 1 1 0 2 + OpStore %yyxz %339 + %341 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %342 = OpLoad %v3int %341 + %343 = OpVectorShuffle %v4int %342 %342 1 1 1 0 + OpStore %yyyx %343 + %345 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %346 = OpLoad %v3int %345 + %347 = OpVectorShuffle %v4int %346 %346 1 1 1 1 + OpStore %yyyy %347 + %349 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %350 = OpLoad %v3int %349 + %351 = OpVectorShuffle %v4int %350 %350 1 1 1 2 + OpStore %yyyz %351 + %353 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %354 = OpLoad %v3int %353 + %355 = OpVectorShuffle %v4int %354 %354 1 1 2 0 + OpStore %yyzx %355 + %357 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %358 = OpLoad %v3int %357 + %359 = OpVectorShuffle %v4int %358 %358 1 1 2 1 + OpStore %yyzy %359 + %361 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %362 = OpLoad %v3int %361 + %363 = OpVectorShuffle %v4int %362 %362 1 1 2 2 + OpStore %yyzz %363 + %365 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %366 = OpLoad %v3int %365 + %367 = OpVectorShuffle %v4int %366 %366 1 2 0 0 + OpStore %yzxx %367 + %369 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %370 = OpLoad %v3int %369 + %371 = OpVectorShuffle %v4int %370 %370 1 2 0 1 + OpStore %yzxy %371 + %373 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %374 = OpLoad %v3int %373 + %375 = OpVectorShuffle %v4int %374 %374 1 2 0 2 + OpStore %yzxz %375 + %377 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %378 = OpLoad %v3int %377 + %379 = OpVectorShuffle %v4int %378 %378 1 2 1 0 + OpStore %yzyx %379 + %381 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %382 = OpLoad %v3int %381 + %383 = OpVectorShuffle %v4int %382 %382 1 2 1 1 + OpStore %yzyy %383 + %385 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %386 = OpLoad %v3int %385 + %387 = OpVectorShuffle %v4int %386 %386 1 2 1 2 + OpStore %yzyz %387 + %389 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %390 = OpLoad %v3int %389 + %391 = OpVectorShuffle %v4int %390 %390 1 2 2 0 + OpStore %yzzx %391 + %393 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %394 = OpLoad %v3int %393 + %395 = OpVectorShuffle %v4int %394 %394 1 2 2 1 + OpStore %yzzy %395 + %397 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %398 = OpLoad %v3int %397 + %399 = OpVectorShuffle %v4int %398 %398 1 2 2 2 + OpStore %yzzz %399 + %401 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %402 = OpLoad %v3int %401 + %403 = OpVectorShuffle %v4int %402 %402 2 0 0 0 + OpStore %zxxx %403 + %405 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %406 = OpLoad %v3int %405 + %407 = OpVectorShuffle %v4int %406 %406 2 0 0 1 + OpStore %zxxy %407 + %409 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %410 = OpLoad %v3int %409 + %411 = OpVectorShuffle %v4int %410 %410 2 0 0 2 + OpStore %zxxz %411 + %413 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %414 = OpLoad %v3int %413 + %415 = OpVectorShuffle %v4int %414 %414 2 0 1 0 + OpStore %zxyx %415 + %417 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %418 = OpLoad %v3int %417 + %419 = OpVectorShuffle %v4int %418 %418 2 0 1 1 + OpStore %zxyy %419 + %421 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %422 = OpLoad %v3int %421 + %423 = OpVectorShuffle %v4int %422 %422 2 0 1 2 + OpStore %zxyz %423 + %425 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %426 = OpLoad %v3int %425 + %427 = OpVectorShuffle %v4int %426 %426 2 0 2 0 + OpStore %zxzx %427 + %429 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %430 = OpLoad %v3int %429 + %431 = OpVectorShuffle %v4int %430 %430 2 0 2 1 + OpStore %zxzy %431 + %433 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %434 = OpLoad %v3int %433 + %435 = OpVectorShuffle %v4int %434 %434 2 0 2 2 + OpStore %zxzz %435 + %437 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %438 = OpLoad %v3int %437 + %439 = OpVectorShuffle %v4int %438 %438 2 1 0 0 + OpStore %zyxx %439 + %441 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %442 = OpLoad %v3int %441 + %443 = OpVectorShuffle %v4int %442 %442 2 1 0 1 + OpStore %zyxy %443 + %445 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %446 = OpLoad %v3int %445 + %447 = OpVectorShuffle %v4int %446 %446 2 1 0 2 + OpStore %zyxz %447 + %449 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %450 = OpLoad %v3int %449 + %451 = OpVectorShuffle %v4int %450 %450 2 1 1 0 + OpStore %zyyx %451 + %453 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %454 = OpLoad %v3int %453 + %455 = OpVectorShuffle %v4int %454 %454 2 1 1 1 + OpStore %zyyy %455 + %457 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %458 = OpLoad %v3int %457 + %459 = OpVectorShuffle %v4int %458 %458 2 1 1 2 + OpStore %zyyz %459 + %461 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %462 = OpLoad %v3int %461 + %463 = OpVectorShuffle %v4int %462 %462 2 1 2 0 + OpStore %zyzx %463 + %465 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %466 = OpLoad %v3int %465 + %467 = OpVectorShuffle %v4int %466 %466 2 1 2 1 + OpStore %zyzy %467 + %469 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %470 = OpLoad %v3int %469 + %471 = OpVectorShuffle %v4int %470 %470 2 1 2 2 + OpStore %zyzz %471 + %473 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %474 = OpLoad %v3int %473 + %475 = OpVectorShuffle %v4int %474 %474 2 2 0 0 + OpStore %zzxx %475 + %477 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %478 = OpLoad %v3int %477 + %479 = OpVectorShuffle %v4int %478 %478 2 2 0 1 + OpStore %zzxy %479 + %481 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %482 = OpLoad %v3int %481 + %483 = OpVectorShuffle %v4int %482 %482 2 2 0 2 + OpStore %zzxz %483 + %485 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %486 = OpLoad %v3int %485 + %487 = OpVectorShuffle %v4int %486 %486 2 2 1 0 + OpStore %zzyx %487 + %489 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %490 = OpLoad %v3int %489 + %491 = OpVectorShuffle %v4int %490 %490 2 2 1 1 + OpStore %zzyy %491 + %493 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %494 = OpLoad %v3int %493 + %495 = OpVectorShuffle %v4int %494 %494 2 2 1 2 + OpStore %zzyz %495 + %497 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %498 = OpLoad %v3int %497 + %499 = OpVectorShuffle %v4int %498 %498 2 2 2 0 + OpStore %zzzx %499 + %501 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %502 = OpLoad %v3int %501 + %503 = OpVectorShuffle %v4int %502 %502 2 2 2 1 + OpStore %zzzy %503 + %505 = OpAccessChain %_ptr_Uniform_v3int %U %uint_0 %uint_0 + %506 = OpLoad %v3int %505 + %507 = OpVectorShuffle %v4int %506 %506 2 2 2 2 + OpStore %zzzz %507 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/swizzle/read/packed_vec3/u32.wgsl.expected.glsl b/test/tint/expressions/swizzle/read/packed_vec3/u32.wgsl.expected.glsl index 3d91f73cd1..08685f8b44 100644 --- a/test/tint/expressions/swizzle/read/packed_vec3/u32.wgsl.expected.glsl +++ b/test/tint/expressions/swizzle/read/packed_vec3/u32.wgsl.expected.glsl @@ -4,132 +4,136 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std140) uniform S_ubo { +struct S { uvec3 v; uint pad; +}; + +layout(binding = 0, std140) uniform U_block_ubo { + S inner; } U; void f() { - uvec3 v = U.v; - uint x = U.v.x; - uint y = U.v.y; - uint z = U.v.z; - uvec2 xx = U.v.xx; - uvec2 xy = U.v.xy; - uvec2 xz = U.v.xz; - uvec2 yx = U.v.yx; - uvec2 yy = U.v.yy; - uvec2 yz = U.v.yz; - uvec2 zx = U.v.zx; - uvec2 zy = U.v.zy; - uvec2 zz = U.v.zz; - uvec3 xxx = U.v.xxx; - uvec3 xxy = U.v.xxy; - uvec3 xxz = U.v.xxz; - uvec3 xyx = U.v.xyx; - uvec3 xyy = U.v.xyy; - uvec3 xyz = U.v.xyz; - uvec3 xzx = U.v.xzx; - uvec3 xzy = U.v.xzy; - uvec3 xzz = U.v.xzz; - uvec3 yxx = U.v.yxx; - uvec3 yxy = U.v.yxy; - uvec3 yxz = U.v.yxz; - uvec3 yyx = U.v.yyx; - uvec3 yyy = U.v.yyy; - uvec3 yyz = U.v.yyz; - uvec3 yzx = U.v.yzx; - uvec3 yzy = U.v.yzy; - uvec3 yzz = U.v.yzz; - uvec3 zxx = U.v.zxx; - uvec3 zxy = U.v.zxy; - uvec3 zxz = U.v.zxz; - uvec3 zyx = U.v.zyx; - uvec3 zyy = U.v.zyy; - uvec3 zyz = U.v.zyz; - uvec3 zzx = U.v.zzx; - uvec3 zzy = U.v.zzy; - uvec3 zzz = U.v.zzz; - uvec4 xxxx = U.v.xxxx; - uvec4 xxxy = U.v.xxxy; - uvec4 xxxz = U.v.xxxz; - uvec4 xxyx = U.v.xxyx; - uvec4 xxyy = U.v.xxyy; - uvec4 xxyz = U.v.xxyz; - uvec4 xxzx = U.v.xxzx; - uvec4 xxzy = U.v.xxzy; - uvec4 xxzz = U.v.xxzz; - uvec4 xyxx = U.v.xyxx; - uvec4 xyxy = U.v.xyxy; - uvec4 xyxz = U.v.xyxz; - uvec4 xyyx = U.v.xyyx; - uvec4 xyyy = U.v.xyyy; - uvec4 xyyz = U.v.xyyz; - uvec4 xyzx = U.v.xyzx; - uvec4 xyzy = U.v.xyzy; - uvec4 xyzz = U.v.xyzz; - uvec4 xzxx = U.v.xzxx; - uvec4 xzxy = U.v.xzxy; - uvec4 xzxz = U.v.xzxz; - uvec4 xzyx = U.v.xzyx; - uvec4 xzyy = U.v.xzyy; - uvec4 xzyz = U.v.xzyz; - uvec4 xzzx = U.v.xzzx; - uvec4 xzzy = U.v.xzzy; - uvec4 xzzz = U.v.xzzz; - uvec4 yxxx = U.v.yxxx; - uvec4 yxxy = U.v.yxxy; - uvec4 yxxz = U.v.yxxz; - uvec4 yxyx = U.v.yxyx; - uvec4 yxyy = U.v.yxyy; - uvec4 yxyz = U.v.yxyz; - uvec4 yxzx = U.v.yxzx; - uvec4 yxzy = U.v.yxzy; - uvec4 yxzz = U.v.yxzz; - uvec4 yyxx = U.v.yyxx; - uvec4 yyxy = U.v.yyxy; - uvec4 yyxz = U.v.yyxz; - uvec4 yyyx = U.v.yyyx; - uvec4 yyyy = U.v.yyyy; - uvec4 yyyz = U.v.yyyz; - uvec4 yyzx = U.v.yyzx; - uvec4 yyzy = U.v.yyzy; - uvec4 yyzz = U.v.yyzz; - uvec4 yzxx = U.v.yzxx; - uvec4 yzxy = U.v.yzxy; - uvec4 yzxz = U.v.yzxz; - uvec4 yzyx = U.v.yzyx; - uvec4 yzyy = U.v.yzyy; - uvec4 yzyz = U.v.yzyz; - uvec4 yzzx = U.v.yzzx; - uvec4 yzzy = U.v.yzzy; - uvec4 yzzz = U.v.yzzz; - uvec4 zxxx = U.v.zxxx; - uvec4 zxxy = U.v.zxxy; - uvec4 zxxz = U.v.zxxz; - uvec4 zxyx = U.v.zxyx; - uvec4 zxyy = U.v.zxyy; - uvec4 zxyz = U.v.zxyz; - uvec4 zxzx = U.v.zxzx; - uvec4 zxzy = U.v.zxzy; - uvec4 zxzz = U.v.zxzz; - uvec4 zyxx = U.v.zyxx; - uvec4 zyxy = U.v.zyxy; - uvec4 zyxz = U.v.zyxz; - uvec4 zyyx = U.v.zyyx; - uvec4 zyyy = U.v.zyyy; - uvec4 zyyz = U.v.zyyz; - uvec4 zyzx = U.v.zyzx; - uvec4 zyzy = U.v.zyzy; - uvec4 zyzz = U.v.zyzz; - uvec4 zzxx = U.v.zzxx; - uvec4 zzxy = U.v.zzxy; - uvec4 zzxz = U.v.zzxz; - uvec4 zzyx = U.v.zzyx; - uvec4 zzyy = U.v.zzyy; - uvec4 zzyz = U.v.zzyz; - uvec4 zzzx = U.v.zzzx; - uvec4 zzzy = U.v.zzzy; - uvec4 zzzz = U.v.zzzz; + uvec3 v = U.inner.v; + uint x = U.inner.v.x; + uint y = U.inner.v.y; + uint z = U.inner.v.z; + uvec2 xx = U.inner.v.xx; + uvec2 xy = U.inner.v.xy; + uvec2 xz = U.inner.v.xz; + uvec2 yx = U.inner.v.yx; + uvec2 yy = U.inner.v.yy; + uvec2 yz = U.inner.v.yz; + uvec2 zx = U.inner.v.zx; + uvec2 zy = U.inner.v.zy; + uvec2 zz = U.inner.v.zz; + uvec3 xxx = U.inner.v.xxx; + uvec3 xxy = U.inner.v.xxy; + uvec3 xxz = U.inner.v.xxz; + uvec3 xyx = U.inner.v.xyx; + uvec3 xyy = U.inner.v.xyy; + uvec3 xyz = U.inner.v.xyz; + uvec3 xzx = U.inner.v.xzx; + uvec3 xzy = U.inner.v.xzy; + uvec3 xzz = U.inner.v.xzz; + uvec3 yxx = U.inner.v.yxx; + uvec3 yxy = U.inner.v.yxy; + uvec3 yxz = U.inner.v.yxz; + uvec3 yyx = U.inner.v.yyx; + uvec3 yyy = U.inner.v.yyy; + uvec3 yyz = U.inner.v.yyz; + uvec3 yzx = U.inner.v.yzx; + uvec3 yzy = U.inner.v.yzy; + uvec3 yzz = U.inner.v.yzz; + uvec3 zxx = U.inner.v.zxx; + uvec3 zxy = U.inner.v.zxy; + uvec3 zxz = U.inner.v.zxz; + uvec3 zyx = U.inner.v.zyx; + uvec3 zyy = U.inner.v.zyy; + uvec3 zyz = U.inner.v.zyz; + uvec3 zzx = U.inner.v.zzx; + uvec3 zzy = U.inner.v.zzy; + uvec3 zzz = U.inner.v.zzz; + uvec4 xxxx = U.inner.v.xxxx; + uvec4 xxxy = U.inner.v.xxxy; + uvec4 xxxz = U.inner.v.xxxz; + uvec4 xxyx = U.inner.v.xxyx; + uvec4 xxyy = U.inner.v.xxyy; + uvec4 xxyz = U.inner.v.xxyz; + uvec4 xxzx = U.inner.v.xxzx; + uvec4 xxzy = U.inner.v.xxzy; + uvec4 xxzz = U.inner.v.xxzz; + uvec4 xyxx = U.inner.v.xyxx; + uvec4 xyxy = U.inner.v.xyxy; + uvec4 xyxz = U.inner.v.xyxz; + uvec4 xyyx = U.inner.v.xyyx; + uvec4 xyyy = U.inner.v.xyyy; + uvec4 xyyz = U.inner.v.xyyz; + uvec4 xyzx = U.inner.v.xyzx; + uvec4 xyzy = U.inner.v.xyzy; + uvec4 xyzz = U.inner.v.xyzz; + uvec4 xzxx = U.inner.v.xzxx; + uvec4 xzxy = U.inner.v.xzxy; + uvec4 xzxz = U.inner.v.xzxz; + uvec4 xzyx = U.inner.v.xzyx; + uvec4 xzyy = U.inner.v.xzyy; + uvec4 xzyz = U.inner.v.xzyz; + uvec4 xzzx = U.inner.v.xzzx; + uvec4 xzzy = U.inner.v.xzzy; + uvec4 xzzz = U.inner.v.xzzz; + uvec4 yxxx = U.inner.v.yxxx; + uvec4 yxxy = U.inner.v.yxxy; + uvec4 yxxz = U.inner.v.yxxz; + uvec4 yxyx = U.inner.v.yxyx; + uvec4 yxyy = U.inner.v.yxyy; + uvec4 yxyz = U.inner.v.yxyz; + uvec4 yxzx = U.inner.v.yxzx; + uvec4 yxzy = U.inner.v.yxzy; + uvec4 yxzz = U.inner.v.yxzz; + uvec4 yyxx = U.inner.v.yyxx; + uvec4 yyxy = U.inner.v.yyxy; + uvec4 yyxz = U.inner.v.yyxz; + uvec4 yyyx = U.inner.v.yyyx; + uvec4 yyyy = U.inner.v.yyyy; + uvec4 yyyz = U.inner.v.yyyz; + uvec4 yyzx = U.inner.v.yyzx; + uvec4 yyzy = U.inner.v.yyzy; + uvec4 yyzz = U.inner.v.yyzz; + uvec4 yzxx = U.inner.v.yzxx; + uvec4 yzxy = U.inner.v.yzxy; + uvec4 yzxz = U.inner.v.yzxz; + uvec4 yzyx = U.inner.v.yzyx; + uvec4 yzyy = U.inner.v.yzyy; + uvec4 yzyz = U.inner.v.yzyz; + uvec4 yzzx = U.inner.v.yzzx; + uvec4 yzzy = U.inner.v.yzzy; + uvec4 yzzz = U.inner.v.yzzz; + uvec4 zxxx = U.inner.v.zxxx; + uvec4 zxxy = U.inner.v.zxxy; + uvec4 zxxz = U.inner.v.zxxz; + uvec4 zxyx = U.inner.v.zxyx; + uvec4 zxyy = U.inner.v.zxyy; + uvec4 zxyz = U.inner.v.zxyz; + uvec4 zxzx = U.inner.v.zxzx; + uvec4 zxzy = U.inner.v.zxzy; + uvec4 zxzz = U.inner.v.zxzz; + uvec4 zyxx = U.inner.v.zyxx; + uvec4 zyxy = U.inner.v.zyxy; + uvec4 zyxz = U.inner.v.zyxz; + uvec4 zyyx = U.inner.v.zyyx; + uvec4 zyyy = U.inner.v.zyyy; + uvec4 zyyz = U.inner.v.zyyz; + uvec4 zyzx = U.inner.v.zyzx; + uvec4 zyzy = U.inner.v.zyzy; + uvec4 zyzz = U.inner.v.zyzz; + uvec4 zzxx = U.inner.v.zzxx; + uvec4 zzxy = U.inner.v.zzxy; + uvec4 zzxz = U.inner.v.zzxz; + uvec4 zzyx = U.inner.v.zzyx; + uvec4 zzyy = U.inner.v.zzyy; + uvec4 zzyz = U.inner.v.zzyz; + uvec4 zzzx = U.inner.v.zzzx; + uvec4 zzzy = U.inner.v.zzzy; + uvec4 zzzz = U.inner.v.zzzz; } diff --git a/test/tint/expressions/swizzle/read/packed_vec3/u32.wgsl.expected.spvasm b/test/tint/expressions/swizzle/read/packed_vec3/u32.wgsl.expected.spvasm index f38664db58..5abf30172c 100644 --- a/test/tint/expressions/swizzle/read/packed_vec3/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/swizzle/read/packed_vec3/u32.wgsl.expected.spvasm @@ -1,12 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 507 +; Bound: 508 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %U_block "U_block" + OpMemberName %U_block 0 "inner" OpName %S "S" OpMemberName %S 0 "v" OpName %U "U" @@ -133,7 +135,8 @@ OpName %zzzx "zzzx" OpName %zzzy "zzzy" OpName %zzzz "zzzz" - OpDecorate %S Block + OpDecorate %U_block Block + OpMemberDecorate %U_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %U NonWritable OpDecorate %U DescriptorSet 0 @@ -141,631 +144,632 @@ %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %S = OpTypeStruct %v3uint -%_ptr_Uniform_S = OpTypePointer Uniform %S - %U = OpVariable %_ptr_Uniform_S Uniform + %U_block = OpTypeStruct %S +%_ptr_Uniform_U_block = OpTypePointer Uniform %U_block + %U = OpVariable %_ptr_Uniform_U_block Uniform %void = OpTypeVoid - %6 = OpTypeFunction %void + %7 = OpTypeFunction %void %uint_0 = OpConstant %uint 0 %_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint %_ptr_Function_v3uint = OpTypePointer Function %v3uint - %18 = OpConstantNull %v3uint + %19 = OpConstantNull %v3uint %_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Function_uint = OpTypePointer Function %uint - %24 = OpConstantNull %uint + %25 = OpConstantNull %uint %uint_1 = OpConstant %uint 1 %uint_2 = OpConstant %uint 2 %v2uint = OpTypeVector %uint 2 %_ptr_Function_v2uint = OpTypePointer Function %v2uint - %39 = OpConstantNull %v2uint + %40 = OpConstantNull %v2uint %v4uint = OpTypeVector %uint 4 %_ptr_Function_v4uint = OpTypePointer Function %v4uint - %186 = OpConstantNull %v4uint -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel + %187 = OpConstantNull %v4uint +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel OpReturn OpFunctionEnd - %f = OpFunction %void None %6 - %11 = OpLabel - %v = OpVariable %_ptr_Function_v3uint Function %18 - %x = OpVariable %_ptr_Function_uint Function %24 - %y = OpVariable %_ptr_Function_uint Function %24 - %z = OpVariable %_ptr_Function_uint Function %24 - %xx = OpVariable %_ptr_Function_v2uint Function %39 - %xy = OpVariable %_ptr_Function_v2uint Function %39 - %xz = OpVariable %_ptr_Function_v2uint Function %39 - %yx = OpVariable %_ptr_Function_v2uint Function %39 - %yy = OpVariable %_ptr_Function_v2uint Function %39 - %yz = OpVariable %_ptr_Function_v2uint Function %39 - %zx = OpVariable %_ptr_Function_v2uint Function %39 - %zy = OpVariable %_ptr_Function_v2uint Function %39 - %zz = OpVariable %_ptr_Function_v2uint Function %39 - %xxx = OpVariable %_ptr_Function_v3uint Function %18 - %xxy = OpVariable %_ptr_Function_v3uint Function %18 - %xxz = OpVariable %_ptr_Function_v3uint Function %18 - %xyx = OpVariable %_ptr_Function_v3uint Function %18 - %xyy = OpVariable %_ptr_Function_v3uint Function %18 - %xyz = OpVariable %_ptr_Function_v3uint Function %18 - %xzx = OpVariable %_ptr_Function_v3uint Function %18 - %xzy = OpVariable %_ptr_Function_v3uint Function %18 - %xzz = OpVariable %_ptr_Function_v3uint Function %18 - %yxx = OpVariable %_ptr_Function_v3uint Function %18 - %yxy = OpVariable %_ptr_Function_v3uint Function %18 - %yxz = OpVariable %_ptr_Function_v3uint Function %18 - %yyx = OpVariable %_ptr_Function_v3uint Function %18 - %yyy = OpVariable %_ptr_Function_v3uint Function %18 - %yyz = OpVariable %_ptr_Function_v3uint Function %18 - %yzx = OpVariable %_ptr_Function_v3uint Function %18 - %yzy = OpVariable %_ptr_Function_v3uint Function %18 - %yzz = OpVariable %_ptr_Function_v3uint Function %18 - %zxx = OpVariable %_ptr_Function_v3uint Function %18 - %zxy = OpVariable %_ptr_Function_v3uint Function %18 - %zxz = OpVariable %_ptr_Function_v3uint Function %18 - %zyx = OpVariable %_ptr_Function_v3uint Function %18 - %zyy = OpVariable %_ptr_Function_v3uint Function %18 - %zyz = OpVariable %_ptr_Function_v3uint Function %18 - %zzx = OpVariable %_ptr_Function_v3uint Function %18 - %zzy = OpVariable %_ptr_Function_v3uint Function %18 - %zzz = OpVariable %_ptr_Function_v3uint Function %18 - %xxxx = OpVariable %_ptr_Function_v4uint Function %186 - %xxxy = OpVariable %_ptr_Function_v4uint Function %186 - %xxxz = OpVariable %_ptr_Function_v4uint Function %186 - %xxyx = OpVariable %_ptr_Function_v4uint Function %186 - %xxyy = OpVariable %_ptr_Function_v4uint Function %186 - %xxyz = OpVariable %_ptr_Function_v4uint Function %186 - %xxzx = OpVariable %_ptr_Function_v4uint Function %186 - %xxzy = OpVariable %_ptr_Function_v4uint Function %186 - %xxzz = OpVariable %_ptr_Function_v4uint Function %186 - %xyxx = OpVariable %_ptr_Function_v4uint Function %186 - %xyxy = OpVariable %_ptr_Function_v4uint Function %186 - %xyxz = OpVariable %_ptr_Function_v4uint Function %186 - %xyyx = OpVariable %_ptr_Function_v4uint Function %186 - %xyyy = OpVariable %_ptr_Function_v4uint Function %186 - %xyyz = OpVariable %_ptr_Function_v4uint Function %186 - %xyzx = OpVariable %_ptr_Function_v4uint Function %186 - %xyzy = OpVariable %_ptr_Function_v4uint Function %186 - %xyzz = OpVariable %_ptr_Function_v4uint Function %186 - %xzxx = OpVariable %_ptr_Function_v4uint Function %186 - %xzxy = OpVariable %_ptr_Function_v4uint Function %186 - %xzxz = OpVariable %_ptr_Function_v4uint Function %186 - %xzyx = OpVariable %_ptr_Function_v4uint Function %186 - %xzyy = OpVariable %_ptr_Function_v4uint Function %186 - %xzyz = OpVariable %_ptr_Function_v4uint Function %186 - %xzzx = OpVariable %_ptr_Function_v4uint Function %186 - %xzzy = OpVariable %_ptr_Function_v4uint Function %186 - %xzzz = OpVariable %_ptr_Function_v4uint Function %186 - %yxxx = OpVariable %_ptr_Function_v4uint Function %186 - %yxxy = OpVariable %_ptr_Function_v4uint Function %186 - %yxxz = OpVariable %_ptr_Function_v4uint Function %186 - %yxyx = OpVariable %_ptr_Function_v4uint Function %186 - %yxyy = OpVariable %_ptr_Function_v4uint Function %186 - %yxyz = OpVariable %_ptr_Function_v4uint Function %186 - %yxzx = OpVariable %_ptr_Function_v4uint Function %186 - %yxzy = OpVariable %_ptr_Function_v4uint Function %186 - %yxzz = OpVariable %_ptr_Function_v4uint Function %186 - %yyxx = OpVariable %_ptr_Function_v4uint Function %186 - %yyxy = OpVariable %_ptr_Function_v4uint Function %186 - %yyxz = OpVariable %_ptr_Function_v4uint Function %186 - %yyyx = OpVariable %_ptr_Function_v4uint Function %186 - %yyyy = OpVariable %_ptr_Function_v4uint Function %186 - %yyyz = OpVariable %_ptr_Function_v4uint Function %186 - %yyzx = OpVariable %_ptr_Function_v4uint Function %186 - %yyzy = OpVariable %_ptr_Function_v4uint Function %186 - %yyzz = OpVariable %_ptr_Function_v4uint Function %186 - %yzxx = OpVariable %_ptr_Function_v4uint Function %186 - %yzxy = OpVariable %_ptr_Function_v4uint Function %186 - %yzxz = OpVariable %_ptr_Function_v4uint Function %186 - %yzyx = OpVariable %_ptr_Function_v4uint Function %186 - %yzyy = OpVariable %_ptr_Function_v4uint Function %186 - %yzyz = OpVariable %_ptr_Function_v4uint Function %186 - %yzzx = OpVariable %_ptr_Function_v4uint Function %186 - %yzzy = OpVariable %_ptr_Function_v4uint Function %186 - %yzzz = OpVariable %_ptr_Function_v4uint Function %186 - %zxxx = OpVariable %_ptr_Function_v4uint Function %186 - %zxxy = OpVariable %_ptr_Function_v4uint Function %186 - %zxxz = OpVariable %_ptr_Function_v4uint Function %186 - %zxyx = OpVariable %_ptr_Function_v4uint Function %186 - %zxyy = OpVariable %_ptr_Function_v4uint Function %186 - %zxyz = OpVariable %_ptr_Function_v4uint Function %186 - %zxzx = OpVariable %_ptr_Function_v4uint Function %186 - %zxzy = OpVariable %_ptr_Function_v4uint Function %186 - %zxzz = OpVariable %_ptr_Function_v4uint Function %186 - %zyxx = OpVariable %_ptr_Function_v4uint Function %186 - %zyxy = OpVariable %_ptr_Function_v4uint Function %186 - %zyxz = OpVariable %_ptr_Function_v4uint Function %186 - %zyyx = OpVariable %_ptr_Function_v4uint Function %186 - %zyyy = OpVariable %_ptr_Function_v4uint Function %186 - %zyyz = OpVariable %_ptr_Function_v4uint Function %186 - %zyzx = OpVariable %_ptr_Function_v4uint Function %186 - %zyzy = OpVariable %_ptr_Function_v4uint Function %186 - %zyzz = OpVariable %_ptr_Function_v4uint Function %186 - %zzxx = OpVariable %_ptr_Function_v4uint Function %186 - %zzxy = OpVariable %_ptr_Function_v4uint Function %186 - %zzxz = OpVariable %_ptr_Function_v4uint Function %186 - %zzyx = OpVariable %_ptr_Function_v4uint Function %186 - %zzyy = OpVariable %_ptr_Function_v4uint Function %186 - %zzyz = OpVariable %_ptr_Function_v4uint Function %186 - %zzzx = OpVariable %_ptr_Function_v4uint Function %186 - %zzzy = OpVariable %_ptr_Function_v4uint Function %186 - %zzzz = OpVariable %_ptr_Function_v4uint Function %186 - %14 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %15 = OpLoad %v3uint %14 - OpStore %v %15 - %20 = OpAccessChain %_ptr_Uniform_uint %U %uint_0 %uint_0 - %21 = OpLoad %uint %20 - OpStore %x %21 - %26 = OpAccessChain %_ptr_Uniform_uint %U %uint_0 %uint_1 - %27 = OpLoad %uint %26 - OpStore %y %27 - %30 = OpAccessChain %_ptr_Uniform_uint %U %uint_0 %uint_2 - %31 = OpLoad %uint %30 - OpStore %z %31 - %33 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %35 = OpLoad %v3uint %33 - %36 = OpVectorShuffle %v2uint %35 %35 0 0 - OpStore %xx %36 - %40 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %41 = OpLoad %v3uint %40 - %42 = OpVectorShuffle %v2uint %41 %41 0 1 - OpStore %xy %42 - %44 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %45 = OpLoad %v3uint %44 - %46 = OpVectorShuffle %v2uint %45 %45 0 2 - OpStore %xz %46 - %48 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %49 = OpLoad %v3uint %48 - %50 = OpVectorShuffle %v2uint %49 %49 1 0 - OpStore %yx %50 - %52 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %53 = OpLoad %v3uint %52 - %54 = OpVectorShuffle %v2uint %53 %53 1 1 - OpStore %yy %54 - %56 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %57 = OpLoad %v3uint %56 - %58 = OpVectorShuffle %v2uint %57 %57 1 2 - OpStore %yz %58 - %60 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %61 = OpLoad %v3uint %60 - %62 = OpVectorShuffle %v2uint %61 %61 2 0 - OpStore %zx %62 - %64 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %65 = OpLoad %v3uint %64 - %66 = OpVectorShuffle %v2uint %65 %65 2 1 - OpStore %zy %66 - %68 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %69 = OpLoad %v3uint %68 - %70 = OpVectorShuffle %v2uint %69 %69 2 2 - OpStore %zz %70 - %72 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %73 = OpLoad %v3uint %72 - %74 = OpVectorShuffle %v3uint %73 %73 0 0 0 - OpStore %xxx %74 - %76 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %77 = OpLoad %v3uint %76 - %78 = OpVectorShuffle %v3uint %77 %77 0 0 1 - OpStore %xxy %78 - %80 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %81 = OpLoad %v3uint %80 - %82 = OpVectorShuffle %v3uint %81 %81 0 0 2 - OpStore %xxz %82 - %84 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %85 = OpLoad %v3uint %84 - %86 = OpVectorShuffle %v3uint %85 %85 0 1 0 - OpStore %xyx %86 - %88 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %89 = OpLoad %v3uint %88 - %90 = OpVectorShuffle %v3uint %89 %89 0 1 1 - OpStore %xyy %90 - %92 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %93 = OpLoad %v3uint %92 - %94 = OpVectorShuffle %v3uint %93 %93 0 1 2 - OpStore %xyz %94 - %96 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %97 = OpLoad %v3uint %96 - %98 = OpVectorShuffle %v3uint %97 %97 0 2 0 - OpStore %xzx %98 - %100 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %101 = OpLoad %v3uint %100 - %102 = OpVectorShuffle %v3uint %101 %101 0 2 1 - OpStore %xzy %102 - %104 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %105 = OpLoad %v3uint %104 - %106 = OpVectorShuffle %v3uint %105 %105 0 2 2 - OpStore %xzz %106 - %108 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %109 = OpLoad %v3uint %108 - %110 = OpVectorShuffle %v3uint %109 %109 1 0 0 - OpStore %yxx %110 - %112 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %113 = OpLoad %v3uint %112 - %114 = OpVectorShuffle %v3uint %113 %113 1 0 1 - OpStore %yxy %114 - %116 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %117 = OpLoad %v3uint %116 - %118 = OpVectorShuffle %v3uint %117 %117 1 0 2 - OpStore %yxz %118 - %120 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %121 = OpLoad %v3uint %120 - %122 = OpVectorShuffle %v3uint %121 %121 1 1 0 - OpStore %yyx %122 - %124 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %125 = OpLoad %v3uint %124 - %126 = OpVectorShuffle %v3uint %125 %125 1 1 1 - OpStore %yyy %126 - %128 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %129 = OpLoad %v3uint %128 - %130 = OpVectorShuffle %v3uint %129 %129 1 1 2 - OpStore %yyz %130 - %132 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %133 = OpLoad %v3uint %132 - %134 = OpVectorShuffle %v3uint %133 %133 1 2 0 - OpStore %yzx %134 - %136 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %137 = OpLoad %v3uint %136 - %138 = OpVectorShuffle %v3uint %137 %137 1 2 1 - OpStore %yzy %138 - %140 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %141 = OpLoad %v3uint %140 - %142 = OpVectorShuffle %v3uint %141 %141 1 2 2 - OpStore %yzz %142 - %144 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %145 = OpLoad %v3uint %144 - %146 = OpVectorShuffle %v3uint %145 %145 2 0 0 - OpStore %zxx %146 - %148 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %149 = OpLoad %v3uint %148 - %150 = OpVectorShuffle %v3uint %149 %149 2 0 1 - OpStore %zxy %150 - %152 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %153 = OpLoad %v3uint %152 - %154 = OpVectorShuffle %v3uint %153 %153 2 0 2 - OpStore %zxz %154 - %156 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %157 = OpLoad %v3uint %156 - %158 = OpVectorShuffle %v3uint %157 %157 2 1 0 - OpStore %zyx %158 - %160 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %161 = OpLoad %v3uint %160 - %162 = OpVectorShuffle %v3uint %161 %161 2 1 1 - OpStore %zyy %162 - %164 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %165 = OpLoad %v3uint %164 - %166 = OpVectorShuffle %v3uint %165 %165 2 1 2 - OpStore %zyz %166 - %168 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %169 = OpLoad %v3uint %168 - %170 = OpVectorShuffle %v3uint %169 %169 2 2 0 - OpStore %zzx %170 - %172 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %173 = OpLoad %v3uint %172 - %174 = OpVectorShuffle %v3uint %173 %173 2 2 1 - OpStore %zzy %174 - %176 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %177 = OpLoad %v3uint %176 - %178 = OpVectorShuffle %v3uint %177 %177 2 2 2 - OpStore %zzz %178 - %180 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %182 = OpLoad %v3uint %180 - %183 = OpVectorShuffle %v4uint %182 %182 0 0 0 0 - OpStore %xxxx %183 - %187 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %188 = OpLoad %v3uint %187 - %189 = OpVectorShuffle %v4uint %188 %188 0 0 0 1 - OpStore %xxxy %189 - %191 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %192 = OpLoad %v3uint %191 - %193 = OpVectorShuffle %v4uint %192 %192 0 0 0 2 - OpStore %xxxz %193 - %195 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %196 = OpLoad %v3uint %195 - %197 = OpVectorShuffle %v4uint %196 %196 0 0 1 0 - OpStore %xxyx %197 - %199 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %200 = OpLoad %v3uint %199 - %201 = OpVectorShuffle %v4uint %200 %200 0 0 1 1 - OpStore %xxyy %201 - %203 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %204 = OpLoad %v3uint %203 - %205 = OpVectorShuffle %v4uint %204 %204 0 0 1 2 - OpStore %xxyz %205 - %207 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %208 = OpLoad %v3uint %207 - %209 = OpVectorShuffle %v4uint %208 %208 0 0 2 0 - OpStore %xxzx %209 - %211 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %212 = OpLoad %v3uint %211 - %213 = OpVectorShuffle %v4uint %212 %212 0 0 2 1 - OpStore %xxzy %213 - %215 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %216 = OpLoad %v3uint %215 - %217 = OpVectorShuffle %v4uint %216 %216 0 0 2 2 - OpStore %xxzz %217 - %219 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %220 = OpLoad %v3uint %219 - %221 = OpVectorShuffle %v4uint %220 %220 0 1 0 0 - OpStore %xyxx %221 - %223 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %224 = OpLoad %v3uint %223 - %225 = OpVectorShuffle %v4uint %224 %224 0 1 0 1 - OpStore %xyxy %225 - %227 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %228 = OpLoad %v3uint %227 - %229 = OpVectorShuffle %v4uint %228 %228 0 1 0 2 - OpStore %xyxz %229 - %231 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %232 = OpLoad %v3uint %231 - %233 = OpVectorShuffle %v4uint %232 %232 0 1 1 0 - OpStore %xyyx %233 - %235 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %236 = OpLoad %v3uint %235 - %237 = OpVectorShuffle %v4uint %236 %236 0 1 1 1 - OpStore %xyyy %237 - %239 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %240 = OpLoad %v3uint %239 - %241 = OpVectorShuffle %v4uint %240 %240 0 1 1 2 - OpStore %xyyz %241 - %243 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %244 = OpLoad %v3uint %243 - %245 = OpVectorShuffle %v4uint %244 %244 0 1 2 0 - OpStore %xyzx %245 - %247 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %248 = OpLoad %v3uint %247 - %249 = OpVectorShuffle %v4uint %248 %248 0 1 2 1 - OpStore %xyzy %249 - %251 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %252 = OpLoad %v3uint %251 - %253 = OpVectorShuffle %v4uint %252 %252 0 1 2 2 - OpStore %xyzz %253 - %255 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %256 = OpLoad %v3uint %255 - %257 = OpVectorShuffle %v4uint %256 %256 0 2 0 0 - OpStore %xzxx %257 - %259 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %260 = OpLoad %v3uint %259 - %261 = OpVectorShuffle %v4uint %260 %260 0 2 0 1 - OpStore %xzxy %261 - %263 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %264 = OpLoad %v3uint %263 - %265 = OpVectorShuffle %v4uint %264 %264 0 2 0 2 - OpStore %xzxz %265 - %267 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %268 = OpLoad %v3uint %267 - %269 = OpVectorShuffle %v4uint %268 %268 0 2 1 0 - OpStore %xzyx %269 - %271 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %272 = OpLoad %v3uint %271 - %273 = OpVectorShuffle %v4uint %272 %272 0 2 1 1 - OpStore %xzyy %273 - %275 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %276 = OpLoad %v3uint %275 - %277 = OpVectorShuffle %v4uint %276 %276 0 2 1 2 - OpStore %xzyz %277 - %279 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %280 = OpLoad %v3uint %279 - %281 = OpVectorShuffle %v4uint %280 %280 0 2 2 0 - OpStore %xzzx %281 - %283 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %284 = OpLoad %v3uint %283 - %285 = OpVectorShuffle %v4uint %284 %284 0 2 2 1 - OpStore %xzzy %285 - %287 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %288 = OpLoad %v3uint %287 - %289 = OpVectorShuffle %v4uint %288 %288 0 2 2 2 - OpStore %xzzz %289 - %291 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %292 = OpLoad %v3uint %291 - %293 = OpVectorShuffle %v4uint %292 %292 1 0 0 0 - OpStore %yxxx %293 - %295 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %296 = OpLoad %v3uint %295 - %297 = OpVectorShuffle %v4uint %296 %296 1 0 0 1 - OpStore %yxxy %297 - %299 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %300 = OpLoad %v3uint %299 - %301 = OpVectorShuffle %v4uint %300 %300 1 0 0 2 - OpStore %yxxz %301 - %303 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %304 = OpLoad %v3uint %303 - %305 = OpVectorShuffle %v4uint %304 %304 1 0 1 0 - OpStore %yxyx %305 - %307 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %308 = OpLoad %v3uint %307 - %309 = OpVectorShuffle %v4uint %308 %308 1 0 1 1 - OpStore %yxyy %309 - %311 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %312 = OpLoad %v3uint %311 - %313 = OpVectorShuffle %v4uint %312 %312 1 0 1 2 - OpStore %yxyz %313 - %315 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %316 = OpLoad %v3uint %315 - %317 = OpVectorShuffle %v4uint %316 %316 1 0 2 0 - OpStore %yxzx %317 - %319 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %320 = OpLoad %v3uint %319 - %321 = OpVectorShuffle %v4uint %320 %320 1 0 2 1 - OpStore %yxzy %321 - %323 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %324 = OpLoad %v3uint %323 - %325 = OpVectorShuffle %v4uint %324 %324 1 0 2 2 - OpStore %yxzz %325 - %327 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %328 = OpLoad %v3uint %327 - %329 = OpVectorShuffle %v4uint %328 %328 1 1 0 0 - OpStore %yyxx %329 - %331 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %332 = OpLoad %v3uint %331 - %333 = OpVectorShuffle %v4uint %332 %332 1 1 0 1 - OpStore %yyxy %333 - %335 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %336 = OpLoad %v3uint %335 - %337 = OpVectorShuffle %v4uint %336 %336 1 1 0 2 - OpStore %yyxz %337 - %339 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %340 = OpLoad %v3uint %339 - %341 = OpVectorShuffle %v4uint %340 %340 1 1 1 0 - OpStore %yyyx %341 - %343 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %344 = OpLoad %v3uint %343 - %345 = OpVectorShuffle %v4uint %344 %344 1 1 1 1 - OpStore %yyyy %345 - %347 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %348 = OpLoad %v3uint %347 - %349 = OpVectorShuffle %v4uint %348 %348 1 1 1 2 - OpStore %yyyz %349 - %351 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %352 = OpLoad %v3uint %351 - %353 = OpVectorShuffle %v4uint %352 %352 1 1 2 0 - OpStore %yyzx %353 - %355 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %356 = OpLoad %v3uint %355 - %357 = OpVectorShuffle %v4uint %356 %356 1 1 2 1 - OpStore %yyzy %357 - %359 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %360 = OpLoad %v3uint %359 - %361 = OpVectorShuffle %v4uint %360 %360 1 1 2 2 - OpStore %yyzz %361 - %363 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %364 = OpLoad %v3uint %363 - %365 = OpVectorShuffle %v4uint %364 %364 1 2 0 0 - OpStore %yzxx %365 - %367 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %368 = OpLoad %v3uint %367 - %369 = OpVectorShuffle %v4uint %368 %368 1 2 0 1 - OpStore %yzxy %369 - %371 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %372 = OpLoad %v3uint %371 - %373 = OpVectorShuffle %v4uint %372 %372 1 2 0 2 - OpStore %yzxz %373 - %375 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %376 = OpLoad %v3uint %375 - %377 = OpVectorShuffle %v4uint %376 %376 1 2 1 0 - OpStore %yzyx %377 - %379 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %380 = OpLoad %v3uint %379 - %381 = OpVectorShuffle %v4uint %380 %380 1 2 1 1 - OpStore %yzyy %381 - %383 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %384 = OpLoad %v3uint %383 - %385 = OpVectorShuffle %v4uint %384 %384 1 2 1 2 - OpStore %yzyz %385 - %387 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %388 = OpLoad %v3uint %387 - %389 = OpVectorShuffle %v4uint %388 %388 1 2 2 0 - OpStore %yzzx %389 - %391 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %392 = OpLoad %v3uint %391 - %393 = OpVectorShuffle %v4uint %392 %392 1 2 2 1 - OpStore %yzzy %393 - %395 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %396 = OpLoad %v3uint %395 - %397 = OpVectorShuffle %v4uint %396 %396 1 2 2 2 - OpStore %yzzz %397 - %399 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %400 = OpLoad %v3uint %399 - %401 = OpVectorShuffle %v4uint %400 %400 2 0 0 0 - OpStore %zxxx %401 - %403 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %404 = OpLoad %v3uint %403 - %405 = OpVectorShuffle %v4uint %404 %404 2 0 0 1 - OpStore %zxxy %405 - %407 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %408 = OpLoad %v3uint %407 - %409 = OpVectorShuffle %v4uint %408 %408 2 0 0 2 - OpStore %zxxz %409 - %411 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %412 = OpLoad %v3uint %411 - %413 = OpVectorShuffle %v4uint %412 %412 2 0 1 0 - OpStore %zxyx %413 - %415 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %416 = OpLoad %v3uint %415 - %417 = OpVectorShuffle %v4uint %416 %416 2 0 1 1 - OpStore %zxyy %417 - %419 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %420 = OpLoad %v3uint %419 - %421 = OpVectorShuffle %v4uint %420 %420 2 0 1 2 - OpStore %zxyz %421 - %423 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %424 = OpLoad %v3uint %423 - %425 = OpVectorShuffle %v4uint %424 %424 2 0 2 0 - OpStore %zxzx %425 - %427 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %428 = OpLoad %v3uint %427 - %429 = OpVectorShuffle %v4uint %428 %428 2 0 2 1 - OpStore %zxzy %429 - %431 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %432 = OpLoad %v3uint %431 - %433 = OpVectorShuffle %v4uint %432 %432 2 0 2 2 - OpStore %zxzz %433 - %435 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %436 = OpLoad %v3uint %435 - %437 = OpVectorShuffle %v4uint %436 %436 2 1 0 0 - OpStore %zyxx %437 - %439 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %440 = OpLoad %v3uint %439 - %441 = OpVectorShuffle %v4uint %440 %440 2 1 0 1 - OpStore %zyxy %441 - %443 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %444 = OpLoad %v3uint %443 - %445 = OpVectorShuffle %v4uint %444 %444 2 1 0 2 - OpStore %zyxz %445 - %447 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %448 = OpLoad %v3uint %447 - %449 = OpVectorShuffle %v4uint %448 %448 2 1 1 0 - OpStore %zyyx %449 - %451 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %452 = OpLoad %v3uint %451 - %453 = OpVectorShuffle %v4uint %452 %452 2 1 1 1 - OpStore %zyyy %453 - %455 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %456 = OpLoad %v3uint %455 - %457 = OpVectorShuffle %v4uint %456 %456 2 1 1 2 - OpStore %zyyz %457 - %459 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %460 = OpLoad %v3uint %459 - %461 = OpVectorShuffle %v4uint %460 %460 2 1 2 0 - OpStore %zyzx %461 - %463 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %464 = OpLoad %v3uint %463 - %465 = OpVectorShuffle %v4uint %464 %464 2 1 2 1 - OpStore %zyzy %465 - %467 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %468 = OpLoad %v3uint %467 - %469 = OpVectorShuffle %v4uint %468 %468 2 1 2 2 - OpStore %zyzz %469 - %471 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %472 = OpLoad %v3uint %471 - %473 = OpVectorShuffle %v4uint %472 %472 2 2 0 0 - OpStore %zzxx %473 - %475 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %476 = OpLoad %v3uint %475 - %477 = OpVectorShuffle %v4uint %476 %476 2 2 0 1 - OpStore %zzxy %477 - %479 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %480 = OpLoad %v3uint %479 - %481 = OpVectorShuffle %v4uint %480 %480 2 2 0 2 - OpStore %zzxz %481 - %483 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %484 = OpLoad %v3uint %483 - %485 = OpVectorShuffle %v4uint %484 %484 2 2 1 0 - OpStore %zzyx %485 - %487 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %488 = OpLoad %v3uint %487 - %489 = OpVectorShuffle %v4uint %488 %488 2 2 1 1 - OpStore %zzyy %489 - %491 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %492 = OpLoad %v3uint %491 - %493 = OpVectorShuffle %v4uint %492 %492 2 2 1 2 - OpStore %zzyz %493 - %495 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %496 = OpLoad %v3uint %495 - %497 = OpVectorShuffle %v4uint %496 %496 2 2 2 0 - OpStore %zzzx %497 - %499 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %500 = OpLoad %v3uint %499 - %501 = OpVectorShuffle %v4uint %500 %500 2 2 2 1 - OpStore %zzzy %501 - %503 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 - %504 = OpLoad %v3uint %503 - %505 = OpVectorShuffle %v4uint %504 %504 2 2 2 2 - OpStore %zzzz %505 + %f = OpFunction %void None %7 + %12 = OpLabel + %v = OpVariable %_ptr_Function_v3uint Function %19 + %x = OpVariable %_ptr_Function_uint Function %25 + %y = OpVariable %_ptr_Function_uint Function %25 + %z = OpVariable %_ptr_Function_uint Function %25 + %xx = OpVariable %_ptr_Function_v2uint Function %40 + %xy = OpVariable %_ptr_Function_v2uint Function %40 + %xz = OpVariable %_ptr_Function_v2uint Function %40 + %yx = OpVariable %_ptr_Function_v2uint Function %40 + %yy = OpVariable %_ptr_Function_v2uint Function %40 + %yz = OpVariable %_ptr_Function_v2uint Function %40 + %zx = OpVariable %_ptr_Function_v2uint Function %40 + %zy = OpVariable %_ptr_Function_v2uint Function %40 + %zz = OpVariable %_ptr_Function_v2uint Function %40 + %xxx = OpVariable %_ptr_Function_v3uint Function %19 + %xxy = OpVariable %_ptr_Function_v3uint Function %19 + %xxz = OpVariable %_ptr_Function_v3uint Function %19 + %xyx = OpVariable %_ptr_Function_v3uint Function %19 + %xyy = OpVariable %_ptr_Function_v3uint Function %19 + %xyz = OpVariable %_ptr_Function_v3uint Function %19 + %xzx = OpVariable %_ptr_Function_v3uint Function %19 + %xzy = OpVariable %_ptr_Function_v3uint Function %19 + %xzz = OpVariable %_ptr_Function_v3uint Function %19 + %yxx = OpVariable %_ptr_Function_v3uint Function %19 + %yxy = OpVariable %_ptr_Function_v3uint Function %19 + %yxz = OpVariable %_ptr_Function_v3uint Function %19 + %yyx = OpVariable %_ptr_Function_v3uint Function %19 + %yyy = OpVariable %_ptr_Function_v3uint Function %19 + %yyz = OpVariable %_ptr_Function_v3uint Function %19 + %yzx = OpVariable %_ptr_Function_v3uint Function %19 + %yzy = OpVariable %_ptr_Function_v3uint Function %19 + %yzz = OpVariable %_ptr_Function_v3uint Function %19 + %zxx = OpVariable %_ptr_Function_v3uint Function %19 + %zxy = OpVariable %_ptr_Function_v3uint Function %19 + %zxz = OpVariable %_ptr_Function_v3uint Function %19 + %zyx = OpVariable %_ptr_Function_v3uint Function %19 + %zyy = OpVariable %_ptr_Function_v3uint Function %19 + %zyz = OpVariable %_ptr_Function_v3uint Function %19 + %zzx = OpVariable %_ptr_Function_v3uint Function %19 + %zzy = OpVariable %_ptr_Function_v3uint Function %19 + %zzz = OpVariable %_ptr_Function_v3uint Function %19 + %xxxx = OpVariable %_ptr_Function_v4uint Function %187 + %xxxy = OpVariable %_ptr_Function_v4uint Function %187 + %xxxz = OpVariable %_ptr_Function_v4uint Function %187 + %xxyx = OpVariable %_ptr_Function_v4uint Function %187 + %xxyy = OpVariable %_ptr_Function_v4uint Function %187 + %xxyz = OpVariable %_ptr_Function_v4uint Function %187 + %xxzx = OpVariable %_ptr_Function_v4uint Function %187 + %xxzy = OpVariable %_ptr_Function_v4uint Function %187 + %xxzz = OpVariable %_ptr_Function_v4uint Function %187 + %xyxx = OpVariable %_ptr_Function_v4uint Function %187 + %xyxy = OpVariable %_ptr_Function_v4uint Function %187 + %xyxz = OpVariable %_ptr_Function_v4uint Function %187 + %xyyx = OpVariable %_ptr_Function_v4uint Function %187 + %xyyy = OpVariable %_ptr_Function_v4uint Function %187 + %xyyz = OpVariable %_ptr_Function_v4uint Function %187 + %xyzx = OpVariable %_ptr_Function_v4uint Function %187 + %xyzy = OpVariable %_ptr_Function_v4uint Function %187 + %xyzz = OpVariable %_ptr_Function_v4uint Function %187 + %xzxx = OpVariable %_ptr_Function_v4uint Function %187 + %xzxy = OpVariable %_ptr_Function_v4uint Function %187 + %xzxz = OpVariable %_ptr_Function_v4uint Function %187 + %xzyx = OpVariable %_ptr_Function_v4uint Function %187 + %xzyy = OpVariable %_ptr_Function_v4uint Function %187 + %xzyz = OpVariable %_ptr_Function_v4uint Function %187 + %xzzx = OpVariable %_ptr_Function_v4uint Function %187 + %xzzy = OpVariable %_ptr_Function_v4uint Function %187 + %xzzz = OpVariable %_ptr_Function_v4uint Function %187 + %yxxx = OpVariable %_ptr_Function_v4uint Function %187 + %yxxy = OpVariable %_ptr_Function_v4uint Function %187 + %yxxz = OpVariable %_ptr_Function_v4uint Function %187 + %yxyx = OpVariable %_ptr_Function_v4uint Function %187 + %yxyy = OpVariable %_ptr_Function_v4uint Function %187 + %yxyz = OpVariable %_ptr_Function_v4uint Function %187 + %yxzx = OpVariable %_ptr_Function_v4uint Function %187 + %yxzy = OpVariable %_ptr_Function_v4uint Function %187 + %yxzz = OpVariable %_ptr_Function_v4uint Function %187 + %yyxx = OpVariable %_ptr_Function_v4uint Function %187 + %yyxy = OpVariable %_ptr_Function_v4uint Function %187 + %yyxz = OpVariable %_ptr_Function_v4uint Function %187 + %yyyx = OpVariable %_ptr_Function_v4uint Function %187 + %yyyy = OpVariable %_ptr_Function_v4uint Function %187 + %yyyz = OpVariable %_ptr_Function_v4uint Function %187 + %yyzx = OpVariable %_ptr_Function_v4uint Function %187 + %yyzy = OpVariable %_ptr_Function_v4uint Function %187 + %yyzz = OpVariable %_ptr_Function_v4uint Function %187 + %yzxx = OpVariable %_ptr_Function_v4uint Function %187 + %yzxy = OpVariable %_ptr_Function_v4uint Function %187 + %yzxz = OpVariable %_ptr_Function_v4uint Function %187 + %yzyx = OpVariable %_ptr_Function_v4uint Function %187 + %yzyy = OpVariable %_ptr_Function_v4uint Function %187 + %yzyz = OpVariable %_ptr_Function_v4uint Function %187 + %yzzx = OpVariable %_ptr_Function_v4uint Function %187 + %yzzy = OpVariable %_ptr_Function_v4uint Function %187 + %yzzz = OpVariable %_ptr_Function_v4uint Function %187 + %zxxx = OpVariable %_ptr_Function_v4uint Function %187 + %zxxy = OpVariable %_ptr_Function_v4uint Function %187 + %zxxz = OpVariable %_ptr_Function_v4uint Function %187 + %zxyx = OpVariable %_ptr_Function_v4uint Function %187 + %zxyy = OpVariable %_ptr_Function_v4uint Function %187 + %zxyz = OpVariable %_ptr_Function_v4uint Function %187 + %zxzx = OpVariable %_ptr_Function_v4uint Function %187 + %zxzy = OpVariable %_ptr_Function_v4uint Function %187 + %zxzz = OpVariable %_ptr_Function_v4uint Function %187 + %zyxx = OpVariable %_ptr_Function_v4uint Function %187 + %zyxy = OpVariable %_ptr_Function_v4uint Function %187 + %zyxz = OpVariable %_ptr_Function_v4uint Function %187 + %zyyx = OpVariable %_ptr_Function_v4uint Function %187 + %zyyy = OpVariable %_ptr_Function_v4uint Function %187 + %zyyz = OpVariable %_ptr_Function_v4uint Function %187 + %zyzx = OpVariable %_ptr_Function_v4uint Function %187 + %zyzy = OpVariable %_ptr_Function_v4uint Function %187 + %zyzz = OpVariable %_ptr_Function_v4uint Function %187 + %zzxx = OpVariable %_ptr_Function_v4uint Function %187 + %zzxy = OpVariable %_ptr_Function_v4uint Function %187 + %zzxz = OpVariable %_ptr_Function_v4uint Function %187 + %zzyx = OpVariable %_ptr_Function_v4uint Function %187 + %zzyy = OpVariable %_ptr_Function_v4uint Function %187 + %zzyz = OpVariable %_ptr_Function_v4uint Function %187 + %zzzx = OpVariable %_ptr_Function_v4uint Function %187 + %zzzy = OpVariable %_ptr_Function_v4uint Function %187 + %zzzz = OpVariable %_ptr_Function_v4uint Function %187 + %15 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %16 = OpLoad %v3uint %15 + OpStore %v %16 + %21 = OpAccessChain %_ptr_Uniform_uint %U %uint_0 %uint_0 %uint_0 + %22 = OpLoad %uint %21 + OpStore %x %22 + %27 = OpAccessChain %_ptr_Uniform_uint %U %uint_0 %uint_0 %uint_1 + %28 = OpLoad %uint %27 + OpStore %y %28 + %31 = OpAccessChain %_ptr_Uniform_uint %U %uint_0 %uint_0 %uint_2 + %32 = OpLoad %uint %31 + OpStore %z %32 + %34 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %36 = OpLoad %v3uint %34 + %37 = OpVectorShuffle %v2uint %36 %36 0 0 + OpStore %xx %37 + %41 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %42 = OpLoad %v3uint %41 + %43 = OpVectorShuffle %v2uint %42 %42 0 1 + OpStore %xy %43 + %45 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %46 = OpLoad %v3uint %45 + %47 = OpVectorShuffle %v2uint %46 %46 0 2 + OpStore %xz %47 + %49 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %50 = OpLoad %v3uint %49 + %51 = OpVectorShuffle %v2uint %50 %50 1 0 + OpStore %yx %51 + %53 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %54 = OpLoad %v3uint %53 + %55 = OpVectorShuffle %v2uint %54 %54 1 1 + OpStore %yy %55 + %57 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %58 = OpLoad %v3uint %57 + %59 = OpVectorShuffle %v2uint %58 %58 1 2 + OpStore %yz %59 + %61 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %62 = OpLoad %v3uint %61 + %63 = OpVectorShuffle %v2uint %62 %62 2 0 + OpStore %zx %63 + %65 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %66 = OpLoad %v3uint %65 + %67 = OpVectorShuffle %v2uint %66 %66 2 1 + OpStore %zy %67 + %69 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %70 = OpLoad %v3uint %69 + %71 = OpVectorShuffle %v2uint %70 %70 2 2 + OpStore %zz %71 + %73 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %74 = OpLoad %v3uint %73 + %75 = OpVectorShuffle %v3uint %74 %74 0 0 0 + OpStore %xxx %75 + %77 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %78 = OpLoad %v3uint %77 + %79 = OpVectorShuffle %v3uint %78 %78 0 0 1 + OpStore %xxy %79 + %81 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %82 = OpLoad %v3uint %81 + %83 = OpVectorShuffle %v3uint %82 %82 0 0 2 + OpStore %xxz %83 + %85 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %86 = OpLoad %v3uint %85 + %87 = OpVectorShuffle %v3uint %86 %86 0 1 0 + OpStore %xyx %87 + %89 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %90 = OpLoad %v3uint %89 + %91 = OpVectorShuffle %v3uint %90 %90 0 1 1 + OpStore %xyy %91 + %93 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %94 = OpLoad %v3uint %93 + %95 = OpVectorShuffle %v3uint %94 %94 0 1 2 + OpStore %xyz %95 + %97 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %98 = OpLoad %v3uint %97 + %99 = OpVectorShuffle %v3uint %98 %98 0 2 0 + OpStore %xzx %99 + %101 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %102 = OpLoad %v3uint %101 + %103 = OpVectorShuffle %v3uint %102 %102 0 2 1 + OpStore %xzy %103 + %105 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %106 = OpLoad %v3uint %105 + %107 = OpVectorShuffle %v3uint %106 %106 0 2 2 + OpStore %xzz %107 + %109 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %110 = OpLoad %v3uint %109 + %111 = OpVectorShuffle %v3uint %110 %110 1 0 0 + OpStore %yxx %111 + %113 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %114 = OpLoad %v3uint %113 + %115 = OpVectorShuffle %v3uint %114 %114 1 0 1 + OpStore %yxy %115 + %117 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %118 = OpLoad %v3uint %117 + %119 = OpVectorShuffle %v3uint %118 %118 1 0 2 + OpStore %yxz %119 + %121 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %122 = OpLoad %v3uint %121 + %123 = OpVectorShuffle %v3uint %122 %122 1 1 0 + OpStore %yyx %123 + %125 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %126 = OpLoad %v3uint %125 + %127 = OpVectorShuffle %v3uint %126 %126 1 1 1 + OpStore %yyy %127 + %129 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %130 = OpLoad %v3uint %129 + %131 = OpVectorShuffle %v3uint %130 %130 1 1 2 + OpStore %yyz %131 + %133 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %134 = OpLoad %v3uint %133 + %135 = OpVectorShuffle %v3uint %134 %134 1 2 0 + OpStore %yzx %135 + %137 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %138 = OpLoad %v3uint %137 + %139 = OpVectorShuffle %v3uint %138 %138 1 2 1 + OpStore %yzy %139 + %141 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %142 = OpLoad %v3uint %141 + %143 = OpVectorShuffle %v3uint %142 %142 1 2 2 + OpStore %yzz %143 + %145 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %146 = OpLoad %v3uint %145 + %147 = OpVectorShuffle %v3uint %146 %146 2 0 0 + OpStore %zxx %147 + %149 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %150 = OpLoad %v3uint %149 + %151 = OpVectorShuffle %v3uint %150 %150 2 0 1 + OpStore %zxy %151 + %153 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %154 = OpLoad %v3uint %153 + %155 = OpVectorShuffle %v3uint %154 %154 2 0 2 + OpStore %zxz %155 + %157 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %158 = OpLoad %v3uint %157 + %159 = OpVectorShuffle %v3uint %158 %158 2 1 0 + OpStore %zyx %159 + %161 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %162 = OpLoad %v3uint %161 + %163 = OpVectorShuffle %v3uint %162 %162 2 1 1 + OpStore %zyy %163 + %165 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %166 = OpLoad %v3uint %165 + %167 = OpVectorShuffle %v3uint %166 %166 2 1 2 + OpStore %zyz %167 + %169 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %170 = OpLoad %v3uint %169 + %171 = OpVectorShuffle %v3uint %170 %170 2 2 0 + OpStore %zzx %171 + %173 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %174 = OpLoad %v3uint %173 + %175 = OpVectorShuffle %v3uint %174 %174 2 2 1 + OpStore %zzy %175 + %177 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %178 = OpLoad %v3uint %177 + %179 = OpVectorShuffle %v3uint %178 %178 2 2 2 + OpStore %zzz %179 + %181 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %183 = OpLoad %v3uint %181 + %184 = OpVectorShuffle %v4uint %183 %183 0 0 0 0 + OpStore %xxxx %184 + %188 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %189 = OpLoad %v3uint %188 + %190 = OpVectorShuffle %v4uint %189 %189 0 0 0 1 + OpStore %xxxy %190 + %192 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %193 = OpLoad %v3uint %192 + %194 = OpVectorShuffle %v4uint %193 %193 0 0 0 2 + OpStore %xxxz %194 + %196 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %197 = OpLoad %v3uint %196 + %198 = OpVectorShuffle %v4uint %197 %197 0 0 1 0 + OpStore %xxyx %198 + %200 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %201 = OpLoad %v3uint %200 + %202 = OpVectorShuffle %v4uint %201 %201 0 0 1 1 + OpStore %xxyy %202 + %204 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %205 = OpLoad %v3uint %204 + %206 = OpVectorShuffle %v4uint %205 %205 0 0 1 2 + OpStore %xxyz %206 + %208 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %209 = OpLoad %v3uint %208 + %210 = OpVectorShuffle %v4uint %209 %209 0 0 2 0 + OpStore %xxzx %210 + %212 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %213 = OpLoad %v3uint %212 + %214 = OpVectorShuffle %v4uint %213 %213 0 0 2 1 + OpStore %xxzy %214 + %216 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %217 = OpLoad %v3uint %216 + %218 = OpVectorShuffle %v4uint %217 %217 0 0 2 2 + OpStore %xxzz %218 + %220 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %221 = OpLoad %v3uint %220 + %222 = OpVectorShuffle %v4uint %221 %221 0 1 0 0 + OpStore %xyxx %222 + %224 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %225 = OpLoad %v3uint %224 + %226 = OpVectorShuffle %v4uint %225 %225 0 1 0 1 + OpStore %xyxy %226 + %228 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %229 = OpLoad %v3uint %228 + %230 = OpVectorShuffle %v4uint %229 %229 0 1 0 2 + OpStore %xyxz %230 + %232 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %233 = OpLoad %v3uint %232 + %234 = OpVectorShuffle %v4uint %233 %233 0 1 1 0 + OpStore %xyyx %234 + %236 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %237 = OpLoad %v3uint %236 + %238 = OpVectorShuffle %v4uint %237 %237 0 1 1 1 + OpStore %xyyy %238 + %240 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %241 = OpLoad %v3uint %240 + %242 = OpVectorShuffle %v4uint %241 %241 0 1 1 2 + OpStore %xyyz %242 + %244 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %245 = OpLoad %v3uint %244 + %246 = OpVectorShuffle %v4uint %245 %245 0 1 2 0 + OpStore %xyzx %246 + %248 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %249 = OpLoad %v3uint %248 + %250 = OpVectorShuffle %v4uint %249 %249 0 1 2 1 + OpStore %xyzy %250 + %252 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %253 = OpLoad %v3uint %252 + %254 = OpVectorShuffle %v4uint %253 %253 0 1 2 2 + OpStore %xyzz %254 + %256 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %257 = OpLoad %v3uint %256 + %258 = OpVectorShuffle %v4uint %257 %257 0 2 0 0 + OpStore %xzxx %258 + %260 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %261 = OpLoad %v3uint %260 + %262 = OpVectorShuffle %v4uint %261 %261 0 2 0 1 + OpStore %xzxy %262 + %264 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %265 = OpLoad %v3uint %264 + %266 = OpVectorShuffle %v4uint %265 %265 0 2 0 2 + OpStore %xzxz %266 + %268 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %269 = OpLoad %v3uint %268 + %270 = OpVectorShuffle %v4uint %269 %269 0 2 1 0 + OpStore %xzyx %270 + %272 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %273 = OpLoad %v3uint %272 + %274 = OpVectorShuffle %v4uint %273 %273 0 2 1 1 + OpStore %xzyy %274 + %276 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %277 = OpLoad %v3uint %276 + %278 = OpVectorShuffle %v4uint %277 %277 0 2 1 2 + OpStore %xzyz %278 + %280 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %281 = OpLoad %v3uint %280 + %282 = OpVectorShuffle %v4uint %281 %281 0 2 2 0 + OpStore %xzzx %282 + %284 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %285 = OpLoad %v3uint %284 + %286 = OpVectorShuffle %v4uint %285 %285 0 2 2 1 + OpStore %xzzy %286 + %288 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %289 = OpLoad %v3uint %288 + %290 = OpVectorShuffle %v4uint %289 %289 0 2 2 2 + OpStore %xzzz %290 + %292 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %293 = OpLoad %v3uint %292 + %294 = OpVectorShuffle %v4uint %293 %293 1 0 0 0 + OpStore %yxxx %294 + %296 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %297 = OpLoad %v3uint %296 + %298 = OpVectorShuffle %v4uint %297 %297 1 0 0 1 + OpStore %yxxy %298 + %300 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %301 = OpLoad %v3uint %300 + %302 = OpVectorShuffle %v4uint %301 %301 1 0 0 2 + OpStore %yxxz %302 + %304 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %305 = OpLoad %v3uint %304 + %306 = OpVectorShuffle %v4uint %305 %305 1 0 1 0 + OpStore %yxyx %306 + %308 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %309 = OpLoad %v3uint %308 + %310 = OpVectorShuffle %v4uint %309 %309 1 0 1 1 + OpStore %yxyy %310 + %312 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %313 = OpLoad %v3uint %312 + %314 = OpVectorShuffle %v4uint %313 %313 1 0 1 2 + OpStore %yxyz %314 + %316 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %317 = OpLoad %v3uint %316 + %318 = OpVectorShuffle %v4uint %317 %317 1 0 2 0 + OpStore %yxzx %318 + %320 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %321 = OpLoad %v3uint %320 + %322 = OpVectorShuffle %v4uint %321 %321 1 0 2 1 + OpStore %yxzy %322 + %324 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %325 = OpLoad %v3uint %324 + %326 = OpVectorShuffle %v4uint %325 %325 1 0 2 2 + OpStore %yxzz %326 + %328 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %329 = OpLoad %v3uint %328 + %330 = OpVectorShuffle %v4uint %329 %329 1 1 0 0 + OpStore %yyxx %330 + %332 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %333 = OpLoad %v3uint %332 + %334 = OpVectorShuffle %v4uint %333 %333 1 1 0 1 + OpStore %yyxy %334 + %336 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %337 = OpLoad %v3uint %336 + %338 = OpVectorShuffle %v4uint %337 %337 1 1 0 2 + OpStore %yyxz %338 + %340 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %341 = OpLoad %v3uint %340 + %342 = OpVectorShuffle %v4uint %341 %341 1 1 1 0 + OpStore %yyyx %342 + %344 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %345 = OpLoad %v3uint %344 + %346 = OpVectorShuffle %v4uint %345 %345 1 1 1 1 + OpStore %yyyy %346 + %348 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %349 = OpLoad %v3uint %348 + %350 = OpVectorShuffle %v4uint %349 %349 1 1 1 2 + OpStore %yyyz %350 + %352 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %353 = OpLoad %v3uint %352 + %354 = OpVectorShuffle %v4uint %353 %353 1 1 2 0 + OpStore %yyzx %354 + %356 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %357 = OpLoad %v3uint %356 + %358 = OpVectorShuffle %v4uint %357 %357 1 1 2 1 + OpStore %yyzy %358 + %360 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %361 = OpLoad %v3uint %360 + %362 = OpVectorShuffle %v4uint %361 %361 1 1 2 2 + OpStore %yyzz %362 + %364 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %365 = OpLoad %v3uint %364 + %366 = OpVectorShuffle %v4uint %365 %365 1 2 0 0 + OpStore %yzxx %366 + %368 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %369 = OpLoad %v3uint %368 + %370 = OpVectorShuffle %v4uint %369 %369 1 2 0 1 + OpStore %yzxy %370 + %372 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %373 = OpLoad %v3uint %372 + %374 = OpVectorShuffle %v4uint %373 %373 1 2 0 2 + OpStore %yzxz %374 + %376 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %377 = OpLoad %v3uint %376 + %378 = OpVectorShuffle %v4uint %377 %377 1 2 1 0 + OpStore %yzyx %378 + %380 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %381 = OpLoad %v3uint %380 + %382 = OpVectorShuffle %v4uint %381 %381 1 2 1 1 + OpStore %yzyy %382 + %384 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %385 = OpLoad %v3uint %384 + %386 = OpVectorShuffle %v4uint %385 %385 1 2 1 2 + OpStore %yzyz %386 + %388 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %389 = OpLoad %v3uint %388 + %390 = OpVectorShuffle %v4uint %389 %389 1 2 2 0 + OpStore %yzzx %390 + %392 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %393 = OpLoad %v3uint %392 + %394 = OpVectorShuffle %v4uint %393 %393 1 2 2 1 + OpStore %yzzy %394 + %396 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %397 = OpLoad %v3uint %396 + %398 = OpVectorShuffle %v4uint %397 %397 1 2 2 2 + OpStore %yzzz %398 + %400 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %401 = OpLoad %v3uint %400 + %402 = OpVectorShuffle %v4uint %401 %401 2 0 0 0 + OpStore %zxxx %402 + %404 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %405 = OpLoad %v3uint %404 + %406 = OpVectorShuffle %v4uint %405 %405 2 0 0 1 + OpStore %zxxy %406 + %408 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %409 = OpLoad %v3uint %408 + %410 = OpVectorShuffle %v4uint %409 %409 2 0 0 2 + OpStore %zxxz %410 + %412 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %413 = OpLoad %v3uint %412 + %414 = OpVectorShuffle %v4uint %413 %413 2 0 1 0 + OpStore %zxyx %414 + %416 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %417 = OpLoad %v3uint %416 + %418 = OpVectorShuffle %v4uint %417 %417 2 0 1 1 + OpStore %zxyy %418 + %420 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %421 = OpLoad %v3uint %420 + %422 = OpVectorShuffle %v4uint %421 %421 2 0 1 2 + OpStore %zxyz %422 + %424 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %425 = OpLoad %v3uint %424 + %426 = OpVectorShuffle %v4uint %425 %425 2 0 2 0 + OpStore %zxzx %426 + %428 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %429 = OpLoad %v3uint %428 + %430 = OpVectorShuffle %v4uint %429 %429 2 0 2 1 + OpStore %zxzy %430 + %432 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %433 = OpLoad %v3uint %432 + %434 = OpVectorShuffle %v4uint %433 %433 2 0 2 2 + OpStore %zxzz %434 + %436 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %437 = OpLoad %v3uint %436 + %438 = OpVectorShuffle %v4uint %437 %437 2 1 0 0 + OpStore %zyxx %438 + %440 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %441 = OpLoad %v3uint %440 + %442 = OpVectorShuffle %v4uint %441 %441 2 1 0 1 + OpStore %zyxy %442 + %444 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %445 = OpLoad %v3uint %444 + %446 = OpVectorShuffle %v4uint %445 %445 2 1 0 2 + OpStore %zyxz %446 + %448 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %449 = OpLoad %v3uint %448 + %450 = OpVectorShuffle %v4uint %449 %449 2 1 1 0 + OpStore %zyyx %450 + %452 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %453 = OpLoad %v3uint %452 + %454 = OpVectorShuffle %v4uint %453 %453 2 1 1 1 + OpStore %zyyy %454 + %456 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %457 = OpLoad %v3uint %456 + %458 = OpVectorShuffle %v4uint %457 %457 2 1 1 2 + OpStore %zyyz %458 + %460 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %461 = OpLoad %v3uint %460 + %462 = OpVectorShuffle %v4uint %461 %461 2 1 2 0 + OpStore %zyzx %462 + %464 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %465 = OpLoad %v3uint %464 + %466 = OpVectorShuffle %v4uint %465 %465 2 1 2 1 + OpStore %zyzy %466 + %468 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %469 = OpLoad %v3uint %468 + %470 = OpVectorShuffle %v4uint %469 %469 2 1 2 2 + OpStore %zyzz %470 + %472 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %473 = OpLoad %v3uint %472 + %474 = OpVectorShuffle %v4uint %473 %473 2 2 0 0 + OpStore %zzxx %474 + %476 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %477 = OpLoad %v3uint %476 + %478 = OpVectorShuffle %v4uint %477 %477 2 2 0 1 + OpStore %zzxy %478 + %480 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %481 = OpLoad %v3uint %480 + %482 = OpVectorShuffle %v4uint %481 %481 2 2 0 2 + OpStore %zzxz %482 + %484 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %485 = OpLoad %v3uint %484 + %486 = OpVectorShuffle %v4uint %485 %485 2 2 1 0 + OpStore %zzyx %486 + %488 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %489 = OpLoad %v3uint %488 + %490 = OpVectorShuffle %v4uint %489 %489 2 2 1 1 + OpStore %zzyy %490 + %492 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %493 = OpLoad %v3uint %492 + %494 = OpVectorShuffle %v4uint %493 %493 2 2 1 2 + OpStore %zzyz %494 + %496 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %497 = OpLoad %v3uint %496 + %498 = OpVectorShuffle %v4uint %497 %497 2 2 2 0 + OpStore %zzzx %498 + %500 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %501 = OpLoad %v3uint %500 + %502 = OpVectorShuffle %v4uint %501 %501 2 2 2 1 + OpStore %zzzy %502 + %504 = OpAccessChain %_ptr_Uniform_v3uint %U %uint_0 %uint_0 + %505 = OpLoad %v3uint %504 + %506 = OpVectorShuffle %v4uint %505 %505 2 2 2 2 + OpStore %zzzz %506 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/swizzle/write/packed_vec3/f32.wgsl.expected.glsl b/test/tint/expressions/swizzle/write/packed_vec3/f32.wgsl.expected.glsl index 919f4412d4..795d51393f 100644 --- a/test/tint/expressions/swizzle/write/packed_vec3/f32.wgsl.expected.glsl +++ b/test/tint/expressions/swizzle/write/packed_vec3/f32.wgsl.expected.glsl @@ -4,15 +4,19 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { vec3 v; uint pad; +}; + +layout(binding = 0, std430) buffer U_block_ssbo { + S inner; } U; void f() { - U.v = vec3(1.0f, 2.0f, 3.0f); - U.v.x = 1.0f; - U.v.y = 2.0f; - U.v.z = 3.0f; + U.inner.v = vec3(1.0f, 2.0f, 3.0f); + U.inner.v.x = 1.0f; + U.inner.v.y = 2.0f; + U.inner.v.z = 3.0f; } diff --git a/test/tint/expressions/swizzle/write/packed_vec3/f32.wgsl.expected.spvasm b/test/tint/expressions/swizzle/write/packed_vec3/f32.wgsl.expected.spvasm index 06c6c109fb..be1ecc9ec4 100644 --- a/test/tint/expressions/swizzle/write/packed_vec3/f32.wgsl.expected.spvasm +++ b/test/tint/expressions/swizzle/write/packed_vec3/f32.wgsl.expected.spvasm @@ -1,51 +1,55 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 26 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %U_block "U_block" + OpMemberName %U_block 0 "inner" OpName %S "S" OpMemberName %S 0 "v" OpName %U "U" OpName %unused_entry_point "unused_entry_point" OpName %f "f" - OpDecorate %S Block + OpDecorate %U_block Block + OpMemberDecorate %U_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %U DescriptorSet 0 OpDecorate %U Binding 0 %float = OpTypeFloat 32 %v3float = OpTypeVector %float 3 %S = OpTypeStruct %v3float -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %U = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %U_block = OpTypeStruct %S +%_ptr_StorageBuffer_U_block = OpTypePointer StorageBuffer %U_block + %U = OpVariable %_ptr_StorageBuffer_U_block StorageBuffer %void = OpTypeVoid - %6 = OpTypeFunction %void + %7 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float %float_1 = OpConstant %float 1 %float_2 = OpConstant %float 2 %float_3 = OpConstant %float 3 - %19 = OpConstantComposite %v3float %float_1 %float_2 %float_3 + %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3 %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float %uint_1 = OpConstant %uint 1 %uint_2 = OpConstant %uint 2 -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel OpReturn OpFunctionEnd - %f = OpFunction %void None %6 - %11 = OpLabel - %15 = OpAccessChain %_ptr_StorageBuffer_v3float %U %uint_0 - OpStore %15 %19 - %21 = OpAccessChain %_ptr_StorageBuffer_float %U %uint_0 %uint_0 - OpStore %21 %float_1 - %23 = OpAccessChain %_ptr_StorageBuffer_float %U %uint_0 %uint_1 - OpStore %23 %float_2 - %25 = OpAccessChain %_ptr_StorageBuffer_float %U %uint_0 %uint_2 - OpStore %25 %float_3 + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpAccessChain %_ptr_StorageBuffer_v3float %U %uint_0 %uint_0 + OpStore %16 %20 + %22 = OpAccessChain %_ptr_StorageBuffer_float %U %uint_0 %uint_0 %uint_0 + OpStore %22 %float_1 + %24 = OpAccessChain %_ptr_StorageBuffer_float %U %uint_0 %uint_0 %uint_1 + OpStore %24 %float_2 + %26 = OpAccessChain %_ptr_StorageBuffer_float %U %uint_0 %uint_0 %uint_2 + OpStore %26 %float_3 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/swizzle/write/packed_vec3/i32.wgsl.expected.glsl b/test/tint/expressions/swizzle/write/packed_vec3/i32.wgsl.expected.glsl index 2318c7c2d9..56c0a4b3f5 100644 --- a/test/tint/expressions/swizzle/write/packed_vec3/i32.wgsl.expected.glsl +++ b/test/tint/expressions/swizzle/write/packed_vec3/i32.wgsl.expected.glsl @@ -4,15 +4,19 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { ivec3 v; uint pad; +}; + +layout(binding = 0, std430) buffer U_block_ssbo { + S inner; } U; void f() { - U.v = ivec3(1, 2, 3); - U.v.x = 1; - U.v.y = 2; - U.v.z = 3; + U.inner.v = ivec3(1, 2, 3); + U.inner.v.x = 1; + U.inner.v.y = 2; + U.inner.v.z = 3; } diff --git a/test/tint/expressions/swizzle/write/packed_vec3/i32.wgsl.expected.spvasm b/test/tint/expressions/swizzle/write/packed_vec3/i32.wgsl.expected.spvasm index b61e867648..7931a89ab4 100644 --- a/test/tint/expressions/swizzle/write/packed_vec3/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/swizzle/write/packed_vec3/i32.wgsl.expected.spvasm @@ -1,51 +1,55 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 26 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %U_block "U_block" + OpMemberName %U_block 0 "inner" OpName %S "S" OpMemberName %S 0 "v" OpName %U "U" OpName %unused_entry_point "unused_entry_point" OpName %f "f" - OpDecorate %S Block + OpDecorate %U_block Block + OpMemberDecorate %U_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %U DescriptorSet 0 OpDecorate %U Binding 0 %int = OpTypeInt 32 1 %v3int = OpTypeVector %int 3 %S = OpTypeStruct %v3int -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %U = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %U_block = OpTypeStruct %S +%_ptr_StorageBuffer_U_block = OpTypePointer StorageBuffer %U_block + %U = OpVariable %_ptr_StorageBuffer_U_block StorageBuffer %void = OpTypeVoid - %6 = OpTypeFunction %void + %7 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v3int = OpTypePointer StorageBuffer %v3int %int_1 = OpConstant %int 1 %int_2 = OpConstant %int 2 %int_3 = OpConstant %int 3 - %19 = OpConstantComposite %v3int %int_1 %int_2 %int_3 + %20 = OpConstantComposite %v3int %int_1 %int_2 %int_3 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %uint_1 = OpConstant %uint 1 %uint_2 = OpConstant %uint 2 -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel OpReturn OpFunctionEnd - %f = OpFunction %void None %6 - %11 = OpLabel - %15 = OpAccessChain %_ptr_StorageBuffer_v3int %U %uint_0 - OpStore %15 %19 - %21 = OpAccessChain %_ptr_StorageBuffer_int %U %uint_0 %uint_0 - OpStore %21 %int_1 - %23 = OpAccessChain %_ptr_StorageBuffer_int %U %uint_0 %uint_1 - OpStore %23 %int_2 - %25 = OpAccessChain %_ptr_StorageBuffer_int %U %uint_0 %uint_2 - OpStore %25 %int_3 + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpAccessChain %_ptr_StorageBuffer_v3int %U %uint_0 %uint_0 + OpStore %16 %20 + %22 = OpAccessChain %_ptr_StorageBuffer_int %U %uint_0 %uint_0 %uint_0 + OpStore %22 %int_1 + %24 = OpAccessChain %_ptr_StorageBuffer_int %U %uint_0 %uint_0 %uint_1 + OpStore %24 %int_2 + %26 = OpAccessChain %_ptr_StorageBuffer_int %U %uint_0 %uint_0 %uint_2 + OpStore %26 %int_3 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/swizzle/write/packed_vec3/u32.wgsl.expected.glsl b/test/tint/expressions/swizzle/write/packed_vec3/u32.wgsl.expected.glsl index ee0d4c6b81..bcac5dca6f 100644 --- a/test/tint/expressions/swizzle/write/packed_vec3/u32.wgsl.expected.glsl +++ b/test/tint/expressions/swizzle/write/packed_vec3/u32.wgsl.expected.glsl @@ -4,15 +4,19 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { uvec3 v; uint pad; +}; + +layout(binding = 0, std430) buffer U_block_ssbo { + S inner; } U; void f() { - U.v = uvec3(1u, 2u, 3u); - U.v.x = 1u; - U.v.y = 2u; - U.v.z = 3u; + U.inner.v = uvec3(1u, 2u, 3u); + U.inner.v.x = 1u; + U.inner.v.y = 2u; + U.inner.v.z = 3u; } diff --git a/test/tint/expressions/swizzle/write/packed_vec3/u32.wgsl.expected.spvasm b/test/tint/expressions/swizzle/write/packed_vec3/u32.wgsl.expected.spvasm index 622a16e1e9..d6c8dc1f64 100644 --- a/test/tint/expressions/swizzle/write/packed_vec3/u32.wgsl.expected.spvasm +++ b/test/tint/expressions/swizzle/write/packed_vec3/u32.wgsl.expected.spvasm @@ -1,48 +1,52 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 23 +; Bound: 24 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %U_block "U_block" + OpMemberName %U_block 0 "inner" OpName %S "S" OpMemberName %S 0 "v" OpName %U "U" OpName %unused_entry_point "unused_entry_point" OpName %f "f" - OpDecorate %S Block + OpDecorate %U_block Block + OpMemberDecorate %U_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %U DescriptorSet 0 OpDecorate %U Binding 0 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %S = OpTypeStruct %v3uint -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %U = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %U_block = OpTypeStruct %S +%_ptr_StorageBuffer_U_block = OpTypePointer StorageBuffer %U_block + %U = OpVariable %_ptr_StorageBuffer_U_block StorageBuffer %void = OpTypeVoid - %6 = OpTypeFunction %void + %7 = OpTypeFunction %void %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v3uint = OpTypePointer StorageBuffer %v3uint %uint_1 = OpConstant %uint 1 %uint_2 = OpConstant %uint 2 %uint_3 = OpConstant %uint 3 - %18 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3 + %19 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3 %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel OpReturn OpFunctionEnd - %f = OpFunction %void None %6 - %11 = OpLabel - %14 = OpAccessChain %_ptr_StorageBuffer_v3uint %U %uint_0 - OpStore %14 %18 - %20 = OpAccessChain %_ptr_StorageBuffer_uint %U %uint_0 %uint_0 - OpStore %20 %uint_1 - %21 = OpAccessChain %_ptr_StorageBuffer_uint %U %uint_0 %uint_1 - OpStore %21 %uint_2 - %22 = OpAccessChain %_ptr_StorageBuffer_uint %U %uint_0 %uint_2 - OpStore %22 %uint_3 + %f = OpFunction %void None %7 + %12 = OpLabel + %15 = OpAccessChain %_ptr_StorageBuffer_v3uint %U %uint_0 %uint_0 + OpStore %15 %19 + %21 = OpAccessChain %_ptr_StorageBuffer_uint %U %uint_0 %uint_0 %uint_0 + OpStore %21 %uint_1 + %22 = OpAccessChain %_ptr_StorageBuffer_uint %U %uint_0 %uint_0 %uint_1 + OpStore %22 %uint_2 + %23 = OpAccessChain %_ptr_StorageBuffer_uint %U %uint_0 %uint_0 %uint_2 + OpStore %23 %uint_3 OpReturn OpFunctionEnd diff --git a/test/tint/layout/storage/mat2x2/f32.wgsl.expected.glsl b/test/tint/layout/storage/mat2x2/f32.wgsl.expected.glsl index 0a32bed3a5..11ce083168 100644 --- a/test/tint/layout/storage/mat2x2/f32.wgsl.expected.glsl +++ b/test/tint/layout/storage/mat2x2/f32.wgsl.expected.glsl @@ -1,12 +1,16 @@ #version 310 es -layout(binding = 0, std430) buffer SSBO_ssbo { +struct SSBO { mat2 m; +}; + +layout(binding = 0, std430) buffer ssbo_block_ssbo { + SSBO inner; } ssbo; void f() { - mat2 v = ssbo.m; - ssbo.m = v; + mat2 v = ssbo.inner.m; + ssbo.inner.m = v; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/layout/storage/mat2x2/f32.wgsl.expected.spvasm b/test/tint/layout/storage/mat2x2/f32.wgsl.expected.spvasm index 2e4ee55c85..97c3d01891 100644 --- a/test/tint/layout/storage/mat2x2/f32.wgsl.expected.spvasm +++ b/test/tint/layout/storage/mat2x2/f32.wgsl.expected.spvasm @@ -1,17 +1,20 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 17 +; Bound: 18 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %f "f" OpExecutionMode %f LocalSize 1 1 1 + OpName %ssbo_block "ssbo_block" + OpMemberName %ssbo_block 0 "inner" OpName %SSBO "SSBO" OpMemberName %SSBO 0 "m" OpName %ssbo "ssbo" OpName %f "f" - OpDecorate %SSBO Block + OpDecorate %ssbo_block Block + OpMemberDecorate %ssbo_block 0 Offset 0 OpMemberDecorate %SSBO 0 Offset 0 OpMemberDecorate %SSBO 0 ColMajor OpMemberDecorate %SSBO 0 MatrixStride 8 @@ -21,18 +24,19 @@ %v2float = OpTypeVector %float 2 %mat2v2float = OpTypeMatrix %v2float 2 %SSBO = OpTypeStruct %mat2v2float -%_ptr_StorageBuffer_SSBO = OpTypePointer StorageBuffer %SSBO - %ssbo = OpVariable %_ptr_StorageBuffer_SSBO StorageBuffer + %ssbo_block = OpTypeStruct %SSBO +%_ptr_StorageBuffer_ssbo_block = OpTypePointer StorageBuffer %ssbo_block + %ssbo = OpVariable %_ptr_StorageBuffer_ssbo_block StorageBuffer %void = OpTypeVoid - %7 = OpTypeFunction %void + %8 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_mat2v2float = OpTypePointer StorageBuffer %mat2v2float - %f = OpFunction %void None %7 - %10 = OpLabel - %14 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %ssbo %uint_0 - %15 = OpLoad %mat2v2float %14 - %16 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %ssbo %uint_0 - OpStore %16 %15 + %f = OpFunction %void None %8 + %11 = OpLabel + %15 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %ssbo %uint_0 %uint_0 + %16 = OpLoad %mat2v2float %15 + %17 = OpAccessChain %_ptr_StorageBuffer_mat2v2float %ssbo %uint_0 %uint_0 + OpStore %17 %16 OpReturn OpFunctionEnd diff --git a/test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.glsl b/test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.glsl index 78de6f78ff..b624759fdb 100644 --- a/test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.glsl +++ b/test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.glsl @@ -6,8 +6,12 @@ struct strided_arr { uint pad_1; }; -layout(binding = 0, std430) buffer SSBO_ssbo { +struct SSBO { strided_arr m[2]; +}; + +layout(binding = 0, std430) buffer ssbo_block_ssbo { + SSBO inner; } ssbo; mat2 arr_to_mat2x2_stride_16(strided_arr arr[2]) { @@ -22,9 +26,9 @@ strided_arr[2] mat2x2_stride_16_to_arr(mat2 m) { } void f_1() { - mat2 x_15 = arr_to_mat2x2_stride_16(ssbo.m); + mat2 x_15 = arr_to_mat2x2_stride_16(ssbo.inner.m); strided_arr tint_symbol[2] = mat2x2_stride_16_to_arr(x_15); - ssbo.m = tint_symbol; + ssbo.inner.m = tint_symbol; return; } diff --git a/test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.spvasm b/test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.spvasm index 7427fec70b..ae6bdbe9f5 100644 --- a/test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.spvasm +++ b/test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.spvasm @@ -1,12 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 45 +; Bound: 46 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %f "f" OpExecutionMode %f LocalSize 1 1 1 + OpName %ssbo_block "ssbo_block" + OpMemberName %ssbo_block 0 "inner" OpName %SSBO "SSBO" OpMemberName %SSBO 0 "m" OpName %strided_arr "strided_arr" @@ -18,7 +20,8 @@ OpName %m "m" OpName %f_1 "f_1" OpName %f "f" - OpDecorate %SSBO Block + OpDecorate %ssbo_block Block + OpMemberDecorate %ssbo_block 0 Offset 0 OpMemberDecorate %SSBO 0 Offset 0 OpMemberDecorate %strided_arr 0 Offset 0 OpDecorate %_arr_strided_arr_uint_2 ArrayStride 16 @@ -31,49 +34,50 @@ %uint_2 = OpConstant %uint 2 %_arr_strided_arr_uint_2 = OpTypeArray %strided_arr %uint_2 %SSBO = OpTypeStruct %_arr_strided_arr_uint_2 -%_ptr_StorageBuffer_SSBO = OpTypePointer StorageBuffer %SSBO - %ssbo = OpVariable %_ptr_StorageBuffer_SSBO StorageBuffer + %ssbo_block = OpTypeStruct %SSBO +%_ptr_StorageBuffer_ssbo_block = OpTypePointer StorageBuffer %ssbo_block + %ssbo = OpVariable %_ptr_StorageBuffer_ssbo_block StorageBuffer %mat2v2float = OpTypeMatrix %v2float 2 - %10 = OpTypeFunction %mat2v2float %_arr_strided_arr_uint_2 - %15 = OpConstantNull %uint + %11 = OpTypeFunction %mat2v2float %_arr_strided_arr_uint_2 + %16 = OpConstantNull %uint %uint_1 = OpConstant %uint 1 - %22 = OpTypeFunction %_arr_strided_arr_uint_2 %mat2v2float + %23 = OpTypeFunction %_arr_strided_arr_uint_2 %mat2v2float %void = OpTypeVoid - %31 = OpTypeFunction %void + %32 = OpTypeFunction %void %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer__arr_strided_arr_uint_2 = OpTypePointer StorageBuffer %_arr_strided_arr_uint_2 -%arr_to_mat2x2_stride_16 = OpFunction %mat2v2float None %10 +%arr_to_mat2x2_stride_16 = OpFunction %mat2v2float None %11 %arr = OpFunctionParameter %_arr_strided_arr_uint_2 - %14 = OpLabel - %16 = OpCompositeExtract %strided_arr %arr 0 - %17 = OpCompositeExtract %v2float %16 0 - %19 = OpCompositeExtract %strided_arr %arr 1 - %20 = OpCompositeExtract %v2float %19 0 - %21 = OpCompositeConstruct %mat2v2float %17 %20 - OpReturnValue %21 + %15 = OpLabel + %17 = OpCompositeExtract %strided_arr %arr 0 + %18 = OpCompositeExtract %v2float %17 0 + %20 = OpCompositeExtract %strided_arr %arr 1 + %21 = OpCompositeExtract %v2float %20 0 + %22 = OpCompositeConstruct %mat2v2float %18 %21 + OpReturnValue %22 OpFunctionEnd -%mat2x2_stride_16_to_arr = OpFunction %_arr_strided_arr_uint_2 None %22 +%mat2x2_stride_16_to_arr = OpFunction %_arr_strided_arr_uint_2 None %23 %m = OpFunctionParameter %mat2v2float - %25 = OpLabel - %26 = OpCompositeExtract %v2float %m 0 - %27 = OpCompositeConstruct %strided_arr %26 - %28 = OpCompositeExtract %v2float %m 1 - %29 = OpCompositeConstruct %strided_arr %28 - %30 = OpCompositeConstruct %_arr_strided_arr_uint_2 %27 %29 - OpReturnValue %30 + %26 = OpLabel + %27 = OpCompositeExtract %v2float %m 0 + %28 = OpCompositeConstruct %strided_arr %27 + %29 = OpCompositeExtract %v2float %m 1 + %30 = OpCompositeConstruct %strided_arr %29 + %31 = OpCompositeConstruct %_arr_strided_arr_uint_2 %28 %30 + OpReturnValue %31 OpFunctionEnd - %f_1 = OpFunction %void None %31 - %34 = OpLabel - %38 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_uint_2 %ssbo %uint_0 - %39 = OpLoad %_arr_strided_arr_uint_2 %38 - %35 = OpFunctionCall %mat2v2float %arr_to_mat2x2_stride_16 %39 - %40 = OpFunctionCall %_arr_strided_arr_uint_2 %mat2x2_stride_16_to_arr %35 - %41 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_uint_2 %ssbo %uint_0 - OpStore %41 %40 + %f_1 = OpFunction %void None %32 + %35 = OpLabel + %39 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_uint_2 %ssbo %uint_0 %uint_0 + %40 = OpLoad %_arr_strided_arr_uint_2 %39 + %36 = OpFunctionCall %mat2v2float %arr_to_mat2x2_stride_16 %40 + %41 = OpFunctionCall %_arr_strided_arr_uint_2 %mat2x2_stride_16_to_arr %36 + %42 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_uint_2 %ssbo %uint_0 %uint_0 + OpStore %42 %41 OpReturn OpFunctionEnd - %f = OpFunction %void None %31 - %43 = OpLabel - %44 = OpFunctionCall %void %f_1 + %f = OpFunction %void None %32 + %44 = OpLabel + %45 = OpFunctionCall %void %f_1 OpReturn OpFunctionEnd diff --git a/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.glsl b/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.glsl index 2a20e0f91a..0993c0743d 100644 --- a/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.glsl +++ b/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.glsl @@ -1,11 +1,15 @@ #version 310 es -layout(binding = 0, std430) buffer S_ssbo { +struct S { int a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void tint_symbol() { - int u = (v.a + 1); + int u = (v.inner.a + 1); } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.spvasm b/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.spvasm index 33ce2fbf78..b54b7a67bc 100644 --- a/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.spvasm +++ b/test/tint/ptr_ref/load/local/ptr_storage.wgsl.expected.spvasm @@ -1,34 +1,38 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 16 +; Bound: 17 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %main "main" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 %int = OpTypeInt 32 1 %S = OpTypeStruct %int -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_1 = OpConstant %int 1 - %main = OpFunction %void None %5 - %8 = OpLabel - %12 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 - %13 = OpLoad %int %12 - %15 = OpIAdd %int %13 %int_1 + %main = OpFunction %void None %6 + %9 = OpLabel + %13 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 + %14 = OpLoad %int %13 + %16 = OpIAdd %int %14 %int_1 OpReturn OpFunctionEnd diff --git a/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.glsl b/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.glsl index 3fbb91e7f0..26e520ad39 100644 --- a/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.glsl +++ b/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.glsl @@ -1,14 +1,18 @@ #version 310 es -layout(binding = 0, std140) uniform S_ubo { +struct S { int a; uint pad; uint pad_1; uint pad_2; +}; + +layout(binding = 0, std140) uniform v_block_ubo { + S inner; } v; void tint_symbol() { - int u = (v.a + 1); + int u = (v.inner.a + 1); } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.spvasm b/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.spvasm index 9b67704fc6..ab9ff0eec5 100644 --- a/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.spvasm +++ b/test/tint/ptr_ref/load/local/ptr_uniform.wgsl.expected.spvasm @@ -1,35 +1,39 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 16 +; Bound: 17 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %main "main" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %v NonWritable OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 %int = OpTypeInt 32 1 %S = OpTypeStruct %int -%_ptr_Uniform_S = OpTypePointer Uniform %S - %v = OpVariable %_ptr_Uniform_S Uniform + %v_block = OpTypeStruct %S +%_ptr_Uniform_v_block = OpTypePointer Uniform %v_block + %v = OpVariable %_ptr_Uniform_v_block Uniform %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_Uniform_int = OpTypePointer Uniform %int %int_1 = OpConstant %int 1 - %main = OpFunction %void None %5 - %8 = OpLabel - %12 = OpAccessChain %_ptr_Uniform_int %v %uint_0 - %13 = OpLoad %int %12 - %15 = OpIAdd %int %13 %int_1 + %main = OpFunction %void None %6 + %9 = OpLabel + %13 = OpAccessChain %_ptr_Uniform_int %v %uint_0 %uint_0 + %14 = OpLoad %int %13 + %16 = OpIAdd %int %14 %int_1 OpReturn OpFunctionEnd diff --git a/test/tint/samples/compute_boids.wgsl.expected.glsl b/test/tint/samples/compute_boids.wgsl.expected.glsl index 9e553117ba..9cc783d345 100644 --- a/test/tint/samples/compute_boids.wgsl.expected.glsl +++ b/test/tint/samples/compute_boids.wgsl.expected.glsl @@ -75,7 +75,7 @@ struct Particle { vec2 vel; }; -layout(binding = 0, std140) uniform SimParams_ubo { +struct SimParams { float deltaT; float rule1Distance; float rule2Distance; @@ -84,14 +84,22 @@ layout(binding = 0, std140) uniform SimParams_ubo { float rule2Scale; float rule3Scale; uint pad; +}; + +struct Particles { + Particle particles[5]; +}; + +layout(binding = 0, std140) uniform params_block_ubo { + SimParams inner; } params; -layout(binding = 1, std430) buffer Particles_ssbo { - Particle particles[5]; +layout(binding = 1, std430) buffer particlesA_block_ssbo { + Particles inner; } particlesA; -layout(binding = 2, std430) buffer Particles_ssbo_1 { - Particle particles[5]; +layout(binding = 2, std430) buffer particlesA_block_ssbo_1 { + Particles inner; } particlesB; void comp_main(uvec3 tint_symbol) { @@ -99,8 +107,8 @@ void comp_main(uvec3 tint_symbol) { if ((index >= 5u)) { return; } - vec2 vPos = particlesA.particles[index].pos; - vec2 vVel = particlesA.particles[index].vel; + vec2 vPos = particlesA.inner.particles[index].pos; + vec2 vVel = particlesA.inner.particles[index].vel; vec2 cMass = vec2(0.0f); vec2 cVel = vec2(0.0f); vec2 colVel = vec2(0.0f); @@ -113,16 +121,16 @@ void comp_main(uvec3 tint_symbol) { if ((i == index)) { continue; } - pos = particlesA.particles[i].pos.xy; - vel = particlesA.particles[i].vel.xy; - if ((distance(pos, vPos) < params.rule1Distance)) { + pos = particlesA.inner.particles[i].pos.xy; + vel = particlesA.inner.particles[i].vel.xy; + if ((distance(pos, vPos) < params.inner.rule1Distance)) { cMass = (cMass + pos); cMassCount = (cMassCount + 1); } - if ((distance(pos, vPos) < params.rule2Distance)) { + if ((distance(pos, vPos) < params.inner.rule2Distance)) { colVel = (colVel - (pos - vPos)); } - if ((distance(pos, vPos) < params.rule3Distance)) { + if ((distance(pos, vPos) < params.inner.rule3Distance)) { cVel = (cVel + vel); cVelCount = (cVelCount + 1); } @@ -134,9 +142,9 @@ void comp_main(uvec3 tint_symbol) { if ((cVelCount > 0)) { cVel = (cVel / vec2(float(cVelCount), float(cVelCount))); } - vVel = (((vVel + (cMass * params.rule1Scale)) + (colVel * params.rule2Scale)) + (cVel * params.rule3Scale)); + vVel = (((vVel + (cMass * params.inner.rule1Scale)) + (colVel * params.inner.rule2Scale)) + (cVel * params.inner.rule3Scale)); vVel = (normalize(vVel) * clamp(length(vVel), 0.0f, 0.100000001f)); - vPos = (vPos + (vVel * params.deltaT)); + vPos = (vPos + (vVel * params.inner.deltaT)); if ((vPos.x < -1.0f)) { vPos.x = 1.0f; } @@ -149,8 +157,8 @@ void comp_main(uvec3 tint_symbol) { if ((vPos.y > 1.0f)) { vPos.y = -1.0f; } - particlesB.particles[index].pos = vPos; - particlesB.particles[index].vel = vVel; + particlesB.inner.particles[index].pos = vPos; + particlesB.inner.particles[index].vel = vVel; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/samples/compute_boids.wgsl.expected.spvasm b/test/tint/samples/compute_boids.wgsl.expected.spvasm index d3abbb5382..0559c3e88d 100644 --- a/test/tint/samples/compute_boids.wgsl.expected.spvasm +++ b/test/tint/samples/compute_boids.wgsl.expected.spvasm @@ -1,10 +1,10 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 277 +; Bound: 279 ; Schema: 0 OpCapability Shader - %37 = OpExtInstImport "GLSL.std.450" + %39 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vert_main "vert_main" %a_particlePos_1 %a_particleVel_1 %a_pos_1 %value %vertex_point_size OpEntryPoint Fragment %frag_main "frag_main" %value_1 @@ -18,6 +18,8 @@ OpName %vertex_point_size "vertex_point_size" OpName %value_1 "value_1" OpName %gl_GlobalInvocationID_1 "gl_GlobalInvocationID_1" + OpName %params_block "params_block" + OpMemberName %params_block 0 "inner" OpName %SimParams "SimParams" OpMemberName %SimParams 0 "deltaT" OpMemberName %SimParams 1 "rule1Distance" @@ -27,6 +29,8 @@ OpMemberName %SimParams 5 "rule2Scale" OpMemberName %SimParams 6 "rule3Scale" OpName %params "params" + OpName %particlesA_block "particlesA_block" + OpMemberName %particlesA_block 0 "inner" OpName %Particles "Particles" OpMemberName %Particles 0 "particles" OpName %Particle "Particle" @@ -64,7 +68,8 @@ OpDecorate %vertex_point_size BuiltIn PointSize OpDecorate %value_1 Location 0 OpDecorate %gl_GlobalInvocationID_1 BuiltIn GlobalInvocationId - OpDecorate %SimParams Block + OpDecorate %params_block Block + OpMemberDecorate %params_block 0 Offset 0 OpMemberDecorate %SimParams 0 Offset 0 OpMemberDecorate %SimParams 1 Offset 4 OpMemberDecorate %SimParams 2 Offset 8 @@ -75,7 +80,8 @@ OpDecorate %params NonWritable OpDecorate %params Binding 0 OpDecorate %params DescriptorSet 0 - OpDecorate %Particles Block + OpDecorate %particlesA_block Block + OpMemberDecorate %particlesA_block 0 Offset 0 OpMemberDecorate %Particles 0 Offset 0 OpMemberDecorate %Particle 0 Offset 0 OpMemberDecorate %Particle 1 Offset 8 @@ -103,33 +109,35 @@ %_ptr_Input_v3uint = OpTypePointer Input %v3uint %gl_GlobalInvocationID_1 = OpVariable %_ptr_Input_v3uint Input %SimParams = OpTypeStruct %float %float %float %float %float %float %float -%_ptr_Uniform_SimParams = OpTypePointer Uniform %SimParams - %params = OpVariable %_ptr_Uniform_SimParams Uniform +%params_block = OpTypeStruct %SimParams +%_ptr_Uniform_params_block = OpTypePointer Uniform %params_block + %params = OpVariable %_ptr_Uniform_params_block Uniform %Particle = OpTypeStruct %v2float %v2float %uint_5 = OpConstant %uint 5 %_arr_Particle_uint_5 = OpTypeArray %Particle %uint_5 %Particles = OpTypeStruct %_arr_Particle_uint_5 -%_ptr_StorageBuffer_Particles = OpTypePointer StorageBuffer %Particles - %particlesA = OpVariable %_ptr_StorageBuffer_Particles StorageBuffer - %particlesB = OpVariable %_ptr_StorageBuffer_Particles StorageBuffer - %29 = OpTypeFunction %v4float %v2float %v2float %v2float +%particlesA_block = OpTypeStruct %Particles +%_ptr_StorageBuffer_particlesA_block = OpTypePointer StorageBuffer %particlesA_block + %particlesA = OpVariable %_ptr_StorageBuffer_particlesA_block StorageBuffer + %particlesB = OpVariable %_ptr_StorageBuffer_particlesA_block StorageBuffer + %31 = OpTypeFunction %v4float %v2float %v2float %v2float %_ptr_Function_float = OpTypePointer Function %float %_ptr_Function_v2float = OpTypePointer Function %v2float - %63 = OpConstantNull %v2float + %65 = OpConstantNull %v2float %float_1 = OpConstant %float 1 %void = OpTypeVoid - %70 = OpTypeFunction %void - %78 = OpTypeFunction %v4float - %81 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 - %85 = OpTypeFunction %void %v3uint + %72 = OpTypeFunction %void + %80 = OpTypeFunction %v4float + %83 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %87 = OpTypeFunction %void %v3uint %_ptr_Function_uint = OpTypePointer Function %uint - %92 = OpConstantNull %uint + %94 = OpConstantNull %uint %bool = OpTypeBool %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float %uint_1 = OpConstant %uint 1 %int = OpTypeInt 32 1 - %113 = OpConstantNull %int + %115 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %_ptr_Uniform_float = OpTypePointer Uniform %float %int_1 = OpConstant %int 1 @@ -139,309 +147,309 @@ %uint_6 = OpConstant %uint 6 %float_0_100000001 = OpConstant %float 0.100000001 %float_n1 = OpConstant %float -1 -%vert_main_inner = OpFunction %v4float None %29 +%vert_main_inner = OpFunction %v4float None %31 %a_particlePos = OpFunctionParameter %v2float %a_particleVel = OpFunctionParameter %v2float %a_pos = OpFunctionParameter %v2float - %34 = OpLabel + %36 = OpLabel %angle = OpVariable %_ptr_Function_float Function %13 - %pos = OpVariable %_ptr_Function_v2float Function %63 - %38 = OpCompositeExtract %float %a_particleVel 0 - %39 = OpCompositeExtract %float %a_particleVel 1 - %36 = OpExtInst %float %37 Atan2 %38 %39 - %35 = OpFNegate %float %36 - OpStore %angle %35 - %42 = OpCompositeExtract %float %a_pos 0 - %44 = OpLoad %float %angle - %43 = OpExtInst %float %37 Cos %44 - %45 = OpFMul %float %42 %43 - %46 = OpCompositeExtract %float %a_pos 1 - %48 = OpLoad %float %angle - %47 = OpExtInst %float %37 Sin %48 - %49 = OpFMul %float %46 %47 - %50 = OpFSub %float %45 %49 - %51 = OpCompositeExtract %float %a_pos 0 - %53 = OpLoad %float %angle - %52 = OpExtInst %float %37 Sin %53 - %54 = OpFMul %float %51 %52 - %55 = OpCompositeExtract %float %a_pos 1 - %57 = OpLoad %float %angle - %56 = OpExtInst %float %37 Cos %57 - %58 = OpFMul %float %55 %56 - %59 = OpFAdd %float %54 %58 - %60 = OpCompositeConstruct %v2float %50 %59 - OpStore %pos %60 - %64 = OpLoad %v2float %pos - %65 = OpFAdd %v2float %64 %a_particlePos - %66 = OpCompositeExtract %float %65 0 - %67 = OpCompositeExtract %float %65 1 - %69 = OpCompositeConstruct %v4float %66 %67 %13 %float_1 - OpReturnValue %69 + %pos = OpVariable %_ptr_Function_v2float Function %65 + %40 = OpCompositeExtract %float %a_particleVel 0 + %41 = OpCompositeExtract %float %a_particleVel 1 + %38 = OpExtInst %float %39 Atan2 %40 %41 + %37 = OpFNegate %float %38 + OpStore %angle %37 + %44 = OpCompositeExtract %float %a_pos 0 + %46 = OpLoad %float %angle + %45 = OpExtInst %float %39 Cos %46 + %47 = OpFMul %float %44 %45 + %48 = OpCompositeExtract %float %a_pos 1 + %50 = OpLoad %float %angle + %49 = OpExtInst %float %39 Sin %50 + %51 = OpFMul %float %48 %49 + %52 = OpFSub %float %47 %51 + %53 = OpCompositeExtract %float %a_pos 0 + %55 = OpLoad %float %angle + %54 = OpExtInst %float %39 Sin %55 + %56 = OpFMul %float %53 %54 + %57 = OpCompositeExtract %float %a_pos 1 + %59 = OpLoad %float %angle + %58 = OpExtInst %float %39 Cos %59 + %60 = OpFMul %float %57 %58 + %61 = OpFAdd %float %56 %60 + %62 = OpCompositeConstruct %v2float %52 %61 + OpStore %pos %62 + %66 = OpLoad %v2float %pos + %67 = OpFAdd %v2float %66 %a_particlePos + %68 = OpCompositeExtract %float %67 0 + %69 = OpCompositeExtract %float %67 1 + %71 = OpCompositeConstruct %v4float %68 %69 %13 %float_1 + OpReturnValue %71 OpFunctionEnd - %vert_main = OpFunction %void None %70 - %73 = OpLabel - %75 = OpLoad %v2float %a_particlePos_1 - %76 = OpLoad %v2float %a_particleVel_1 - %77 = OpLoad %v2float %a_pos_1 - %74 = OpFunctionCall %v4float %vert_main_inner %75 %76 %77 - OpStore %value %74 + %vert_main = OpFunction %void None %72 + %75 = OpLabel + %77 = OpLoad %v2float %a_particlePos_1 + %78 = OpLoad %v2float %a_particleVel_1 + %79 = OpLoad %v2float %a_pos_1 + %76 = OpFunctionCall %v4float %vert_main_inner %77 %78 %79 + OpStore %value %76 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd -%frag_main_inner = OpFunction %v4float None %78 - %80 = OpLabel - OpReturnValue %81 +%frag_main_inner = OpFunction %v4float None %80 + %82 = OpLabel + OpReturnValue %83 OpFunctionEnd - %frag_main = OpFunction %void None %70 - %83 = OpLabel - %84 = OpFunctionCall %v4float %frag_main_inner - OpStore %value_1 %84 + %frag_main = OpFunction %void None %72 + %85 = OpLabel + %86 = OpFunctionCall %v4float %frag_main_inner + OpStore %value_1 %86 OpReturn OpFunctionEnd -%comp_main_inner = OpFunction %void None %85 +%comp_main_inner = OpFunction %void None %87 %gl_GlobalInvocationID = OpFunctionParameter %v3uint - %88 = OpLabel - %index = OpVariable %_ptr_Function_uint Function %92 - %vPos = OpVariable %_ptr_Function_v2float Function %63 - %vVel = OpVariable %_ptr_Function_v2float Function %63 - %cMass = OpVariable %_ptr_Function_v2float Function %63 - %cVel = OpVariable %_ptr_Function_v2float Function %63 - %colVel = OpVariable %_ptr_Function_v2float Function %63 - %cMassCount = OpVariable %_ptr_Function_int Function %113 - %cVelCount = OpVariable %_ptr_Function_int Function %113 - %pos_0 = OpVariable %_ptr_Function_v2float Function %63 - %vel = OpVariable %_ptr_Function_v2float Function %63 - %i = OpVariable %_ptr_Function_uint Function %92 - %89 = OpCompositeExtract %uint %gl_GlobalInvocationID 0 - OpStore %index %89 - %93 = OpLoad %uint %index - %94 = OpUGreaterThanEqual %bool %93 %uint_5 - OpSelectionMerge %96 None - OpBranchConditional %94 %97 %96 - %97 = OpLabel + %90 = OpLabel + %index = OpVariable %_ptr_Function_uint Function %94 + %vPos = OpVariable %_ptr_Function_v2float Function %65 + %vVel = OpVariable %_ptr_Function_v2float Function %65 + %cMass = OpVariable %_ptr_Function_v2float Function %65 + %cVel = OpVariable %_ptr_Function_v2float Function %65 + %colVel = OpVariable %_ptr_Function_v2float Function %65 + %cMassCount = OpVariable %_ptr_Function_int Function %115 + %cVelCount = OpVariable %_ptr_Function_int Function %115 + %pos_0 = OpVariable %_ptr_Function_v2float Function %65 + %vel = OpVariable %_ptr_Function_v2float Function %65 + %i = OpVariable %_ptr_Function_uint Function %94 + %91 = OpCompositeExtract %uint %gl_GlobalInvocationID 0 + OpStore %index %91 + %95 = OpLoad %uint %index + %96 = OpUGreaterThanEqual %bool %95 %uint_5 + OpSelectionMerge %98 None + OpBranchConditional %96 %99 %98 + %99 = OpLabel OpReturn - %96 = OpLabel - %99 = OpLoad %uint %index - %101 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesA %uint_0 %99 %uint_0 - %102 = OpLoad %v2float %101 - OpStore %vPos %102 - %104 = OpLoad %uint %index - %106 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesA %uint_0 %104 %uint_1 - %107 = OpLoad %v2float %106 - OpStore %vVel %107 - OpStore %cMass %63 - OpStore %cVel %63 - OpStore %colVel %63 - OpStore %cMassCount %113 - OpStore %cVelCount %113 - OpStore %i %92 - OpBranch %120 - %120 = OpLabel - OpLoopMerge %121 %122 None - OpBranch %123 - %123 = OpLabel - %125 = OpLoad %uint %i - %126 = OpULessThan %bool %125 %uint_5 - %124 = OpLogicalNot %bool %126 - OpSelectionMerge %127 None - OpBranchConditional %124 %128 %127 - %128 = OpLabel - OpBranch %121 - %127 = OpLabel - %129 = OpLoad %uint %i - %130 = OpLoad %uint %index - %131 = OpIEqual %bool %129 %130 - OpSelectionMerge %132 None - OpBranchConditional %131 %133 %132 - %133 = OpLabel - OpBranch %122 - %132 = OpLabel - %134 = OpLoad %uint %i - %135 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesA %uint_0 %134 %uint_0 - %136 = OpLoad %v2float %135 - %137 = OpVectorShuffle %v2float %136 %136 0 1 - OpStore %pos_0 %137 - %138 = OpLoad %uint %i - %139 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesA %uint_0 %138 %uint_1 - %140 = OpLoad %v2float %139 - %141 = OpVectorShuffle %v2float %140 %140 0 1 - OpStore %vel %141 - %143 = OpLoad %v2float %pos_0 - %144 = OpLoad %v2float %vPos - %142 = OpExtInst %float %37 Distance %143 %144 - %146 = OpAccessChain %_ptr_Uniform_float %params %uint_1 - %147 = OpLoad %float %146 - %148 = OpFOrdLessThan %bool %142 %147 - OpSelectionMerge %149 None - OpBranchConditional %148 %150 %149 - %150 = OpLabel - %151 = OpLoad %v2float %cMass - %152 = OpLoad %v2float %pos_0 - %153 = OpFAdd %v2float %151 %152 - OpStore %cMass %153 - %154 = OpLoad %int %cMassCount - %156 = OpIAdd %int %154 %int_1 - OpStore %cMassCount %156 - OpBranch %149 - %149 = OpLabel - %158 = OpLoad %v2float %pos_0 - %159 = OpLoad %v2float %vPos - %157 = OpExtInst %float %37 Distance %158 %159 - %161 = OpAccessChain %_ptr_Uniform_float %params %uint_2 - %162 = OpLoad %float %161 - %163 = OpFOrdLessThan %bool %157 %162 - OpSelectionMerge %164 None - OpBranchConditional %163 %165 %164 - %165 = OpLabel - %166 = OpLoad %v2float %colVel - %167 = OpLoad %v2float %pos_0 - %168 = OpLoad %v2float %vPos - %169 = OpFSub %v2float %167 %168 - %170 = OpFSub %v2float %166 %169 - OpStore %colVel %170 - OpBranch %164 - %164 = OpLabel - %172 = OpLoad %v2float %pos_0 - %173 = OpLoad %v2float %vPos - %171 = OpExtInst %float %37 Distance %172 %173 - %175 = OpAccessChain %_ptr_Uniform_float %params %uint_3 - %176 = OpLoad %float %175 - %177 = OpFOrdLessThan %bool %171 %176 - OpSelectionMerge %178 None - OpBranchConditional %177 %179 %178 - %179 = OpLabel - %180 = OpLoad %v2float %cVel - %181 = OpLoad %v2float %vel - %182 = OpFAdd %v2float %180 %181 - OpStore %cVel %182 - %183 = OpLoad %int %cVelCount - %184 = OpIAdd %int %183 %int_1 - OpStore %cVelCount %184 - OpBranch %178 - %178 = OpLabel + %98 = OpLabel + %101 = OpLoad %uint %index + %103 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesA %uint_0 %uint_0 %101 %uint_0 + %104 = OpLoad %v2float %103 + OpStore %vPos %104 + %106 = OpLoad %uint %index + %108 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesA %uint_0 %uint_0 %106 %uint_1 + %109 = OpLoad %v2float %108 + OpStore %vVel %109 + OpStore %cMass %65 + OpStore %cVel %65 + OpStore %colVel %65 + OpStore %cMassCount %115 + OpStore %cVelCount %115 + OpStore %i %94 OpBranch %122 %122 = OpLabel - %185 = OpLoad %uint %i - %186 = OpIAdd %uint %185 %uint_1 - OpStore %i %186 - OpBranch %120 - %121 = OpLabel - %187 = OpLoad %int %cMassCount - %188 = OpSGreaterThan %bool %187 %113 - OpSelectionMerge %189 None - OpBranchConditional %188 %190 %189 - %190 = OpLabel - %191 = OpLoad %v2float %cMass - %193 = OpLoad %int %cMassCount - %192 = OpConvertSToF %float %193 + OpLoopMerge %123 %124 None + OpBranch %125 + %125 = OpLabel + %127 = OpLoad %uint %i + %128 = OpULessThan %bool %127 %uint_5 + %126 = OpLogicalNot %bool %128 + OpSelectionMerge %129 None + OpBranchConditional %126 %130 %129 + %130 = OpLabel + OpBranch %123 + %129 = OpLabel + %131 = OpLoad %uint %i + %132 = OpLoad %uint %index + %133 = OpIEqual %bool %131 %132 + OpSelectionMerge %134 None + OpBranchConditional %133 %135 %134 + %135 = OpLabel + OpBranch %124 + %134 = OpLabel + %136 = OpLoad %uint %i + %137 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesA %uint_0 %uint_0 %136 %uint_0 + %138 = OpLoad %v2float %137 + %139 = OpVectorShuffle %v2float %138 %138 0 1 + OpStore %pos_0 %139 + %140 = OpLoad %uint %i + %141 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesA %uint_0 %uint_0 %140 %uint_1 + %142 = OpLoad %v2float %141 + %143 = OpVectorShuffle %v2float %142 %142 0 1 + OpStore %vel %143 + %145 = OpLoad %v2float %pos_0 + %146 = OpLoad %v2float %vPos + %144 = OpExtInst %float %39 Distance %145 %146 + %148 = OpAccessChain %_ptr_Uniform_float %params %uint_0 %uint_1 + %149 = OpLoad %float %148 + %150 = OpFOrdLessThan %bool %144 %149 + OpSelectionMerge %151 None + OpBranchConditional %150 %152 %151 + %152 = OpLabel + %153 = OpLoad %v2float %cMass + %154 = OpLoad %v2float %pos_0 + %155 = OpFAdd %v2float %153 %154 + OpStore %cMass %155 + %156 = OpLoad %int %cMassCount + %158 = OpIAdd %int %156 %int_1 + OpStore %cMassCount %158 + OpBranch %151 + %151 = OpLabel + %160 = OpLoad %v2float %pos_0 + %161 = OpLoad %v2float %vPos + %159 = OpExtInst %float %39 Distance %160 %161 + %163 = OpAccessChain %_ptr_Uniform_float %params %uint_0 %uint_2 + %164 = OpLoad %float %163 + %165 = OpFOrdLessThan %bool %159 %164 + OpSelectionMerge %166 None + OpBranchConditional %165 %167 %166 + %167 = OpLabel + %168 = OpLoad %v2float %colVel + %169 = OpLoad %v2float %pos_0 + %170 = OpLoad %v2float %vPos + %171 = OpFSub %v2float %169 %170 + %172 = OpFSub %v2float %168 %171 + OpStore %colVel %172 + OpBranch %166 + %166 = OpLabel + %174 = OpLoad %v2float %pos_0 + %175 = OpLoad %v2float %vPos + %173 = OpExtInst %float %39 Distance %174 %175 + %177 = OpAccessChain %_ptr_Uniform_float %params %uint_0 %uint_3 + %178 = OpLoad %float %177 + %179 = OpFOrdLessThan %bool %173 %178 + OpSelectionMerge %180 None + OpBranchConditional %179 %181 %180 + %181 = OpLabel + %182 = OpLoad %v2float %cVel + %183 = OpLoad %v2float %vel + %184 = OpFAdd %v2float %182 %183 + OpStore %cVel %184 + %185 = OpLoad %int %cVelCount + %186 = OpIAdd %int %185 %int_1 + OpStore %cVelCount %186 + OpBranch %180 + %180 = OpLabel + OpBranch %124 + %124 = OpLabel + %187 = OpLoad %uint %i + %188 = OpIAdd %uint %187 %uint_1 + OpStore %i %188 + OpBranch %122 + %123 = OpLabel + %189 = OpLoad %int %cMassCount + %190 = OpSGreaterThan %bool %189 %115 + OpSelectionMerge %191 None + OpBranchConditional %190 %192 %191 + %192 = OpLabel + %193 = OpLoad %v2float %cMass %195 = OpLoad %int %cMassCount %194 = OpConvertSToF %float %195 - %196 = OpCompositeConstruct %v2float %192 %194 - %197 = OpFDiv %v2float %191 %196 - %198 = OpLoad %v2float %vPos - %199 = OpFSub %v2float %197 %198 - OpStore %cMass %199 - OpBranch %189 - %189 = OpLabel - %200 = OpLoad %int %cVelCount - %201 = OpSGreaterThan %bool %200 %113 - OpSelectionMerge %202 None - OpBranchConditional %201 %203 %202 - %203 = OpLabel - %204 = OpLoad %v2float %cVel - %206 = OpLoad %int %cVelCount - %205 = OpConvertSToF %float %206 + %197 = OpLoad %int %cMassCount + %196 = OpConvertSToF %float %197 + %198 = OpCompositeConstruct %v2float %194 %196 + %199 = OpFDiv %v2float %193 %198 + %200 = OpLoad %v2float %vPos + %201 = OpFSub %v2float %199 %200 + OpStore %cMass %201 + OpBranch %191 + %191 = OpLabel + %202 = OpLoad %int %cVelCount + %203 = OpSGreaterThan %bool %202 %115 + OpSelectionMerge %204 None + OpBranchConditional %203 %205 %204 + %205 = OpLabel + %206 = OpLoad %v2float %cVel %208 = OpLoad %int %cVelCount %207 = OpConvertSToF %float %208 - %209 = OpCompositeConstruct %v2float %205 %207 - %210 = OpFDiv %v2float %204 %209 - OpStore %cVel %210 - OpBranch %202 - %202 = OpLabel - %211 = OpLoad %v2float %vVel - %212 = OpLoad %v2float %cMass - %214 = OpAccessChain %_ptr_Uniform_float %params %uint_4 - %215 = OpLoad %float %214 - %216 = OpVectorTimesScalar %v2float %212 %215 - %217 = OpFAdd %v2float %211 %216 - %218 = OpLoad %v2float %colVel - %219 = OpAccessChain %_ptr_Uniform_float %params %uint_5 - %220 = OpLoad %float %219 - %221 = OpVectorTimesScalar %v2float %218 %220 - %222 = OpFAdd %v2float %217 %221 - %223 = OpLoad %v2float %cVel - %225 = OpAccessChain %_ptr_Uniform_float %params %uint_6 - %226 = OpLoad %float %225 - %227 = OpVectorTimesScalar %v2float %223 %226 - %228 = OpFAdd %v2float %222 %227 - OpStore %vVel %228 - %230 = OpLoad %v2float %vVel - %229 = OpExtInst %v2float %37 Normalize %230 - %233 = OpLoad %v2float %vVel - %232 = OpExtInst %float %37 Length %233 - %231 = OpExtInst %float %37 NClamp %232 %13 %float_0_100000001 - %235 = OpVectorTimesScalar %v2float %229 %231 - OpStore %vVel %235 - %236 = OpLoad %v2float %vPos - %237 = OpLoad %v2float %vVel - %238 = OpAccessChain %_ptr_Uniform_float %params %uint_0 - %239 = OpLoad %float %238 - %240 = OpVectorTimesScalar %v2float %237 %239 - %241 = OpFAdd %v2float %236 %240 - OpStore %vPos %241 - %242 = OpAccessChain %_ptr_Function_float %vPos %uint_0 - %243 = OpLoad %float %242 - %245 = OpFOrdLessThan %bool %243 %float_n1 - OpSelectionMerge %246 None - OpBranchConditional %245 %247 %246 - %247 = OpLabel - %248 = OpAccessChain %_ptr_Function_float %vPos %uint_0 - OpStore %248 %float_1 - OpBranch %246 - %246 = OpLabel - %249 = OpAccessChain %_ptr_Function_float %vPos %uint_0 - %250 = OpLoad %float %249 - %251 = OpFOrdGreaterThan %bool %250 %float_1 - OpSelectionMerge %252 None - OpBranchConditional %251 %253 %252 - %253 = OpLabel - %254 = OpAccessChain %_ptr_Function_float %vPos %uint_0 - OpStore %254 %float_n1 - OpBranch %252 - %252 = OpLabel - %255 = OpAccessChain %_ptr_Function_float %vPos %uint_1 - %256 = OpLoad %float %255 - %257 = OpFOrdLessThan %bool %256 %float_n1 - OpSelectionMerge %258 None - OpBranchConditional %257 %259 %258 - %259 = OpLabel - %260 = OpAccessChain %_ptr_Function_float %vPos %uint_1 - OpStore %260 %float_1 - OpBranch %258 - %258 = OpLabel - %261 = OpAccessChain %_ptr_Function_float %vPos %uint_1 - %262 = OpLoad %float %261 - %263 = OpFOrdGreaterThan %bool %262 %float_1 - OpSelectionMerge %264 None - OpBranchConditional %263 %265 %264 - %265 = OpLabel - %266 = OpAccessChain %_ptr_Function_float %vPos %uint_1 - OpStore %266 %float_n1 - OpBranch %264 - %264 = OpLabel - %267 = OpLoad %uint %index - %268 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesB %uint_0 %267 %uint_0 - %269 = OpLoad %v2float %vPos - OpStore %268 %269 - %270 = OpLoad %uint %index - %271 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesB %uint_0 %270 %uint_1 - %272 = OpLoad %v2float %vVel - OpStore %271 %272 + %210 = OpLoad %int %cVelCount + %209 = OpConvertSToF %float %210 + %211 = OpCompositeConstruct %v2float %207 %209 + %212 = OpFDiv %v2float %206 %211 + OpStore %cVel %212 + OpBranch %204 + %204 = OpLabel + %213 = OpLoad %v2float %vVel + %214 = OpLoad %v2float %cMass + %216 = OpAccessChain %_ptr_Uniform_float %params %uint_0 %uint_4 + %217 = OpLoad %float %216 + %218 = OpVectorTimesScalar %v2float %214 %217 + %219 = OpFAdd %v2float %213 %218 + %220 = OpLoad %v2float %colVel + %221 = OpAccessChain %_ptr_Uniform_float %params %uint_0 %uint_5 + %222 = OpLoad %float %221 + %223 = OpVectorTimesScalar %v2float %220 %222 + %224 = OpFAdd %v2float %219 %223 + %225 = OpLoad %v2float %cVel + %227 = OpAccessChain %_ptr_Uniform_float %params %uint_0 %uint_6 + %228 = OpLoad %float %227 + %229 = OpVectorTimesScalar %v2float %225 %228 + %230 = OpFAdd %v2float %224 %229 + OpStore %vVel %230 + %232 = OpLoad %v2float %vVel + %231 = OpExtInst %v2float %39 Normalize %232 + %235 = OpLoad %v2float %vVel + %234 = OpExtInst %float %39 Length %235 + %233 = OpExtInst %float %39 NClamp %234 %13 %float_0_100000001 + %237 = OpVectorTimesScalar %v2float %231 %233 + OpStore %vVel %237 + %238 = OpLoad %v2float %vPos + %239 = OpLoad %v2float %vVel + %240 = OpAccessChain %_ptr_Uniform_float %params %uint_0 %uint_0 + %241 = OpLoad %float %240 + %242 = OpVectorTimesScalar %v2float %239 %241 + %243 = OpFAdd %v2float %238 %242 + OpStore %vPos %243 + %244 = OpAccessChain %_ptr_Function_float %vPos %uint_0 + %245 = OpLoad %float %244 + %247 = OpFOrdLessThan %bool %245 %float_n1 + OpSelectionMerge %248 None + OpBranchConditional %247 %249 %248 + %249 = OpLabel + %250 = OpAccessChain %_ptr_Function_float %vPos %uint_0 + OpStore %250 %float_1 + OpBranch %248 + %248 = OpLabel + %251 = OpAccessChain %_ptr_Function_float %vPos %uint_0 + %252 = OpLoad %float %251 + %253 = OpFOrdGreaterThan %bool %252 %float_1 + OpSelectionMerge %254 None + OpBranchConditional %253 %255 %254 + %255 = OpLabel + %256 = OpAccessChain %_ptr_Function_float %vPos %uint_0 + OpStore %256 %float_n1 + OpBranch %254 + %254 = OpLabel + %257 = OpAccessChain %_ptr_Function_float %vPos %uint_1 + %258 = OpLoad %float %257 + %259 = OpFOrdLessThan %bool %258 %float_n1 + OpSelectionMerge %260 None + OpBranchConditional %259 %261 %260 + %261 = OpLabel + %262 = OpAccessChain %_ptr_Function_float %vPos %uint_1 + OpStore %262 %float_1 + OpBranch %260 + %260 = OpLabel + %263 = OpAccessChain %_ptr_Function_float %vPos %uint_1 + %264 = OpLoad %float %263 + %265 = OpFOrdGreaterThan %bool %264 %float_1 + OpSelectionMerge %266 None + OpBranchConditional %265 %267 %266 + %267 = OpLabel + %268 = OpAccessChain %_ptr_Function_float %vPos %uint_1 + OpStore %268 %float_n1 + OpBranch %266 + %266 = OpLabel + %269 = OpLoad %uint %index + %270 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesB %uint_0 %uint_0 %269 %uint_0 + %271 = OpLoad %v2float %vPos + OpStore %270 %271 + %272 = OpLoad %uint %index + %273 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesB %uint_0 %uint_0 %272 %uint_1 + %274 = OpLoad %v2float %vVel + OpStore %273 %274 OpReturn OpFunctionEnd - %comp_main = OpFunction %void None %70 - %274 = OpLabel - %276 = OpLoad %v3uint %gl_GlobalInvocationID_1 - %275 = OpFunctionCall %void %comp_main_inner %276 + %comp_main = OpFunction %void None %72 + %276 = OpLabel + %278 = OpLoad %v3uint %gl_GlobalInvocationID_1 + %277 = OpFunctionCall %void %comp_main_inner %278 OpReturn OpFunctionEnd diff --git a/test/tint/samples/cube.wgsl.expected.glsl b/test/tint/samples/cube.wgsl.expected.glsl index 4526aa73a6..4dd32747dc 100644 --- a/test/tint/samples/cube.wgsl.expected.glsl +++ b/test/tint/samples/cube.wgsl.expected.glsl @@ -3,8 +3,12 @@ layout(location = 0) in vec4 cur_position_1; layout(location = 1) in vec4 color_1; layout(location = 0) out vec4 vtxFragColor_1; -layout(binding = 0, std140) uniform Uniforms_ubo { +struct Uniforms { mat4 modelViewProjectionMatrix; +}; + +layout(binding = 0, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; struct VertexInput { @@ -19,7 +23,7 @@ struct VertexOutput { VertexOutput vtx_main(VertexInput tint_symbol) { VertexOutput tint_symbol_1 = VertexOutput(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f)); - tint_symbol_1.Position = (uniforms.modelViewProjectionMatrix * tint_symbol.cur_position); + tint_symbol_1.Position = (uniforms.inner.modelViewProjectionMatrix * tint_symbol.cur_position); tint_symbol_1.vtxFragColor = tint_symbol.color; return tint_symbol_1; } diff --git a/test/tint/samples/cube.wgsl.expected.spvasm b/test/tint/samples/cube.wgsl.expected.spvasm index cbbf88e1af..1dd38918e7 100644 --- a/test/tint/samples/cube.wgsl.expected.spvasm +++ b/test/tint/samples/cube.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 60 +; Bound: 61 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -15,6 +15,8 @@ OpName %vertex_point_size "vertex_point_size" OpName %fragColor_1 "fragColor_1" OpName %value "value" + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "modelViewProjectionMatrix" OpName %uniforms "uniforms" @@ -38,7 +40,8 @@ OpDecorate %vertex_point_size BuiltIn PointSize OpDecorate %fragColor_1 Location 0 OpDecorate %value Location 0 - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 0 ColMajor OpMemberDecorate %Uniforms 0 MatrixStride 16 @@ -65,60 +68,61 @@ %value = OpVariable %_ptr_Output_v4float Output %8 %mat4v4float = OpTypeMatrix %v4float 4 %Uniforms = OpTypeStruct %mat4v4float -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %VertexOutput = OpTypeStruct %v4float %v4float %VertexInput = OpTypeStruct %v4float %v4float - %19 = OpTypeFunction %VertexOutput %VertexInput + %20 = OpTypeFunction %VertexOutput %VertexInput %_ptr_Function_VertexOutput = OpTypePointer Function %VertexOutput - %27 = OpConstantNull %VertexOutput + %28 = OpConstantNull %VertexOutput %uint = OpTypeInt 32 0 %uint_1 = OpConstant %uint 1 %_ptr_Function_v4float = OpTypePointer Function %v4float %uint_0 = OpConstant %uint 0 %_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float %void = OpTypeVoid - %41 = OpTypeFunction %void + %42 = OpTypeFunction %void %float_1 = OpConstant %float 1 - %52 = OpTypeFunction %v4float %v4float -%vtx_main_inner = OpFunction %VertexOutput None %19 + %53 = OpTypeFunction %v4float %v4float +%vtx_main_inner = OpFunction %VertexOutput None %20 %input = OpFunctionParameter %VertexInput - %24 = OpLabel - %output = OpVariable %_ptr_Function_VertexOutput Function %27 - %31 = OpAccessChain %_ptr_Function_v4float %output %uint_1 - %34 = OpAccessChain %_ptr_Uniform_mat4v4float %uniforms %uint_0 - %35 = OpLoad %mat4v4float %34 - %36 = OpCompositeExtract %v4float %input 0 - %37 = OpMatrixTimesVector %v4float %35 %36 - OpStore %31 %37 - %38 = OpAccessChain %_ptr_Function_v4float %output %uint_0 - %39 = OpCompositeExtract %v4float %input 1 - OpStore %38 %39 - %40 = OpLoad %VertexOutput %output - OpReturnValue %40 + %25 = OpLabel + %output = OpVariable %_ptr_Function_VertexOutput Function %28 + %32 = OpAccessChain %_ptr_Function_v4float %output %uint_1 + %35 = OpAccessChain %_ptr_Uniform_mat4v4float %uniforms %uint_0 %uint_0 + %36 = OpLoad %mat4v4float %35 + %37 = OpCompositeExtract %v4float %input 0 + %38 = OpMatrixTimesVector %v4float %36 %37 + OpStore %32 %38 + %39 = OpAccessChain %_ptr_Function_v4float %output %uint_0 + %40 = OpCompositeExtract %v4float %input 1 + OpStore %39 %40 + %41 = OpLoad %VertexOutput %output + OpReturnValue %41 OpFunctionEnd - %vtx_main = OpFunction %void None %41 - %44 = OpLabel - %46 = OpLoad %v4float %cur_position_1 - %47 = OpLoad %v4float %color_1 - %48 = OpCompositeConstruct %VertexInput %46 %47 - %45 = OpFunctionCall %VertexOutput %vtx_main_inner %48 - %49 = OpCompositeExtract %v4float %45 0 - OpStore %vtxFragColor_1 %49 - %50 = OpCompositeExtract %v4float %45 1 - OpStore %Position_1 %50 + %vtx_main = OpFunction %void None %42 + %45 = OpLabel + %47 = OpLoad %v4float %cur_position_1 + %48 = OpLoad %v4float %color_1 + %49 = OpCompositeConstruct %VertexInput %47 %48 + %46 = OpFunctionCall %VertexOutput %vtx_main_inner %49 + %50 = OpCompositeExtract %v4float %46 0 + OpStore %vtxFragColor_1 %50 + %51 = OpCompositeExtract %v4float %46 1 + OpStore %Position_1 %51 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd -%frag_main_inner = OpFunction %v4float None %52 +%frag_main_inner = OpFunction %v4float None %53 %fragColor = OpFunctionParameter %v4float - %55 = OpLabel + %56 = OpLabel OpReturnValue %fragColor OpFunctionEnd - %frag_main = OpFunction %void None %41 - %57 = OpLabel - %59 = OpLoad %v4float %fragColor_1 - %58 = OpFunctionCall %v4float %frag_main_inner %59 - OpStore %value %58 + %frag_main = OpFunction %void None %42 + %58 = OpLabel + %60 = OpLoad %v4float %fragColor_1 + %59 = OpFunctionCall %v4float %frag_main_inner %60 + OpStore %value %59 OpReturn OpFunctionEnd diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.glsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.glsl index f5130acef6..5344aa6b66 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.glsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.glsl @@ -1,5 +1,12 @@ #version 310 es +struct Uniforms { + uint i; + uint pad; + uint pad_1; + uint pad_2; +}; + struct InnerS { int v; }; @@ -8,11 +15,8 @@ struct OuterS { InnerS a1[8]; }; -layout(binding = 4, std140) uniform Uniforms_ubo { - uint i; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 4, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; void tint_symbol() { @@ -20,7 +24,7 @@ void tint_symbol() { OuterS s1 = OuterS(InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0))); { for(int i = 0; (i < 4); i = (i + 1)) { - s1.a1[uniforms.i] = v; + s1.a1[uniforms.inner.i] = v; } } } diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.spvasm b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.spvasm index de7d64cfb8..ac68884969 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.spvasm +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_body.wgsl.expected.spvasm @@ -1,12 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 43 +; Bound: 44 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "i" OpName %uniforms "uniforms" @@ -18,7 +20,8 @@ OpMemberName %OuterS 0 "a1" OpName %s1 "s1" OpName %i "i" - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpDecorate %uniforms NonWritable OpDecorate %uniforms DescriptorSet 1 @@ -28,56 +31,57 @@ OpDecorate %_arr_InnerS_uint_8 ArrayStride 4 %uint = OpTypeInt 32 0 %Uniforms = OpTypeStruct %uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %int = OpTypeInt 32 1 %InnerS = OpTypeStruct %int %_ptr_Function_InnerS = OpTypePointer Function %InnerS - %13 = OpConstantNull %InnerS + %14 = OpConstantNull %InnerS %uint_8 = OpConstant %uint 8 %_arr_InnerS_uint_8 = OpTypeArray %InnerS %uint_8 %OuterS = OpTypeStruct %_arr_InnerS_uint_8 %_ptr_Function_OuterS = OpTypePointer Function %OuterS - %19 = OpConstantNull %OuterS - %20 = OpConstantNull %int + %20 = OpConstantNull %OuterS + %21 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %int_4 = OpConstant %int 4 %bool = OpTypeBool %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %int_1 = OpConstant %int 1 - %main = OpFunction %void None %5 - %8 = OpLabel - %v = OpVariable %_ptr_Function_InnerS Function %13 - %s1 = OpVariable %_ptr_Function_OuterS Function %19 - %i = OpVariable %_ptr_Function_int Function %20 - OpStore %i %20 - OpBranch %23 - %23 = OpLabel - OpLoopMerge %24 %25 None + %main = OpFunction %void None %6 + %9 = OpLabel + %v = OpVariable %_ptr_Function_InnerS Function %14 + %s1 = OpVariable %_ptr_Function_OuterS Function %20 + %i = OpVariable %_ptr_Function_int Function %21 + OpStore %i %21 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %29 = OpLoad %int %i + %31 = OpSLessThan %bool %29 %int_4 + %28 = OpLogicalNot %bool %31 + OpSelectionMerge %33 None + OpBranchConditional %28 %34 %33 + %34 = OpLabel + OpBranch %25 + %33 = OpLabel + %37 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %38 = OpLoad %uint %37 + %39 = OpAccessChain %_ptr_Function_InnerS %s1 %uint_0 %38 + %40 = OpLoad %InnerS %v + OpStore %39 %40 OpBranch %26 %26 = OpLabel - %28 = OpLoad %int %i - %30 = OpSLessThan %bool %28 %int_4 - %27 = OpLogicalNot %bool %30 - OpSelectionMerge %32 None - OpBranchConditional %27 %33 %32 - %33 = OpLabel + %41 = OpLoad %int %i + %43 = OpIAdd %int %41 %int_1 + OpStore %i %43 OpBranch %24 - %32 = OpLabel - %36 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %37 = OpLoad %uint %36 - %38 = OpAccessChain %_ptr_Function_InnerS %s1 %uint_0 %37 - %39 = OpLoad %InnerS %v - OpStore %38 %39 - OpBranch %25 %25 = OpLabel - %40 = OpLoad %int %i - %42 = OpIAdd %int %40 %int_1 - OpStore %i %42 - OpBranch %23 - %24 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.glsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.glsl index 81900b94db..b6ec97b623 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.glsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.glsl @@ -1,5 +1,12 @@ #version 310 es +struct Uniforms { + uint i; + uint pad; + uint pad_1; + uint pad_2; +}; + struct InnerS { int v; }; @@ -8,18 +15,15 @@ struct OuterS { InnerS a1[8]; }; -layout(binding = 4, std140) uniform Uniforms_ubo { - uint i; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 4, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; void tint_symbol() { InnerS v = InnerS(0); OuterS s1 = OuterS(InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0))); { - for(int i = 0; (i < 4); s1.a1[uniforms.i] = v) { + for(int i = 0; (i < 4); s1.a1[uniforms.inner.i] = v) { i = (i + 1); } } diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.spvasm b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.spvasm index 47cbb056cc..95980294c5 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.spvasm +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_continuing.wgsl.expected.spvasm @@ -1,12 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 43 +; Bound: 44 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "i" OpName %uniforms "uniforms" @@ -18,7 +20,8 @@ OpMemberName %OuterS 0 "a1" OpName %s1 "s1" OpName %i "i" - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpDecorate %uniforms NonWritable OpDecorate %uniforms DescriptorSet 1 @@ -28,56 +31,57 @@ OpDecorate %_arr_InnerS_uint_8 ArrayStride 4 %uint = OpTypeInt 32 0 %Uniforms = OpTypeStruct %uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %int = OpTypeInt 32 1 %InnerS = OpTypeStruct %int %_ptr_Function_InnerS = OpTypePointer Function %InnerS - %13 = OpConstantNull %InnerS + %14 = OpConstantNull %InnerS %uint_8 = OpConstant %uint 8 %_arr_InnerS_uint_8 = OpTypeArray %InnerS %uint_8 %OuterS = OpTypeStruct %_arr_InnerS_uint_8 %_ptr_Function_OuterS = OpTypePointer Function %OuterS - %19 = OpConstantNull %OuterS - %20 = OpConstantNull %int + %20 = OpConstantNull %OuterS + %21 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %int_4 = OpConstant %int 4 %bool = OpTypeBool %int_1 = OpConstant %int 1 %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint - %main = OpFunction %void None %5 - %8 = OpLabel - %v = OpVariable %_ptr_Function_InnerS Function %13 - %s1 = OpVariable %_ptr_Function_OuterS Function %19 - %i = OpVariable %_ptr_Function_int Function %20 - OpStore %i %20 - OpBranch %23 - %23 = OpLabel - OpLoopMerge %24 %25 None + %main = OpFunction %void None %6 + %9 = OpLabel + %v = OpVariable %_ptr_Function_InnerS Function %14 + %s1 = OpVariable %_ptr_Function_OuterS Function %20 + %i = OpVariable %_ptr_Function_int Function %21 + OpStore %i %21 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %29 = OpLoad %int %i + %31 = OpSLessThan %bool %29 %int_4 + %28 = OpLogicalNot %bool %31 + OpSelectionMerge %33 None + OpBranchConditional %28 %34 %33 + %34 = OpLabel + OpBranch %25 + %33 = OpLabel + %35 = OpLoad %int %i + %37 = OpIAdd %int %35 %int_1 + OpStore %i %37 OpBranch %26 %26 = OpLabel - %28 = OpLoad %int %i - %30 = OpSLessThan %bool %28 %int_4 - %27 = OpLogicalNot %bool %30 - OpSelectionMerge %32 None - OpBranchConditional %27 %33 %32 - %33 = OpLabel + %40 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %41 = OpLoad %uint %40 + %42 = OpAccessChain %_ptr_Function_InnerS %s1 %uint_0 %41 + %43 = OpLoad %InnerS %v + OpStore %42 %43 OpBranch %24 - %32 = OpLabel - %34 = OpLoad %int %i - %36 = OpIAdd %int %34 %int_1 - OpStore %i %36 - OpBranch %25 %25 = OpLabel - %39 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %40 = OpLoad %uint %39 - %41 = OpAccessChain %_ptr_Function_InnerS %s1 %uint_0 %40 - %42 = OpLoad %InnerS %v - OpStore %41 %42 - OpBranch %23 - %24 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.glsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.glsl index 39960c3448..5dedd3edbc 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.glsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.glsl @@ -1,5 +1,12 @@ #version 310 es +struct Uniforms { + uint i; + uint pad; + uint pad_1; + uint pad_2; +}; + struct InnerS { int v; }; @@ -8,11 +15,8 @@ struct OuterS { InnerS a1[8]; }; -layout(binding = 4, std140) uniform Uniforms_ubo { - uint i; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 4, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; void tint_symbol() { @@ -20,7 +24,7 @@ void tint_symbol() { OuterS s1 = OuterS(InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0))); int i = 0; { - for(s1.a1[uniforms.i] = v; (i < 4); i = (i + 1)) { + for(s1.a1[uniforms.inner.i] = v; (i < 4); i = (i + 1)) { } } } diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.spvasm b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.spvasm index e3e61dd652..c1a99d47ab 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.spvasm +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/in_for_loop_init.wgsl.expected.spvasm @@ -1,12 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 43 +; Bound: 44 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "i" OpName %uniforms "uniforms" @@ -18,7 +20,8 @@ OpMemberName %OuterS 0 "a1" OpName %s1 "s1" OpName %i "i" - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpDecorate %uniforms NonWritable OpDecorate %uniforms DescriptorSet 1 @@ -28,56 +31,57 @@ OpDecorate %_arr_InnerS_uint_8 ArrayStride 4 %uint = OpTypeInt 32 0 %Uniforms = OpTypeStruct %uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %int = OpTypeInt 32 1 %InnerS = OpTypeStruct %int %_ptr_Function_InnerS = OpTypePointer Function %InnerS - %13 = OpConstantNull %InnerS + %14 = OpConstantNull %InnerS %uint_8 = OpConstant %uint 8 %_arr_InnerS_uint_8 = OpTypeArray %InnerS %uint_8 %OuterS = OpTypeStruct %_arr_InnerS_uint_8 %_ptr_Function_OuterS = OpTypePointer Function %OuterS - %19 = OpConstantNull %OuterS - %20 = OpConstantNull %int + %20 = OpConstantNull %OuterS + %21 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %int_4 = OpConstant %int 4 %bool = OpTypeBool %int_1 = OpConstant %int 1 - %main = OpFunction %void None %5 - %8 = OpLabel - %v = OpVariable %_ptr_Function_InnerS Function %13 - %s1 = OpVariable %_ptr_Function_OuterS Function %19 - %i = OpVariable %_ptr_Function_int Function %20 - OpStore %i %20 - %25 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %26 = OpLoad %uint %25 - %27 = OpAccessChain %_ptr_Function_InnerS %s1 %uint_0 %26 - %28 = OpLoad %InnerS %v - OpStore %27 %28 - OpBranch %29 - %29 = OpLabel - OpLoopMerge %30 %31 None + %main = OpFunction %void None %6 + %9 = OpLabel + %v = OpVariable %_ptr_Function_InnerS Function %14 + %s1 = OpVariable %_ptr_Function_OuterS Function %20 + %i = OpVariable %_ptr_Function_int Function %21 + OpStore %i %21 + %26 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %27 = OpLoad %uint %26 + %28 = OpAccessChain %_ptr_Function_InnerS %s1 %uint_0 %27 + %29 = OpLoad %InnerS %v + OpStore %28 %29 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %35 = OpLoad %int %i + %37 = OpSLessThan %bool %35 %int_4 + %34 = OpLogicalNot %bool %37 + OpSelectionMerge %39 None + OpBranchConditional %34 %40 %39 + %40 = OpLabel + OpBranch %31 + %39 = OpLabel OpBranch %32 %32 = OpLabel - %34 = OpLoad %int %i - %36 = OpSLessThan %bool %34 %int_4 - %33 = OpLogicalNot %bool %36 - OpSelectionMerge %38 None - OpBranchConditional %33 %39 %38 - %39 = OpLabel + %41 = OpLoad %int %i + %43 = OpIAdd %int %41 %int_1 + OpStore %i %43 OpBranch %30 - %38 = OpLabel - OpBranch %31 %31 = OpLabel - %40 = OpLoad %int %i - %42 = OpIAdd %int %40 %int_1 - OpStore %i %42 - OpBranch %29 - %30 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl.expected.glsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl.expected.glsl index 4b1fbf935a..5be0805cb3 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl.expected.glsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl.expected.glsl @@ -1,5 +1,12 @@ #version 310 es +struct Uniforms { + uint i; + uint j; + uint pad; + uint pad_1; +}; + struct InnerS { int v; }; @@ -18,11 +25,8 @@ uint getNextIndex() { return nextIndex; } -layout(binding = 4, std140) uniform Uniforms_ubo { - uint i; - uint j; - uint pad; - uint pad_1; +layout(binding = 4, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; void tint_symbol() { @@ -30,7 +34,7 @@ void tint_symbol() { OuterS s = OuterS(S1[8](S1(InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0))), S1(InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0))), S1(InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0))), S1(InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0))), S1(InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0))), S1(InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0))), S1(InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0))), S1(InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0))))); InnerS tint_symbol_1 = v; uint tint_symbol_2 = getNextIndex(); - s.a1[tint_symbol_2].a2[uniforms.j] = tint_symbol_1; + s.a1[tint_symbol_2].a2[uniforms.inner.j] = tint_symbol_1; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl.expected.spvasm b/test/tint/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl.expected.spvasm index 526b6fac1a..a9aa39b1dd 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl.expected.spvasm +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/indexing_with_side_effect_func.wgsl.expected.spvasm @@ -1,13 +1,15 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 39 +; Bound: 40 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 OpName %nextIndex "nextIndex" + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "i" OpMemberName %Uniforms 1 "j" @@ -22,7 +24,8 @@ OpName %S1 "S1" OpMemberName %S1 0 "a2" OpName %s "s" - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 1 Offset 4 OpDecorate %uniforms NonWritable @@ -38,42 +41,43 @@ %4 = OpConstantNull %uint %nextIndex = OpVariable %_ptr_Private_uint Private %4 %Uniforms = OpTypeStruct %uint %uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform - %8 = OpTypeFunction %uint +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform + %9 = OpTypeFunction %uint %uint_1 = OpConstant %uint 1 %void = OpTypeVoid - %15 = OpTypeFunction %void + %16 = OpTypeFunction %void %int = OpTypeInt 32 1 %InnerS = OpTypeStruct %int %_ptr_Function_InnerS = OpTypePointer Function %InnerS - %23 = OpConstantNull %InnerS + %24 = OpConstantNull %InnerS %uint_8 = OpConstant %uint 8 %_arr_InnerS_uint_8 = OpTypeArray %InnerS %uint_8 %S1 = OpTypeStruct %_arr_InnerS_uint_8 %_arr_S1_uint_8 = OpTypeArray %S1 %uint_8 %OuterS = OpTypeStruct %_arr_S1_uint_8 %_ptr_Function_OuterS = OpTypePointer Function %OuterS - %31 = OpConstantNull %OuterS + %32 = OpConstantNull %OuterS %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint -%getNextIndex = OpFunction %uint None %8 - %10 = OpLabel - %11 = OpLoad %uint %nextIndex - %13 = OpIAdd %uint %11 %uint_1 - OpStore %nextIndex %13 - %14 = OpLoad %uint %nextIndex - OpReturnValue %14 +%getNextIndex = OpFunction %uint None %9 + %11 = OpLabel + %12 = OpLoad %uint %nextIndex + %14 = OpIAdd %uint %12 %uint_1 + OpStore %nextIndex %14 + %15 = OpLoad %uint %nextIndex + OpReturnValue %15 OpFunctionEnd - %main = OpFunction %void None %15 - %18 = OpLabel - %v = OpVariable %_ptr_Function_InnerS Function %23 - %s = OpVariable %_ptr_Function_OuterS Function %31 - %32 = OpLoad %InnerS %v - %33 = OpFunctionCall %uint %getNextIndex - %36 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %37 = OpLoad %uint %36 - %38 = OpAccessChain %_ptr_Function_InnerS %s %uint_0 %33 %uint_0 %37 - OpStore %38 %32 + %main = OpFunction %void None %16 + %19 = OpLabel + %v = OpVariable %_ptr_Function_InnerS Function %24 + %s = OpVariable %_ptr_Function_OuterS Function %32 + %33 = OpLoad %InnerS %v + %34 = OpFunctionCall %uint %getNextIndex + %37 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 + %38 = OpLoad %uint %37 + %39 = OpAccessChain %_ptr_Function_InnerS %s %uint_0 %34 %uint_0 %38 + OpStore %39 %33 OpReturn OpFunctionEnd diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl.expected.glsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl.expected.glsl index f617713020..1aab58e82e 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl.expected.glsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl.expected.glsl @@ -1,5 +1,12 @@ #version 310 es +struct Uniforms { + uint i; + uint pad; + uint pad_1; + uint pad_2; +}; + struct InnerS { int v; }; @@ -8,17 +15,14 @@ struct OuterS { InnerS a1[8]; }; -layout(binding = 4, std140) uniform Uniforms_ubo { - uint i; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 4, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; void tint_symbol() { InnerS v = InnerS(0); OuterS s1 = OuterS(InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0))); - s1.a1[uniforms.i] = v; + s1.a1[uniforms.inner.i] = v; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl.expected.spvasm b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl.expected.spvasm index 8507c70c66..7ae7fab1c1 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl.expected.spvasm +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array.wgsl.expected.spvasm @@ -1,12 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 26 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "i" OpName %uniforms "uniforms" @@ -17,7 +19,8 @@ OpName %OuterS "OuterS" OpMemberName %OuterS 0 "a1" OpName %s1 "s1" - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpDecorate %uniforms NonWritable OpDecorate %uniforms DescriptorSet 1 @@ -27,29 +30,30 @@ OpDecorate %_arr_InnerS_uint_8 ArrayStride 4 %uint = OpTypeInt 32 0 %Uniforms = OpTypeStruct %uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %int = OpTypeInt 32 1 %InnerS = OpTypeStruct %int %_ptr_Function_InnerS = OpTypePointer Function %InnerS - %13 = OpConstantNull %InnerS + %14 = OpConstantNull %InnerS %uint_8 = OpConstant %uint 8 %_arr_InnerS_uint_8 = OpTypeArray %InnerS %uint_8 %OuterS = OpTypeStruct %_arr_InnerS_uint_8 %_ptr_Function_OuterS = OpTypePointer Function %OuterS - %19 = OpConstantNull %OuterS + %20 = OpConstantNull %OuterS %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint - %main = OpFunction %void None %5 - %8 = OpLabel - %v = OpVariable %_ptr_Function_InnerS Function %13 - %s1 = OpVariable %_ptr_Function_OuterS Function %19 - %22 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %23 = OpLoad %uint %22 - %24 = OpAccessChain %_ptr_Function_InnerS %s1 %uint_0 %23 - %25 = OpLoad %InnerS %v - OpStore %24 %25 + %main = OpFunction %void None %6 + %9 = OpLabel + %v = OpVariable %_ptr_Function_InnerS Function %14 + %s1 = OpVariable %_ptr_Function_OuterS Function %20 + %23 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %24 = OpLoad %uint %23 + %25 = OpAccessChain %_ptr_Function_InnerS %s1 %uint_0 %24 + %26 = OpLoad %InnerS %v + OpStore %25 %26 OpReturn OpFunctionEnd diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl.expected.glsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl.expected.glsl index c636cfdfbc..4235699fb4 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl.expected.glsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl.expected.glsl @@ -1,5 +1,12 @@ #version 310 es +struct Uniforms { + uint i; + uint j; + uint pad; + uint pad_1; +}; + struct InnerS { int v; }; @@ -8,17 +15,14 @@ struct OuterS { InnerS a1[8][8]; }; -layout(binding = 4, std140) uniform Uniforms_ubo { - uint i; - uint j; - uint pad; - uint pad_1; +layout(binding = 4, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; void tint_symbol() { InnerS v = InnerS(0); OuterS s1 = OuterS(InnerS[8][8](InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0)), InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0)), InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0)), InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0)), InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0)), InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0)), InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0)), InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0)))); - s1.a1[uniforms.i][uniforms.j] = v; + s1.a1[uniforms.inner.i][uniforms.inner.j] = v; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl.expected.spvasm b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl.expected.spvasm index 18a14e5320..aa61d47f27 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl.expected.spvasm +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_array.wgsl.expected.spvasm @@ -1,12 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 30 +; Bound: 31 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "i" OpMemberName %Uniforms 1 "j" @@ -18,7 +20,8 @@ OpName %OuterS "OuterS" OpMemberName %OuterS 0 "a1" OpName %s1 "s1" - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 1 Offset 4 OpDecorate %uniforms NonWritable @@ -30,33 +33,34 @@ OpDecorate %_arr__arr_InnerS_uint_8_uint_8 ArrayStride 32 %uint = OpTypeInt 32 0 %Uniforms = OpTypeStruct %uint %uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %int = OpTypeInt 32 1 %InnerS = OpTypeStruct %int %_ptr_Function_InnerS = OpTypePointer Function %InnerS - %13 = OpConstantNull %InnerS + %14 = OpConstantNull %InnerS %uint_8 = OpConstant %uint 8 %_arr_InnerS_uint_8 = OpTypeArray %InnerS %uint_8 %_arr__arr_InnerS_uint_8_uint_8 = OpTypeArray %_arr_InnerS_uint_8 %uint_8 %OuterS = OpTypeStruct %_arr__arr_InnerS_uint_8_uint_8 %_ptr_Function_OuterS = OpTypePointer Function %OuterS - %20 = OpConstantNull %OuterS + %21 = OpConstantNull %OuterS %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %uint_1 = OpConstant %uint 1 - %main = OpFunction %void None %5 - %8 = OpLabel - %v = OpVariable %_ptr_Function_InnerS Function %13 - %s1 = OpVariable %_ptr_Function_OuterS Function %20 - %23 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %24 = OpLoad %uint %23 - %26 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %27 = OpLoad %uint %26 - %28 = OpAccessChain %_ptr_Function_InnerS %s1 %uint_0 %24 %27 - %29 = OpLoad %InnerS %v - OpStore %28 %29 + %main = OpFunction %void None %6 + %9 = OpLabel + %v = OpVariable %_ptr_Function_InnerS Function %14 + %s1 = OpVariable %_ptr_Function_OuterS Function %21 + %24 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %25 = OpLoad %uint %24 + %27 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 + %28 = OpLoad %uint %27 + %29 = OpAccessChain %_ptr_Function_InnerS %s1 %uint_0 %25 %28 + %30 = OpLoad %InnerS %v + OpStore %29 %30 OpReturn OpFunctionEnd diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl.expected.glsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl.expected.glsl index 46ad319bf0..06a2fe114b 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl.expected.glsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl.expected.glsl @@ -1,5 +1,12 @@ #version 310 es +struct Uniforms { + uint i; + uint pad; + uint pad_1; + uint pad_2; +}; + struct InnerS { int v; }; @@ -12,17 +19,14 @@ struct OuterS { S1 a1[8]; }; -layout(binding = 4, std140) uniform Uniforms_ubo { - uint i; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 4, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; void tint_symbol() { InnerS v = InnerS(0); OuterS s1 = OuterS(S1[8](S1(InnerS(0)), S1(InnerS(0)), S1(InnerS(0)), S1(InnerS(0)), S1(InnerS(0)), S1(InnerS(0)), S1(InnerS(0)), S1(InnerS(0)))); - s1.a1[uniforms.i].s2 = v; + s1.a1[uniforms.inner.i].s2 = v; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl.expected.spvasm b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl.expected.spvasm index 2b16c9be57..f9ef9c4ac9 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl.expected.spvasm +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct.wgsl.expected.spvasm @@ -1,12 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 27 +; Bound: 28 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "i" OpName %uniforms "uniforms" @@ -19,7 +21,8 @@ OpName %S1 "S1" OpMemberName %S1 0 "s2" OpName %s1 "s1" - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpDecorate %uniforms NonWritable OpDecorate %uniforms DescriptorSet 1 @@ -30,30 +33,31 @@ OpDecorate %_arr_S1_uint_8 ArrayStride 4 %uint = OpTypeInt 32 0 %Uniforms = OpTypeStruct %uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %int = OpTypeInt 32 1 %InnerS = OpTypeStruct %int %_ptr_Function_InnerS = OpTypePointer Function %InnerS - %13 = OpConstantNull %InnerS + %14 = OpConstantNull %InnerS %S1 = OpTypeStruct %InnerS %uint_8 = OpConstant %uint 8 %_arr_S1_uint_8 = OpTypeArray %S1 %uint_8 %OuterS = OpTypeStruct %_arr_S1_uint_8 %_ptr_Function_OuterS = OpTypePointer Function %OuterS - %20 = OpConstantNull %OuterS + %21 = OpConstantNull %OuterS %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint - %main = OpFunction %void None %5 - %8 = OpLabel - %v = OpVariable %_ptr_Function_InnerS Function %13 - %s1 = OpVariable %_ptr_Function_OuterS Function %20 - %23 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %24 = OpLoad %uint %23 - %25 = OpAccessChain %_ptr_Function_InnerS %s1 %uint_0 %24 %uint_0 - %26 = OpLoad %InnerS %v - OpStore %25 %26 + %main = OpFunction %void None %6 + %9 = OpLabel + %v = OpVariable %_ptr_Function_InnerS Function %14 + %s1 = OpVariable %_ptr_Function_OuterS Function %21 + %24 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %25 = OpLoad %uint %24 + %26 = OpAccessChain %_ptr_Function_InnerS %s1 %uint_0 %25 %uint_0 + %27 = OpLoad %InnerS %v + OpStore %26 %27 OpReturn OpFunctionEnd diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl.expected.glsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl.expected.glsl index ae7e1f6849..7859a43c94 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl.expected.glsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl.expected.glsl @@ -1,5 +1,12 @@ #version 310 es +struct Uniforms { + uint i; + uint j; + uint pad; + uint pad_1; +}; + struct InnerS { int v; }; @@ -12,17 +19,14 @@ struct OuterS { S1 a1[8]; }; -layout(binding = 4, std140) uniform Uniforms_ubo { - uint i; - uint j; - uint pad; - uint pad_1; +layout(binding = 4, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; void tint_symbol() { InnerS v = InnerS(0); OuterS s = OuterS(S1[8](S1(InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0))), S1(InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0))), S1(InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0))), S1(InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0))), S1(InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0))), S1(InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0))), S1(InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0))), S1(InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0))))); - s.a1[uniforms.i].a2[uniforms.j] = v; + s.a1[uniforms.inner.i].a2[uniforms.inner.j] = v; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl.expected.spvasm b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl.expected.spvasm index 85b4009803..e7e2abd70b 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl.expected.spvasm +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_array_struct_array.wgsl.expected.spvasm @@ -1,12 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 31 +; Bound: 32 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "i" OpMemberName %Uniforms 1 "j" @@ -20,7 +22,8 @@ OpName %S1 "S1" OpMemberName %S1 0 "a2" OpName %s "s" - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 1 Offset 4 OpDecorate %uniforms NonWritable @@ -33,34 +36,35 @@ OpDecorate %_arr_S1_uint_8 ArrayStride 32 %uint = OpTypeInt 32 0 %Uniforms = OpTypeStruct %uint %uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %int = OpTypeInt 32 1 %InnerS = OpTypeStruct %int %_ptr_Function_InnerS = OpTypePointer Function %InnerS - %13 = OpConstantNull %InnerS + %14 = OpConstantNull %InnerS %uint_8 = OpConstant %uint 8 %_arr_InnerS_uint_8 = OpTypeArray %InnerS %uint_8 %S1 = OpTypeStruct %_arr_InnerS_uint_8 %_arr_S1_uint_8 = OpTypeArray %S1 %uint_8 %OuterS = OpTypeStruct %_arr_S1_uint_8 %_ptr_Function_OuterS = OpTypePointer Function %OuterS - %21 = OpConstantNull %OuterS + %22 = OpConstantNull %OuterS %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %uint_1 = OpConstant %uint 1 - %main = OpFunction %void None %5 - %8 = OpLabel - %v = OpVariable %_ptr_Function_InnerS Function %13 - %s = OpVariable %_ptr_Function_OuterS Function %21 - %24 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %25 = OpLoad %uint %24 - %27 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %28 = OpLoad %uint %27 - %29 = OpAccessChain %_ptr_Function_InnerS %s %uint_0 %25 %uint_0 %28 - %30 = OpLoad %InnerS %v - OpStore %29 %30 + %main = OpFunction %void None %6 + %9 = OpLabel + %v = OpVariable %_ptr_Function_InnerS Function %14 + %s = OpVariable %_ptr_Function_OuterS Function %22 + %25 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %26 = OpLoad %uint %25 + %28 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 + %29 = OpLoad %uint %28 + %30 = OpAccessChain %_ptr_Function_InnerS %s %uint_0 %26 %uint_0 %29 + %31 = OpLoad %InnerS %v + OpStore %30 %31 OpReturn OpFunctionEnd diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.glsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.glsl index 3ad5adb504..94f69b8395 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.glsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array.wgsl.expected.glsl @@ -1,14 +1,18 @@ #version 310 es +struct Uniforms { + uint i; + uint pad; + uint pad_1; + uint pad_2; +}; + struct InnerS { int v; }; -layout(binding = 4, std140) uniform Uniforms_ubo { - uint i; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 4, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; layout(binding = 0, std430) buffer OuterS_ssbo { @@ -17,7 +21,7 @@ layout(binding = 0, std430) buffer OuterS_ssbo { void tint_symbol() { InnerS v = InnerS(0); - s1.a1[uniforms.i] = v; + s1.a1[uniforms.inner.i] = v; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; 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 f974ffac47..933984ec38 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,12 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 25 +; Bound: 26 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "i" OpName %uniforms "uniforms" @@ -17,7 +19,8 @@ OpName %s1 "s1" OpName %main "main" OpName %v "v" - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpDecorate %uniforms NonWritable OpDecorate %uniforms DescriptorSet 1 @@ -30,8 +33,9 @@ OpDecorate %s1 DescriptorSet 0 %uint = OpTypeInt 32 0 %Uniforms = OpTypeStruct %uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %int = OpTypeInt 32 1 %InnerS = OpTypeStruct %int %_runtimearr_InnerS = OpTypeRuntimeArray %InnerS @@ -39,19 +43,19 @@ %_ptr_StorageBuffer_OuterS = OpTypePointer StorageBuffer %OuterS %s1 = OpVariable %_ptr_StorageBuffer_OuterS StorageBuffer %void = OpTypeVoid - %11 = OpTypeFunction %void + %12 = OpTypeFunction %void %_ptr_Function_InnerS = OpTypePointer Function %InnerS - %17 = OpConstantNull %InnerS + %18 = OpConstantNull %InnerS %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_StorageBuffer_InnerS = OpTypePointer StorageBuffer %InnerS - %main = OpFunction %void None %11 - %14 = OpLabel - %v = OpVariable %_ptr_Function_InnerS Function %17 - %20 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %21 = OpLoad %uint %20 - %23 = OpAccessChain %_ptr_StorageBuffer_InnerS %s1 %uint_0 %21 - %24 = OpLoad %InnerS %v - OpStore %23 %24 + %main = OpFunction %void None %12 + %15 = OpLabel + %v = OpVariable %_ptr_Function_InnerS Function %18 + %21 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %22 = OpLoad %uint %21 + %24 = OpAccessChain %_ptr_StorageBuffer_InnerS %s1 %uint_0 %22 + %25 = OpLoad %InnerS %v + OpStore %24 %25 OpReturn OpFunctionEnd diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.glsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.glsl index 9b35005670..9d90f312db 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.glsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_dynamic_array_struct_array.wgsl.expected.glsl @@ -1,5 +1,12 @@ #version 310 es +struct Uniforms { + uint i; + uint j; + uint pad; + uint pad_1; +}; + struct InnerS { int v; }; @@ -8,11 +15,8 @@ struct S1 { InnerS a2[8]; }; -layout(binding = 4, std140) uniform Uniforms_ubo { - uint i; - uint j; - uint pad; - uint pad_1; +layout(binding = 4, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; layout(binding = 0, std430) buffer OuterS_ssbo { @@ -21,7 +25,7 @@ layout(binding = 0, std430) buffer OuterS_ssbo { void tint_symbol() { InnerS v = InnerS(0); - s.a1[uniforms.i].a2[uniforms.j] = v; + s.a1[uniforms.inner.i].a2[uniforms.inner.j] = v; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; 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 dcaad5fc74..504825bc9d 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,12 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 31 +; Bound: 32 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "i" OpMemberName %Uniforms 1 "j" @@ -20,7 +22,8 @@ OpName %s "s" OpName %main "main" OpName %v "v" - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpMemberDecorate %Uniforms 1 Offset 4 OpDecorate %uniforms NonWritable @@ -36,8 +39,9 @@ OpDecorate %s DescriptorSet 0 %uint = OpTypeInt 32 0 %Uniforms = OpTypeStruct %uint %uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %int = OpTypeInt 32 1 %InnerS = OpTypeStruct %int %uint_8 = OpConstant %uint 8 @@ -48,22 +52,22 @@ %_ptr_StorageBuffer_OuterS = OpTypePointer StorageBuffer %OuterS %s = OpVariable %_ptr_StorageBuffer_OuterS StorageBuffer %void = OpTypeVoid - %14 = OpTypeFunction %void + %15 = OpTypeFunction %void %_ptr_Function_InnerS = OpTypePointer Function %InnerS - %20 = OpConstantNull %InnerS + %21 = OpConstantNull %InnerS %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %uint_1 = OpConstant %uint 1 %_ptr_StorageBuffer_InnerS = OpTypePointer StorageBuffer %InnerS - %main = OpFunction %void None %14 - %17 = OpLabel - %v = OpVariable %_ptr_Function_InnerS Function %20 - %23 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %24 = OpLoad %uint %23 - %26 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1 - %27 = OpLoad %uint %26 - %29 = OpAccessChain %_ptr_StorageBuffer_InnerS %s %uint_0 %24 %uint_0 %27 - %30 = OpLoad %InnerS %v - OpStore %29 %30 + %main = OpFunction %void None %15 + %18 = OpLabel + %v = OpVariable %_ptr_Function_InnerS Function %21 + %24 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %25 = OpLoad %uint %24 + %27 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 + %28 = OpLoad %uint %27 + %30 = OpAccessChain %_ptr_StorageBuffer_InnerS %s %uint_0 %25 %uint_0 %28 + %31 = OpLoad %InnerS %v + OpStore %30 %31 OpReturn OpFunctionEnd diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.glsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.glsl index 049e650811..8686a5fc45 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.glsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.glsl @@ -1,20 +1,24 @@ #version 310 es +struct Uniforms { + uint i; + uint pad; + uint pad_1; + uint pad_2; +}; + struct OuterS { mat2x4 m1; }; -layout(binding = 4, std140) uniform Uniforms_ubo { - uint i; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 4, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; void tint_symbol() { OuterS s1 = OuterS(mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); - s1.m1[uniforms.i] = vec4(1.0f); - s1.m1[uniforms.i][uniforms.i] = 1.0f; + s1.m1[uniforms.inner.i] = vec4(1.0f); + s1.m1[uniforms.inner.i][uniforms.inner.i] = 1.0f; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.spvasm b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.spvasm index 1333aeb6c1..06951576ab 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.spvasm +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_matrix.wgsl.expected.spvasm @@ -1,12 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 30 +; Bound: 31 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "i" OpName %uniforms "uniforms" @@ -14,7 +16,8 @@ OpName %OuterS "OuterS" OpMemberName %OuterS 0 "m1" OpName %s1 "s1" - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpDecorate %uniforms NonWritable OpDecorate %uniforms DescriptorSet 1 @@ -24,34 +27,35 @@ OpMemberDecorate %OuterS 0 MatrixStride 16 %uint = OpTypeInt 32 0 %Uniforms = OpTypeStruct %uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 %mat2v4float = OpTypeMatrix %v4float 2 %OuterS = OpTypeStruct %mat2v4float %_ptr_Function_OuterS = OpTypePointer Function %OuterS - %15 = OpConstantNull %OuterS + %16 = OpConstantNull %OuterS %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Function_v4float = OpTypePointer Function %v4float %float_1 = OpConstant %float 1 - %23 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %24 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 %_ptr_Function_float = OpTypePointer Function %float - %main = OpFunction %void None %5 - %8 = OpLabel - %s1 = OpVariable %_ptr_Function_OuterS Function %15 - %18 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %19 = OpLoad %uint %18 - %21 = OpAccessChain %_ptr_Function_v4float %s1 %uint_0 %19 - OpStore %21 %23 - %24 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %25 = OpLoad %uint %24 - %26 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %27 = OpLoad %uint %26 - %29 = OpAccessChain %_ptr_Function_float %s1 %uint_0 %25 %27 - OpStore %29 %float_1 + %main = OpFunction %void None %6 + %9 = OpLabel + %s1 = OpVariable %_ptr_Function_OuterS Function %16 + %19 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %20 = OpLoad %uint %19 + %22 = OpAccessChain %_ptr_Function_v4float %s1 %uint_0 %20 + OpStore %22 %24 + %25 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %26 = OpLoad %uint %25 + %27 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %28 = OpLoad %uint %27 + %30 = OpAccessChain %_ptr_Function_float %s1 %uint_0 %26 %28 + OpStore %30 %float_1 OpReturn OpFunctionEnd diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl.expected.glsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl.expected.glsl index 6a2e306893..3b324c2a97 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl.expected.glsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl.expected.glsl @@ -1,5 +1,12 @@ #version 310 es +struct Uniforms { + uint i; + uint pad; + uint pad_1; + uint pad_2; +}; + struct InnerS { int v; }; @@ -9,18 +16,15 @@ struct OuterS { InnerS a2[8]; }; -layout(binding = 4, std140) uniform Uniforms_ubo { - uint i; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 4, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; void tint_symbol() { InnerS v = InnerS(0); OuterS s1 = OuterS(InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0)), InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0))); - s1.a1[uniforms.i] = v; - s1.a2[uniforms.i] = v; + s1.a1[uniforms.inner.i] = v; + s1.a2[uniforms.inner.i] = v; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl.expected.spvasm b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl.expected.spvasm index 7f0b5d5469..e2172a86d3 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl.expected.spvasm +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_multiple_arrays.wgsl.expected.spvasm @@ -1,12 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 31 +; Bound: 32 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "i" OpName %uniforms "uniforms" @@ -18,7 +20,8 @@ OpMemberName %OuterS 0 "a1" OpMemberName %OuterS 1 "a2" OpName %s1 "s1" - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpDecorate %uniforms NonWritable OpDecorate %uniforms DescriptorSet 1 @@ -29,35 +32,36 @@ OpMemberDecorate %OuterS 1 Offset 32 %uint = OpTypeInt 32 0 %Uniforms = OpTypeStruct %uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %int = OpTypeInt 32 1 %InnerS = OpTypeStruct %int %_ptr_Function_InnerS = OpTypePointer Function %InnerS - %13 = OpConstantNull %InnerS + %14 = OpConstantNull %InnerS %uint_8 = OpConstant %uint 8 %_arr_InnerS_uint_8 = OpTypeArray %InnerS %uint_8 %OuterS = OpTypeStruct %_arr_InnerS_uint_8 %_arr_InnerS_uint_8 %_ptr_Function_OuterS = OpTypePointer Function %OuterS - %19 = OpConstantNull %OuterS + %20 = OpConstantNull %OuterS %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %uint_1 = OpConstant %uint 1 - %main = OpFunction %void None %5 - %8 = OpLabel - %v = OpVariable %_ptr_Function_InnerS Function %13 - %s1 = OpVariable %_ptr_Function_OuterS Function %19 - %22 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %23 = OpLoad %uint %22 - %24 = OpAccessChain %_ptr_Function_InnerS %s1 %uint_0 %23 - %25 = OpLoad %InnerS %v - OpStore %24 %25 - %27 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %28 = OpLoad %uint %27 - %29 = OpAccessChain %_ptr_Function_InnerS %s1 %uint_1 %28 - %30 = OpLoad %InnerS %v - OpStore %29 %30 + %main = OpFunction %void None %6 + %9 = OpLabel + %v = OpVariable %_ptr_Function_InnerS Function %14 + %s1 = OpVariable %_ptr_Function_OuterS Function %20 + %23 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %24 = OpLoad %uint %23 + %25 = OpAccessChain %_ptr_Function_InnerS %s1 %uint_0 %24 + %26 = OpLoad %InnerS %v + OpStore %25 %26 + %28 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %29 = OpLoad %uint %28 + %30 = OpAccessChain %_ptr_Function_InnerS %s1 %uint_1 %29 + %31 = OpLoad %InnerS %v + OpStore %30 %31 OpReturn OpFunctionEnd diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl.expected.glsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl.expected.glsl index 02e5a528e0..02a481b12f 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl.expected.glsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl.expected.glsl @@ -1,5 +1,12 @@ #version 310 es +struct Uniforms { + uint i; + uint pad; + uint pad_1; + uint pad_2; +}; + struct InnerS { int v; }; @@ -12,17 +19,14 @@ struct OuterS { S1 s2; }; -layout(binding = 4, std140) uniform Uniforms_ubo { - uint i; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 4, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; void tint_symbol() { InnerS v = InnerS(0); OuterS s1 = OuterS(S1(InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0)))); - s1.s2.a[uniforms.i] = v; + s1.s2.a[uniforms.inner.i] = v; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl.expected.spvasm b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl.expected.spvasm index 9c0f206172..bb7e2d4677 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl.expected.spvasm +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_struct_array.wgsl.expected.spvasm @@ -1,12 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 27 +; Bound: 28 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "i" OpName %uniforms "uniforms" @@ -19,7 +21,8 @@ OpName %S1 "S1" OpMemberName %S1 0 "a" OpName %s1 "s1" - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpDecorate %uniforms NonWritable OpDecorate %uniforms DescriptorSet 1 @@ -30,30 +33,31 @@ OpDecorate %_arr_InnerS_uint_8 ArrayStride 4 %uint = OpTypeInt 32 0 %Uniforms = OpTypeStruct %uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %int = OpTypeInt 32 1 %InnerS = OpTypeStruct %int %_ptr_Function_InnerS = OpTypePointer Function %InnerS - %13 = OpConstantNull %InnerS + %14 = OpConstantNull %InnerS %uint_8 = OpConstant %uint 8 %_arr_InnerS_uint_8 = OpTypeArray %InnerS %uint_8 %S1 = OpTypeStruct %_arr_InnerS_uint_8 %OuterS = OpTypeStruct %S1 %_ptr_Function_OuterS = OpTypePointer Function %OuterS - %20 = OpConstantNull %OuterS + %21 = OpConstantNull %OuterS %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint - %main = OpFunction %void None %5 - %8 = OpLabel - %v = OpVariable %_ptr_Function_InnerS Function %13 - %s1 = OpVariable %_ptr_Function_OuterS Function %20 - %23 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %24 = OpLoad %uint %23 - %25 = OpAccessChain %_ptr_Function_InnerS %s1 %uint_0 %uint_0 %24 - %26 = OpLoad %InnerS %v - OpStore %25 %26 + %main = OpFunction %void None %6 + %9 = OpLabel + %v = OpVariable %_ptr_Function_InnerS Function %14 + %s1 = OpVariable %_ptr_Function_OuterS Function %21 + %24 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %25 = OpLoad %uint %24 + %26 = OpAccessChain %_ptr_Function_InnerS %s1 %uint_0 %uint_0 %25 + %27 = OpLoad %InnerS %v + OpStore %26 %27 OpReturn OpFunctionEnd diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.glsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.glsl index b2fc18cc0f..a2093e89a3 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.glsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.glsl @@ -1,19 +1,23 @@ #version 310 es +struct Uniforms { + uint i; + uint pad; + uint pad_1; + uint pad_2; +}; + struct OuterS { vec3 v1; }; -layout(binding = 4, std140) uniform Uniforms_ubo { - uint i; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 4, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; void tint_symbol() { OuterS s1 = OuterS(vec3(0.0f, 0.0f, 0.0f)); - s1.v1[uniforms.i] = 1.0f; + s1.v1[uniforms.inner.i] = 1.0f; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.spvasm b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.spvasm index 677b550a19..25159120ed 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.spvasm +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/struct_vector.wgsl.expected.spvasm @@ -1,12 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 22 +; Bound: 23 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "i" OpName %uniforms "uniforms" @@ -14,7 +16,8 @@ OpName %OuterS "OuterS" OpMemberName %OuterS 0 "v1" OpName %s1 "s1" - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpDecorate %uniforms NonWritable OpDecorate %uniforms DescriptorSet 1 @@ -22,25 +25,26 @@ OpMemberDecorate %OuterS 0 Offset 0 %uint = OpTypeInt 32 0 %Uniforms = OpTypeStruct %uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %float = OpTypeFloat 32 %v3float = OpTypeVector %float 3 %OuterS = OpTypeStruct %v3float %_ptr_Function_OuterS = OpTypePointer Function %OuterS - %14 = OpConstantNull %OuterS + %15 = OpConstantNull %OuterS %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Function_float = OpTypePointer Function %float %float_1 = OpConstant %float 1 - %main = OpFunction %void None %5 - %8 = OpLabel - %s1 = OpVariable %_ptr_Function_OuterS Function %14 - %17 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %18 = OpLoad %uint %17 - %20 = OpAccessChain %_ptr_Function_float %s1 %uint_0 %18 - OpStore %20 %float_1 + %main = OpFunction %void None %6 + %9 = OpLabel + %s1 = OpVariable %_ptr_Function_OuterS Function %15 + %18 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %19 = OpLoad %uint %18 + %21 = OpAccessChain %_ptr_Function_float %s1 %uint_0 %19 + OpStore %21 %float_1 OpReturn OpFunctionEnd diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.glsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.glsl index d8898da978..1c5886b50d 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.glsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.glsl @@ -1,14 +1,18 @@ #version 310 es +struct Uniforms { + uint i; + uint pad; + uint pad_1; + uint pad_2; +}; + struct OuterS { uint a1[8]; }; -layout(binding = 4, std140) uniform Uniforms_ubo { - uint i; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 4, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; uint f(uint i) { @@ -18,8 +22,8 @@ uint f(uint i) { void tint_symbol() { OuterS s1 = OuterS(uint[8](0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u)); vec3 v = vec3(0.0f, 0.0f, 0.0f); - v[s1.a1[uniforms.i]] = 1.0f; - uint tint_symbol_1 = f(s1.a1[uniforms.i]); + v[s1.a1[uniforms.inner.i]] = 1.0f; + uint tint_symbol_1 = f(s1.a1[uniforms.inner.i]); v[tint_symbol_1] = 1.0f; } diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.spvasm b/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.spvasm index 329d21a6b5..aef87cbdc7 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.spvasm +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/vector_assign.wgsl.expected.spvasm @@ -1,12 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 42 +; Bound: 43 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "i" OpName %uniforms "uniforms" @@ -17,7 +19,8 @@ OpMemberName %OuterS 0 "a1" OpName %s1 "s1" OpName %v "v" - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpDecorate %uniforms NonWritable OpDecorate %uniforms DescriptorSet 1 @@ -26,48 +29,49 @@ OpDecorate %_arr_uint_uint_8 ArrayStride 4 %uint = OpTypeInt 32 0 %Uniforms = OpTypeStruct %uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform - %5 = OpTypeFunction %uint %uint +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform + %6 = OpTypeFunction %uint %uint %uint_1 = OpConstant %uint 1 %void = OpTypeVoid - %11 = OpTypeFunction %void + %12 = OpTypeFunction %void %uint_8 = OpConstant %uint 8 %_arr_uint_uint_8 = OpTypeArray %uint %uint_8 %OuterS = OpTypeStruct %_arr_uint_uint_8 %_ptr_Function_OuterS = OpTypePointer Function %OuterS - %20 = OpConstantNull %OuterS + %21 = OpConstantNull %OuterS %float = OpTypeFloat 32 %v3float = OpTypeVector %float 3 %_ptr_Function_v3float = OpTypePointer Function %v3float - %25 = OpConstantNull %v3float + %26 = OpConstantNull %v3float %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint %_ptr_Function_uint = OpTypePointer Function %uint %_ptr_Function_float = OpTypePointer Function %float %float_1 = OpConstant %float 1 - %f = OpFunction %uint None %5 + %f = OpFunction %uint None %6 %i = OpFunctionParameter %uint - %8 = OpLabel - %10 = OpIAdd %uint %i %uint_1 - OpReturnValue %10 + %9 = OpLabel + %11 = OpIAdd %uint %i %uint_1 + OpReturnValue %11 OpFunctionEnd - %main = OpFunction %void None %11 - %14 = OpLabel - %s1 = OpVariable %_ptr_Function_OuterS Function %20 - %v = OpVariable %_ptr_Function_v3float Function %25 - %28 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %29 = OpLoad %uint %28 - %31 = OpAccessChain %_ptr_Function_uint %s1 %uint_0 %29 - %32 = OpLoad %uint %31 - %34 = OpAccessChain %_ptr_Function_float %v %32 - OpStore %34 %float_1 - %37 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %38 = OpLoad %uint %37 - %39 = OpAccessChain %_ptr_Function_uint %s1 %uint_0 %38 - %40 = OpLoad %uint %39 - %36 = OpFunctionCall %uint %f %40 - %41 = OpAccessChain %_ptr_Function_float %v %36 - OpStore %41 %float_1 + %main = OpFunction %void None %12 + %15 = OpLabel + %s1 = OpVariable %_ptr_Function_OuterS Function %21 + %v = OpVariable %_ptr_Function_v3float Function %26 + %29 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %30 = OpLoad %uint %29 + %32 = OpAccessChain %_ptr_Function_uint %s1 %uint_0 %30 + %33 = OpLoad %uint %32 + %35 = OpAccessChain %_ptr_Function_float %v %33 + OpStore %35 %float_1 + %38 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Function_uint %s1 %uint_0 %39 + %41 = OpLoad %uint %40 + %37 = OpFunctionCall %uint %f %41 + %42 = OpAccessChain %_ptr_Function_float %v %37 + OpStore %42 %float_1 OpReturn OpFunctionEnd diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl.expected.glsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl.expected.glsl index 25859a3d6d..2e9382dd72 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl.expected.glsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl.expected.glsl @@ -1,5 +1,12 @@ #version 310 es +struct Uniforms { + uint i; + uint pad; + uint pad_1; + uint pad_2; +}; + struct InnerS { int v; }; @@ -8,17 +15,14 @@ struct OuterS { InnerS a1[8]; }; -layout(binding = 4, std140) uniform Uniforms_ubo { - uint i; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 4, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; void tint_symbol() { InnerS v = InnerS(0); OuterS s1 = OuterS(InnerS[8](InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0), InnerS(0))); - uint p_save = uniforms.i; + uint p_save = uniforms.inner.i; s1.a1[p_save] = v; } diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl.expected.spvasm b/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl.expected.spvasm index 8507c70c66..7ae7fab1c1 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl.expected.spvasm +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer.wgsl.expected.spvasm @@ -1,12 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 26 +; Bound: 27 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "i" OpName %uniforms "uniforms" @@ -17,7 +19,8 @@ OpName %OuterS "OuterS" OpMemberName %OuterS 0 "a1" OpName %s1 "s1" - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpDecorate %uniforms NonWritable OpDecorate %uniforms DescriptorSet 1 @@ -27,29 +30,30 @@ OpDecorate %_arr_InnerS_uint_8 ArrayStride 4 %uint = OpTypeInt 32 0 %Uniforms = OpTypeStruct %uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %int = OpTypeInt 32 1 %InnerS = OpTypeStruct %int %_ptr_Function_InnerS = OpTypePointer Function %InnerS - %13 = OpConstantNull %InnerS + %14 = OpConstantNull %InnerS %uint_8 = OpConstant %uint 8 %_arr_InnerS_uint_8 = OpTypeArray %InnerS %uint_8 %OuterS = OpTypeStruct %_arr_InnerS_uint_8 %_ptr_Function_OuterS = OpTypePointer Function %OuterS - %19 = OpConstantNull %OuterS + %20 = OpConstantNull %OuterS %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint - %main = OpFunction %void None %5 - %8 = OpLabel - %v = OpVariable %_ptr_Function_InnerS Function %13 - %s1 = OpVariable %_ptr_Function_OuterS Function %19 - %22 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %23 = OpLoad %uint %22 - %24 = OpAccessChain %_ptr_Function_InnerS %s1 %uint_0 %23 - %25 = OpLoad %InnerS %v - OpStore %24 %25 + %main = OpFunction %void None %6 + %9 = OpLabel + %v = OpVariable %_ptr_Function_InnerS Function %14 + %s1 = OpVariable %_ptr_Function_OuterS Function %20 + %23 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %24 = OpLoad %uint %23 + %25 = OpAccessChain %_ptr_Function_InnerS %s1 %uint_0 %24 + %26 = OpLoad %InnerS %v + OpStore %25 %26 OpReturn OpFunctionEnd diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl.expected.glsl b/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl.expected.glsl index 5045e6a322..7ebfbcfa09 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl.expected.glsl +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl.expected.glsl @@ -1,5 +1,12 @@ #version 310 es +struct Uniforms { + uint i; + uint pad; + uint pad_1; + uint pad_2; +}; + struct InnerS { int v; }; @@ -8,16 +15,13 @@ struct OuterS { InnerS a1[8]; }; -layout(binding = 4, std140) uniform Uniforms_ubo { - uint i; - uint pad; - uint pad_1; - uint pad_2; +layout(binding = 4, std140) uniform uniforms_block_ubo { + Uniforms inner; } uniforms; void f(inout OuterS p) { InnerS v = InnerS(0); - p.a1[uniforms.i] = v; + p.a1[uniforms.inner.i] = v; } void tint_symbol() { diff --git a/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl.expected.spvasm b/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl.expected.spvasm index bfda721ac7..1033394138 100644 --- a/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl.expected.spvasm +++ b/test/tint/statements/assign/indexed_assign_to_array_in_struct/via_pointer_arg.wgsl.expected.spvasm @@ -1,12 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 33 +; Bound: 34 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %uniforms_block "uniforms_block" + OpMemberName %uniforms_block 0 "inner" OpName %Uniforms "Uniforms" OpMemberName %Uniforms 0 "i" OpName %uniforms "uniforms" @@ -19,7 +21,8 @@ OpName %v "v" OpName %main "main" OpName %s1 "s1" - OpDecorate %Uniforms Block + OpDecorate %uniforms_block Block + OpMemberDecorate %uniforms_block 0 Offset 0 OpMemberDecorate %Uniforms 0 Offset 0 OpDecorate %uniforms NonWritable OpDecorate %uniforms DescriptorSet 1 @@ -29,8 +32,9 @@ OpDecorate %_arr_InnerS_uint_8 ArrayStride 4 %uint = OpTypeInt 32 0 %Uniforms = OpTypeStruct %uint -%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms - %uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform +%uniforms_block = OpTypeStruct %Uniforms +%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block + %uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform %void = OpTypeVoid %int = OpTypeInt 32 1 %InnerS = OpTypeStruct %int @@ -38,27 +42,27 @@ %_arr_InnerS_uint_8 = OpTypeArray %InnerS %uint_8 %OuterS = OpTypeStruct %_arr_InnerS_uint_8 %_ptr_Function_OuterS = OpTypePointer Function %OuterS - %5 = OpTypeFunction %void %_ptr_Function_OuterS + %6 = OpTypeFunction %void %_ptr_Function_OuterS %_ptr_Function_InnerS = OpTypePointer Function %InnerS - %18 = OpConstantNull %InnerS + %19 = OpConstantNull %InnerS %uint_0 = OpConstant %uint 0 %_ptr_Uniform_uint = OpTypePointer Uniform %uint - %26 = OpTypeFunction %void - %30 = OpConstantNull %OuterS - %f = OpFunction %void None %5 + %27 = OpTypeFunction %void + %31 = OpConstantNull %OuterS + %f = OpFunction %void None %6 %p = OpFunctionParameter %_ptr_Function_OuterS - %15 = OpLabel - %v = OpVariable %_ptr_Function_InnerS Function %18 - %22 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 - %23 = OpLoad %uint %22 - %24 = OpAccessChain %_ptr_Function_InnerS %p %uint_0 %23 - %25 = OpLoad %InnerS %v - OpStore %24 %25 + %16 = OpLabel + %v = OpVariable %_ptr_Function_InnerS Function %19 + %23 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 + %24 = OpLoad %uint %23 + %25 = OpAccessChain %_ptr_Function_InnerS %p %uint_0 %24 + %26 = OpLoad %InnerS %v + OpStore %25 %26 OpReturn OpFunctionEnd - %main = OpFunction %void None %26 - %28 = OpLabel - %s1 = OpVariable %_ptr_Function_OuterS Function %30 - %31 = OpFunctionCall %void %f %s1 + %main = OpFunction %void None %27 + %29 = OpLabel + %s1 = OpVariable %_ptr_Function_OuterS Function %31 + %32 = OpFunctionCall %void %f %s1 OpReturn OpFunctionEnd diff --git a/test/tint/statements/assign/phony/storage_buffer.wgsl.expected.glsl b/test/tint/statements/assign/phony/storage_buffer.wgsl.expected.glsl index be246a1a2e..2d226c0864 100644 --- a/test/tint/statements/assign/phony/storage_buffer.wgsl.expected.glsl +++ b/test/tint/statements/assign/phony/storage_buffer.wgsl.expected.glsl @@ -1,7 +1,11 @@ #version 310 es -layout(binding = 0, std430) buffer S_ssbo { +struct S { int i; +}; + +layout(binding = 0, std430) buffer s_block_ssbo { + S inner; } s; void tint_symbol() { diff --git a/test/tint/statements/assign/phony/storage_buffer.wgsl.expected.spvasm b/test/tint/statements/assign/phony/storage_buffer.wgsl.expected.spvasm index 41a786bd17..f80431cf97 100644 --- a/test/tint/statements/assign/phony/storage_buffer.wgsl.expected.spvasm +++ b/test/tint/statements/assign/phony/storage_buffer.wgsl.expected.spvasm @@ -1,27 +1,31 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 9 +; Bound: 10 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %s_block "s_block" + OpMemberName %s_block 0 "inner" OpName %S "S" OpMemberName %S 0 "i" OpName %s "s" OpName %main "main" - OpDecorate %S Block + OpDecorate %s_block Block + OpMemberDecorate %s_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %s Binding 0 OpDecorate %s DescriptorSet 0 %int = OpTypeInt 32 1 %S = OpTypeStruct %int -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %s = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %s_block = OpTypeStruct %S +%_ptr_StorageBuffer_s_block = OpTypePointer StorageBuffer %s_block + %s = OpVariable %_ptr_StorageBuffer_s_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void - %main = OpFunction %void None %5 - %8 = OpLabel + %6 = OpTypeFunction %void + %main = OpFunction %void None %6 + %9 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.glsl b/test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.glsl index 9d861c5ff1..c48d383b4d 100644 --- a/test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.glsl +++ b/test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.glsl @@ -1,10 +1,14 @@ #version 310 es -layout(binding = 0, std140) uniform S_ubo { +struct S { int i; uint pad; uint pad_1; uint pad_2; +}; + +layout(binding = 0, std140) uniform u_block_ubo { + S inner; } u; void tint_symbol() { diff --git a/test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.spvasm b/test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.spvasm index 06508a884e..d3dcf21526 100644 --- a/test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.spvasm +++ b/test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.spvasm @@ -1,28 +1,32 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 9 +; Bound: 10 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 + OpName %u_block "u_block" + OpMemberName %u_block 0 "inner" OpName %S "S" OpMemberName %S 0 "i" OpName %u "u" OpName %main "main" - OpDecorate %S Block + OpDecorate %u_block Block + OpMemberDecorate %u_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %u NonWritable OpDecorate %u Binding 0 OpDecorate %u DescriptorSet 0 %int = OpTypeInt 32 1 %S = OpTypeStruct %int -%_ptr_Uniform_S = OpTypePointer Uniform %S - %u = OpVariable %_ptr_Uniform_S Uniform + %u_block = OpTypeStruct %S +%_ptr_Uniform_u_block = OpTypePointer Uniform %u_block + %u = OpVariable %_ptr_Uniform_u_block Uniform %void = OpTypeVoid - %5 = OpTypeFunction %void - %main = OpFunction %void None %5 - %8 = OpLabel + %6 = OpTypeFunction %void + %main = OpFunction %void None %6 + %9 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/for_loop.wgsl.expected.glsl b/test/tint/statements/compound_assign/for_loop.wgsl.expected.glsl index c62965a2c4..9704a0ac8c 100644 --- a/test/tint/statements/compound_assign/for_loop.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/for_loop.wgsl.expected.glsl @@ -4,13 +4,17 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { int a; uint pad; uint pad_1; uint pad_2; vec4 b; mat2 c; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; uint i = 0u; diff --git a/test/tint/statements/compound_assign/for_loop.wgsl.expected.spvasm b/test/tint/statements/compound_assign/for_loop.wgsl.expected.spvasm index de44b9bb76..0ab22fd964 100644 --- a/test/tint/statements/compound_assign/for_loop.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/for_loop.wgsl.expected.spvasm @@ -1,12 +1,14 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 67 +; Bound: 68 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpMemberName %S 1 "b" @@ -19,7 +21,8 @@ OpName %idx3 "idx3" OpName %foo "foo" OpName %a "a" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpMemberDecorate %S 1 Offset 16 OpMemberDecorate %S 2 Offset 32 @@ -34,87 +37,88 @@ %v2float = OpTypeVector %float 2 %mat2v2float = OpTypeMatrix %v2float 2 %S = OpTypeStruct %int %v4float %mat2v2float -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %uint = OpTypeInt 32 0 %_ptr_Private_uint = OpTypePointer Private %uint - %12 = OpConstantNull %uint - %i = OpVariable %_ptr_Private_uint Private %12 + %13 = OpConstantNull %uint + %i = OpVariable %_ptr_Private_uint Private %13 %void = OpTypeVoid - %13 = OpTypeFunction %void - %17 = OpTypeFunction %int + %14 = OpTypeFunction %void + %18 = OpTypeFunction %int %uint_1 = OpConstant %uint 1 %int_1 = OpConstant %int 1 %uint_2 = OpConstant %uint 2 %uint_3 = OpConstant %uint 3 %uint_4 = OpConstant %uint 4 %_arr_float_uint_4 = OpTypeArray %float %uint_4 - %38 = OpConstantNull %_arr_float_uint_4 + %39 = OpConstantNull %_arr_float_uint_4 %_ptr_Function__arr_float_uint_4 = OpTypePointer Function %_arr_float_uint_4 %_ptr_Function_float = OpTypePointer Function %float %float_2 = OpConstant %float 2 %float_10 = OpConstant %float 10 %bool = OpTypeBool %float_1 = OpConstant %float 1 -%unused_entry_point = OpFunction %void None %13 - %16 = OpLabel +%unused_entry_point = OpFunction %void None %14 + %17 = OpLabel OpReturn OpFunctionEnd - %idx1 = OpFunction %int None %17 - %19 = OpLabel - %20 = OpLoad %uint %i - %22 = OpIAdd %uint %20 %uint_1 - OpStore %i %22 + %idx1 = OpFunction %int None %18 + %20 = OpLabel + %21 = OpLoad %uint %i + %23 = OpIAdd %uint %21 %uint_1 + OpStore %i %23 OpReturnValue %int_1 OpFunctionEnd - %idx2 = OpFunction %int None %17 - %25 = OpLabel - %26 = OpLoad %uint %i - %28 = OpIAdd %uint %26 %uint_2 - OpStore %i %28 + %idx2 = OpFunction %int None %18 + %26 = OpLabel + %27 = OpLoad %uint %i + %29 = OpIAdd %uint %27 %uint_2 + OpStore %i %29 OpReturnValue %int_1 OpFunctionEnd - %idx3 = OpFunction %int None %17 - %30 = OpLabel - %31 = OpLoad %uint %i - %33 = OpIAdd %uint %31 %uint_3 - OpStore %i %33 + %idx3 = OpFunction %int None %18 + %31 = OpLabel + %32 = OpLoad %uint %i + %34 = OpIAdd %uint %32 %uint_3 + OpStore %i %34 OpReturnValue %int_1 OpFunctionEnd - %foo = OpFunction %void None %13 - %35 = OpLabel - %a = OpVariable %_ptr_Function__arr_float_uint_4 Function %38 - OpStore %a %38 - %41 = OpFunctionCall %int %idx1 - %43 = OpAccessChain %_ptr_Function_float %a %41 - %44 = OpAccessChain %_ptr_Function_float %a %41 - %45 = OpLoad %float %44 - %47 = OpFMul %float %45 %float_2 - OpStore %43 %47 - OpBranch %48 - %48 = OpLabel - OpLoopMerge %49 %50 None + %foo = OpFunction %void None %14 + %36 = OpLabel + %a = OpVariable %_ptr_Function__arr_float_uint_4 Function %39 + OpStore %a %39 + %42 = OpFunctionCall %int %idx1 + %44 = OpAccessChain %_ptr_Function_float %a %42 + %45 = OpAccessChain %_ptr_Function_float %a %42 + %46 = OpLoad %float %45 + %48 = OpFMul %float %46 %float_2 + OpStore %44 %48 + OpBranch %49 + %49 = OpLabel + OpLoopMerge %50 %51 None + OpBranch %52 + %52 = OpLabel + %53 = OpFunctionCall %int %idx2 + %55 = OpAccessChain %_ptr_Function_float %a %53 + %56 = OpLoad %float %55 + %58 = OpFOrdLessThan %bool %56 %float_10 + %54 = OpLogicalNot %bool %58 + OpSelectionMerge %60 None + OpBranchConditional %54 %61 %60 + %61 = OpLabel + OpBranch %50 + %60 = OpLabel OpBranch %51 %51 = OpLabel - %52 = OpFunctionCall %int %idx2 - %54 = OpAccessChain %_ptr_Function_float %a %52 - %55 = OpLoad %float %54 - %57 = OpFOrdLessThan %bool %55 %float_10 - %53 = OpLogicalNot %bool %57 - OpSelectionMerge %59 None - OpBranchConditional %53 %60 %59 - %60 = OpLabel + %62 = OpFunctionCall %int %idx3 + %63 = OpAccessChain %_ptr_Function_float %a %62 + %64 = OpAccessChain %_ptr_Function_float %a %62 + %65 = OpLoad %float %64 + %67 = OpFAdd %float %65 %float_1 + OpStore %63 %67 OpBranch %49 - %59 = OpLabel - OpBranch %50 %50 = OpLabel - %61 = OpFunctionCall %int %idx3 - %62 = OpAccessChain %_ptr_Function_float %a %61 - %63 = OpAccessChain %_ptr_Function_float %a %61 - %64 = OpLoad %float %63 - %66 = OpFAdd %float %64 %float_1 - OpStore %62 %66 - OpBranch %48 - %49 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.glsl b/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.glsl index 4bc44844df..6d80a7539b 100644 --- a/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { mat4 a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a - mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f))); + v.inner.a = (v.inner.a - mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f))); } diff --git a/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.spvasm b/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.spvasm index 2c93a1c7a2..a07cc9c59a 100644 --- a/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.spvasm @@ -1,18 +1,21 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 34 +; Bound: 35 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpMemberDecorate %S 0 ColMajor OpMemberDecorate %S 0 MatrixStride 16 @@ -22,36 +25,37 @@ %v4float = OpTypeVector %float 4 %mat4v4float = OpTypeMatrix %v4float 4 %S = OpTypeStruct %mat4v4float -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %7 = OpTypeFunction %void + %8 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_mat4v4float = OpTypePointer StorageBuffer %mat4v4float - %19 = OpConstantNull %mat4v4float -%unused_entry_point = OpFunction %void None %7 - %10 = OpLabel + %20 = OpConstantNull %mat4v4float +%unused_entry_point = OpFunction %void None %8 + %11 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %7 - %12 = OpLabel - %16 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %v %uint_0 - %17 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %v %uint_0 - %18 = OpLoad %mat4v4float %17 - %21 = OpCompositeExtract %v4float %18 0 + %foo = OpFunction %void None %8 + %13 = OpLabel + %17 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %v %uint_0 %uint_0 + %18 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %v %uint_0 %uint_0 + %19 = OpLoad %mat4v4float %18 %22 = OpCompositeExtract %v4float %19 0 - %23 = OpFSub %v4float %21 %22 - %24 = OpCompositeExtract %v4float %18 1 + %23 = OpCompositeExtract %v4float %20 0 + %24 = OpFSub %v4float %22 %23 %25 = OpCompositeExtract %v4float %19 1 - %26 = OpFSub %v4float %24 %25 - %27 = OpCompositeExtract %v4float %18 2 + %26 = OpCompositeExtract %v4float %20 1 + %27 = OpFSub %v4float %25 %26 %28 = OpCompositeExtract %v4float %19 2 - %29 = OpFSub %v4float %27 %28 - %30 = OpCompositeExtract %v4float %18 3 + %29 = OpCompositeExtract %v4float %20 2 + %30 = OpFSub %v4float %28 %29 %31 = OpCompositeExtract %v4float %19 3 - %32 = OpFSub %v4float %30 %31 - %33 = OpCompositeConstruct %mat4v4float %23 %26 %29 %32 - OpStore %16 %33 + %32 = OpCompositeExtract %v4float %20 3 + %33 = OpFSub %v4float %31 %32 + %34 = OpCompositeConstruct %mat4v4float %24 %27 %30 %33 + OpStore %17 %34 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.glsl b/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.glsl index 2731dc53b3..cd08da2451 100644 --- a/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { mat4 a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a + mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f))); + v.inner.a = (v.inner.a + mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f))); } diff --git a/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.spvasm b/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.spvasm index d0c518517a..f5ceabd054 100644 --- a/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.spvasm @@ -1,18 +1,21 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 34 +; Bound: 35 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpMemberDecorate %S 0 ColMajor OpMemberDecorate %S 0 MatrixStride 16 @@ -22,36 +25,37 @@ %v4float = OpTypeVector %float 4 %mat4v4float = OpTypeMatrix %v4float 4 %S = OpTypeStruct %mat4v4float -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %7 = OpTypeFunction %void + %8 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_mat4v4float = OpTypePointer StorageBuffer %mat4v4float - %19 = OpConstantNull %mat4v4float -%unused_entry_point = OpFunction %void None %7 - %10 = OpLabel + %20 = OpConstantNull %mat4v4float +%unused_entry_point = OpFunction %void None %8 + %11 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %7 - %12 = OpLabel - %16 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %v %uint_0 - %17 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %v %uint_0 - %18 = OpLoad %mat4v4float %17 - %21 = OpCompositeExtract %v4float %18 0 + %foo = OpFunction %void None %8 + %13 = OpLabel + %17 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %v %uint_0 %uint_0 + %18 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %v %uint_0 %uint_0 + %19 = OpLoad %mat4v4float %18 %22 = OpCompositeExtract %v4float %19 0 - %23 = OpFAdd %v4float %21 %22 - %24 = OpCompositeExtract %v4float %18 1 + %23 = OpCompositeExtract %v4float %20 0 + %24 = OpFAdd %v4float %22 %23 %25 = OpCompositeExtract %v4float %19 1 - %26 = OpFAdd %v4float %24 %25 - %27 = OpCompositeExtract %v4float %18 2 + %26 = OpCompositeExtract %v4float %20 1 + %27 = OpFAdd %v4float %25 %26 %28 = OpCompositeExtract %v4float %19 2 - %29 = OpFAdd %v4float %27 %28 - %30 = OpCompositeExtract %v4float %18 3 + %29 = OpCompositeExtract %v4float %20 2 + %30 = OpFAdd %v4float %28 %29 %31 = OpCompositeExtract %v4float %19 3 - %32 = OpFAdd %v4float %30 %31 - %33 = OpCompositeConstruct %mat4v4float %23 %26 %29 %32 - OpStore %16 %33 + %32 = OpCompositeExtract %v4float %20 3 + %33 = OpFAdd %v4float %31 %32 + %34 = OpCompositeConstruct %mat4v4float %24 %27 %30 %33 + OpStore %17 %34 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.glsl b/test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.glsl index 6454531028..bb93284add 100644 --- a/test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { mat4 a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a * 2.0f); + v.inner.a = (v.inner.a * 2.0f); } diff --git a/test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.spvasm b/test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.spvasm index c120639478..f22fa6a63e 100644 --- a/test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.spvasm @@ -1,18 +1,21 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 21 +; Bound: 22 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpMemberDecorate %S 0 ColMajor OpMemberDecorate %S 0 MatrixStride 16 @@ -22,24 +25,25 @@ %v4float = OpTypeVector %float 4 %mat4v4float = OpTypeMatrix %v4float 4 %S = OpTypeStruct %mat4v4float -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %7 = OpTypeFunction %void + %8 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_mat4v4float = OpTypePointer StorageBuffer %mat4v4float %float_2 = OpConstant %float 2 -%unused_entry_point = OpFunction %void None %7 - %10 = OpLabel +%unused_entry_point = OpFunction %void None %8 + %11 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %7 - %12 = OpLabel - %16 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %v %uint_0 - %17 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %v %uint_0 - %18 = OpLoad %mat4v4float %17 - %20 = OpMatrixTimesScalar %mat4v4float %18 %float_2 - OpStore %16 %20 + %foo = OpFunction %void None %8 + %13 = OpLabel + %17 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %v %uint_0 %uint_0 + %18 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %v %uint_0 %uint_0 + %19 = OpLoad %mat4v4float %18 + %21 = OpMatrixTimesScalar %mat4v4float %19 %float_2 + OpStore %17 %21 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/matrix/times.wgsl.expected.glsl b/test/tint/statements/compound_assign/matrix/times.wgsl.expected.glsl index d0cf2da11b..617cc3122b 100644 --- a/test/tint/statements/compound_assign/matrix/times.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/matrix/times.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { mat4 a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a * mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f))); + v.inner.a = (v.inner.a * mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f))); } diff --git a/test/tint/statements/compound_assign/matrix/times.wgsl.expected.spvasm b/test/tint/statements/compound_assign/matrix/times.wgsl.expected.spvasm index 12cf6b3620..7da0a28c09 100644 --- a/test/tint/statements/compound_assign/matrix/times.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/matrix/times.wgsl.expected.spvasm @@ -1,18 +1,21 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 21 +; Bound: 22 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpMemberDecorate %S 0 ColMajor OpMemberDecorate %S 0 MatrixStride 16 @@ -22,24 +25,25 @@ %v4float = OpTypeVector %float 4 %mat4v4float = OpTypeMatrix %v4float 4 %S = OpTypeStruct %mat4v4float -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %7 = OpTypeFunction %void + %8 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_mat4v4float = OpTypePointer StorageBuffer %mat4v4float - %19 = OpConstantNull %mat4v4float -%unused_entry_point = OpFunction %void None %7 - %10 = OpLabel + %20 = OpConstantNull %mat4v4float +%unused_entry_point = OpFunction %void None %8 + %11 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %7 - %12 = OpLabel - %16 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %v %uint_0 - %17 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %v %uint_0 - %18 = OpLoad %mat4v4float %17 - %20 = OpMatrixTimesMatrix %mat4v4float %18 %19 - OpStore %16 %20 + %foo = OpFunction %void None %8 + %13 = OpLabel + %17 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %v %uint_0 %uint_0 + %18 = OpAccessChain %_ptr_StorageBuffer_mat4v4float %v %uint_0 %uint_0 + %19 = OpLoad %mat4v4float %18 + %21 = OpMatrixTimesMatrix %mat4v4float %19 %20 + OpStore %17 %21 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/scalar/and.wgsl.expected.glsl b/test/tint/statements/compound_assign/scalar/and.wgsl.expected.glsl index cf037cf09f..93281fd222 100644 --- a/test/tint/statements/compound_assign/scalar/and.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/scalar/and.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { int a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a & 2); + v.inner.a = (v.inner.a & 2); } diff --git a/test/tint/statements/compound_assign/scalar/and.wgsl.expected.spvasm b/test/tint/statements/compound_assign/scalar/and.wgsl.expected.spvasm index 3018c77426..eb5d33149b 100644 --- a/test/tint/statements/compound_assign/scalar/and.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/scalar/and.wgsl.expected.spvasm @@ -1,41 +1,45 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 19 +; Bound: 20 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 %int = OpTypeInt 32 1 %S = OpTypeStruct %int -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_2 = OpConstant %int 2 -%unused_entry_point = OpFunction %void None %5 - %8 = OpLabel +%unused_entry_point = OpFunction %void None %6 + %9 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %5 - %10 = OpLabel - %14 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 - %15 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 - %16 = OpLoad %int %15 - %18 = OpBitwiseAnd %int %16 %int_2 - OpStore %14 %18 + %foo = OpFunction %void None %6 + %11 = OpLabel + %15 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 + %16 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 + %17 = OpLoad %int %16 + %19 = OpBitwiseAnd %int %17 %int_2 + OpStore %15 %19 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.glsl b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.glsl index da4bd07ff0..369c9899ab 100644 --- a/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { int a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a / 2); + v.inner.a = (v.inner.a / 2); } diff --git a/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.spvasm b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.spvasm index 7aa32b7f8e..e4078d1f57 100644 --- a/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.spvasm @@ -1,41 +1,45 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 19 +; Bound: 20 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 %int = OpTypeInt 32 1 %S = OpTypeStruct %int -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_2 = OpConstant %int 2 -%unused_entry_point = OpFunction %void None %5 - %8 = OpLabel +%unused_entry_point = OpFunction %void None %6 + %9 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %5 - %10 = OpLabel - %14 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 - %15 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 - %16 = OpLoad %int %15 - %18 = OpSDiv %int %16 %int_2 - OpStore %14 %18 + %foo = OpFunction %void None %6 + %11 = OpLabel + %15 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 + %16 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 + %17 = OpLoad %int %16 + %19 = OpSDiv %int %17 %int_2 + OpStore %15 %19 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/scalar/minus.wgsl.expected.glsl b/test/tint/statements/compound_assign/scalar/minus.wgsl.expected.glsl index 78334e5bca..371657d545 100644 --- a/test/tint/statements/compound_assign/scalar/minus.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/scalar/minus.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { int a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a - 2); + v.inner.a = (v.inner.a - 2); } diff --git a/test/tint/statements/compound_assign/scalar/minus.wgsl.expected.spvasm b/test/tint/statements/compound_assign/scalar/minus.wgsl.expected.spvasm index 13e9c6897b..48e3ecb4ac 100644 --- a/test/tint/statements/compound_assign/scalar/minus.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/scalar/minus.wgsl.expected.spvasm @@ -1,41 +1,45 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 19 +; Bound: 20 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 %int = OpTypeInt 32 1 %S = OpTypeStruct %int -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_2 = OpConstant %int 2 -%unused_entry_point = OpFunction %void None %5 - %8 = OpLabel +%unused_entry_point = OpFunction %void None %6 + %9 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %5 - %10 = OpLabel - %14 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 - %15 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 - %16 = OpLoad %int %15 - %18 = OpISub %int %16 %int_2 - OpStore %14 %18 + %foo = OpFunction %void None %6 + %11 = OpLabel + %15 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 + %16 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 + %17 = OpLoad %int %16 + %19 = OpISub %int %17 %int_2 + OpStore %15 %19 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.glsl b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.glsl index bee2c0dae8..8e34ac7068 100644 --- a/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { int a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a % 2); + v.inner.a = (v.inner.a % 2); } diff --git a/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.spvasm b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.spvasm index d109e993c6..4c9f181906 100644 --- a/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.spvasm @@ -1,41 +1,45 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 19 +; Bound: 20 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 %int = OpTypeInt 32 1 %S = OpTypeStruct %int -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_2 = OpConstant %int 2 -%unused_entry_point = OpFunction %void None %5 - %8 = OpLabel +%unused_entry_point = OpFunction %void None %6 + %9 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %5 - %10 = OpLabel - %14 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 - %15 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 - %16 = OpLoad %int %15 - %18 = OpSMod %int %16 %int_2 - OpStore %14 %18 + %foo = OpFunction %void None %6 + %11 = OpLabel + %15 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 + %16 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 + %17 = OpLoad %int %16 + %19 = OpSMod %int %17 %int_2 + OpStore %15 %19 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/scalar/or.wgsl.expected.glsl b/test/tint/statements/compound_assign/scalar/or.wgsl.expected.glsl index 474cb2aebf..0e74bde820 100644 --- a/test/tint/statements/compound_assign/scalar/or.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/scalar/or.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { int a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a | 2); + v.inner.a = (v.inner.a | 2); } diff --git a/test/tint/statements/compound_assign/scalar/or.wgsl.expected.spvasm b/test/tint/statements/compound_assign/scalar/or.wgsl.expected.spvasm index d90f474605..02c927115e 100644 --- a/test/tint/statements/compound_assign/scalar/or.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/scalar/or.wgsl.expected.spvasm @@ -1,41 +1,45 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 19 +; Bound: 20 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 %int = OpTypeInt 32 1 %S = OpTypeStruct %int -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_2 = OpConstant %int 2 -%unused_entry_point = OpFunction %void None %5 - %8 = OpLabel +%unused_entry_point = OpFunction %void None %6 + %9 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %5 - %10 = OpLabel - %14 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 - %15 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 - %16 = OpLoad %int %15 - %18 = OpBitwiseOr %int %16 %int_2 - OpStore %14 %18 + %foo = OpFunction %void None %6 + %11 = OpLabel + %15 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 + %16 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 + %17 = OpLoad %int %16 + %19 = OpBitwiseOr %int %17 %int_2 + OpStore %15 %19 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/scalar/plus.wgsl.expected.glsl b/test/tint/statements/compound_assign/scalar/plus.wgsl.expected.glsl index fb89b1611b..c37bc513b1 100644 --- a/test/tint/statements/compound_assign/scalar/plus.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/scalar/plus.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { int a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a + 2); + v.inner.a = (v.inner.a + 2); } diff --git a/test/tint/statements/compound_assign/scalar/plus.wgsl.expected.spvasm b/test/tint/statements/compound_assign/scalar/plus.wgsl.expected.spvasm index 1f6c345d1a..25309e308a 100644 --- a/test/tint/statements/compound_assign/scalar/plus.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/scalar/plus.wgsl.expected.spvasm @@ -1,41 +1,45 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 19 +; Bound: 20 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 %int = OpTypeInt 32 1 %S = OpTypeStruct %int -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_2 = OpConstant %int 2 -%unused_entry_point = OpFunction %void None %5 - %8 = OpLabel +%unused_entry_point = OpFunction %void None %6 + %9 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %5 - %10 = OpLabel - %14 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 - %15 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 - %16 = OpLoad %int %15 - %18 = OpIAdd %int %16 %int_2 - OpStore %14 %18 + %foo = OpFunction %void None %6 + %11 = OpLabel + %15 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 + %16 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 + %17 = OpLoad %int %16 + %19 = OpIAdd %int %17 %int_2 + OpStore %15 %19 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/scalar/shift_left.wgsl.expected.glsl b/test/tint/statements/compound_assign/scalar/shift_left.wgsl.expected.glsl index 632e2d898d..9d281652a3 100644 --- a/test/tint/statements/compound_assign/scalar/shift_left.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/scalar/shift_left.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { int a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a << 2u); + v.inner.a = (v.inner.a << 2u); } diff --git a/test/tint/statements/compound_assign/scalar/shift_left.wgsl.expected.spvasm b/test/tint/statements/compound_assign/scalar/shift_left.wgsl.expected.spvasm index 0f8c1e83b4..b33bd89dbf 100644 --- a/test/tint/statements/compound_assign/scalar/shift_left.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/scalar/shift_left.wgsl.expected.spvasm @@ -1,41 +1,45 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 19 +; Bound: 20 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 %int = OpTypeInt 32 1 %S = OpTypeStruct %int -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %uint_2 = OpConstant %uint 2 -%unused_entry_point = OpFunction %void None %5 - %8 = OpLabel +%unused_entry_point = OpFunction %void None %6 + %9 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %5 - %10 = OpLabel - %14 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 - %15 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 - %16 = OpLoad %int %15 - %18 = OpShiftLeftLogical %int %16 %uint_2 - OpStore %14 %18 + %foo = OpFunction %void None %6 + %11 = OpLabel + %15 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 + %16 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 + %17 = OpLoad %int %16 + %19 = OpShiftLeftLogical %int %17 %uint_2 + OpStore %15 %19 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/scalar/shift_right.wgsl.expected.glsl b/test/tint/statements/compound_assign/scalar/shift_right.wgsl.expected.glsl index 3734f7b1ab..d67b9a2d09 100644 --- a/test/tint/statements/compound_assign/scalar/shift_right.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/scalar/shift_right.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { int a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a >> 2u); + v.inner.a = (v.inner.a >> 2u); } diff --git a/test/tint/statements/compound_assign/scalar/shift_right.wgsl.expected.spvasm b/test/tint/statements/compound_assign/scalar/shift_right.wgsl.expected.spvasm index b8fcd7a996..81460ffede 100644 --- a/test/tint/statements/compound_assign/scalar/shift_right.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/scalar/shift_right.wgsl.expected.spvasm @@ -1,41 +1,45 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 19 +; Bound: 20 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 %int = OpTypeInt 32 1 %S = OpTypeStruct %int -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %uint_2 = OpConstant %uint 2 -%unused_entry_point = OpFunction %void None %5 - %8 = OpLabel +%unused_entry_point = OpFunction %void None %6 + %9 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %5 - %10 = OpLabel - %14 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 - %15 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 - %16 = OpLoad %int %15 - %18 = OpShiftRightArithmetic %int %16 %uint_2 - OpStore %14 %18 + %foo = OpFunction %void None %6 + %11 = OpLabel + %15 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 + %16 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 + %17 = OpLoad %int %16 + %19 = OpShiftRightArithmetic %int %17 %uint_2 + OpStore %15 %19 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/scalar/times.wgsl.expected.glsl b/test/tint/statements/compound_assign/scalar/times.wgsl.expected.glsl index 87692a2b1b..0e3a99eaf2 100644 --- a/test/tint/statements/compound_assign/scalar/times.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/scalar/times.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { int a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a * 2); + v.inner.a = (v.inner.a * 2); } diff --git a/test/tint/statements/compound_assign/scalar/times.wgsl.expected.spvasm b/test/tint/statements/compound_assign/scalar/times.wgsl.expected.spvasm index f2df422742..0b4a2edf65 100644 --- a/test/tint/statements/compound_assign/scalar/times.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/scalar/times.wgsl.expected.spvasm @@ -1,41 +1,45 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 19 +; Bound: 20 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 %int = OpTypeInt 32 1 %S = OpTypeStruct %int -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_2 = OpConstant %int 2 -%unused_entry_point = OpFunction %void None %5 - %8 = OpLabel +%unused_entry_point = OpFunction %void None %6 + %9 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %5 - %10 = OpLabel - %14 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 - %15 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 - %16 = OpLoad %int %15 - %18 = OpIMul %int %16 %int_2 - OpStore %14 %18 + %foo = OpFunction %void None %6 + %11 = OpLabel + %15 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 + %16 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 + %17 = OpLoad %int %16 + %19 = OpIMul %int %17 %int_2 + OpStore %15 %19 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/scalar/xor.wgsl.expected.glsl b/test/tint/statements/compound_assign/scalar/xor.wgsl.expected.glsl index 4e25c103b2..25c09305d5 100644 --- a/test/tint/statements/compound_assign/scalar/xor.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/scalar/xor.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { int a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a ^ 2); + v.inner.a = (v.inner.a ^ 2); } diff --git a/test/tint/statements/compound_assign/scalar/xor.wgsl.expected.spvasm b/test/tint/statements/compound_assign/scalar/xor.wgsl.expected.spvasm index e37d5bbe6b..78d0a7fbf1 100644 --- a/test/tint/statements/compound_assign/scalar/xor.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/scalar/xor.wgsl.expected.spvasm @@ -1,41 +1,45 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 19 +; Bound: 20 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 %int = OpTypeInt 32 1 %S = OpTypeStruct %int -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %5 = OpTypeFunction %void + %6 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_2 = OpConstant %int 2 -%unused_entry_point = OpFunction %void None %5 - %8 = OpLabel +%unused_entry_point = OpFunction %void None %6 + %9 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %5 - %10 = OpLabel - %14 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 - %15 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 - %16 = OpLoad %int %15 - %18 = OpBitwiseXor %int %16 %int_2 - OpStore %14 %18 + %foo = OpFunction %void None %6 + %11 = OpLabel + %15 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 + %16 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 + %17 = OpLoad %int %16 + %19 = OpBitwiseXor %int %17 %int_2 + OpStore %15 %19 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/vector/and.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/and.wgsl.expected.glsl index 35e6116f71..9e0882116b 100644 --- a/test/tint/statements/compound_assign/vector/and.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/vector/and.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { ivec4 a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a & ivec4(2)); + v.inner.a = (v.inner.a & ivec4(2)); } diff --git a/test/tint/statements/compound_assign/vector/and.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/and.wgsl.expected.spvasm index 10f27ff919..5a0bd7deee 100644 --- a/test/tint/statements/compound_assign/vector/and.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/vector/and.wgsl.expected.spvasm @@ -1,43 +1,47 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 21 +; Bound: 22 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 %int = OpTypeInt 32 1 %v4int = OpTypeVector %int 4 %S = OpTypeStruct %v4int -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %6 = OpTypeFunction %void + %7 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int %int_2 = OpConstant %int 2 - %19 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel + %20 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %6 - %11 = OpLabel - %15 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 - %16 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 - %17 = OpLoad %v4int %16 - %20 = OpBitwiseAnd %v4int %17 %19 - OpStore %15 %20 + %foo = OpFunction %void None %7 + %12 = OpLabel + %16 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 + %17 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 + %18 = OpLoad %v4int %17 + %21 = OpBitwiseAnd %v4int %18 %20 + OpStore %16 %21 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.glsl index 418c57b575..b43fd7b565 100644 --- a/test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { vec4 a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a / 2.0f); + v.inner.a = (v.inner.a / 2.0f); } diff --git a/test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.spvasm index b25b02d019..6e264fdf88 100644 --- a/test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.spvasm @@ -1,46 +1,50 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 25 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 %S = OpTypeStruct %v4float -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %6 = OpTypeFunction %void + %7 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float %float_2 = OpConstant %float 2 %_ptr_Function_v4float = OpTypePointer Function %v4float - %22 = OpConstantNull %v4float -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel + %23 = OpConstantNull %v4float +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %6 - %11 = OpLabel - %20 = OpVariable %_ptr_Function_v4float Function %22 - %15 = OpAccessChain %_ptr_StorageBuffer_v4float %v %uint_0 - %16 = OpAccessChain %_ptr_StorageBuffer_v4float %v %uint_0 - %17 = OpLoad %v4float %16 - %23 = OpCompositeConstruct %v4float %float_2 %float_2 %float_2 %float_2 - %19 = OpFDiv %v4float %17 %23 - OpStore %15 %19 + %foo = OpFunction %void None %7 + %12 = OpLabel + %21 = OpVariable %_ptr_Function_v4float Function %23 + %16 = OpAccessChain %_ptr_StorageBuffer_v4float %v %uint_0 %uint_0 + %17 = OpAccessChain %_ptr_StorageBuffer_v4float %v %uint_0 %uint_0 + %18 = OpLoad %v4float %17 + %24 = OpCompositeConstruct %v4float %float_2 %float_2 %float_2 %float_2 + %20 = OpFDiv %v4float %18 %24 + OpStore %16 %20 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/vector/divide.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.glsl index ffb013a33d..5f6f244a01 100644 --- a/test/tint/statements/compound_assign/vector/divide.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { ivec4 a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a / ivec4(2)); + v.inner.a = (v.inner.a / ivec4(2)); } diff --git a/test/tint/statements/compound_assign/vector/divide.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.spvasm index 5eaea4102c..9b7ff51579 100644 --- a/test/tint/statements/compound_assign/vector/divide.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.spvasm @@ -1,43 +1,47 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 21 +; Bound: 22 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 %int = OpTypeInt 32 1 %v4int = OpTypeVector %int 4 %S = OpTypeStruct %v4int -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %6 = OpTypeFunction %void + %7 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int %int_2 = OpConstant %int 2 - %19 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel + %20 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %6 - %11 = OpLabel - %15 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 - %16 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 - %17 = OpLoad %v4int %16 - %20 = OpSDiv %v4int %17 %19 - OpStore %15 %20 + %foo = OpFunction %void None %7 + %12 = OpLabel + %16 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 + %17 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 + %18 = OpLoad %v4int %17 + %21 = OpSDiv %v4int %18 %20 + OpStore %16 %21 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.glsl index 90fae2d2eb..041e1b5f02 100644 --- a/test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { vec4 a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a - 2.0f); + v.inner.a = (v.inner.a - 2.0f); } diff --git a/test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.spvasm index 5723fffbe2..f5c6197680 100644 --- a/test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.spvasm @@ -1,46 +1,50 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 25 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 %S = OpTypeStruct %v4float -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %6 = OpTypeFunction %void + %7 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float %float_2 = OpConstant %float 2 %_ptr_Function_v4float = OpTypePointer Function %v4float - %22 = OpConstantNull %v4float -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel + %23 = OpConstantNull %v4float +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %6 - %11 = OpLabel - %20 = OpVariable %_ptr_Function_v4float Function %22 - %15 = OpAccessChain %_ptr_StorageBuffer_v4float %v %uint_0 - %16 = OpAccessChain %_ptr_StorageBuffer_v4float %v %uint_0 - %17 = OpLoad %v4float %16 - %23 = OpCompositeConstruct %v4float %float_2 %float_2 %float_2 %float_2 - %19 = OpFSub %v4float %17 %23 - OpStore %15 %19 + %foo = OpFunction %void None %7 + %12 = OpLabel + %21 = OpVariable %_ptr_Function_v4float Function %23 + %16 = OpAccessChain %_ptr_StorageBuffer_v4float %v %uint_0 %uint_0 + %17 = OpAccessChain %_ptr_StorageBuffer_v4float %v %uint_0 %uint_0 + %18 = OpLoad %v4float %17 + %24 = OpCompositeConstruct %v4float %float_2 %float_2 %float_2 %float_2 + %20 = OpFSub %v4float %18 %24 + OpStore %16 %20 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/vector/minus.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/minus.wgsl.expected.glsl index 4a40bac1e7..fc13484fee 100644 --- a/test/tint/statements/compound_assign/vector/minus.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/vector/minus.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { ivec4 a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a - ivec4(2)); + v.inner.a = (v.inner.a - ivec4(2)); } diff --git a/test/tint/statements/compound_assign/vector/minus.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/minus.wgsl.expected.spvasm index b670da2dac..1d7f15b6df 100644 --- a/test/tint/statements/compound_assign/vector/minus.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/vector/minus.wgsl.expected.spvasm @@ -1,43 +1,47 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 21 +; Bound: 22 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 %int = OpTypeInt 32 1 %v4int = OpTypeVector %int 4 %S = OpTypeStruct %v4int -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %6 = OpTypeFunction %void + %7 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int %int_2 = OpConstant %int 2 - %19 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel + %20 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %6 - %11 = OpLabel - %15 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 - %16 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 - %17 = OpLoad %v4int %16 - %20 = OpISub %v4int %17 %19 - OpStore %15 %20 + %foo = OpFunction %void None %7 + %12 = OpLabel + %16 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 + %17 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 + %18 = OpLoad %v4int %17 + %21 = OpISub %v4int %18 %20 + OpStore %16 %21 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.glsl index ded8188f33..53e18c8864 100644 --- a/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { ivec4 a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a % 2); + v.inner.a = (v.inner.a % 2); } diff --git a/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.spvasm index eee788af06..137c568e01 100644 --- a/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.spvasm @@ -1,46 +1,50 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 25 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 %int = OpTypeInt 32 1 %v4int = OpTypeVector %int 4 %S = OpTypeStruct %v4int -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %6 = OpTypeFunction %void + %7 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int %int_2 = OpConstant %int 2 %_ptr_Function_v4int = OpTypePointer Function %v4int - %22 = OpConstantNull %v4int -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel + %23 = OpConstantNull %v4int +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %6 - %11 = OpLabel - %20 = OpVariable %_ptr_Function_v4int Function %22 - %15 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 - %16 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 - %17 = OpLoad %v4int %16 - %23 = OpCompositeConstruct %v4int %int_2 %int_2 %int_2 %int_2 - %19 = OpSMod %v4int %17 %23 - OpStore %15 %19 + %foo = OpFunction %void None %7 + %12 = OpLabel + %21 = OpVariable %_ptr_Function_v4int Function %23 + %16 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 + %17 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 + %18 = OpLoad %v4int %17 + %24 = OpCompositeConstruct %v4int %int_2 %int_2 %int_2 %int_2 + %20 = OpSMod %v4int %18 %24 + OpStore %16 %20 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.glsl index 5e9d6ac353..d837a08dd7 100644 --- a/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { ivec4 a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a % ivec4(2)); + v.inner.a = (v.inner.a % ivec4(2)); } diff --git a/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.spvasm index c34ad91737..74e9f79c23 100644 --- a/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.spvasm @@ -1,43 +1,47 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 21 +; Bound: 22 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 %int = OpTypeInt 32 1 %v4int = OpTypeVector %int 4 %S = OpTypeStruct %v4int -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %6 = OpTypeFunction %void + %7 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int %int_2 = OpConstant %int 2 - %19 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel + %20 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %6 - %11 = OpLabel - %15 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 - %16 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 - %17 = OpLoad %v4int %16 - %20 = OpSMod %v4int %17 %19 - OpStore %15 %20 + %foo = OpFunction %void None %7 + %12 = OpLabel + %16 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 + %17 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 + %18 = OpLoad %v4int %17 + %21 = OpSMod %v4int %18 %20 + OpStore %16 %21 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/vector/or.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/or.wgsl.expected.glsl index 83eda7c9c9..a52880bd9e 100644 --- a/test/tint/statements/compound_assign/vector/or.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/vector/or.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { ivec4 a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a | ivec4(2)); + v.inner.a = (v.inner.a | ivec4(2)); } diff --git a/test/tint/statements/compound_assign/vector/or.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/or.wgsl.expected.spvasm index d11137f184..328a6d74f0 100644 --- a/test/tint/statements/compound_assign/vector/or.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/vector/or.wgsl.expected.spvasm @@ -1,43 +1,47 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 21 +; Bound: 22 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 %int = OpTypeInt 32 1 %v4int = OpTypeVector %int 4 %S = OpTypeStruct %v4int -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %6 = OpTypeFunction %void + %7 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int %int_2 = OpConstant %int 2 - %19 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel + %20 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %6 - %11 = OpLabel - %15 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 - %16 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 - %17 = OpLoad %v4int %16 - %20 = OpBitwiseOr %v4int %17 %19 - OpStore %15 %20 + %foo = OpFunction %void None %7 + %12 = OpLabel + %16 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 + %17 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 + %18 = OpLoad %v4int %17 + %21 = OpBitwiseOr %v4int %18 %20 + OpStore %16 %21 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.glsl index ce64d6f49f..f35ff10de6 100644 --- a/test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { vec4 a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a + 2.0f); + v.inner.a = (v.inner.a + 2.0f); } diff --git a/test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.spvasm index 787c30db69..291f023343 100644 --- a/test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.spvasm @@ -1,46 +1,50 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 24 +; Bound: 25 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 %S = OpTypeStruct %v4float -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %6 = OpTypeFunction %void + %7 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float %float_2 = OpConstant %float 2 %_ptr_Function_v4float = OpTypePointer Function %v4float - %22 = OpConstantNull %v4float -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel + %23 = OpConstantNull %v4float +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %6 - %11 = OpLabel - %20 = OpVariable %_ptr_Function_v4float Function %22 - %15 = OpAccessChain %_ptr_StorageBuffer_v4float %v %uint_0 - %16 = OpAccessChain %_ptr_StorageBuffer_v4float %v %uint_0 - %17 = OpLoad %v4float %16 - %23 = OpCompositeConstruct %v4float %float_2 %float_2 %float_2 %float_2 - %19 = OpFAdd %v4float %17 %23 - OpStore %15 %19 + %foo = OpFunction %void None %7 + %12 = OpLabel + %21 = OpVariable %_ptr_Function_v4float Function %23 + %16 = OpAccessChain %_ptr_StorageBuffer_v4float %v %uint_0 %uint_0 + %17 = OpAccessChain %_ptr_StorageBuffer_v4float %v %uint_0 %uint_0 + %18 = OpLoad %v4float %17 + %24 = OpCompositeConstruct %v4float %float_2 %float_2 %float_2 %float_2 + %20 = OpFAdd %v4float %18 %24 + OpStore %16 %20 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/vector/plus.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/plus.wgsl.expected.glsl index 7860e8d546..00b700d39e 100644 --- a/test/tint/statements/compound_assign/vector/plus.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/vector/plus.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { ivec4 a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a + ivec4(2)); + v.inner.a = (v.inner.a + ivec4(2)); } diff --git a/test/tint/statements/compound_assign/vector/plus.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/plus.wgsl.expected.spvasm index 718656a82a..4d5cb77993 100644 --- a/test/tint/statements/compound_assign/vector/plus.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/vector/plus.wgsl.expected.spvasm @@ -1,43 +1,47 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 21 +; Bound: 22 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 %int = OpTypeInt 32 1 %v4int = OpTypeVector %int 4 %S = OpTypeStruct %v4int -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %6 = OpTypeFunction %void + %7 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int %int_2 = OpConstant %int 2 - %19 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel + %20 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %6 - %11 = OpLabel - %15 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 - %16 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 - %17 = OpLoad %v4int %16 - %20 = OpIAdd %v4int %17 %19 - OpStore %15 %20 + %foo = OpFunction %void None %7 + %12 = OpLabel + %16 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 + %17 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 + %18 = OpLoad %v4int %17 + %21 = OpIAdd %v4int %18 %20 + OpStore %16 %21 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/vector/shift_left.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/shift_left.wgsl.expected.glsl index 003db4879b..69a34c5386 100644 --- a/test/tint/statements/compound_assign/vector/shift_left.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/vector/shift_left.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { ivec4 a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a << uvec4(2u)); + v.inner.a = (v.inner.a << uvec4(2u)); } diff --git a/test/tint/statements/compound_assign/vector/shift_left.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/shift_left.wgsl.expected.spvasm index 0f42a940ac..cf9077258b 100644 --- a/test/tint/statements/compound_assign/vector/shift_left.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/vector/shift_left.wgsl.expected.spvasm @@ -1,44 +1,48 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 22 +; Bound: 23 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 %int = OpTypeInt 32 1 %v4int = OpTypeVector %int 4 %S = OpTypeStruct %v4int -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %6 = OpTypeFunction %void + %7 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int %v4uint = OpTypeVector %uint 4 %uint_2 = OpConstant %uint 2 - %20 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel + %21 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %6 - %11 = OpLabel - %15 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 - %16 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 - %17 = OpLoad %v4int %16 - %21 = OpShiftLeftLogical %v4int %17 %20 - OpStore %15 %21 + %foo = OpFunction %void None %7 + %12 = OpLabel + %16 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 + %17 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 + %18 = OpLoad %v4int %17 + %22 = OpShiftLeftLogical %v4int %18 %21 + OpStore %16 %22 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/vector/shift_right.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/shift_right.wgsl.expected.glsl index ce65ca701f..d2067ddc7b 100644 --- a/test/tint/statements/compound_assign/vector/shift_right.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/vector/shift_right.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { ivec4 a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a >> uvec4(2u)); + v.inner.a = (v.inner.a >> uvec4(2u)); } diff --git a/test/tint/statements/compound_assign/vector/shift_right.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/shift_right.wgsl.expected.spvasm index 5ab37da073..e6ed50c347 100644 --- a/test/tint/statements/compound_assign/vector/shift_right.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/vector/shift_right.wgsl.expected.spvasm @@ -1,44 +1,48 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 22 +; Bound: 23 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 %int = OpTypeInt 32 1 %v4int = OpTypeVector %int 4 %S = OpTypeStruct %v4int -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %6 = OpTypeFunction %void + %7 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int %v4uint = OpTypeVector %uint 4 %uint_2 = OpConstant %uint 2 - %20 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel + %21 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %6 - %11 = OpLabel - %15 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 - %16 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 - %17 = OpLoad %v4int %16 - %21 = OpShiftRightArithmetic %v4int %17 %20 - OpStore %15 %21 + %foo = OpFunction %void None %7 + %12 = OpLabel + %16 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 + %17 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 + %18 = OpLoad %v4int %17 + %22 = OpShiftRightArithmetic %v4int %18 %21 + OpStore %16 %22 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.glsl index 5063090a82..d34c6217a7 100644 --- a/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { vec4 a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a * mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f))); + v.inner.a = (v.inner.a * mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f))); } diff --git a/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.spvasm index 6e5cef7c75..b97534d8f8 100644 --- a/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.spvasm @@ -1,43 +1,47 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 21 +; Bound: 22 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 %S = OpTypeStruct %v4float -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %6 = OpTypeFunction %void + %7 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float %mat4v4float = OpTypeMatrix %v4float 4 - %19 = OpConstantNull %mat4v4float -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel + %20 = OpConstantNull %mat4v4float +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %6 - %11 = OpLabel - %15 = OpAccessChain %_ptr_StorageBuffer_v4float %v %uint_0 - %16 = OpAccessChain %_ptr_StorageBuffer_v4float %v %uint_0 - %17 = OpLoad %v4float %16 - %20 = OpVectorTimesMatrix %v4float %17 %19 - OpStore %15 %20 + %foo = OpFunction %void None %7 + %12 = OpLabel + %16 = OpAccessChain %_ptr_StorageBuffer_v4float %v %uint_0 %uint_0 + %17 = OpAccessChain %_ptr_StorageBuffer_v4float %v %uint_0 %uint_0 + %18 = OpLoad %v4float %17 + %21 = OpVectorTimesMatrix %v4float %18 %20 + OpStore %16 %21 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.glsl index 7e463898fe..a92ca53d06 100644 --- a/test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { vec4 a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a * 2.0f); + v.inner.a = (v.inner.a * 2.0f); } diff --git a/test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.spvasm index 733b250162..03c3e6bb9f 100644 --- a/test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.spvasm @@ -1,42 +1,46 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 20 +; Bound: 21 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 %float = OpTypeFloat 32 %v4float = OpTypeVector %float 4 %S = OpTypeStruct %v4float -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %6 = OpTypeFunction %void + %7 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float %float_2 = OpConstant %float 2 -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %6 - %11 = OpLabel - %15 = OpAccessChain %_ptr_StorageBuffer_v4float %v %uint_0 - %16 = OpAccessChain %_ptr_StorageBuffer_v4float %v %uint_0 - %17 = OpLoad %v4float %16 - %19 = OpVectorTimesScalar %v4float %17 %float_2 - OpStore %15 %19 + %foo = OpFunction %void None %7 + %12 = OpLabel + %16 = OpAccessChain %_ptr_StorageBuffer_v4float %v %uint_0 %uint_0 + %17 = OpAccessChain %_ptr_StorageBuffer_v4float %v %uint_0 %uint_0 + %18 = OpLoad %v4float %17 + %20 = OpVectorTimesScalar %v4float %18 %float_2 + OpStore %16 %20 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/vector/times.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/times.wgsl.expected.glsl index 69618977b3..b6a5435bbf 100644 --- a/test/tint/statements/compound_assign/vector/times.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/vector/times.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { ivec4 a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a * ivec4(2)); + v.inner.a = (v.inner.a * ivec4(2)); } diff --git a/test/tint/statements/compound_assign/vector/times.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/times.wgsl.expected.spvasm index 28e4545b18..62de04b8f2 100644 --- a/test/tint/statements/compound_assign/vector/times.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/vector/times.wgsl.expected.spvasm @@ -1,43 +1,47 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 21 +; Bound: 22 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 %int = OpTypeInt 32 1 %v4int = OpTypeVector %int 4 %S = OpTypeStruct %v4int -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %6 = OpTypeFunction %void + %7 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int %int_2 = OpConstant %int 2 - %19 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel + %20 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %6 - %11 = OpLabel - %15 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 - %16 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 - %17 = OpLoad %v4int %16 - %20 = OpIMul %v4int %17 %19 - OpStore %15 %20 + %foo = OpFunction %void None %7 + %12 = OpLabel + %16 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 + %17 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 + %18 = OpLoad %v4int %17 + %21 = OpIMul %v4int %18 %20 + OpStore %16 %21 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/vector/xor.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/xor.wgsl.expected.glsl index 7a74217571..becfe95862 100644 --- a/test/tint/statements/compound_assign/vector/xor.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/vector/xor.wgsl.expected.glsl @@ -4,11 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0, std430) buffer S_ssbo { +struct S { ivec4 a; +}; + +layout(binding = 0, std430) buffer v_block_ssbo { + S inner; } v; void foo() { - v.a = (v.a ^ ivec4(2)); + v.inner.a = (v.inner.a ^ ivec4(2)); } diff --git a/test/tint/statements/compound_assign/vector/xor.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/xor.wgsl.expected.spvasm index 105fc009f8..b06cfe9192 100644 --- a/test/tint/statements/compound_assign/vector/xor.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/vector/xor.wgsl.expected.spvasm @@ -1,43 +1,47 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 21 +; Bound: 22 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %v_block "v_block" + OpMemberName %v_block 0 "inner" OpName %S "S" OpMemberName %S 0 "a" OpName %v "v" OpName %unused_entry_point "unused_entry_point" OpName %foo "foo" - OpDecorate %S Block + OpDecorate %v_block Block + OpMemberDecorate %v_block 0 Offset 0 OpMemberDecorate %S 0 Offset 0 OpDecorate %v DescriptorSet 0 OpDecorate %v Binding 0 %int = OpTypeInt 32 1 %v4int = OpTypeVector %int 4 %S = OpTypeStruct %v4int -%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S - %v = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %v_block = OpTypeStruct %S +%_ptr_StorageBuffer_v_block = OpTypePointer StorageBuffer %v_block + %v = OpVariable %_ptr_StorageBuffer_v_block StorageBuffer %void = OpTypeVoid - %6 = OpTypeFunction %void + %7 = OpTypeFunction %void %uint = OpTypeInt 32 0 %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int %int_2 = OpConstant %int 2 - %19 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 -%unused_entry_point = OpFunction %void None %6 - %9 = OpLabel + %20 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel OpReturn OpFunctionEnd - %foo = OpFunction %void None %6 - %11 = OpLabel - %15 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 - %16 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 - %17 = OpLoad %v4int %16 - %20 = OpBitwiseXor %v4int %17 %19 - OpStore %15 %20 + %foo = OpFunction %void None %7 + %12 = OpLabel + %16 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 + %17 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 + %18 = OpLoad %v4int %17 + %21 = OpBitwiseXor %v4int %18 %20 + OpStore %16 %21 OpReturn OpFunctionEnd