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 <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Stephen White 2022-09-13 19:48:51 +00:00 committed by Dawn LUCI CQ
parent 26ffcd1768
commit 05d8b02b0f
146 changed files with 1452 additions and 192 deletions

View File

@ -671,8 +671,7 @@ ResultOrError<std::vector<Ref<AdapterBase>>> Backend::DiscoverAdapters(
// iOS only has a single device so MTLCopyAllDevices doesn't exist there.
#if defined(DAWN_PLATFORM_IOS)
Ref<Adapter> adapter =
AcquireRef(new Adapter(GetInstance(), MTLCreateSystemDefaultDevice()));
Ref<Adapter> adapter = AcquireRef(new Adapter(GetInstance(), MTLCreateSystemDefaultDevice()));
if (!GetInstance()->ConsumedError(adapter->Initialize())) {
adapters.push_back(std::move(adapter));
}

View File

@ -344,13 +344,15 @@ namespace {
auto GenerateParams() {
auto params = MakeParamGenerator<ComputeLayoutMemoryBufferTestParams>(
{
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},
{

View File

@ -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",

View File

@ -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

View File

@ -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 <string>
#include <unordered_map>
#include <utility>
#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<const ast::StructMember*, 8>* new_members,
utils::Hashset<const ast::StructMember*, 8>* 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<const ast::Struct*, const ast::Struct*> replaced_structs;
utils::Hashset<const ast::StructMember*, 8> padding_members;
ctx.ReplaceAll([&](const ast::Struct* ast_str) -> const ast::Struct* {
auto* str = sem.Get<sem::Struct>(ast_str);
if (!str || !str->IsHostShareable()) {
return nullptr;
}
uint32_t offset = 0;
bool has_runtime_sized_array = false;
utils::Vector<const ast::StructMember*, 8> 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<sem::Struct>() && 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<sem::Array>()) {
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<ast::Struct>(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<sem::Call>(ast_call);
if (!call) {
return nullptr;
}
auto* cons = call->Target()->As<sem::TypeConstructor>();
if (!cons) {
return nullptr;
}
auto* str = cons->ReturnType()->As<sem::Struct>();
if (!str) {
return nullptr;
}
auto* new_struct = replaced_structs[str->Declaration()];
if (!new_struct) {
return nullptr;
}
utils::Vector<const ast::Expression*, 8> 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

View File

@ -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<PadStructs, Transform> {
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_

View File

@ -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 <memory>
#include <utility>
#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<PadStructs>(src, data);
EXPECT_EQ(expect, str(got));
}
TEST_F(PadStructsTest, Uniform) {
auto* src = R"(
struct S {
x : i32,
}
@group(0) @binding(0) var<uniform> 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<uniform> u : S;
fn main() {
let x = u.x;
}
)";
DataMap data;
auto got = Run<PadStructs>(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<uniform> 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<uniform> u : S;
fn main() {
let x = u.x;
}
)";
DataMap data;
auto got = Run<PadStructs>(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<uniform> u : S;
var<private> 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<uniform> u : S;
var<private> p : S;
fn main() {
p.x = u.x;
}
)";
DataMap data;
auto got = Run<PadStructs>(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<storage, read_write> s : S;
var<private> 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<storage, read_write> s : S;
var<private> p : S;
fn main() {
p.x = 123;
s.x = p.x;
}
)";
DataMap data;
auto got = Run<PadStructs>(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<uniform> u : S;
@group(0) @binding(1) var<storage, read_write> 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<uniform> u : S;
@group(0) @binding(1) var<storage, read_write> s : S;
fn main() {
s.x = u.x;
}
)";
DataMap data;
auto got = Run<PadStructs>(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<private> p : S;
fn main() {
p.x = 123;
}
)";
auto* expect = R"(
struct S {
@size(12)
x : i32,
y : i32,
}
var<private> p : S;
fn main() {
p.x = 123;
}
)";
DataMap data;
auto got = Run<PadStructs>(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<uniform> u : S;
var<private> 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<uniform> u : S;
var<private> p : S;
fn main() {
p.a = u.b;
p.b = u.a;
}
)";
DataMap data;
auto got = Run<PadStructs>(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<storage, read_write> s : S;
var<private> 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<storage, read_write> s : S;
var<private> p : S;
fn main() {
p.a = 123;
p.b = 321;
s.a = p.b;
s.b = p.a;
}
)";
DataMap data;
auto got = Run<PadStructs>(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<uniform> u : S;
@group(0) @binding(1) var<storage, read_write> 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<uniform> u : S;
@group(0) @binding(1) var<storage, read_write> s : S;
fn main() {
s.a = u.b;
s.b = u.a;
}
)";
DataMap data;
auto got = Run<PadStructs>(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<private> p : S;
fn main() {
p.a = 123;
p.b = 321;
}
)";
auto* expect = R"(
struct S {
a : i32,
@align(16)
b : i32,
}
var<private> p : S;
fn main() {
p.a = 123;
p.b = 321;
}
)";
DataMap data;
auto got = Run<PadStructs>(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<f32>,
b : array<T>,
}
@group(0) @binding(0) var<storage, read_write> s : S;
fn main() {
s.b[0] = T(1.0f, 23);
}
)";
auto* expect = R"(
struct T {
a : f32,
b : i32,
}
struct S {
a : vec4<f32>,
b : array<T>,
}
@group(0) @binding(0) var<storage, read_write> s : S;
fn main() {
s.b[0] = T(1.0f, 23);
}
)";
DataMap data;
auto got = Run<PadStructs>(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<f32>,
b : array<T, 1u>,
}
@group(0) @binding(0) var<storage, read_write> s : S;
fn main() {
s.b[0] = T(1.0f, 23);
}
)";
auto* expect = R"(
struct T {
a : f32,
b : i32,
}
struct S {
a : vec4<f32>,
b : array<T, 1u>,
pad : u32,
pad_1 : u32,
}
@group(0) @binding(0) var<storage, read_write> s : S;
fn main() {
s.b[0] = T(1.0f, 23);
}
)";
DataMap data;
auto got = Run<PadStructs>(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<storage, read_write> 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<storage, read_write> s : S;
fn main() {
s = S(1.0f, 0u, 2, 0u);
}
)";
DataMap data;
auto got = Run<PadStructs>(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<storage, read_write> 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<storage, read_write> s : S;
fn main() {
s = S();
}
)";
DataMap data;
auto got = Run<PadStructs>(src, data);
EXPECT_EQ(expect, str(got));
}
} // namespace
} // namespace tint::transform

