From 05d8b02b0f49d46054105f21e388633562c201f7 Mon Sep 17 00:00:00 2001 From: Stephen White Date: Tue, 13 Sep 2022 19:48:51 +0000 Subject: [PATCH] GLSL: implement host-visible memory padding. Since GLSL ES does not support the offset= attribute, struct members with explicit @align or @size attributes require adding explicit padding members. This in turn requires rewriting any constructor calls to initialize the new padding to zero, handled in the same transform. Note that this is currently overly-verbose, and will add padding where GLSL doesn't technically need it (e.g., padding a vec3 out to 16 bytes). Bug: tint:1415 Change-Id: Ia9ba513066a0e84f4c43247fcbbe02f5fadd6630 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101720 Reviewed-by: Ben Clayton Commit-Queue: Stephen White Kokoro: Kokoro --- src/dawn/native/metal/BackendMTL.mm | 3 +- .../ComputeLayoutMemoryBufferTests.cpp | 6 +- src/tint/BUILD.gn | 3 + src/tint/CMakeLists.txt | 3 + src/tint/transform/pad_structs.cc | 146 +++++ src/tint/transform/pad_structs.h | 45 ++ src/tint/transform/pad_structs_test.cc | 597 ++++++++++++++++++ src/tint/writer/glsl/generator_impl.cc | 19 +- src/tint/writer/glsl/generator_impl.h | 3 +- .../glsl/generator_impl_function_test.cc | 6 +- .../generator_impl_member_accessor_test.cc | 18 + .../generator_impl_storage_buffer_test.cc | 4 +- .../generator_impl_uniform_buffer_test.cc | 2 +- src/tint/writer/spirv/builder_block_test.cc | 3 +- .../assign_to_function_var.wgsl.expected.glsl | 2 +- .../assign_to_private_var.wgsl.expected.glsl | 2 +- .../assign_to_storage_var.wgsl.expected.glsl | 2 +- ...assign_to_workgroup_var.wgsl.expected.glsl | 2 +- test/tint/array/strides.spvasm.expected.glsl | 23 +- .../benchmark/particles.wgsl.expected.glsl | 24 +- .../dynamic_index/read.wgsl.expected.glsl | 2 + .../dynamic_index/write.wgsl.expected.glsl | 2 + .../static_index/read.wgsl.expected.glsl | 1 + .../static_index/write.wgsl.expected.glsl | 1 + .../dynamic_index/read.wgsl.expected.glsl | 4 +- .../static_index/read.wgsl.expected.glsl | 7 +- .../dynamic_index_via_ptr.wgsl.expected.glsl | 2 +- .../static_index_via_ptr.wgsl.expected.glsl | 2 +- .../mat2x2/to_builtin.wgsl.expected.glsl | 4 +- .../std140/mat2x2/to_fn.wgsl.expected.glsl | 4 +- .../mat2x2/to_private.wgsl.expected.glsl | 4 +- .../mat2x2/to_storage.wgsl.expected.glsl | 10 +- .../mat2x2/to_workgroup.wgsl.expected.glsl | 4 +- .../dynamic_index_via_ptr.wgsl.expected.glsl | 12 +- .../static_index_via_ptr.wgsl.expected.glsl | 12 +- .../mat3x2/to_builtin.wgsl.expected.glsl | 6 +- .../std140/mat3x2/to_fn.wgsl.expected.glsl | 14 +- .../mat3x2/to_private.wgsl.expected.glsl | 14 +- .../mat3x2/to_storage.wgsl.expected.glsl | 30 +- .../mat3x2/to_workgroup.wgsl.expected.glsl | 14 +- .../dynamic_index_via_ptr.wgsl.expected.glsl | 2 +- .../static_index_via_ptr.wgsl.expected.glsl | 2 +- .../mat4x2/to_builtin.wgsl.expected.glsl | 4 +- .../std140/mat4x2/to_fn.wgsl.expected.glsl | 4 +- .../mat4x2/to_private.wgsl.expected.glsl | 4 +- .../mat4x2/to_storage.wgsl.expected.glsl | 10 +- .../mat4x2/to_workgroup.wgsl.expected.glsl | 4 +- .../uniform/types/array.wgsl.expected.glsl | 2 +- .../uniform/types/f32.wgsl.expected.glsl | 2 +- .../uniform/types/i32.wgsl.expected.glsl | 2 +- .../uniform/types/mat2x2.wgsl.expected.glsl | 2 +- .../uniform/types/mat2x3.wgsl.expected.glsl | 2 +- .../uniform/types/mat3x2.wgsl.expected.glsl | 2 +- .../uniform/types/mat4x4.wgsl.expected.glsl | 2 +- .../uniform/types/struct.wgsl.expected.glsl | 5 +- .../uniform/types/u32.wgsl.expected.glsl | 2 +- .../uniform/types/vec2.wgsl.expected.glsl | 2 +- .../uniform/types/vec3.wgsl.expected.glsl | 2 +- .../uniform/types/vec4.wgsl.expected.glsl | 2 +- .../bug/chromium/1273230.wgsl.expected.glsl | 4 +- test/tint/bug/dawn/947.wgsl.expected.glsl | 2 +- .../read/function.wgsl.expected.glsl | 5 +- .../read/private.wgsl.expected.glsl | 5 +- .../read/storage.wgsl.expected.glsl | 5 +- .../read/uniform.wgsl.expected.glsl | 5 +- .../read/workgroup.wgsl.expected.glsl | 5 +- .../write/function.wgsl.expected.glsl | 5 +- .../function_via_param.wgsl.expected.glsl | 5 +- .../write/private.wgsl.expected.glsl | 5 +- .../private_via_param.wgsl.expected.glsl | 5 +- .../write/storage.wgsl.expected.glsl | 5 +- .../write/workgroup.wgsl.expected.glsl | 5 +- .../1206.wgsl.expected.glsl | 9 +- .../local_assign_scalar_x.wgsl.expected.glsl | 4 +- .../local_assign_scalar_xy.wgsl.expected.glsl | 4 +- .../local_assign_scalar_y.wgsl.expected.glsl | 4 +- .../local_assign_vector.wgsl.expected.glsl | 4 +- .../module_assign_scalar_x.wgsl.expected.glsl | 4 +- ...module_assign_scalar_xy.wgsl.expected.glsl | 4 +- .../module_assign_scalar_y.wgsl.expected.glsl | 4 +- .../module_assign_vector.wgsl.expected.glsl | 4 +- test/tint/bug/tint/1046.wgsl.expected.glsl | 4 +- test/tint/bug/tint/1061.spvasm.expected.glsl | 2 +- test/tint/bug/tint/1088.spvasm.expected.glsl | 8 +- test/tint/bug/tint/1113.wgsl.expected.glsl | 12 +- test/tint/bug/tint/1118.wgsl.expected.glsl | 9 +- test/tint/bug/tint/1121.wgsl.expected.glsl | 6 +- test/tint/bug/tint/1520.spvasm.expected.glsl | 9 +- test/tint/bug/tint/294.wgsl.expected.glsl | 2 + test/tint/bug/tint/369.wgsl.expected.glsl | 2 +- test/tint/bug/tint/403.wgsl.expected.glsl | 4 +- test/tint/bug/tint/534.wgsl.expected.glsl | 2 +- test/tint/bug/tint/744.wgsl.expected.glsl | 4 +- test/tint/bug/tint/749.spvasm.expected.glsl | 4 +- test/tint/bug/tint/913.wgsl.expected.glsl | 2 +- test/tint/bug/tint/914.wgsl.expected.glsl | 3 +- test/tint/bug/tint/922.wgsl.expected.glsl | 6 +- test/tint/bug/tint/942.wgsl.expected.glsl | 9 +- test/tint/bug/tint/943.spvasm.expected.glsl | 10 +- test/tint/bug/tint/948.wgsl.expected.glsl | 5 +- test/tint/bug/tint/949.wgsl.expected.glsl | 8 +- test/tint/bug/tint/951.spvasm.expected.glsl | 5 +- test/tint/bug/tint/959.wgsl.expected.glsl | 64 +- test/tint/bug/tint/993.wgsl.expected.glsl | 5 +- test/tint/bug/tint/998.wgsl.expected.glsl | 5 +- .../ba1481.wgsl.expected.glsl | 6 +- .../textureLoad/8acf41.wgsl.expected.glsl | 6 +- .../979816.wgsl.expected.glsl | 6 +- .../ba1481.wgsl.expected.glsl | 6 +- .../var/textureLoad/8acf41.wgsl.expected.glsl | 6 +- .../979816.wgsl.expected.glsl | 6 +- .../texture_external_param.wgsl.expected.glsl | 6 +- .../mul/mat3x2-vec3/f32.wgsl.expected.glsl | 5 +- .../mul/mat3x3-vec3/f32.wgsl.expected.glsl | 3 +- .../mul/vec3-mat3x3/f32.wgsl.expected.glsl | 3 +- .../mul/vec3-mat4x3/f32.wgsl.expected.glsl | 3 +- .../read/packed_vec3/f32.wgsl.expected.glsl | 3 +- .../read/packed_vec3/i32.wgsl.expected.glsl | 3 +- .../read/packed_vec3/u32.wgsl.expected.glsl | 3 +- .../write/packed_vec3/f32.wgsl.expected.glsl | 1 + .../write/packed_vec3/i32.wgsl.expected.glsl | 1 + .../write/packed_vec3/u32.wgsl.expected.glsl | 1 + .../mat2x2/stride/16.spvasm.expected.glsl | 6 +- .../load/local/ptr_uniform.wgsl.expected.glsl | 5 +- .../samples/compute_boids.wgsl.expected.glsl | 3 +- test/tint/samples/cube.wgsl.expected.glsl | 2 +- ...d_struct_storage_buffer.wgsl.expected.glsl | 60 +- .../in_for_loop_body.wgsl.expected.glsl | 5 +- .../in_for_loop_continuing.wgsl.expected.glsl | 5 +- .../in_for_loop_init.wgsl.expected.glsl | 5 +- ...g_with_side_effect_func.wgsl.expected.glsl | 4 +- .../struct_array.wgsl.expected.glsl | 5 +- .../struct_array_array.wgsl.expected.glsl | 4 +- .../struct_array_struct.wgsl.expected.glsl | 5 +- ...ruct_array_struct_array.wgsl.expected.glsl | 4 +- .../struct_dynamic_array.wgsl.expected.glsl | 5 +- ...amic_array_struct_array.wgsl.expected.glsl | 4 +- .../struct_matrix.wgsl.expected.glsl | 5 +- .../struct_multiple_arrays.wgsl.expected.glsl | 5 +- .../struct_struct_array.wgsl.expected.glsl | 5 +- .../struct_vector.wgsl.expected.glsl | 5 +- .../vector_assign.wgsl.expected.glsl | 5 +- .../via_pointer.wgsl.expected.glsl | 5 +- .../via_pointer_arg.wgsl.expected.glsl | 5 +- .../phony/uniform_buffer.wgsl.expected.glsl | 5 +- .../for_loop.wgsl.expected.glsl | 3 + 146 files changed, 1452 insertions(+), 192 deletions(-) create mode 100644 src/tint/transform/pad_structs.cc create mode 100644 src/tint/transform/pad_structs.h create mode 100644 src/tint/transform/pad_structs_test.cc diff --git a/src/dawn/native/metal/BackendMTL.mm b/src/dawn/native/metal/BackendMTL.mm index 3ef6f3f1e7..9415e52828 100644 --- a/src/dawn/native/metal/BackendMTL.mm +++ b/src/dawn/native/metal/BackendMTL.mm @@ -671,8 +671,7 @@ ResultOrError>> Backend::DiscoverAdapters( // iOS only has a single device so MTLCopyAllDevices doesn't exist there. #if defined(DAWN_PLATFORM_IOS) - Ref adapter = - AcquireRef(new Adapter(GetInstance(), MTLCreateSystemDefaultDevice())); + Ref adapter = AcquireRef(new Adapter(GetInstance(), MTLCreateSystemDefaultDevice())); if (!GetInstance()->ConsumedError(adapter->Initialize())) { adapters.push_back(std::move(adapter)); } diff --git a/src/dawn/tests/end2end/ComputeLayoutMemoryBufferTests.cpp b/src/dawn/tests/end2end/ComputeLayoutMemoryBufferTests.cpp index b75c9ba992..3dad8baea1 100644 --- a/src/dawn/tests/end2end/ComputeLayoutMemoryBufferTests.cpp +++ b/src/dawn/tests/end2end/ComputeLayoutMemoryBufferTests.cpp @@ -344,13 +344,15 @@ namespace { auto GenerateParams() { auto params = MakeParamGenerator( { - D3D12Backend(), MetalBackend(), VulkanBackend(), + D3D12Backend(), + MetalBackend(), + VulkanBackend(), // TODO(crbug.com/dawn/942) // There was a compiler error: Buffer block cannot be expressed as any of std430, // std140, scalar, even with enhanced layouts. You can try flattening this block to // support a more flexible layout. // OpenGLBackend(), - // OpenGLESBackend(), + OpenGLESBackend(), }, {StorageClass::Storage, StorageClass::Uniform}, { diff --git a/src/tint/BUILD.gn b/src/tint/BUILD.gn index ea32d7898e..6f2d21d53d 100644 --- a/src/tint/BUILD.gn +++ b/src/tint/BUILD.gn @@ -514,6 +514,8 @@ libtint_source_set("libtint_core_all_src") { "transform/multiplanar_external_texture.h", "transform/num_workgroups_from_uniform.cc", "transform/num_workgroups_from_uniform.h", + "transform/pad_structs.cc", + "transform/pad_structs.h", "transform/promote_initializers_to_let.cc", "transform/promote_initializers_to_let.h", "transform/promote_side_effects_to_decl.cc", @@ -1207,6 +1209,7 @@ if (tint_build_unittests) { "transform/module_scope_var_to_entry_point_param_test.cc", "transform/multiplanar_external_texture_test.cc", "transform/num_workgroups_from_uniform_test.cc", + "transform/pad_structs_test.cc", "transform/promote_initializers_to_let_test.cc", "transform/promote_side_effects_to_decl_test.cc", "transform/remove_continue_in_switch_test.cc", diff --git a/src/tint/CMakeLists.txt b/src/tint/CMakeLists.txt index 08212d38b8..545ff86b59 100644 --- a/src/tint/CMakeLists.txt +++ b/src/tint/CMakeLists.txt @@ -426,6 +426,8 @@ set(TINT_LIB_SRCS transform/multiplanar_external_texture.h transform/num_workgroups_from_uniform.cc transform/num_workgroups_from_uniform.h + transform/pad_structs.cc + transform/pad_structs.h transform/promote_initializers_to_let.cc transform/promote_initializers_to_let.h transform/promote_side_effects_to_decl.cc @@ -1123,6 +1125,7 @@ if(TINT_BUILD_TESTS) transform/module_scope_var_to_entry_point_param_test.cc transform/multiplanar_external_texture_test.cc transform/num_workgroups_from_uniform_test.cc + transform/pad_structs_test.cc transform/promote_initializers_to_let_test.cc transform/promote_side_effects_to_decl_test.cc transform/remove_continue_in_switch_test.cc diff --git a/src/tint/transform/pad_structs.cc b/src/tint/transform/pad_structs.cc new file mode 100644 index 0000000000..c0be12ccd8 --- /dev/null +++ b/src/tint/transform/pad_structs.cc @@ -0,0 +1,146 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/transform/pad_structs.h" + +#include +#include +#include + +#include "src/tint/ast/parameter.h" +#include "src/tint/program_builder.h" +#include "src/tint/sem/call.h" +#include "src/tint/sem/module.h" +#include "src/tint/sem/type_constructor.h" + +using namespace tint::number_suffixes; // NOLINT + +TINT_INSTANTIATE_TYPEINFO(tint::transform::PadStructs); + +namespace tint::transform { + +namespace { + +void CreatePadding(utils::Vector* new_members, + utils::Hashset* padding_members, + ProgramBuilder* b, + uint32_t bytes) { + for (uint32_t i = 0; i < bytes / 4u; ++i) { + auto name = b->Symbols().New("pad"); + auto* member = b->Member(name, b->ty.u32()); + padding_members->Add(member); + new_members->Push(member); + } +} + +} // namespace + +PadStructs::PadStructs() = default; + +PadStructs::~PadStructs() = default; + +void PadStructs::Run(CloneContext& ctx, const DataMap&, DataMap&) const { + auto& sem = ctx.src->Sem(); + + std::unordered_map replaced_structs; + utils::Hashset padding_members; + + ctx.ReplaceAll([&](const ast::Struct* ast_str) -> const ast::Struct* { + auto* str = sem.Get(ast_str); + if (!str || !str->IsHostShareable()) { + return nullptr; + } + uint32_t offset = 0; + bool has_runtime_sized_array = false; + utils::Vector new_members; + for (auto* mem : str->Members()) { + auto name = ctx.src->Symbols().NameFor(mem->Name()); + + if (offset < mem->Offset()) { + CreatePadding(&new_members, &padding_members, ctx.dst, mem->Offset() - offset); + offset = mem->Offset(); + } + + auto* ty = mem->Type(); + const ast::Type* type = CreateASTTypeFor(ctx, ty); + + new_members.Push(ctx.dst->Member(name, type)); + + uint32_t size = ty->Size(); + if (ty->Is() && str->UsedAs(ast::StorageClass::kUniform)) { + // std140 structs should be padded out to 16 bytes. + size = utils::RoundUp(16u, size); + } else if (auto* array_ty = ty->As()) { + if (array_ty->Count() == 0) { + has_runtime_sized_array = true; + } + } + offset += size; + } + + // Add any required padding after the last member, if it's not a runtime-sized array. + uint32_t struct_size = str->Size(); + if (str->UsedAs(ast::StorageClass::kUniform)) { + struct_size = utils::RoundUp(16u, struct_size); + } + if (offset < struct_size && !has_runtime_sized_array) { + CreatePadding(&new_members, &padding_members, ctx.dst, struct_size - offset); + } + auto* new_struct = ctx.dst->create(ctx.Clone(ast_str->name), + std::move(new_members), utils::Empty); + replaced_structs[ast_str] = new_struct; + return new_struct; + }); + + ctx.ReplaceAll([&](const ast::CallExpression* ast_call) -> const ast::CallExpression* { + if (ast_call->args.Length() == 0) { + return nullptr; + } + + auto* call = sem.Get(ast_call); + if (!call) { + return nullptr; + } + auto* cons = call->Target()->As(); + if (!cons) { + return nullptr; + } + auto* str = cons->ReturnType()->As(); + if (!str) { + return nullptr; + } + + auto* new_struct = replaced_structs[str->Declaration()]; + if (!new_struct) { + return nullptr; + } + + utils::Vector new_args; + + auto* arg = ast_call->args.begin(); + for (auto* member : new_struct->members) { + if (padding_members.Contains(member)) { + new_args.Push(ctx.dst->Expr(0_u)); + } else { + new_args.Push(ctx.Clone(*arg)); + arg++; + } + } + return ctx.dst->Construct(CreateASTTypeFor(ctx, str), new_args); + }); + + ctx.Clone(); +} + +} // namespace tint::transform diff --git a/src/tint/transform/pad_structs.h b/src/tint/transform/pad_structs.h new file mode 100644 index 0000000000..55fec749e4 --- /dev/null +++ b/src/tint/transform/pad_structs.h @@ -0,0 +1,45 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_TRANSFORM_PAD_STRUCTS_H_ +#define SRC_TINT_TRANSFORM_PAD_STRUCTS_H_ + +#include "src/tint/transform/transform.h" + +namespace tint::transform { + +/// This transform turns all explicit alignment and sizing into padding +/// members of structs. This is required for GLSL ES, since it not support +/// the offset= decoration. +class PadStructs final : public Castable { + public: + /// Constructor + PadStructs(); + + /// Destructor + ~PadStructs() override; + + protected: + /// Runs the transform using the CloneContext built for transforming a + /// program. Run() is responsible for calling Clone() on the CloneContext. + /// @param ctx the CloneContext primed with the input program and + /// ProgramBuilder + /// @param inputs optional extra transform-specific input data + /// @param outputs optional extra transform-specific output data + void Run(CloneContext& ctx, const DataMap& inputs, DataMap& outputs) const override; +}; + +} // namespace tint::transform + +#endif // SRC_TINT_TRANSFORM_PAD_STRUCTS_H_ diff --git a/src/tint/transform/pad_structs_test.cc b/src/tint/transform/pad_structs_test.cc new file mode 100644 index 0000000000..694175e716 --- /dev/null +++ b/src/tint/transform/pad_structs_test.cc @@ -0,0 +1,597 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/transform/pad_structs.h" + +#include +#include + +#include "src/tint/transform/test_helper.h" + +namespace tint::transform { +namespace { + +using PadStructsTest = TransformTest; + +TEST_F(PadStructsTest, EmptyModule) { + auto* src = ""; + auto* expect = src; + + DataMap data; + auto got = Run(src, data); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PadStructsTest, Uniform) { + auto* src = R"( +struct S { + x : i32, +} + +@group(0) @binding(0) var u : S; + +fn main() { + let x = u.x; +} +)"; + auto* expect = R"( +struct S { + x : i32, + pad : u32, + pad_1 : u32, + pad_2 : u32, +} + +@group(0) @binding(0) var u : S; + +fn main() { + let x = u.x; +} +)"; + DataMap data; + auto got = Run(src, data); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PadStructsTest, Size) { + auto* src = R"( +struct S { + @size(12) + x : i32, + y : i32, +} + +@group(0) @binding(0) var u : S; + +fn main() { + let x = u.x; +} +)"; + auto* expect = R"( +struct S { + x : i32, + pad : u32, + pad_1 : u32, + y : i32, +} + +@group(0) @binding(0) var u : S; + +fn main() { + let x = u.x; +} +)"; + + DataMap data; + auto got = Run(src, data); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PadStructsTest, SizeUniformAndPrivate) { + auto* src = R"( +struct S { + @size(12) + x : i32, + y : i32, +} + +@group(0) @binding(0) var u : S; + +var p : S; + +fn main() { + p.x = u.x; +} +)"; + auto* expect = R"( +struct S { + x : i32, + pad : u32, + pad_1 : u32, + y : i32, +} + +@group(0) @binding(0) var u : S; + +var p : S; + +fn main() { + p.x = u.x; +} +)"; + + DataMap data; + auto got = Run(src, data); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PadStructsTest, SizeStorageAndPrivate) { + auto* src = R"( +struct S { + @size(12) + x : i32, + y : i32, +} + +@group(0) @binding(0) var s : S; + +var p : S; + +fn main() { + p.x = 123; + s.x = p.x; +} +)"; + auto* expect = R"( +struct S { + x : i32, + pad : u32, + pad_1 : u32, + y : i32, +} + +@group(0) @binding(0) var s : S; + +var p : S; + +fn main() { + p.x = 123; + s.x = p.x; +} +)"; + + DataMap data; + auto got = Run(src, data); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PadStructsTest, SizeUniformAndStorage) { + auto* src = R"( +struct S { + @size(12) + x : i32, + y : i32, +} + +@group(0) @binding(0) var u : S; + +@group(0) @binding(1) var s : S; + +fn main() { + s.x = u.x; +} +)"; + auto* expect = R"( +struct S { + x : i32, + pad : u32, + pad_1 : u32, + y : i32, +} + +@group(0) @binding(0) var u : S; + +@group(0) @binding(1) var s : S; + +fn main() { + s.x = u.x; +} +)"; + + DataMap data; + auto got = Run(src, data); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PadStructsTest, SizePrivateOnly) { + // Structs that are not host-visible should have no explicit padding. + auto* src = R"( +struct S { + @size(12) + x : i32, + y : i32, +} + +var p : S; + +fn main() { + p.x = 123; +} +)"; + auto* expect = R"( +struct S { + @size(12) + x : i32, + y : i32, +} + +var p : S; + +fn main() { + p.x = 123; +} +)"; + + DataMap data; + auto got = Run(src, data); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PadStructsTest, AlignUniformAndPrivate) { + auto* src = R"( +struct S { + a : i32, + @align(16) + b : i32, +} + +@group(0) @binding(0) var u : S; + +var p : S; + +fn main() { + p.a = u.b; + p.b = u.a; +} +)"; + auto* expect = R"( +struct S { + a : i32, + pad : u32, + pad_1 : u32, + pad_2 : u32, + b : i32, + pad_3 : u32, + pad_4 : u32, + pad_5 : u32, +} + +@group(0) @binding(0) var u : S; + +var p : S; + +fn main() { + p.a = u.b; + p.b = u.a; +} +)"; + + DataMap data; + auto got = Run(src, data); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PadStructsTest, AlignStorageAndPrivate) { + auto* src = R"( +struct S { + a : i32, + @align(16) + b : i32, +} + +@group(0) @binding(0) var s : S; + +var p : S; + +fn main() { + p.a = 123; + p.b = 321; + s.a = p.b; + s.b = p.a; +} +)"; + auto* expect = R"( +struct S { + a : i32, + pad : u32, + pad_1 : u32, + pad_2 : u32, + b : i32, + pad_3 : u32, + pad_4 : u32, + pad_5 : u32, +} + +@group(0) @binding(0) var s : S; + +var p : S; + +fn main() { + p.a = 123; + p.b = 321; + s.a = p.b; + s.b = p.a; +} +)"; + + DataMap data; + auto got = Run(src, data); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PadStructsTest, AlignUniformAndStorage) { + auto* src = R"( +struct S { + a : i32, + @align(16) + b : i32, +} + +@group(0) @binding(0) var u : S; + +@group(0) @binding(1) var s : S; + +fn main() { + s.a = u.b; + s.b = u.a; +} +)"; + auto* expect = R"( +struct S { + a : i32, + pad : u32, + pad_1 : u32, + pad_2 : u32, + b : i32, + pad_3 : u32, + pad_4 : u32, + pad_5 : u32, +} + +@group(0) @binding(0) var u : S; + +@group(0) @binding(1) var s : S; + +fn main() { + s.a = u.b; + s.b = u.a; +} +)"; + + DataMap data; + auto got = Run(src, data); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PadStructsTest, AlignPrivateOnly) { + // Structs that are not host-visible should have no explicit padding. + auto* src = R"( +struct S { + a : i32, + @align(16) + b : i32, +} + +var p : S; + +fn main() { + p.a = 123; + p.b = 321; +} +)"; + auto* expect = R"( +struct S { + a : i32, + @align(16) + b : i32, +} + +var p : S; + +fn main() { + p.a = 123; + p.b = 321; +} +)"; + + DataMap data; + auto got = Run(src, data); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PadStructsTest, LastMemberRuntimeSizeArray) { + // Structs with runtime-sized arrays should not be padded after the + // last member. + auto* src = R"( +struct T { + a : f32, + b : i32, +} + +struct S { + a : vec4, + b : array, +} + +@group(0) @binding(0) var s : S; + +fn main() { + s.b[0] = T(1.0f, 23); +} +)"; + auto* expect = R"( +struct T { + a : f32, + b : i32, +} + +struct S { + a : vec4, + b : array, +} + +@group(0) @binding(0) var s : S; + +fn main() { + s.b[0] = T(1.0f, 23); +} +)"; + + DataMap data; + auto got = Run(src, data); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PadStructsTest, LastMemberFixedSizeArray) { + // Structs without runtime-sized arrays should be padded after the last + // member. + auto* src = R"( +struct T { + a : f32, + b : i32, +} + +struct S { + a : vec4, + b : array, +} + +@group(0) @binding(0) var s : S; + +fn main() { + s.b[0] = T(1.0f, 23); +} +)"; + auto* expect = R"( +struct T { + a : f32, + b : i32, +} + +struct S { + a : vec4, + b : array, + pad : u32, + pad_1 : u32, +} + +@group(0) @binding(0) var s : S; + +fn main() { + s.b[0] = T(1.0f, 23); +} +)"; + + DataMap data; + auto got = Run(src, data); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PadStructsTest, Constructor) { + // Calls to a constructor of a padded struct must be modified to initialize the padding. + auto* src = R"( +struct S { + a : f32, + @align(8) + b : i32, +} + +@group(0) @binding(0) var s : S; + +fn main() { + s = S(1.0f, 2); +} +)"; + auto* expect = R"( +struct S { + a : f32, + pad : u32, + b : i32, + pad_1 : u32, +} + +@group(0) @binding(0) var s : S; + +fn main() { + s = S(1.0f, 0u, 2, 0u); +} +)"; + + DataMap data; + auto got = Run(src, data); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(PadStructsTest, ConstructorZeroArgs) { + // Calls to a zero-argument constructor of a padded struct should not be modified. + auto* src = R"( +struct S { + a : f32, + @align(8) + b : i32, +} + +@group(0) @binding(0) var s : S; + +fn main() { + s = S(); +} +)"; + auto* expect = R"( +struct S { + a : f32, + pad : u32, + b : i32, + pad_1 : u32, +} + +@group(0) @binding(0) var s : S; + +fn main() { + s = S(); +} +)"; + + DataMap data; + auto got = Run(src, data); + + EXPECT_EQ(expect, str(got)); +} + +} // namespace +} // namespace tint::transform diff --git a/src/tint/writer/glsl/generator_impl.cc b/src/tint/writer/glsl/generator_impl.cc index 3f989992d6..d35570b2d2 100644 --- a/src/tint/writer/glsl/generator_impl.cc +++ b/src/tint/writer/glsl/generator_impl.cc @@ -58,6 +58,7 @@ #include "src/tint/transform/fold_trivial_single_use_lets.h" #include "src/tint/transform/loop_to_for_loop.h" #include "src/tint/transform/manager.h" +#include "src/tint/transform/pad_structs.h" #include "src/tint/transform/promote_initializers_to_let.h" #include "src/tint/transform/promote_side_effects_to_decl.h" #include "src/tint/transform/remove_phonies.h" @@ -220,6 +221,7 @@ SanitizedResult Sanitize(const Program* in, manager.Add(); manager.Add(); manager.Add(); // Must come after PromoteSideEffectsToDecl + manager.Add(); manager.Add(); manager.Add(); @@ -1910,13 +1912,10 @@ bool GeneratorImpl::EmitUniformVariable(const ast::Var* var, const sem::Variable auto bp = sem->As()->BindingPoint(); { auto out = line(); - out << "layout(binding = " << bp.binding; - if (version_.IsDesktop()) { - out << ", std140"; - } + out << "layout(binding = " << bp.binding << ", std140"; out << ") uniform " << UniqueIdentifier(StructName(str) + "_ubo") << " {"; } - EmitStructMembers(current_buffer_, str, /* emit_offsets */ true); + EmitStructMembers(current_buffer_, str); auto name = builder_.Symbols().NameFor(var->symbol); line() << "} " << name << ";"; line(); @@ -1934,7 +1933,7 @@ bool GeneratorImpl::EmitStorageVariable(const ast::Var* var, const sem::Variable auto bp = sem->As()->BindingPoint(); line() << "layout(binding = " << bp.binding << ", std430) buffer " << UniqueIdentifier(StructName(str) + "_ssbo") << " {"; - EmitStructMembers(current_buffer_, str, /* emit_offsets */ true); + EmitStructMembers(current_buffer_, str); auto name = builder_.Symbols().NameFor(var->symbol); line() << "} " << name << ";"; line(); @@ -2859,7 +2858,7 @@ bool GeneratorImpl::EmitTypeAndName(std::ostream& out, bool GeneratorImpl::EmitStructType(TextBuffer* b, const sem::Struct* str) { auto storage_class_uses = str->StorageClassUsage(); line(b) << "struct " << StructName(str) << " {"; - EmitStructMembers(b, str, false); + EmitStructMembers(b, str); line(b) << "};"; line(b); @@ -2874,7 +2873,7 @@ bool GeneratorImpl::EmitStructTypeOnce(TextBuffer* buffer, const sem::Struct* st return EmitStructType(buffer, str); } -bool GeneratorImpl::EmitStructMembers(TextBuffer* b, const sem::Struct* str, bool emit_offsets) { +bool GeneratorImpl::EmitStructMembers(TextBuffer* b, const sem::Struct* str) { ScopedIndent si(b); for (auto* mem : str->Members()) { auto name = builder_.Symbols().NameFor(mem->Name()); @@ -2883,10 +2882,6 @@ bool GeneratorImpl::EmitStructMembers(TextBuffer* b, const sem::Struct* str, boo auto out = line(b); - // Note: offsets are unsupported on GLSL ES. - if (emit_offsets && version_.IsDesktop() && mem->Offset() != 0) { - out << "layout(offset=" << mem->Offset() << ") "; - } if (!EmitTypeAndName(out, ty, ast::StorageClass::kNone, ast::Access::kReadWrite, name)) { return false; } diff --git a/src/tint/writer/glsl/generator_impl.h b/src/tint/writer/glsl/generator_impl.h index cab688136b..9d1016a46b 100644 --- a/src/tint/writer/glsl/generator_impl.h +++ b/src/tint/writer/glsl/generator_impl.h @@ -432,9 +432,8 @@ class GeneratorImpl : public TextGenerator { /// Handles generating the members of a structure /// @param buffer the text buffer that the struct members will be written to /// @param ty the struct to generate - /// @param emit_offsets whether offsets should be emitted as offset= /// @returns true if the struct members are emitted - bool EmitStructMembers(TextBuffer* buffer, const sem::Struct* ty, bool emit_offsets); + bool EmitStructMembers(TextBuffer* buffer, const sem::Struct* ty); /// Handles a unary op expression /// @param out the output of the expression stream /// @param expr the expression to emit diff --git a/src/tint/writer/glsl/generator_impl_function_test.cc b/src/tint/writer/glsl/generator_impl_function_test.cc index 473c30cee3..eb0a9a8521 100644 --- a/src/tint/writer/glsl/generator_impl_function_test.cc +++ b/src/tint/writer/glsl/generator_impl_function_test.cc @@ -384,7 +384,7 @@ struct UBO { vec4 coord; }; -layout(binding = 0) uniform UBO_ubo { +layout(binding = 0, std140) uniform UBO_ubo { vec4 coord; } ubo; @@ -425,7 +425,7 @@ struct Uniforms { vec4 coord; }; -layout(binding = 0) uniform Uniforms_ubo { +layout(binding = 0, std140) uniform Uniforms_ubo { vec4 coord; } uniforms; @@ -635,7 +635,7 @@ struct S { float x; }; -layout(binding = 0) uniform S_ubo { +layout(binding = 0, std140) uniform S_ubo { float x; } coord; 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 b44a11b1e6..43c0d82306 100644 --- a/src/tint/writer/glsl/generator_impl_member_accessor_test.cc +++ b/src/tint/writer/glsl/generator_impl_member_accessor_test.cc @@ -279,6 +279,9 @@ precision mediump float; layout(binding = 0, std430) buffer Data_ssbo { int a; + uint pad; + uint pad_1; + uint pad_2; mat2x3 b; } data; @@ -320,6 +323,9 @@ precision mediump float; layout(binding = 0, std430) buffer Data_ssbo { float z; + uint pad; + uint pad_1; + uint pad_2; mat4x3 a; } data; @@ -497,7 +503,9 @@ precision mediump float; struct Inner { vec3 a; + uint pad; vec3 b; + uint pad_1; }; layout(binding = 0, std430) buffer Data_ssbo { @@ -552,7 +560,9 @@ precision mediump float; struct Inner { vec3 a; + uint pad; vec3 b; + uint pad_1; }; layout(binding = 0, std430) buffer Data_ssbo { @@ -608,7 +618,9 @@ precision mediump float; struct Inner { vec3 a; + uint pad; vec3 b; + uint pad_1; }; layout(binding = 0, std430) buffer Data_ssbo { @@ -663,7 +675,9 @@ precision mediump float; struct Inner { vec3 a; + uint pad; vec3 b; + uint pad_1; }; layout(binding = 0, std430) buffer Data_ssbo { @@ -717,7 +731,9 @@ precision mediump float; struct Inner { vec3 a; + uint pad; vec3 b; + uint pad_1; }; layout(binding = 0, std430) buffer Data_ssbo { @@ -772,7 +788,9 @@ precision mediump float; struct Inner { ivec3 a; + uint pad; vec3 b; + uint pad_1; }; layout(binding = 0, std430) buffer Data_ssbo { diff --git a/src/tint/writer/glsl/generator_impl_storage_buffer_test.cc b/src/tint/writer/glsl/generator_impl_storage_buffer_test.cc index 2c7bed1e39..f6f127fb57 100644 --- a/src/tint/writer/glsl/generator_impl_storage_buffer_test.cc +++ b/src/tint/writer/glsl/generator_impl_storage_buffer_test.cc @@ -82,8 +82,8 @@ struct Nephews { layout(binding = 0, std430) buffer Nephews_ssbo { float huey; - layout(offset=256) float dewey; - layout(offset=512) float louie; + float dewey; + float louie; } nephews; )"); diff --git a/src/tint/writer/glsl/generator_impl_uniform_buffer_test.cc b/src/tint/writer/glsl/generator_impl_uniform_buffer_test.cc index e3d2eeea96..cae4735c18 100644 --- a/src/tint/writer/glsl/generator_impl_uniform_buffer_test.cc +++ b/src/tint/writer/glsl/generator_impl_uniform_buffer_test.cc @@ -37,7 +37,7 @@ struct Simple { float member; }; -layout(binding = 0) uniform Simple_ubo { +layout(binding = 0, std140) uniform Simple_ubo { float member; } simple; diff --git a/src/tint/writer/spirv/builder_block_test.cc b/src/tint/writer/spirv/builder_block_test.cc index 76f7556ad6..f89db11c23 100644 --- a/src/tint/writer/spirv/builder_block_test.cc +++ b/src/tint/writer/spirv/builder_block_test.cc @@ -26,8 +26,7 @@ TEST_F(BuilderTest, Block) { // Note, this test uses shadow variables which aren't allowed in WGSL but // serves to prove the block code is pushing new scopes as needed. auto* inner = Block(Decl(Var("var", ty.f32())), Assign("var", 2_f)); - auto* outer = Block(Decl(Var("var", ty.f32())), Assign("var", 1_f), - inner, Assign("var", 3_f)); + auto* outer = Block(Decl(Var("var", ty.f32())), Assign("var", 1_f), inner, Assign("var", 3_f)); WrapInFunction(outer); diff --git a/test/tint/array/assign_to_function_var.wgsl.expected.glsl b/test/tint/array/assign_to_function_var.wgsl.expected.glsl index ecaba844b9..f3c51f858c 100644 --- a/test/tint/array/assign_to_function_var.wgsl.expected.glsl +++ b/test/tint/array/assign_to_function_var.wgsl.expected.glsl @@ -10,7 +10,7 @@ struct S { 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) uniform src_uniform_block_ubo { +layout(binding = 0, std140) uniform src_uniform_block_ubo { S inner; } src_uniform; diff --git a/test/tint/array/assign_to_private_var.wgsl.expected.glsl b/test/tint/array/assign_to_private_var.wgsl.expected.glsl index 57630d574a..bc6ac3112f 100644 --- a/test/tint/array/assign_to_private_var.wgsl.expected.glsl +++ b/test/tint/array/assign_to_private_var.wgsl.expected.glsl @@ -10,7 +10,7 @@ struct S { 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) uniform src_uniform_block_ubo { +layout(binding = 0, std140) uniform src_uniform_block_ubo { S inner; } src_uniform; 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 fd9a95f367..2535ca8dbd 100644 --- a/test/tint/array/assign_to_storage_var.wgsl.expected.glsl +++ b/test/tint/array/assign_to_storage_var.wgsl.expected.glsl @@ -10,7 +10,7 @@ struct S { 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) uniform src_uniform_block_ubo { +layout(binding = 0, std140) uniform src_uniform_block_ubo { S inner; } src_uniform; diff --git a/test/tint/array/assign_to_workgroup_var.wgsl.expected.glsl b/test/tint/array/assign_to_workgroup_var.wgsl.expected.glsl index c023ca5fd0..ba0987799f 100644 --- a/test/tint/array/assign_to_workgroup_var.wgsl.expected.glsl +++ b/test/tint/array/assign_to_workgroup_var.wgsl.expected.glsl @@ -10,7 +10,7 @@ struct S { 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) uniform src_uniform_block_ubo { +layout(binding = 0, std140) uniform src_uniform_block_ubo { S inner; } src_uniform; diff --git a/test/tint/array/strides.spvasm.expected.glsl b/test/tint/array/strides.spvasm.expected.glsl index 90c988ab4e..290bcb49d6 100644 --- a/test/tint/array/strides.spvasm.expected.glsl +++ b/test/tint/array/strides.spvasm.expected.glsl @@ -2,10 +2,31 @@ struct strided_arr { float el; + uint pad; }; struct strided_arr_1 { strided_arr el[3][2]; + uint pad_1; + uint pad_2; + uint pad_3; + uint pad_4; + uint pad_5; + uint pad_6; + uint pad_7; + uint pad_8; + uint pad_9; + uint pad_10; + uint pad_11; + uint pad_12; + uint pad_13; + uint pad_14; + uint pad_15; + uint pad_16; + uint pad_17; + uint pad_18; + uint pad_19; + uint pad_20; }; layout(binding = 0, std430) buffer S_ssbo { @@ -17,7 +38,7 @@ void f_1() { 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 tint_symbol[4] = strided_arr_1[4](strided_arr_1(strided_arr[3][2](strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)), strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)), strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)))), strided_arr_1(strided_arr[3][2](strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)), strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)), strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)))), strided_arr_1(strided_arr[3][2](strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)), strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)), strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)))), strided_arr_1(strided_arr[3][2](strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)), strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)), strided_arr[2](strided_arr(0.0f), strided_arr(0.0f))))); + 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; return; diff --git a/test/tint/benchmark/particles.wgsl.expected.glsl b/test/tint/benchmark/particles.wgsl.expected.glsl index 4f82c9e412..b0a08c13b3 100644 --- a/test/tint/benchmark/particles.wgsl.expected.glsl +++ b/test/tint/benchmark/particles.wgsl.expected.glsl @@ -7,10 +7,12 @@ layout(location = 1) in vec4 color_1; layout(location = 2) in vec2 quad_pos_1; layout(location = 0) out vec4 color_2; layout(location = 1) out vec2 quad_pos_2; -layout(binding = 0) uniform RenderParams_ubo { +layout(binding = 0, std140) uniform RenderParams_ubo { mat4 modelViewProjectionMatrix; vec3 right; + uint pad; vec3 up; + uint pad_1; } render_params; struct VertexInput { @@ -146,10 +148,14 @@ struct Particle { float lifetime; vec4 color; vec3 velocity; + uint pad_3; }; -layout(binding = 0) uniform SimulationParams_ubo { +layout(binding = 0, std140) uniform SimulationParams_ubo { float deltaTime; + uint pad; + uint pad_1; + uint pad_2; vec4 seed; } sim_params; @@ -204,8 +210,8 @@ void main() { return; } Error parsing GLSL shader: -ERROR: 0:60: 'textureQueryLevels' : no matching overloaded function found -ERROR: 0:60: '' : compilation terminated +ERROR: 0:64: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:64: '' : compilation terminated ERROR: 2 compilation errors. No code generated. @@ -242,8 +248,11 @@ struct Particle { vec3 velocity; }; -layout(binding = 3) uniform UBO_ubo { +layout(binding = 3, std140) uniform UBO_ubo { uint width; + uint pad; + uint pad_1; + uint pad_2; } ubo; layout(binding = 4, std430) buffer Buffer_ssbo { @@ -297,8 +306,11 @@ struct Particle { vec3 velocity; }; -layout(binding = 3) uniform UBO_ubo { +layout(binding = 3, std140) uniform UBO_ubo { uint width; + uint pad; + uint pad_1; + uint pad_2; } ubo; layout(binding = 4, std430) buffer Buffer_ssbo { diff --git a/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.glsl b/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.glsl index 6ef27681f5..704afa310d 100644 --- a/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.glsl +++ b/test/tint/buffer/storage/dynamic_index/read.wgsl.expected.glsl @@ -9,6 +9,8 @@ struct Inner { float f; mat2x3 g; mat3x2 h; + uint pad; + uint pad_1; ivec4 i[4]; }; diff --git a/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.glsl b/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.glsl index 71c6708a5c..f26e111f41 100644 --- a/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.glsl +++ b/test/tint/buffer/storage/dynamic_index/write.wgsl.expected.glsl @@ -9,6 +9,8 @@ struct Inner { float f; mat2x3 g; mat3x2 h; + uint pad; + uint pad_1; ivec4 i[4]; }; 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 447a5fcb93..dac902ac38 100644 --- a/test/tint/buffer/storage/static_index/read.wgsl.expected.glsl +++ b/test/tint/buffer/storage/static_index/read.wgsl.expected.glsl @@ -15,6 +15,7 @@ layout(binding = 0, std430) buffer S_ssbo { mat3x2 h; Inner i; Inner j[4]; + uint pad; } s; void tint_symbol() { 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 f2f9b98cd9..610d6dabb3 100644 --- a/test/tint/buffer/storage/static_index/write.wgsl.expected.glsl +++ b/test/tint/buffer/storage/static_index/write.wgsl.expected.glsl @@ -15,6 +15,7 @@ layout(binding = 0, std430) buffer S_ssbo { mat3x2 h; Inner i; Inner j[4]; + uint pad; } s; void tint_symbol() { 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 ebf8edb3b5..067b82de10 100644 --- a/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/dynamic_index/read.wgsl.expected.glsl @@ -27,6 +27,8 @@ struct Inner_std140 { vec2 j_0; vec2 j_1; vec2 j_2; + uint pad; + uint pad_1; ivec4 k[4]; }; @@ -34,7 +36,7 @@ struct S { Inner arr[8]; }; -layout(binding = 0) uniform S_std140_ubo { +layout(binding = 0, std140) uniform S_std140_ubo { Inner_std140 arr[8]; } s; 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 82cc9d0147..1b07ab0d8b 100644 --- a/test/tint/buffer/uniform/static_index/read.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/static_index/read.wgsl.expected.glsl @@ -2,6 +2,9 @@ struct Inner { int x; + uint pad; + uint pad_1; + uint pad_2; }; struct S { @@ -19,7 +22,7 @@ struct S { Inner l[4]; }; -layout(binding = 0) uniform S_std140_ubo { +layout(binding = 0, std140) uniform S_std140_ubo { ivec3 a; int b; uvec3 c; @@ -32,6 +35,8 @@ layout(binding = 0) uniform S_std140_ubo { vec2 j_0; vec2 j_1; vec2 j_2; + uint pad_3; + uint pad_4; Inner k; Inner l[4]; } s; diff --git a/test/tint/buffer/uniform/std140/mat2x2/dynamic_index_via_ptr.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/mat2x2/dynamic_index_via_ptr.wgsl.expected.glsl index e53a2e01d3..70d9461a80 100644 --- a/test/tint/buffer/uniform/std140/mat2x2/dynamic_index_via_ptr.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/std140/mat2x2/dynamic_index_via_ptr.wgsl.expected.glsl @@ -17,7 +17,7 @@ struct Outer_std140 { Inner_std140 a[4]; }; -layout(binding = 0) uniform a_block_ubo { +layout(binding = 0, std140) uniform a_block_ubo { Outer_std140 inner[4]; } a; diff --git a/test/tint/buffer/uniform/std140/mat2x2/static_index_via_ptr.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/mat2x2/static_index_via_ptr.wgsl.expected.glsl index 7f11118c30..6dccf2ad30 100644 --- a/test/tint/buffer/uniform/std140/mat2x2/static_index_via_ptr.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/std140/mat2x2/static_index_via_ptr.wgsl.expected.glsl @@ -17,7 +17,7 @@ struct Outer_std140 { Inner_std140 a[4]; }; -layout(binding = 0) uniform a_block_ubo { +layout(binding = 0, std140) uniform a_block_ubo { Outer_std140 inner[4]; } a; diff --git a/test/tint/buffer/uniform/std140/mat2x2/to_builtin.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/mat2x2/to_builtin.wgsl.expected.glsl index 1850c73ae9..d6c96b0560 100644 --- a/test/tint/buffer/uniform/std140/mat2x2/to_builtin.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/std140/mat2x2/to_builtin.wgsl.expected.glsl @@ -8,12 +8,14 @@ struct S { struct S_std140 { int before; + uint pad; vec2 m_0; vec2 m_1; int after; + uint pad_1; }; -layout(binding = 0) uniform u_block_ubo { +layout(binding = 0, std140) uniform u_block_ubo { S_std140 inner[4]; } u; diff --git a/test/tint/buffer/uniform/std140/mat2x2/to_fn.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/mat2x2/to_fn.wgsl.expected.glsl index 576ddd0fee..1d5f1334cb 100644 --- a/test/tint/buffer/uniform/std140/mat2x2/to_fn.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/std140/mat2x2/to_fn.wgsl.expected.glsl @@ -8,12 +8,14 @@ struct S { struct S_std140 { int before; + uint pad; vec2 m_0; vec2 m_1; int after; + uint pad_1; }; -layout(binding = 0) uniform u_block_ubo { +layout(binding = 0, std140) uniform u_block_ubo { S_std140 inner[4]; } u; diff --git a/test/tint/buffer/uniform/std140/mat2x2/to_private.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/mat2x2/to_private.wgsl.expected.glsl index a6b76c64e1..f21f59bac6 100644 --- a/test/tint/buffer/uniform/std140/mat2x2/to_private.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/std140/mat2x2/to_private.wgsl.expected.glsl @@ -8,12 +8,14 @@ struct S { struct S_std140 { int before; + uint pad; vec2 m_0; vec2 m_1; int after; + uint pad_1; }; -layout(binding = 0) uniform u_block_ubo { +layout(binding = 0, std140) uniform u_block_ubo { S_std140 inner[4]; } u; diff --git a/test/tint/buffer/uniform/std140/mat2x2/to_storage.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/mat2x2/to_storage.wgsl.expected.glsl index afca67d20d..b6b2c362c0 100644 --- a/test/tint/buffer/uniform/std140/mat2x2/to_storage.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/std140/mat2x2/to_storage.wgsl.expected.glsl @@ -2,18 +2,22 @@ struct S { int before; + uint pad; mat2 m; int after; + uint pad_1; }; struct S_std140 { int before; + uint pad_2; vec2 m_0; vec2 m_1; int after; + uint pad_3; }; -layout(binding = 0) uniform u_block_ubo { +layout(binding = 0, std140) uniform u_block_ubo { S_std140 inner[4]; } u; @@ -22,12 +26,12 @@ layout(binding = 1, std430) buffer s_block_ssbo { } s; S conv_S(S_std140 val) { - S tint_symbol = S(val.before, mat2(val.m_0, val.m_1), val.after); + S tint_symbol = S(val.before, 0u, mat2(val.m_0, val.m_1), val.after, 0u); return tint_symbol; } S[4] conv_arr_4_S(S_std140 val[4]) { - S arr[4] = S[4](S(0, mat2(0.0f, 0.0f, 0.0f, 0.0f), 0), S(0, mat2(0.0f, 0.0f, 0.0f, 0.0f), 0), S(0, mat2(0.0f, 0.0f, 0.0f, 0.0f), 0), S(0, mat2(0.0f, 0.0f, 0.0f, 0.0f), 0)); + S arr[4] = S[4](S(0, 0u, mat2(0.0f, 0.0f, 0.0f, 0.0f), 0, 0u), S(0, 0u, mat2(0.0f, 0.0f, 0.0f, 0.0f), 0, 0u), S(0, 0u, mat2(0.0f, 0.0f, 0.0f, 0.0f), 0, 0u), S(0, 0u, mat2(0.0f, 0.0f, 0.0f, 0.0f), 0, 0u)); { for(uint i = 0u; (i < 4u); i = (i + 1u)) { arr[i] = conv_S(val[i]); diff --git a/test/tint/buffer/uniform/std140/mat2x2/to_workgroup.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/mat2x2/to_workgroup.wgsl.expected.glsl index af5d513251..b75753ca4f 100644 --- a/test/tint/buffer/uniform/std140/mat2x2/to_workgroup.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/std140/mat2x2/to_workgroup.wgsl.expected.glsl @@ -8,12 +8,14 @@ struct S { struct S_std140 { int before; + uint pad; vec2 m_0; vec2 m_1; int after; + uint pad_1; }; -layout(binding = 0) uniform u_block_ubo { +layout(binding = 0, std140) uniform u_block_ubo { S_std140 inner[4]; } u; diff --git a/test/tint/buffer/uniform/std140/mat3x2/dynamic_index_via_ptr.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/mat3x2/dynamic_index_via_ptr.wgsl.expected.glsl index 8aaf4c23a9..c85ce1af03 100644 --- a/test/tint/buffer/uniform/std140/mat3x2/dynamic_index_via_ptr.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/std140/mat3x2/dynamic_index_via_ptr.wgsl.expected.glsl @@ -8,6 +8,16 @@ struct Inner_std140 { vec2 m_0; vec2 m_1; vec2 m_2; + uint pad; + uint pad_1; + uint pad_2; + uint pad_3; + uint pad_4; + uint pad_5; + uint pad_6; + uint pad_7; + uint pad_8; + uint pad_9; }; struct Outer { @@ -18,7 +28,7 @@ struct Outer_std140 { Inner_std140 a[4]; }; -layout(binding = 0) uniform a_block_ubo { +layout(binding = 0, std140) uniform a_block_ubo { Outer_std140 inner[4]; } a; diff --git a/test/tint/buffer/uniform/std140/mat3x2/static_index_via_ptr.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/mat3x2/static_index_via_ptr.wgsl.expected.glsl index 47bf6baaf1..85ff44462c 100644 --- a/test/tint/buffer/uniform/std140/mat3x2/static_index_via_ptr.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/std140/mat3x2/static_index_via_ptr.wgsl.expected.glsl @@ -8,6 +8,16 @@ struct Inner_std140 { vec2 m_0; vec2 m_1; vec2 m_2; + uint pad; + uint pad_1; + uint pad_2; + uint pad_3; + uint pad_4; + uint pad_5; + uint pad_6; + uint pad_7; + uint pad_8; + uint pad_9; }; struct Outer { @@ -18,7 +28,7 @@ struct Outer_std140 { Inner_std140 a[4]; }; -layout(binding = 0) uniform a_block_ubo { +layout(binding = 0, std140) uniform a_block_ubo { Outer_std140 inner[4]; } a; diff --git a/test/tint/buffer/uniform/std140/mat3x2/to_builtin.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/mat3x2/to_builtin.wgsl.expected.glsl index d940c27e0b..2d02c4d32a 100644 --- a/test/tint/buffer/uniform/std140/mat3x2/to_builtin.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/std140/mat3x2/to_builtin.wgsl.expected.glsl @@ -8,13 +8,17 @@ struct S { struct S_std140 { int before; + uint pad; vec2 m_0; vec2 m_1; vec2 m_2; + uint pad_1; + uint pad_2; int after; + uint pad_3; }; -layout(binding = 0) uniform u_block_ubo { +layout(binding = 0, std140) uniform u_block_ubo { S_std140 inner[4]; } u; diff --git a/test/tint/buffer/uniform/std140/mat3x2/to_fn.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/mat3x2/to_fn.wgsl.expected.glsl index 8bcd005382..cb73e8774d 100644 --- a/test/tint/buffer/uniform/std140/mat3x2/to_fn.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/std140/mat3x2/to_fn.wgsl.expected.glsl @@ -8,13 +8,25 @@ struct S { struct S_std140 { int before; + uint pad; vec2 m_0; vec2 m_1; vec2 m_2; + uint pad_1; + uint pad_2; + uint pad_3; + uint pad_4; + uint pad_5; + uint pad_6; + uint pad_7; + uint pad_8; + uint pad_9; + uint pad_10; int after; + uint pad_11; }; -layout(binding = 0) uniform u_block_ubo { +layout(binding = 0, std140) uniform u_block_ubo { S_std140 inner[4]; } u; diff --git a/test/tint/buffer/uniform/std140/mat3x2/to_private.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/mat3x2/to_private.wgsl.expected.glsl index 3c89125fbd..afdcbcd33f 100644 --- a/test/tint/buffer/uniform/std140/mat3x2/to_private.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/std140/mat3x2/to_private.wgsl.expected.glsl @@ -8,13 +8,25 @@ struct S { struct S_std140 { int before; + uint pad; vec2 m_0; vec2 m_1; vec2 m_2; + uint pad_1; + uint pad_2; + uint pad_3; + uint pad_4; + uint pad_5; + uint pad_6; + uint pad_7; + uint pad_8; + uint pad_9; + uint pad_10; int after; + uint pad_11; }; -layout(binding = 0) uniform u_block_ubo { +layout(binding = 0, std140) uniform u_block_ubo { S_std140 inner[4]; } u; diff --git a/test/tint/buffer/uniform/std140/mat3x2/to_storage.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/mat3x2/to_storage.wgsl.expected.glsl index df93b2640f..fd4678d25f 100644 --- a/test/tint/buffer/uniform/std140/mat3x2/to_storage.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/std140/mat3x2/to_storage.wgsl.expected.glsl @@ -2,19 +2,43 @@ struct S { int before; + uint pad; mat3x2 m; + uint pad_1; + uint pad_2; + uint pad_3; + uint pad_4; + uint pad_5; + uint pad_6; + uint pad_7; + uint pad_8; + uint pad_9; + uint pad_10; int after; + uint pad_11; }; struct S_std140 { int before; + uint pad_12; vec2 m_0; vec2 m_1; vec2 m_2; + uint pad_13; + uint pad_14; + uint pad_15; + uint pad_16; + uint pad_17; + uint pad_18; + uint pad_19; + uint pad_20; + uint pad_21; + uint pad_22; int after; + uint pad_23; }; -layout(binding = 0) uniform u_block_ubo { +layout(binding = 0, std140) uniform u_block_ubo { S_std140 inner[4]; } u; @@ -23,12 +47,12 @@ layout(binding = 1, std430) buffer s_block_ssbo { } s; S conv_S(S_std140 val) { - S tint_symbol = S(val.before, mat3x2(val.m_0, val.m_1, val.m_2), val.after); + S tint_symbol = S(val.before, 0u, mat3x2(val.m_0, val.m_1, val.m_2), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, val.after, 0u); return tint_symbol; } S[4] conv_arr_4_S(S_std140 val[4]) { - S arr[4] = S[4](S(0, mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0), S(0, mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0), S(0, mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0), S(0, mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0)); + S arr[4] = S[4](S(0, 0u, mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0, 0u), S(0, 0u, mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0, 0u), S(0, 0u, mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0, 0u), S(0, 0u, mat3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0, 0u)); { for(uint i = 0u; (i < 4u); i = (i + 1u)) { arr[i] = conv_S(val[i]); diff --git a/test/tint/buffer/uniform/std140/mat3x2/to_workgroup.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/mat3x2/to_workgroup.wgsl.expected.glsl index d004b4b8e0..17e4debbec 100644 --- a/test/tint/buffer/uniform/std140/mat3x2/to_workgroup.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/std140/mat3x2/to_workgroup.wgsl.expected.glsl @@ -8,13 +8,25 @@ struct S { struct S_std140 { int before; + uint pad; vec2 m_0; vec2 m_1; vec2 m_2; + uint pad_1; + uint pad_2; + uint pad_3; + uint pad_4; + uint pad_5; + uint pad_6; + uint pad_7; + uint pad_8; + uint pad_9; + uint pad_10; int after; + uint pad_11; }; -layout(binding = 0) uniform u_block_ubo { +layout(binding = 0, std140) uniform u_block_ubo { S_std140 inner[4]; } u; diff --git a/test/tint/buffer/uniform/std140/mat4x2/dynamic_index_via_ptr.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/mat4x2/dynamic_index_via_ptr.wgsl.expected.glsl index 1ccb8d25a2..da098b6f70 100644 --- a/test/tint/buffer/uniform/std140/mat4x2/dynamic_index_via_ptr.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/std140/mat4x2/dynamic_index_via_ptr.wgsl.expected.glsl @@ -19,7 +19,7 @@ struct Outer_std140 { Inner_std140 a[4]; }; -layout(binding = 0) uniform a_block_ubo { +layout(binding = 0, std140) uniform a_block_ubo { Outer_std140 inner[4]; } a; diff --git a/test/tint/buffer/uniform/std140/mat4x2/static_index_via_ptr.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/mat4x2/static_index_via_ptr.wgsl.expected.glsl index 5c10cfbace..99394e5547 100644 --- a/test/tint/buffer/uniform/std140/mat4x2/static_index_via_ptr.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/std140/mat4x2/static_index_via_ptr.wgsl.expected.glsl @@ -19,7 +19,7 @@ struct Outer_std140 { Inner_std140 a[4]; }; -layout(binding = 0) uniform a_block_ubo { +layout(binding = 0, std140) uniform a_block_ubo { Outer_std140 inner[4]; } a; diff --git a/test/tint/buffer/uniform/std140/mat4x2/to_builtin.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/mat4x2/to_builtin.wgsl.expected.glsl index 46fbeb6378..9eede3ec25 100644 --- a/test/tint/buffer/uniform/std140/mat4x2/to_builtin.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/std140/mat4x2/to_builtin.wgsl.expected.glsl @@ -8,14 +8,16 @@ struct S { struct S_std140 { int before; + uint pad; vec2 m_0; vec2 m_1; vec2 m_2; vec2 m_3; int after; + uint pad_1; }; -layout(binding = 0) uniform u_block_ubo { +layout(binding = 0, std140) uniform u_block_ubo { S_std140 inner[4]; } u; diff --git a/test/tint/buffer/uniform/std140/mat4x2/to_fn.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/mat4x2/to_fn.wgsl.expected.glsl index c409f8b675..837c23eb04 100644 --- a/test/tint/buffer/uniform/std140/mat4x2/to_fn.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/std140/mat4x2/to_fn.wgsl.expected.glsl @@ -8,14 +8,16 @@ struct S { struct S_std140 { int before; + uint pad; vec2 m_0; vec2 m_1; vec2 m_2; vec2 m_3; int after; + uint pad_1; }; -layout(binding = 0) uniform u_block_ubo { +layout(binding = 0, std140) uniform u_block_ubo { S_std140 inner[4]; } u; diff --git a/test/tint/buffer/uniform/std140/mat4x2/to_private.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/mat4x2/to_private.wgsl.expected.glsl index 9696062194..235d81dcc6 100644 --- a/test/tint/buffer/uniform/std140/mat4x2/to_private.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/std140/mat4x2/to_private.wgsl.expected.glsl @@ -8,14 +8,16 @@ struct S { struct S_std140 { int before; + uint pad; vec2 m_0; vec2 m_1; vec2 m_2; vec2 m_3; int after; + uint pad_1; }; -layout(binding = 0) uniform u_block_ubo { +layout(binding = 0, std140) uniform u_block_ubo { S_std140 inner[4]; } u; diff --git a/test/tint/buffer/uniform/std140/mat4x2/to_storage.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/mat4x2/to_storage.wgsl.expected.glsl index 72e4c1c6f8..13e7964244 100644 --- a/test/tint/buffer/uniform/std140/mat4x2/to_storage.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/std140/mat4x2/to_storage.wgsl.expected.glsl @@ -2,20 +2,24 @@ struct S { int before; + uint pad; mat4x2 m; int after; + uint pad_1; }; struct S_std140 { int before; + uint pad_2; vec2 m_0; vec2 m_1; vec2 m_2; vec2 m_3; int after; + uint pad_3; }; -layout(binding = 0) uniform u_block_ubo { +layout(binding = 0, std140) uniform u_block_ubo { S_std140 inner[4]; } u; @@ -24,12 +28,12 @@ layout(binding = 1, std430) buffer s_block_ssbo { } s; S conv_S(S_std140 val) { - S tint_symbol = S(val.before, mat4x2(val.m_0, val.m_1, val.m_2, val.m_3), val.after); + S tint_symbol = S(val.before, 0u, mat4x2(val.m_0, val.m_1, val.m_2, val.m_3), val.after, 0u); return tint_symbol; } S[4] conv_arr_4_S(S_std140 val[4]) { - S arr[4] = S[4](S(0, mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0), S(0, mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0), S(0, mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0), S(0, mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0)); + S arr[4] = S[4](S(0, 0u, mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0, 0u), S(0, 0u, mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0, 0u), S(0, 0u, mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0, 0u), S(0, 0u, mat4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), 0, 0u)); { for(uint i = 0u; (i < 4u); i = (i + 1u)) { arr[i] = conv_S(val[i]); diff --git a/test/tint/buffer/uniform/std140/mat4x2/to_workgroup.wgsl.expected.glsl b/test/tint/buffer/uniform/std140/mat4x2/to_workgroup.wgsl.expected.glsl index 5f308a198b..1b2f51f3ee 100644 --- a/test/tint/buffer/uniform/std140/mat4x2/to_workgroup.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/std140/mat4x2/to_workgroup.wgsl.expected.glsl @@ -8,14 +8,16 @@ struct S { struct S_std140 { int before; + uint pad; vec2 m_0; vec2 m_1; vec2 m_2; vec2 m_3; int after; + uint pad_1; }; -layout(binding = 0) uniform u_block_ubo { +layout(binding = 0, std140) uniform u_block_ubo { S_std140 inner[4]; } u; diff --git a/test/tint/buffer/uniform/types/array.wgsl.expected.glsl b/test/tint/buffer/uniform/types/array.wgsl.expected.glsl index d07ae638ba..c3f6dce0a0 100644 --- a/test/tint/buffer/uniform/types/array.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/types/array.wgsl.expected.glsl @@ -1,6 +1,6 @@ #version 310 es -layout(binding = 0) uniform u_block_ubo { +layout(binding = 0, std140) uniform u_block_ubo { vec4 inner[4]; } u; diff --git a/test/tint/buffer/uniform/types/f32.wgsl.expected.glsl b/test/tint/buffer/uniform/types/f32.wgsl.expected.glsl index 664b5a3490..4121bca087 100644 --- a/test/tint/buffer/uniform/types/f32.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/types/f32.wgsl.expected.glsl @@ -1,6 +1,6 @@ #version 310 es -layout(binding = 0) uniform u_block_ubo { +layout(binding = 0, std140) uniform u_block_ubo { float inner; } u; diff --git a/test/tint/buffer/uniform/types/i32.wgsl.expected.glsl b/test/tint/buffer/uniform/types/i32.wgsl.expected.glsl index 69fc627f05..84659c9aab 100644 --- a/test/tint/buffer/uniform/types/i32.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/types/i32.wgsl.expected.glsl @@ -1,6 +1,6 @@ #version 310 es -layout(binding = 0) uniform u_block_ubo { +layout(binding = 0, std140) uniform u_block_ubo { int inner; } u; diff --git a/test/tint/buffer/uniform/types/mat2x2.wgsl.expected.glsl b/test/tint/buffer/uniform/types/mat2x2.wgsl.expected.glsl index e53fad79a1..ae3c014f3b 100644 --- a/test/tint/buffer/uniform/types/mat2x2.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/types/mat2x2.wgsl.expected.glsl @@ -1,6 +1,6 @@ #version 310 es -layout(binding = 0) uniform u_block_ubo { +layout(binding = 0, std140) uniform u_block_ubo { mat2 inner; } u; diff --git a/test/tint/buffer/uniform/types/mat2x3.wgsl.expected.glsl b/test/tint/buffer/uniform/types/mat2x3.wgsl.expected.glsl index ce089a27dc..bef656040a 100644 --- a/test/tint/buffer/uniform/types/mat2x3.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/types/mat2x3.wgsl.expected.glsl @@ -1,6 +1,6 @@ #version 310 es -layout(binding = 0) uniform u_block_ubo { +layout(binding = 0, std140) uniform u_block_ubo { mat2x3 inner; } u; diff --git a/test/tint/buffer/uniform/types/mat3x2.wgsl.expected.glsl b/test/tint/buffer/uniform/types/mat3x2.wgsl.expected.glsl index 4bf66e37c3..06a0a60802 100644 --- a/test/tint/buffer/uniform/types/mat3x2.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/types/mat3x2.wgsl.expected.glsl @@ -1,6 +1,6 @@ #version 310 es -layout(binding = 0) uniform u_block_ubo { +layout(binding = 0, std140) uniform u_block_ubo { mat3x2 inner; } u; diff --git a/test/tint/buffer/uniform/types/mat4x4.wgsl.expected.glsl b/test/tint/buffer/uniform/types/mat4x4.wgsl.expected.glsl index f0b2c98854..d93e2b4a66 100644 --- a/test/tint/buffer/uniform/types/mat4x4.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/types/mat4x4.wgsl.expected.glsl @@ -1,6 +1,6 @@ #version 310 es -layout(binding = 0) uniform u_block_ubo { +layout(binding = 0, std140) uniform u_block_ubo { mat4 inner; } u; diff --git a/test/tint/buffer/uniform/types/struct.wgsl.expected.glsl b/test/tint/buffer/uniform/types/struct.wgsl.expected.glsl index 708f1766c5..b717d8c054 100644 --- a/test/tint/buffer/uniform/types/struct.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/types/struct.wgsl.expected.glsl @@ -2,13 +2,16 @@ struct Inner { float f; + uint pad; + uint pad_1; + uint pad_2; }; struct S { Inner inner; }; -layout(binding = 0) uniform u_block_ubo { +layout(binding = 0, std140) uniform u_block_ubo { S inner; } u; diff --git a/test/tint/buffer/uniform/types/u32.wgsl.expected.glsl b/test/tint/buffer/uniform/types/u32.wgsl.expected.glsl index 68cf9bc601..32fad0524b 100644 --- a/test/tint/buffer/uniform/types/u32.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/types/u32.wgsl.expected.glsl @@ -1,6 +1,6 @@ #version 310 es -layout(binding = 0) uniform u_block_ubo { +layout(binding = 0, std140) uniform u_block_ubo { uint inner; } u; diff --git a/test/tint/buffer/uniform/types/vec2.wgsl.expected.glsl b/test/tint/buffer/uniform/types/vec2.wgsl.expected.glsl index d3a3922af1..e50974887d 100644 --- a/test/tint/buffer/uniform/types/vec2.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/types/vec2.wgsl.expected.glsl @@ -1,6 +1,6 @@ #version 310 es -layout(binding = 0) uniform u_block_ubo { +layout(binding = 0, std140) uniform u_block_ubo { ivec2 inner; } u; diff --git a/test/tint/buffer/uniform/types/vec3.wgsl.expected.glsl b/test/tint/buffer/uniform/types/vec3.wgsl.expected.glsl index 473cdcdd26..94bee31a50 100644 --- a/test/tint/buffer/uniform/types/vec3.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/types/vec3.wgsl.expected.glsl @@ -1,6 +1,6 @@ #version 310 es -layout(binding = 0) uniform u_block_ubo { +layout(binding = 0, std140) uniform u_block_ubo { uvec3 inner; } u; diff --git a/test/tint/buffer/uniform/types/vec4.wgsl.expected.glsl b/test/tint/buffer/uniform/types/vec4.wgsl.expected.glsl index 20066797c2..6358e5c53e 100644 --- a/test/tint/buffer/uniform/types/vec4.wgsl.expected.glsl +++ b/test/tint/buffer/uniform/types/vec4.wgsl.expected.glsl @@ -1,6 +1,6 @@ #version 310 es -layout(binding = 0) uniform u_block_ubo { +layout(binding = 0, std140) uniform u_block_ubo { vec4 inner; } u; diff --git a/test/tint/bug/chromium/1273230.wgsl.expected.glsl b/test/tint/bug/chromium/1273230.wgsl.expected.glsl index 685ab0375b..ac98a18641 100644 --- a/test/tint/bug/chromium/1273230.wgsl.expected.glsl +++ b/test/tint/bug/chromium/1273230.wgsl.expected.glsl @@ -1,12 +1,14 @@ #version 310 es -layout(binding = 0) uniform Uniforms_ubo { +layout(binding = 0, std140) uniform Uniforms_ubo { uint numTriangles; uint gridSize; uint puuuuuuuuuuuuuuuuad1; uint pad2; vec3 bbMin; + uint pad; vec3 bbMax; + uint pad_1; } uniforms; layout(binding = 10, std430) buffer U32s_ssbo { diff --git a/test/tint/bug/dawn/947.wgsl.expected.glsl b/test/tint/bug/dawn/947.wgsl.expected.glsl index 1eb72211e1..7113cf5604 100644 --- a/test/tint/bug/dawn/947.wgsl.expected.glsl +++ b/test/tint/bug/dawn/947.wgsl.expected.glsl @@ -13,7 +13,7 @@ bug/dawn/947.wgsl:55:33 note: reading from user-defined input 'texcoord' may res #version 310 es layout(location = 0) out vec2 texcoords_1; -layout(binding = 0) uniform Uniforms_ubo { +layout(binding = 0, std140) uniform Uniforms_ubo { vec2 u_scale; vec2 u_offset; } uniforms; 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 e7bad69788..dc22690628 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,7 +1,10 @@ #version 310 es -layout(binding = 0) uniform UBO_ubo { +layout(binding = 0, std140) uniform UBO_ubo { int dynamic_idx; + uint pad; + uint pad_1; + uint pad_2; } ubo; struct S { 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 8ed17e0d52..6b7cb32a44 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,7 +1,10 @@ #version 310 es -layout(binding = 0) uniform UBO_ubo { +layout(binding = 0, std140) uniform UBO_ubo { int dynamic_idx; + uint pad; + uint pad_1; + uint pad_2; } ubo; struct S { 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 68fb6499f8..dee0c361f3 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,7 +1,10 @@ #version 310 es -layout(binding = 0) uniform UBO_ubo { +layout(binding = 0, std140) uniform UBO_ubo { int dynamic_idx; + uint pad; + uint pad_1; + uint pad_2; } ubo; layout(binding = 2, std430) buffer Result_ssbo { 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 e980b5d8f7..ec3aa7d009 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,8 +1,11 @@ #version 310 es -layout(binding = 0) uniform UBO_ubo { +layout(binding = 0, std140) uniform UBO_ubo { ivec4 data[4]; int dynamic_idx; + uint pad; + uint pad_1; + uint pad_2; } ubo; layout(binding = 2, std430) buffer Result_ssbo { 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 c98cbdf305..c163eef147 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,7 +1,10 @@ #version 310 es -layout(binding = 0) uniform UBO_ubo { +layout(binding = 0, std140) uniform UBO_ubo { int dynamic_idx; + uint pad; + uint pad_1; + uint pad_2; } ubo; struct S { 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 1798e8b60a..635b4d853f 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,7 +1,10 @@ #version 310 es -layout(binding = 0) uniform UBO_ubo { +layout(binding = 0, std140) uniform UBO_ubo { int dynamic_idx; + uint pad; + uint pad_1; + uint pad_2; } ubo; struct S { 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 a5ca9c710c..5286aa6b4c 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,7 +1,10 @@ #version 310 es -layout(binding = 0) uniform UBO_ubo { +layout(binding = 0, std140) uniform UBO_ubo { int dynamic_idx; + uint pad; + uint pad_1; + uint pad_2; } ubo; struct S { 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 f5737c7a3c..e1a897f394 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,7 +1,10 @@ #version 310 es -layout(binding = 0) uniform UBO_ubo { +layout(binding = 0, std140) uniform UBO_ubo { int dynamic_idx; + uint pad; + uint pad_1; + uint pad_2; } ubo; struct S { 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 6ecdef3f43..12ca09ab8a 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,7 +1,10 @@ #version 310 es -layout(binding = 0) uniform UBO_ubo { +layout(binding = 0, std140) uniform UBO_ubo { int dynamic_idx; + uint pad; + uint pad_1; + uint pad_2; } ubo; struct S { 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 8fc82a26ff..be6fc9c478 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,7 +1,10 @@ #version 310 es -layout(binding = 0) uniform UBO_ubo { +layout(binding = 0, std140) uniform UBO_ubo { int dynamic_idx; + uint pad; + uint pad_1; + uint pad_2; } ubo; layout(binding = 2, std430) buffer Result_ssbo { 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 11cf2013dc..417dbdf73f 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,7 +1,10 @@ #version 310 es -layout(binding = 0) uniform UBO_ubo { +layout(binding = 0, std140) uniform UBO_ubo { int dynamic_idx; + uint pad; + uint pad_1; + uint pad_2; } ubo; struct S { 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 af6d54473a..89e8cbc6e0 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 @@ -3,16 +3,23 @@ struct Particle { vec3 position[8]; float lifetime; + uint pad_3; + uint pad_4; + uint pad_5; vec4 color; vec3 velocity; + uint pad_6; }; layout(binding = 3, std430) buffer Particles_ssbo { Particle p[]; } particles; -layout(binding = 4) uniform Simulation_ubo { +layout(binding = 4, std140) uniform Simulation_ubo { uint i; + uint pad; + uint pad_1; + uint pad_2; } sim; void tint_symbol() { 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 719abc4468..99500a6e2d 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,8 +1,10 @@ #version 310 es -layout(binding = 4) uniform Uniforms_ubo { +layout(binding = 4, std140) uniform Uniforms_ubo { uint i; uint j; + uint pad; + uint pad_1; } uniforms; void tint_symbol() { 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 d3300f2582..5d76866324 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,8 +1,10 @@ #version 310 es -layout(binding = 4) uniform Uniforms_ubo { +layout(binding = 4, std140) uniform Uniforms_ubo { uint i; uint j; + uint pad; + uint pad_1; } uniforms; void tint_symbol() { 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 daf05d32a1..8d409b64fa 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,8 +1,10 @@ #version 310 es -layout(binding = 4) uniform Uniforms_ubo { +layout(binding = 4, std140) uniform Uniforms_ubo { uint i; uint j; + uint pad; + uint pad_1; } uniforms; mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); 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 dfeccecfd4..aeaf8f5909 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,8 +1,10 @@ #version 310 es -layout(binding = 4) uniform Uniforms_ubo { +layout(binding = 4, std140) uniform Uniforms_ubo { uint i; uint j; + uint pad; + uint pad_1; } uniforms; void tint_symbol() { 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 647fc8675f..9ade51c8a4 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,8 +1,10 @@ #version 310 es -layout(binding = 4) uniform Uniforms_ubo { +layout(binding = 4, std140) uniform Uniforms_ubo { uint i; uint j; + uint pad; + uint pad_1; } uniforms; mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); 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 c0f23a7b70..89a3e066b6 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,8 +1,10 @@ #version 310 es -layout(binding = 4) uniform Uniforms_ubo { +layout(binding = 4, std140) uniform Uniforms_ubo { uint i; uint j; + uint pad; + uint pad_1; } uniforms; mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); 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 daf05d32a1..8d409b64fa 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,8 +1,10 @@ #version 310 es -layout(binding = 4) uniform Uniforms_ubo { +layout(binding = 4, std140) uniform Uniforms_ubo { uint i; uint j; + uint pad; + uint pad_1; } uniforms; mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); 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 309d081d63..057a6fd552 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,8 +1,10 @@ #version 310 es -layout(binding = 4) uniform Uniforms_ubo { +layout(binding = 4, std140) uniform Uniforms_ubo { uint i; uint j; + uint pad; + uint pad_1; } uniforms; mat2x4 m1 = mat2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); diff --git a/test/tint/bug/tint/1046.wgsl.expected.glsl b/test/tint/bug/tint/1046.wgsl.expected.glsl index a65f34438a..2900bc3b4e 100644 --- a/test/tint/bug/tint/1046.wgsl.expected.glsl +++ b/test/tint/bug/tint/1046.wgsl.expected.glsl @@ -10,11 +10,13 @@ struct PointLight { vec4 position; }; -layout(binding = 0) uniform Uniforms_ubo { +layout(binding = 0, std140) uniform Uniforms_ubo { mat4 worldView; mat4 proj; uint numPointLights; uint color_source; + uint pad; + uint pad_1; vec4 color; } uniforms; diff --git a/test/tint/bug/tint/1061.spvasm.expected.glsl b/test/tint/bug/tint/1061.spvasm.expected.glsl index edeb86cb73..3df5cd7672 100644 --- a/test/tint/bug/tint/1061.spvasm.expected.glsl +++ b/test/tint/bug/tint/1061.spvasm.expected.glsl @@ -2,7 +2,7 @@ precision mediump float; layout(location = 0) out vec4 x_GLF_color_1_1; -layout(binding = 0) uniform buf0_ubo { +layout(binding = 0, std140) uniform buf0_ubo { vec4 ref; } x_7; diff --git a/test/tint/bug/tint/1088.spvasm.expected.glsl b/test/tint/bug/tint/1088.spvasm.expected.glsl index 6084c129d9..43e39e5179 100644 --- a/test/tint/bug/tint/1088.spvasm.expected.glsl +++ b/test/tint/bug/tint/1088.spvasm.expected.glsl @@ -6,12 +6,18 @@ layout(location = 1) in vec3 normal_param_1; layout(location = 0) out vec2 vUV_1_1; struct strided_arr { float el; + uint pad; + uint pad_1; + uint pad_2; }; vec3 position = vec3(0.0f, 0.0f, 0.0f); -layout(binding = 2) uniform LeftOver_ubo { +layout(binding = 2, std140) uniform LeftOver_ubo { mat4 worldViewProjection; float time; + uint pad_3; + uint pad_4; + uint pad_5; mat4 test2[2]; strided_arr test[4]; } x_14; diff --git a/test/tint/bug/tint/1113.wgsl.expected.glsl b/test/tint/bug/tint/1113.wgsl.expected.glsl index c077619d30..456c153a8a 100644 --- a/test/tint/bug/tint/1113.wgsl.expected.glsl +++ b/test/tint/bug/tint/1113.wgsl.expected.glsl @@ -1,12 +1,14 @@ #version 310 es -layout(binding = 0) uniform Uniforms_ubo { +layout(binding = 0, std140) uniform Uniforms_ubo { uint numTriangles; uint gridSize; uint pad1; uint pad2; vec3 bbMin; + uint pad; vec3 bbMax; + uint pad_1; } uniforms; layout(binding = 10, std430) buffer U32s_ssbo { @@ -102,13 +104,15 @@ void main() { } #version 310 es -layout(binding = 0) uniform Uniforms_ubo { +layout(binding = 0, std140) uniform Uniforms_ubo { uint numTriangles; uint gridSize; uint pad1; uint pad2; vec3 bbMin; + uint pad; vec3 bbMax; + uint pad_1; } uniforms; layout(binding = 10, std430) buffer U32s_ssbo { @@ -174,13 +178,15 @@ void main() { } #version 310 es -layout(binding = 0) uniform Uniforms_ubo { +layout(binding = 0, std140) uniform Uniforms_ubo { uint numTriangles; uint gridSize; uint pad1; uint pad2; vec3 bbMin; + uint pad; vec3 bbMax; + uint pad_1; } uniforms; layout(binding = 10, std430) buffer U32s_ssbo { diff --git a/test/tint/bug/tint/1118.wgsl.expected.glsl b/test/tint/bug/tint/1118.wgsl.expected.glsl index a6952110fd..2fe20d264a 100644 --- a/test/tint/bug/tint/1118.wgsl.expected.glsl +++ b/test/tint/bug/tint/1118.wgsl.expected.glsl @@ -18,11 +18,11 @@ 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) uniform Scene_ubo { +layout(binding = 0, std140) uniform Scene_ubo { vec4 vEyePosition; } x_29; -layout(binding = 1) uniform Material_ubo { +layout(binding = 1, std140) uniform Material_ubo { vec4 vDiffuseColor; vec3 vAmbientColor; float placeholder; @@ -30,8 +30,11 @@ layout(binding = 1) uniform Material_ubo { float placeholder2; } x_49; -layout(binding = 2) uniform Mesh_ubo { +layout(binding = 2, std140) uniform Mesh_ubo { float visibility; + uint pad; + uint pad_1; + uint pad_2; } x_137; vec4 glFragColor = vec4(0.0f, 0.0f, 0.0f, 0.0f); diff --git a/test/tint/bug/tint/1121.wgsl.expected.glsl b/test/tint/bug/tint/1121.wgsl.expected.glsl index e509937fd3..0636c71d87 100644 --- a/test/tint/bug/tint/1121.wgsl.expected.glsl +++ b/test/tint/bug/tint/1121.wgsl.expected.glsl @@ -19,16 +19,18 @@ layout(binding = 0, std430) buffer Tiles_ssbo { TileLightIdData data[4]; } tileLightId; -layout(binding = 0) uniform Config_ubo { +layout(binding = 0, std140) uniform Config_ubo { uint numLights; uint numTiles; uint tileCountX; uint tileCountY; uint numTileLightSlot; uint tileSize; + uint pad; + uint pad_1; } config; -layout(binding = 0) uniform Uniforms_ubo { +layout(binding = 0, std140) uniform Uniforms_ubo { vec4 tint_symbol; vec4 tint_symbol_1; mat4 viewMatrix; diff --git a/test/tint/bug/tint/1520.spvasm.expected.glsl b/test/tint/bug/tint/1520.spvasm.expected.glsl index 0e08ab8ad2..cfdecf1103 100644 --- a/test/tint/bug/tint/1520.spvasm.expected.glsl +++ b/test/tint/bug/tint/1520.spvasm.expected.glsl @@ -3,8 +3,15 @@ precision mediump float; layout(location = 0) in vec4 vcolor_S0_param_1; layout(location = 0) out vec4 sk_FragColor_1_1; -layout(binding = 0) uniform UniformBuffer_ubo { +layout(binding = 0, std140) uniform UniformBuffer_ubo { + uint pad; + uint pad_1; + uint pad_2; + uint pad_3; float unknownInput_S1_c0; + uint pad_4; + uint pad_5; + uint pad_6; vec4 ucolorRed_S1_c0; vec4 ucolorGreen_S1_c0; mat3 umatrix_S1; diff --git a/test/tint/bug/tint/294.wgsl.expected.glsl b/test/tint/bug/tint/294.wgsl.expected.glsl index 8bfaa2e57b..33f393f94a 100644 --- a/test/tint/bug/tint/294.wgsl.expected.glsl +++ b/test/tint/bug/tint/294.wgsl.expected.glsl @@ -6,7 +6,9 @@ void unused_entry_point() { } struct Light { vec3 position; + uint pad; vec3 colour; + uint pad_1; }; layout(binding = 1, std430) buffer Lights_ssbo { diff --git a/test/tint/bug/tint/369.wgsl.expected.glsl b/test/tint/bug/tint/369.wgsl.expected.glsl index 0a45971659..8fa9069bf5 100644 --- a/test/tint/bug/tint/369.wgsl.expected.glsl +++ b/test/tint/bug/tint/369.wgsl.expected.glsl @@ -8,7 +8,7 @@ layout(binding = 0, std430) buffer S_ssbo { mat2 m; } SSBO; -layout(binding = 0) uniform S_std140_ubo { +layout(binding = 0, std140) uniform S_std140_ubo { vec2 m_0; vec2 m_1; } UBO; diff --git a/test/tint/bug/tint/403.wgsl.expected.glsl b/test/tint/bug/tint/403.wgsl.expected.glsl index 836967695b..38d12caca5 100644 --- a/test/tint/bug/tint/403.wgsl.expected.glsl +++ b/test/tint/bug/tint/403.wgsl.expected.glsl @@ -8,12 +8,12 @@ struct vertexUniformBuffer2 { mat2 transform2; }; -layout(binding = 0) uniform vertexUniformBuffer1_std140_ubo { +layout(binding = 0, std140) uniform vertexUniformBuffer1_std140_ubo { vec2 transform1_0; vec2 transform1_1; } x_20; -layout(binding = 0) uniform vertexUniformBuffer2_std140_ubo { +layout(binding = 0, std140) uniform vertexUniformBuffer2_std140_ubo { vec2 transform2_0; vec2 transform2_1; } x_26; diff --git a/test/tint/bug/tint/534.wgsl.expected.glsl b/test/tint/bug/tint/534.wgsl.expected.glsl index 7c556c5b9f..12c0408fca 100644 --- a/test/tint/bug/tint/534.wgsl.expected.glsl +++ b/test/tint/bug/tint/534.wgsl.expected.glsl @@ -4,7 +4,7 @@ layout(binding = 2, std430) buffer OutputBuf_ssbo { uint result[]; } tint_symbol; -layout(binding = 3) uniform Uniforms_ubo { +layout(binding = 3, std140) uniform Uniforms_ubo { uint dstTextureFlipY; uint isFloat16; uint isRGB10A2Unorm; diff --git a/test/tint/bug/tint/744.wgsl.expected.glsl b/test/tint/bug/tint/744.wgsl.expected.glsl index eeeef6750d..a142a002af 100644 --- a/test/tint/bug/tint/744.wgsl.expected.glsl +++ b/test/tint/bug/tint/744.wgsl.expected.glsl @@ -12,10 +12,12 @@ layout(binding = 2, std430) buffer Matrix_ssbo_2 { uint numbers[]; } resultMatrix; -layout(binding = 3) uniform Uniforms_ubo { +layout(binding = 3, std140) uniform Uniforms_ubo { uvec2 aShape; uvec2 bShape; uvec2 outShape; + uint pad; + uint pad_1; } uniforms; void tint_symbol(uvec3 global_id) { diff --git a/test/tint/bug/tint/749.spvasm.expected.glsl b/test/tint/bug/tint/749.spvasm.expected.glsl index 7f580c1ef1..57b834da56 100644 --- a/test/tint/bug/tint/749.spvasm.expected.glsl +++ b/test/tint/bug/tint/749.spvasm.expected.glsl @@ -8,8 +8,10 @@ struct QuicksortObject { QuicksortObject obj = QuicksortObject(int[10](0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); vec4 tint_symbol = vec4(0.0f, 0.0f, 0.0f, 0.0f); -layout(binding = 0) uniform buf0_ubo { +layout(binding = 0, std140) uniform buf0_ubo { vec2 resolution; + uint pad; + uint pad_1; } x_188; vec4 x_GLF_color = vec4(0.0f, 0.0f, 0.0f, 0.0f); diff --git a/test/tint/bug/tint/913.wgsl.expected.glsl b/test/tint/bug/tint/913.wgsl.expected.glsl index 01a54d0e6d..03f0da148d 100644 --- a/test/tint/bug/tint/913.wgsl.expected.glsl +++ b/test/tint/bug/tint/913.wgsl.expected.glsl @@ -4,7 +4,7 @@ layout(binding = 2, std430) buffer OutputBuf_ssbo { uint result[]; } tint_symbol; -layout(binding = 3) uniform Uniforms_ubo { +layout(binding = 3, std140) uniform Uniforms_ubo { uint dstTextureFlipY; uint channelCount; uvec2 srcCopyOrigin; diff --git a/test/tint/bug/tint/914.wgsl.expected.glsl b/test/tint/bug/tint/914.wgsl.expected.glsl index 25ef733670..b9ebe4a1d9 100644 --- a/test/tint/bug/tint/914.wgsl.expected.glsl +++ b/test/tint/bug/tint/914.wgsl.expected.glsl @@ -12,10 +12,11 @@ layout(binding = 2, std430) buffer Matrix_ssbo_2 { float numbers[]; } resultMatrix; -layout(binding = 3) uniform Uniforms_ubo { +layout(binding = 3, std140) uniform Uniforms_ubo { uint dimAOuter; uint dimInner; uint dimBOuter; + uint pad; } uniforms; float mm_readA(uint row, uint col) { diff --git a/test/tint/bug/tint/922.wgsl.expected.glsl b/test/tint/bug/tint/922.wgsl.expected.glsl index d88d88758c..351b258381 100644 --- a/test/tint/bug/tint/922.wgsl.expected.glsl +++ b/test/tint/bug/tint/922.wgsl.expected.glsl @@ -31,16 +31,16 @@ struct VertexOutput { vec4 member; }; -layout(binding = 0) uniform ub_SceneParams_ubo { +layout(binding = 0, std140) uniform ub_SceneParams_ubo { Mat4x4_ u_Projection; } global; -layout(binding = 1) uniform ub_MaterialParams_ubo { +layout(binding = 1, std140) uniform ub_MaterialParams_ubo { Mat4x2_ u_TexMtx[1]; vec4 u_Misc0_; } global1; -layout(binding = 2) uniform ub_PacketParams_ubo { +layout(binding = 2, std140) uniform ub_PacketParams_ubo { Mat4x3_ u_PosMtx[32]; } global2; diff --git a/test/tint/bug/tint/942.wgsl.expected.glsl b/test/tint/bug/tint/942.wgsl.expected.glsl index f577d034ad..bf44f34ce5 100644 --- a/test/tint/bug/tint/942.wgsl.expected.glsl +++ b/test/tint/bug/tint/942.wgsl.expected.glsl @@ -1,13 +1,18 @@ #version 310 es -layout(binding = 1) uniform Params_ubo { +layout(binding = 1, std140) uniform Params_ubo { uint filterDim; uint blockDim; + uint pad; + uint pad_1; } params; layout(rgba8) uniform highp writeonly image2D outputTex; -layout(binding = 3) uniform Flip_ubo { +layout(binding = 3, std140) uniform Flip_ubo { uint value; + uint pad_2; + uint pad_3; + uint pad_4; } flip; shared vec3 tile[4][256]; diff --git a/test/tint/bug/tint/943.spvasm.expected.glsl b/test/tint/bug/tint/943.spvasm.expected.glsl index 59b4da0623..2a9acbb0b7 100644 --- a/test/tint/bug/tint/943.spvasm.expected.glsl +++ b/test/tint/bug/tint/943.spvasm.expected.glsl @@ -4,12 +4,20 @@ note: reading from module-scope private variable 'dimInner_1' may result in a no #version 310 es int dimAOuter_1 = 0; -layout(binding = 3) uniform Uniforms_ubo { +layout(binding = 3, std140) uniform Uniforms_ubo { float NAN; + uint pad; + uint pad_1; + uint pad_2; ivec3 aShape; + uint pad_3; ivec3 bShape; + uint pad_4; ivec3 outShape; + uint pad_5; ivec2 outShapeStrides; + uint pad_6; + uint pad_7; } x_48; int dimInner_1 = 0; diff --git a/test/tint/bug/tint/948.wgsl.expected.glsl b/test/tint/bug/tint/948.wgsl.expected.glsl index 50e686325d..107f86e93c 100644 --- a/test/tint/bug/tint/948.wgsl.expected.glsl +++ b/test/tint/bug/tint/948.wgsl.expected.glsl @@ -25,9 +25,11 @@ 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) uniform LeftOver_ubo { +layout(binding = 9, std140) uniform LeftOver_ubo { float time; uint padding; + uint pad; + uint pad_1; mat4 worldViewProjection; vec2 outputSize; vec2 stageSize; @@ -35,6 +37,7 @@ layout(binding = 9) uniform LeftOver_ubo { float stageScale; float spriteCount; vec3 colorMul; + uint pad_2; } x_20; vec2 tUV = vec2(0.0f, 0.0f); diff --git a/test/tint/bug/tint/949.wgsl.expected.glsl b/test/tint/bug/tint/949.wgsl.expected.glsl index 3372f6748e..7585e915d5 100644 --- a/test/tint/bug/tint/949.wgsl.expected.glsl +++ b/test/tint/bug/tint/949.wgsl.expected.glsl @@ -26,11 +26,13 @@ struct lightingInfo { 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) uniform LeftOver_ubo { +layout(binding = 6, std140) uniform LeftOver_ubo { mat4 u_World; mat4 u_ViewProjection; float u_bumpStrength; uint padding; + uint pad; + uint pad_1; vec3 u_cameraPosition; float u_parallaxScale; float textureInfoName; @@ -42,7 +44,7 @@ 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) uniform Light0_ubo { +layout(binding = 5, std140) uniform Light0_ubo { vec4 vLightData; vec4 vLightDiffuse; vec4 vLightSpecular; @@ -50,6 +52,8 @@ layout(binding = 5) uniform Light0_ubo { uint padding_2; vec4 shadowsInfo; vec2 depthValues; + uint pad_2; + uint pad_3; } light0; vec4 glFragColor = vec4(0.0f, 0.0f, 0.0f, 0.0f); diff --git a/test/tint/bug/tint/951.spvasm.expected.glsl b/test/tint/bug/tint/951.spvasm.expected.glsl index 618b6849d2..af2f6d4185 100644 --- a/test/tint/bug/tint/951.spvasm.expected.glsl +++ b/test/tint/bug/tint/951.spvasm.expected.glsl @@ -9,12 +9,15 @@ layout(binding = 1, std430) buffer ssbA_ssbo { } x_20; uvec3 tint_symbol = uvec3(0u, 0u, 0u); -layout(binding = 2) uniform Uniforms_ubo { +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; } x_24; float getAAtOutCoords_() { diff --git a/test/tint/bug/tint/959.wgsl.expected.glsl b/test/tint/bug/tint/959.wgsl.expected.glsl index a461051acc..d0639e473c 100644 --- a/test/tint/bug/tint/959.wgsl.expected.glsl +++ b/test/tint/bug/tint/959.wgsl.expected.glsl @@ -3,66 +3,114 @@ precision mediump float; layout(binding = 0, std430) buffer S_ssbo { float a; + uint pad; + uint pad_1; + uint pad_2; } b0; layout(binding = 0, std430) buffer S_ssbo_1 { float a; + uint pad; + uint pad_1; + uint pad_2; } b1; layout(binding = 0, std430) buffer S_ssbo_2 { float a; + uint pad; + uint pad_1; + uint pad_2; } b2; layout(binding = 0, std430) buffer S_ssbo_3 { float a; + uint pad; + uint pad_1; + uint pad_2; } b3; layout(binding = 0, std430) buffer S_ssbo_4 { float a; + uint pad; + uint pad_1; + uint pad_2; } b4; layout(binding = 0, std430) buffer S_ssbo_5 { float a; + uint pad; + uint pad_1; + uint pad_2; } b5; layout(binding = 0, std430) buffer S_ssbo_6 { float a; + uint pad; + uint pad_1; + uint pad_2; } b6; layout(binding = 0, std430) buffer S_ssbo_7 { float a; + uint pad; + uint pad_1; + uint pad_2; } b7; -layout(binding = 1) uniform S_ubo { +layout(binding = 1, std140) uniform S_ubo { float a; + uint pad; + uint pad_1; + uint pad_2; } b8; -layout(binding = 1) uniform S_ubo_1 { +layout(binding = 1, std140) uniform S_ubo_1 { float a; + uint pad; + uint pad_1; + uint pad_2; } b9; -layout(binding = 1) uniform S_ubo_2 { +layout(binding = 1, std140) uniform S_ubo_2 { float a; + uint pad; + uint pad_1; + uint pad_2; } b10; -layout(binding = 1) uniform S_ubo_3 { +layout(binding = 1, std140) uniform S_ubo_3 { float a; + uint pad; + uint pad_1; + uint pad_2; } b11; -layout(binding = 1) uniform S_ubo_4 { +layout(binding = 1, std140) uniform S_ubo_4 { float a; + uint pad; + uint pad_1; + uint pad_2; } b12; -layout(binding = 1) uniform S_ubo_5 { +layout(binding = 1, std140) uniform S_ubo_5 { float a; + uint pad; + uint pad_1; + uint pad_2; } b13; -layout(binding = 1) uniform S_ubo_6 { +layout(binding = 1, std140) uniform S_ubo_6 { float a; + uint pad; + uint pad_1; + uint pad_2; } b14; -layout(binding = 1) uniform S_ubo_7 { +layout(binding = 1, std140) uniform S_ubo_7 { float a; + uint pad; + uint pad_1; + uint pad_2; } b15; void tint_symbol() { diff --git a/test/tint/bug/tint/993.wgsl.expected.glsl b/test/tint/bug/tint/993.wgsl.expected.glsl index bd15be7af7..c3ca8de754 100644 --- a/test/tint/bug/tint/993.wgsl.expected.glsl +++ b/test/tint/bug/tint/993.wgsl.expected.glsl @@ -1,7 +1,10 @@ #version 310 es -layout(binding = 0) uniform Constants_ubo { +layout(binding = 0, std140) uniform Constants_ubo { uint zero; + uint pad; + uint pad_1; + uint pad_2; } constants; layout(binding = 1, std430) buffer Result_ssbo { diff --git a/test/tint/bug/tint/998.wgsl.expected.glsl b/test/tint/bug/tint/998.wgsl.expected.glsl index 30dd9b8546..2aa26427c5 100644 --- a/test/tint/bug/tint/998.wgsl.expected.glsl +++ b/test/tint/bug/tint/998.wgsl.expected.glsl @@ -1,7 +1,10 @@ #version 310 es -layout(binding = 0) uniform Constants_ubo { +layout(binding = 0, std140) uniform Constants_ubo { uint zero; + uint pad; + uint pad_1; + uint pad_2; } constants; struct Result { diff --git a/test/tint/builtins/gen/literal/textureDimensions/ba1481.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/ba1481.wgsl.expected.glsl index f610169663..7bb878ea2b 100644 --- a/test/tint/builtins/gen/literal/textureDimensions/ba1481.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/textureDimensions/ba1481.wgsl.expected.glsl @@ -11,7 +11,7 @@ struct GammaTransferParams { uint padding; }; -layout(binding = 2) uniform ExternalTextureParams_ubo { +layout(binding = 2, std140) uniform ExternalTextureParams_ubo { uint numPlanes; uint doYuvToRgbConversionOnly; mat3x4 yuvToRgbConversionMatrix; @@ -52,7 +52,7 @@ struct GammaTransferParams { uint padding; }; -layout(binding = 2) uniform ExternalTextureParams_ubo { +layout(binding = 2, std140) uniform ExternalTextureParams_ubo { uint numPlanes; uint doYuvToRgbConversionOnly; mat3x4 yuvToRgbConversionMatrix; @@ -87,7 +87,7 @@ struct GammaTransferParams { uint padding; }; -layout(binding = 2) uniform ExternalTextureParams_ubo { +layout(binding = 2, std140) uniform ExternalTextureParams_ubo { uint numPlanes; uint doYuvToRgbConversionOnly; mat3x4 yuvToRgbConversionMatrix; diff --git a/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.glsl index 2d9af35db2..2667743d90 100644 --- a/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.glsl @@ -20,7 +20,7 @@ struct ExternalTextureParams { mat3 gamutConversionMatrix; }; -layout(binding = 2) uniform ext_tex_params_block_ubo { +layout(binding = 2, std140) uniform ext_tex_params_block_ubo { ExternalTextureParams inner; } ext_tex_params; @@ -88,7 +88,7 @@ struct ExternalTextureParams { mat3 gamutConversionMatrix; }; -layout(binding = 2) uniform ext_tex_params_block_ubo { +layout(binding = 2, std140) uniform ext_tex_params_block_ubo { ExternalTextureParams inner; } ext_tex_params; @@ -150,7 +150,7 @@ struct ExternalTextureParams { mat3 gamutConversionMatrix; }; -layout(binding = 2) uniform ext_tex_params_block_ubo { +layout(binding = 2, std140) uniform ext_tex_params_block_ubo { ExternalTextureParams inner; } ext_tex_params; diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/979816.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/979816.wgsl.expected.glsl index 63c387fe10..e90a09d82a 100644 --- a/test/tint/builtins/gen/literal/textureSampleLevel/979816.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/textureSampleLevel/979816.wgsl.expected.glsl @@ -20,7 +20,7 @@ struct ExternalTextureParams { mat3 gamutConversionMatrix; }; -layout(binding = 3) uniform ext_tex_params_block_ubo { +layout(binding = 3, std140) uniform ext_tex_params_block_ubo { ExternalTextureParams inner; } ext_tex_params; @@ -89,7 +89,7 @@ struct ExternalTextureParams { mat3 gamutConversionMatrix; }; -layout(binding = 3) uniform ext_tex_params_block_ubo { +layout(binding = 3, std140) uniform ext_tex_params_block_ubo { ExternalTextureParams inner; } ext_tex_params; @@ -152,7 +152,7 @@ struct ExternalTextureParams { mat3 gamutConversionMatrix; }; -layout(binding = 3) uniform ext_tex_params_block_ubo { +layout(binding = 3, std140) uniform ext_tex_params_block_ubo { ExternalTextureParams inner; } ext_tex_params; diff --git a/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.glsl index f610169663..7bb878ea2b 100644 --- a/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.glsl @@ -11,7 +11,7 @@ struct GammaTransferParams { uint padding; }; -layout(binding = 2) uniform ExternalTextureParams_ubo { +layout(binding = 2, std140) uniform ExternalTextureParams_ubo { uint numPlanes; uint doYuvToRgbConversionOnly; mat3x4 yuvToRgbConversionMatrix; @@ -52,7 +52,7 @@ struct GammaTransferParams { uint padding; }; -layout(binding = 2) uniform ExternalTextureParams_ubo { +layout(binding = 2, std140) uniform ExternalTextureParams_ubo { uint numPlanes; uint doYuvToRgbConversionOnly; mat3x4 yuvToRgbConversionMatrix; @@ -87,7 +87,7 @@ struct GammaTransferParams { uint padding; }; -layout(binding = 2) uniform ExternalTextureParams_ubo { +layout(binding = 2, std140) uniform ExternalTextureParams_ubo { uint numPlanes; uint doYuvToRgbConversionOnly; mat3x4 yuvToRgbConversionMatrix; diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.glsl index 0debae11b3..e81af144de 100644 --- a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.glsl @@ -20,7 +20,7 @@ struct ExternalTextureParams { mat3 gamutConversionMatrix; }; -layout(binding = 2) uniform ext_tex_params_block_ubo { +layout(binding = 2, std140) uniform ext_tex_params_block_ubo { ExternalTextureParams inner; } ext_tex_params; @@ -89,7 +89,7 @@ struct ExternalTextureParams { mat3 gamutConversionMatrix; }; -layout(binding = 2) uniform ext_tex_params_block_ubo { +layout(binding = 2, std140) uniform ext_tex_params_block_ubo { ExternalTextureParams inner; } ext_tex_params; @@ -152,7 +152,7 @@ struct ExternalTextureParams { mat3 gamutConversionMatrix; }; -layout(binding = 2) uniform ext_tex_params_block_ubo { +layout(binding = 2, std140) uniform ext_tex_params_block_ubo { ExternalTextureParams inner; } ext_tex_params; diff --git a/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.glsl index 1a5bb9aaec..168f660b07 100644 --- a/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.glsl @@ -20,7 +20,7 @@ struct ExternalTextureParams { mat3 gamutConversionMatrix; }; -layout(binding = 3) uniform ext_tex_params_block_ubo { +layout(binding = 3, std140) uniform ext_tex_params_block_ubo { ExternalTextureParams inner; } ext_tex_params; @@ -90,7 +90,7 @@ struct ExternalTextureParams { mat3 gamutConversionMatrix; }; -layout(binding = 3) uniform ext_tex_params_block_ubo { +layout(binding = 3, std140) uniform ext_tex_params_block_ubo { ExternalTextureParams inner; } ext_tex_params; @@ -154,7 +154,7 @@ struct ExternalTextureParams { mat3 gamutConversionMatrix; }; -layout(binding = 3) uniform ext_tex_params_block_ubo { +layout(binding = 3, std140) uniform ext_tex_params_block_ubo { ExternalTextureParams inner; } ext_tex_params; diff --git a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.glsl b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.glsl index 47f9c0a175..2a7cdf697d 100644 --- a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.glsl +++ b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.glsl @@ -20,7 +20,7 @@ struct ExternalTextureParams { mat3 gamutConversionMatrix; }; -layout(binding = 2) uniform ext_tex_params_block_ubo { +layout(binding = 2, std140) uniform ext_tex_params_block_ubo { ExternalTextureParams inner; } ext_tex_params; @@ -92,7 +92,7 @@ struct ExternalTextureParams { mat3 gamutConversionMatrix; }; -layout(binding = 2) uniform ext_tex_params_block_ubo { +layout(binding = 2, std140) uniform ext_tex_params_block_ubo { ExternalTextureParams inner; } ext_tex_params; @@ -158,7 +158,7 @@ struct ExternalTextureParams { mat3 gamutConversionMatrix; }; -layout(binding = 2) uniform ext_tex_params_block_ubo { +layout(binding = 2, std140) uniform ext_tex_params_block_ubo { ExternalTextureParams inner; } ext_tex_params; 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 c2ceb0a0a2..8193622f9c 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 @@ -6,11 +6,14 @@ struct S { vec3 vector; }; -layout(binding = 0) uniform S_std140_ubo { +layout(binding = 0, std140) uniform S_std140_ubo { vec2 matrix_0; vec2 matrix_1; vec2 matrix_2; + uint pad; + uint pad_1; vec3 vector; + uint pad_2; } data; mat3x2 load_data_matrix() { 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 b5481e4506..f8f1b37fc5 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,9 +1,10 @@ #version 310 es precision mediump float; -layout(binding = 0) uniform S_ubo { +layout(binding = 0, std140) uniform S_ubo { mat3 matrix; vec3 vector; + uint pad; } data; void tint_symbol() { 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 805940727c..1d17cf7dd8 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,9 +1,10 @@ #version 310 es precision mediump float; -layout(binding = 0) uniform S_ubo { +layout(binding = 0, std140) uniform S_ubo { mat3 matrix; vec3 vector; + uint pad; } data; void tint_symbol() { 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 26960f6895..149b5e09b1 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,9 +1,10 @@ #version 310 es precision mediump float; -layout(binding = 0) uniform S_ubo { +layout(binding = 0, std140) uniform S_ubo { mat4x3 matrix; vec3 vector; + uint pad; } data; void tint_symbol() { 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 9f4cd7dbe4..e72cd13ae6 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,8 +4,9 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0) uniform S_ubo { +layout(binding = 0, std140) uniform S_ubo { vec3 v; + uint pad; } U; void f() { 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 ce0631d5d4..865c502f54 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,8 +4,9 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0) uniform S_ubo { +layout(binding = 0, std140) uniform S_ubo { ivec3 v; + uint pad; } U; void f() { 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 435e00118b..3d91f73cd1 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,8 +4,9 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -layout(binding = 0) uniform S_ubo { +layout(binding = 0, std140) uniform S_ubo { uvec3 v; + uint pad; } U; void f() { 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 5bec520bd9..919f4412d4 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 @@ -6,6 +6,7 @@ void unused_entry_point() { } layout(binding = 0, std430) buffer S_ssbo { vec3 v; + uint pad; } U; void f() { 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 ab987b2811..2318c7c2d9 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 @@ -6,6 +6,7 @@ void unused_entry_point() { } layout(binding = 0, std430) buffer S_ssbo { ivec3 v; + uint pad; } U; void f() { 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 6481d65321..ee0d4c6b81 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 @@ -6,6 +6,7 @@ void unused_entry_point() { } layout(binding = 0, std430) buffer S_ssbo { uvec3 v; + uint pad; } U; void f() { 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 b4391341ac..78de6f78ff 100644 --- a/test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.glsl +++ b/test/tint/layout/storage/mat2x2/stride/16.spvasm.expected.glsl @@ -2,6 +2,8 @@ struct strided_arr { vec2 el; + uint pad; + uint pad_1; }; layout(binding = 0, std430) buffer SSBO_ssbo { @@ -13,8 +15,8 @@ mat2 arr_to_mat2x2_stride_16(strided_arr arr[2]) { } strided_arr[2] mat2x2_stride_16_to_arr(mat2 m) { - strided_arr tint_symbol_1 = strided_arr(m[0u]); - strided_arr tint_symbol_2 = strided_arr(m[1u]); + strided_arr tint_symbol_1 = strided_arr(m[0u], 0u, 0u); + strided_arr tint_symbol_2 = strided_arr(m[1u], 0u, 0u); strided_arr tint_symbol_3[2] = strided_arr[2](tint_symbol_1, tint_symbol_2); return tint_symbol_3; } 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 b259bfb2f4..3fbb91e7f0 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,7 +1,10 @@ #version 310 es -layout(binding = 0) uniform S_ubo { +layout(binding = 0, std140) uniform S_ubo { int a; + uint pad; + uint pad_1; + uint pad_2; } v; void tint_symbol() { diff --git a/test/tint/samples/compute_boids.wgsl.expected.glsl b/test/tint/samples/compute_boids.wgsl.expected.glsl index 408cf550dc..9e553117ba 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) uniform SimParams_ubo { +layout(binding = 0, std140) uniform SimParams_ubo { float deltaT; float rule1Distance; float rule2Distance; @@ -83,6 +83,7 @@ layout(binding = 0) uniform SimParams_ubo { float rule1Scale; float rule2Scale; float rule3Scale; + uint pad; } params; layout(binding = 1, std430) buffer Particles_ssbo { diff --git a/test/tint/samples/cube.wgsl.expected.glsl b/test/tint/samples/cube.wgsl.expected.glsl index 442e404ab0..4526aa73a6 100644 --- a/test/tint/samples/cube.wgsl.expected.glsl +++ b/test/tint/samples/cube.wgsl.expected.glsl @@ -3,7 +3,7 @@ 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) uniform Uniforms_ubo { +layout(binding = 0, std140) uniform Uniforms_ubo { mat4 modelViewProjectionMatrix; } uniforms; diff --git a/test/tint/shader_io/shared_struct_storage_buffer.wgsl.expected.glsl b/test/tint/shader_io/shared_struct_storage_buffer.wgsl.expected.glsl index 325570b2b6..27263429da 100644 --- a/test/tint/shader_io/shared_struct_storage_buffer.wgsl.expected.glsl +++ b/test/tint/shader_io/shared_struct_storage_buffer.wgsl.expected.glsl @@ -6,7 +6,65 @@ layout(location = 1) flat in uint u_1; struct S { float f; uint u; + uint pad; + uint pad_1; + uint pad_2; + uint pad_3; + uint pad_4; + uint pad_5; + uint pad_6; + uint pad_7; + uint pad_8; + uint pad_9; + uint pad_10; + uint pad_11; + uint pad_12; + uint pad_13; + uint pad_14; + uint pad_15; + uint pad_16; + uint pad_17; + uint pad_18; + uint pad_19; + uint pad_20; + uint pad_21; + uint pad_22; + uint pad_23; + uint pad_24; + uint pad_25; + uint pad_26; + uint pad_27; + uint pad_28; + uint pad_29; vec4 v; + uint pad_30; + uint pad_31; + uint pad_32; + uint pad_33; + uint pad_34; + uint pad_35; + uint pad_36; + uint pad_37; + uint pad_38; + uint pad_39; + uint pad_40; + uint pad_41; + uint pad_42; + uint pad_43; + uint pad_44; + uint pad_45; + uint pad_46; + uint pad_47; + uint pad_48; + uint pad_49; + uint pad_50; + uint pad_51; + uint pad_52; + uint pad_53; + uint pad_54; + uint pad_55; + uint pad_56; + uint pad_57; }; layout(binding = 0, std430) buffer tint_symbol_block_ssbo { @@ -21,7 +79,7 @@ void frag_main(S tint_symbol_1) { } void main() { - S tint_symbol_2 = S(f_1, u_1, gl_FragCoord); + S tint_symbol_2 = S(f_1, u_1, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, gl_FragCoord, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u); frag_main(tint_symbol_2); return; } 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 359938c04e..f5130acef6 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 @@ -8,8 +8,11 @@ struct OuterS { InnerS a1[8]; }; -layout(binding = 4) uniform Uniforms_ubo { +layout(binding = 4, std140) uniform Uniforms_ubo { uint i; + uint pad; + uint pad_1; + uint pad_2; } uniforms; void tint_symbol() { 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 9ef360bd2c..81900b94db 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 @@ -8,8 +8,11 @@ struct OuterS { InnerS a1[8]; }; -layout(binding = 4) uniform Uniforms_ubo { +layout(binding = 4, std140) uniform Uniforms_ubo { uint i; + uint pad; + uint pad_1; + uint pad_2; } uniforms; void tint_symbol() { 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 49aff5d2e3..39960c3448 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 @@ -8,8 +8,11 @@ struct OuterS { InnerS a1[8]; }; -layout(binding = 4) uniform Uniforms_ubo { +layout(binding = 4, std140) uniform Uniforms_ubo { uint i; + uint pad; + uint pad_1; + uint pad_2; } uniforms; void tint_symbol() { 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 4505b851f0..4b1fbf935a 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 @@ -18,9 +18,11 @@ uint getNextIndex() { return nextIndex; } -layout(binding = 4) uniform Uniforms_ubo { +layout(binding = 4, std140) uniform Uniforms_ubo { uint i; uint j; + uint pad; + uint pad_1; } uniforms; void tint_symbol() { 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 1b59df8b15..f617713020 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 @@ -8,8 +8,11 @@ struct OuterS { InnerS a1[8]; }; -layout(binding = 4) uniform Uniforms_ubo { +layout(binding = 4, std140) uniform Uniforms_ubo { uint i; + uint pad; + uint pad_1; + uint pad_2; } uniforms; void tint_symbol() { 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 01c4ad2613..c636cfdfbc 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 @@ -8,9 +8,11 @@ struct OuterS { InnerS a1[8][8]; }; -layout(binding = 4) uniform Uniforms_ubo { +layout(binding = 4, std140) uniform Uniforms_ubo { uint i; uint j; + uint pad; + uint pad_1; } uniforms; void tint_symbol() { 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 af08fd8046..46ad319bf0 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 @@ -12,8 +12,11 @@ struct OuterS { S1 a1[8]; }; -layout(binding = 4) uniform Uniforms_ubo { +layout(binding = 4, std140) uniform Uniforms_ubo { uint i; + uint pad; + uint pad_1; + uint pad_2; } uniforms; void tint_symbol() { 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 2951c8f44f..ae7e1f6849 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 @@ -12,9 +12,11 @@ struct OuterS { S1 a1[8]; }; -layout(binding = 4) uniform Uniforms_ubo { +layout(binding = 4, std140) uniform Uniforms_ubo { uint i; uint j; + uint pad; + uint pad_1; } uniforms; void tint_symbol() { 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 23b760d45c..3ad5adb504 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 @@ -4,8 +4,11 @@ struct InnerS { int v; }; -layout(binding = 4) uniform Uniforms_ubo { +layout(binding = 4, std140) uniform Uniforms_ubo { uint i; + uint pad; + uint pad_1; + uint pad_2; } uniforms; layout(binding = 0, std430) buffer OuterS_ssbo { 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 24161948f5..9b35005670 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 @@ -8,9 +8,11 @@ struct S1 { InnerS a2[8]; }; -layout(binding = 4) uniform Uniforms_ubo { +layout(binding = 4, std140) uniform Uniforms_ubo { uint i; uint j; + uint pad; + uint pad_1; } uniforms; layout(binding = 0, std430) buffer OuterS_ssbo { 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 9211926e23..049e650811 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 @@ -4,8 +4,11 @@ struct OuterS { mat2x4 m1; }; -layout(binding = 4) uniform Uniforms_ubo { +layout(binding = 4, std140) uniform Uniforms_ubo { uint i; + uint pad; + uint pad_1; + uint pad_2; } uniforms; void tint_symbol() { 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 6334c1fe0d..6a2e306893 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 @@ -9,8 +9,11 @@ struct OuterS { InnerS a2[8]; }; -layout(binding = 4) uniform Uniforms_ubo { +layout(binding = 4, std140) uniform Uniforms_ubo { uint i; + uint pad; + uint pad_1; + uint pad_2; } uniforms; void tint_symbol() { 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 c33dcc481a..02e5a528e0 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 @@ -12,8 +12,11 @@ struct OuterS { S1 s2; }; -layout(binding = 4) uniform Uniforms_ubo { +layout(binding = 4, std140) uniform Uniforms_ubo { uint i; + uint pad; + uint pad_1; + uint pad_2; } uniforms; void tint_symbol() { 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 fb6df1479b..b2fc18cc0f 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 @@ -4,8 +4,11 @@ struct OuterS { vec3 v1; }; -layout(binding = 4) uniform Uniforms_ubo { +layout(binding = 4, std140) uniform Uniforms_ubo { uint i; + uint pad; + uint pad_1; + uint pad_2; } uniforms; void tint_symbol() { 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 35c1d85a5e..d8898da978 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 @@ -4,8 +4,11 @@ struct OuterS { uint a1[8]; }; -layout(binding = 4) uniform Uniforms_ubo { +layout(binding = 4, std140) uniform Uniforms_ubo { uint i; + uint pad; + uint pad_1; + uint pad_2; } uniforms; uint f(uint i) { 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 08a5f1604b..25859a3d6d 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 @@ -8,8 +8,11 @@ struct OuterS { InnerS a1[8]; }; -layout(binding = 4) uniform Uniforms_ubo { +layout(binding = 4, std140) uniform Uniforms_ubo { uint i; + uint pad; + uint pad_1; + uint pad_2; } uniforms; void tint_symbol() { 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 dd49ae7f8d..5045e6a322 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 @@ -8,8 +8,11 @@ struct OuterS { InnerS a1[8]; }; -layout(binding = 4) uniform Uniforms_ubo { +layout(binding = 4, std140) uniform Uniforms_ubo { uint i; + uint pad; + uint pad_1; + uint pad_2; } uniforms; void f(inout OuterS p) { 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 15769cebff..9d861c5ff1 100644 --- a/test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.glsl +++ b/test/tint/statements/assign/phony/uniform_buffer.wgsl.expected.glsl @@ -1,7 +1,10 @@ #version 310 es -layout(binding = 0) uniform S_ubo { +layout(binding = 0, std140) uniform S_ubo { int i; + uint pad; + uint pad_1; + uint pad_2; } u; void tint_symbol() { 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 daad9096cb..c62965a2c4 100644 --- a/test/tint/statements/compound_assign/for_loop.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/for_loop.wgsl.expected.glsl @@ -6,6 +6,9 @@ void unused_entry_point() { } layout(binding = 0, std430) buffer S_ssbo { int a; + uint pad; + uint pad_1; + uint pad_2; vec4 b; mat2 c; } v;