View File

@ -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<transform::ExpandCompoundAssignment>();
manager.Add<transform::PromoteSideEffectsToDecl>();
manager.Add<transform::Std140>(); // Must come after PromoteSideEffectsToDecl
manager.Add<transform::PadStructs>();
manager.Add<transform::UnwindDiscardFunctions>();
manager.Add<transform::SimplifyPointers>();
@ -1910,13 +1912,10 @@ bool GeneratorImpl::EmitUniformVariable(const ast::Var* var, const sem::Variable
auto bp = sem->As<sem::GlobalVariable>()->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<sem::GlobalVariable>()->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;
}

View File

@ -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

View File

@ -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;

View File

@ -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 {

View File

@ -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;
)");

View File

@ -37,7 +37,7 @@ struct Simple {
float member;
};
layout(binding = 0) uniform Simple_ubo {
layout(binding = 0, std140) uniform Simple_ubo {
float member;
} simple;

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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 {

View File

@ -9,6 +9,8 @@ struct Inner {
float f;
mat2x3 g;
mat3x2 h;
uint pad;
uint pad_1;
ivec4 i[4];
};

View File

@ -9,6 +9,8 @@ struct Inner {
float f;
mat2x3 g;
mat3x2 h;
uint pad;
uint pad_1;
ivec4 i[4];
};

View File

@ -15,6 +15,7 @@ layout(binding = 0, std430) buffer S_ssbo {
mat3x2 h;
Inner i;
Inner j[4];
uint pad;
} s;
void tint_symbol() {

View File

@ -15,6 +15,7 @@ layout(binding = 0, std430) buffer S_ssbo {
mat3x2 h;
Inner i;
Inner j[4];
uint pad;
} s;
void tint_symbol() {

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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]);

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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]);

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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]);

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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 {

View File

@ -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;

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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);

View File

@ -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() {

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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 {

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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 {

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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) {

View File

@ -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);

View File

@ -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;

View File

@ -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) {

View File

@ -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;

View File

@ -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];

View File

@ -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;

View File

@ -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);

Some files were not shown because too many files have changed in this diff Show More