GLSL: Change Add[Spirv]BlockAttribute to support GLSL

Modify the AddSpirvBlockAttribute transform to fix top-level structure
access of uniform, storage and push-constant buffers for use in the
GLSL backend. The small change to the transform makes the transform
wrap host-sharable buffers, if they're also used as a
non-host-sharable structure. Also rename the transform to
AddBlockAttrbibute in order to reflect its wider applicability.

Change-Id: Ib2bf4ebf6bce72790791dbae9387032be765e4b9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101061
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
This commit is contained in:
Stephen White 2022-09-02 19:19:10 +00:00 committed by Dawn LUCI CQ
parent 822de46c74
commit 863d9edf59
362 changed files with 2316 additions and 3876 deletions

View File

@ -390,9 +390,9 @@ libtint_source_set("libtint_core_all_src") {
"program_builder.h", "program_builder.h",
"program_id.cc", "program_id.cc",
"program_id.h", "program_id.h",
"reflection.h",
"reader/reader.cc", "reader/reader.cc",
"reader/reader.h", "reader/reader.h",
"reflection.h",
"resolver/const_eval.cc", "resolver/const_eval.cc",
"resolver/const_eval.h", "resolver/const_eval.h",
"resolver/ctor_conv_intrinsic.cc", "resolver/ctor_conv_intrinsic.cc",
@ -470,10 +470,10 @@ libtint_source_set("libtint_core_all_src") {
"text/unicode.cc", "text/unicode.cc",
"text/unicode.h", "text/unicode.h",
"traits.h", "traits.h",
"transform/add_block_attribute.cc",
"transform/add_block_attribute.h",
"transform/add_empty_entry_point.cc", "transform/add_empty_entry_point.cc",
"transform/add_empty_entry_point.h", "transform/add_empty_entry_point.h",
"transform/add_spirv_block_attribute.cc",
"transform/add_spirv_block_attribute.h",
"transform/array_length_from_uniform.cc", "transform/array_length_from_uniform.cc",
"transform/array_length_from_uniform.h", "transform/array_length_from_uniform.h",
"transform/binding_remapper.cc", "transform/binding_remapper.cc",
@ -1186,8 +1186,8 @@ if (tint_build_unittests) {
tint_unittests_source_set("tint_unittests_transform_src") { tint_unittests_source_set("tint_unittests_transform_src") {
sources = [ sources = [
"transform/add_block_attribute_test.cc",
"transform/add_empty_entry_point_test.cc", "transform/add_empty_entry_point_test.cc",
"transform/add_spirv_block_attribute_test.cc",
"transform/array_length_from_uniform_test.cc", "transform/array_length_from_uniform_test.cc",
"transform/binding_remapper_test.cc", "transform/binding_remapper_test.cc",
"transform/builtin_polyfill_test.cc", "transform/builtin_polyfill_test.cc",

View File

@ -384,8 +384,8 @@ set(TINT_LIB_SRCS
traits.h traits.h
transform/add_empty_entry_point.cc transform/add_empty_entry_point.cc
transform/add_empty_entry_point.h transform/add_empty_entry_point.h
transform/add_spirv_block_attribute.cc transform/add_block_attribute.cc
transform/add_spirv_block_attribute.h transform/add_block_attribute.h
transform/array_length_from_uniform.cc transform/array_length_from_uniform.cc
transform/array_length_from_uniform.h transform/array_length_from_uniform.h
transform/binding_remapper.cc transform/binding_remapper.cc
@ -1102,7 +1102,7 @@ if(TINT_BUILD_TESTS)
if(${TINT_BUILD_WGSL_READER} AND ${TINT_BUILD_WGSL_WRITER}) if(${TINT_BUILD_WGSL_READER} AND ${TINT_BUILD_WGSL_WRITER})
list(APPEND TINT_TEST_SRCS list(APPEND TINT_TEST_SRCS
transform/add_empty_entry_point_test.cc transform/add_empty_entry_point_test.cc
transform/add_spirv_block_attribute_test.cc transform/add_block_attribute_test.cc
transform/array_length_from_uniform_test.cc transform/array_length_from_uniform_test.cc
transform/binding_remapper_test.cc transform/binding_remapper_test.cc
transform/builtin_polyfill_test.cc transform/builtin_polyfill_test.cc

View File

@ -26,13 +26,13 @@
#include "src/tint/ast/texture.h" #include "src/tint/ast/texture.h"
#include "src/tint/ast/u32.h" #include "src/tint/ast/u32.h"
#include "src/tint/ast/vector.h" #include "src/tint/ast/vector.h"
#include "src/tint/transform/add_spirv_block_attribute.h" #include "src/tint/transform/add_block_attribute.h"
namespace tint::ast { namespace tint::ast {
namespace { namespace {
using AstStructTest = TestHelper; using AstStructTest = TestHelper;
using SpirvBlockAttribute = transform::AddSpirvBlockAttribute::SpirvBlockAttribute; using BlockAttribute = transform::AddBlockAttribute::BlockAttribute;
TEST_F(AstStructTest, Creation) { TEST_F(AstStructTest, Creation) {
auto name = Sym("s"); auto name = Sym("s");
@ -51,12 +51,12 @@ TEST_F(AstStructTest, Creation_WithAttributes) {
auto* s = create<Struct>(name, utils::Vector{Member("a", ty.i32())}, auto* s = create<Struct>(name, utils::Vector{Member("a", ty.i32())},
utils::Vector{ utils::Vector{
ASTNodes().Create<SpirvBlockAttribute>(ID(), AllocateNodeID()), ASTNodes().Create<BlockAttribute>(ID(), AllocateNodeID()),
}); });
EXPECT_EQ(s->name, name); EXPECT_EQ(s->name, name);
EXPECT_EQ(s->members.Length(), 1u); EXPECT_EQ(s->members.Length(), 1u);
ASSERT_EQ(s->attributes.Length(), 1u); ASSERT_EQ(s->attributes.Length(), 1u);
EXPECT_TRUE(s->attributes[0]->Is<SpirvBlockAttribute>()); EXPECT_TRUE(s->attributes[0]->Is<BlockAttribute>());
EXPECT_EQ(s->source.range.begin.line, 0u); EXPECT_EQ(s->source.range.begin.line, 0u);
EXPECT_EQ(s->source.range.begin.column, 0u); EXPECT_EQ(s->source.range.begin.column, 0u);
EXPECT_EQ(s->source.range.end.line, 0u); EXPECT_EQ(s->source.range.end.line, 0u);
@ -65,14 +65,14 @@ TEST_F(AstStructTest, Creation_WithAttributes) {
TEST_F(AstStructTest, CreationWithSourceAndAttributes) { TEST_F(AstStructTest, CreationWithSourceAndAttributes) {
auto name = Sym("s"); auto name = Sym("s");
auto* s = create<Struct>( auto* s =
Source{Source::Range{Source::Location{27, 4}, Source::Location{27, 8}}}, name, create<Struct>(Source{Source::Range{Source::Location{27, 4}, Source::Location{27, 8}}},
utils::Vector{Member("a", ty.i32())}, name, utils::Vector{Member("a", ty.i32())},
utils::Vector{ASTNodes().Create<SpirvBlockAttribute>(ID(), AllocateNodeID())}); utils::Vector{ASTNodes().Create<BlockAttribute>(ID(), AllocateNodeID())});
EXPECT_EQ(s->name, name); EXPECT_EQ(s->name, name);
EXPECT_EQ(s->members.Length(), 1u); EXPECT_EQ(s->members.Length(), 1u);
ASSERT_EQ(s->attributes.Length(), 1u); ASSERT_EQ(s->attributes.Length(), 1u);
EXPECT_TRUE(s->attributes[0]->Is<SpirvBlockAttribute>()); EXPECT_TRUE(s->attributes[0]->Is<BlockAttribute>());
EXPECT_EQ(s->source.range.begin.line, 27u); EXPECT_EQ(s->source.range.begin.line, 27u);
EXPECT_EQ(s->source.range.begin.column, 4u); EXPECT_EQ(s->source.range.begin.column, 4u);
EXPECT_EQ(s->source.range.end.line, 27u); EXPECT_EQ(s->source.range.end.line, 27u);
@ -115,9 +115,9 @@ TEST_F(AstStructTest, Assert_DifferentProgramID_Attribute) {
{ {
ProgramBuilder b1; ProgramBuilder b1;
ProgramBuilder b2; ProgramBuilder b2;
b1.create<Struct>(b1.Sym("S"), utils::Vector{b1.Member("a", b1.ty.i32())}, b1.create<Struct>(
utils::Vector{b2.ASTNodes().Create<SpirvBlockAttribute>( b1.Sym("S"), utils::Vector{b1.Member("a", b1.ty.i32())},
b2.ID(), b2.AllocateNodeID())}); utils::Vector{b2.ASTNodes().Create<BlockAttribute>(b2.ID(), b2.AllocateNodeID())});
}, },
"internal compiler error"); "internal compiler error");
} }

View File

@ -15,7 +15,7 @@
#include "src/tint/ast/disable_validation_attribute.h" #include "src/tint/ast/disable_validation_attribute.h"
#include "src/tint/resolver/resolver.h" #include "src/tint/resolver/resolver.h"
#include "src/tint/resolver/resolver_test_helper.h" #include "src/tint/resolver/resolver_test_helper.h"
#include "src/tint/transform/add_spirv_block_attribute.h" #include "src/tint/transform/add_block_attribute.h"
#include "gmock/gmock.h" #include "gmock/gmock.h"
@ -557,7 +557,7 @@ TEST_F(EntryPointReturnTypeAttributeTest, DuplicateInternalAttribute) {
namespace StructAndStructMemberTests { namespace StructAndStructMemberTests {
using StructAttributeTest = TestWithParams; using StructAttributeTest = TestWithParams;
using SpirvBlockAttribute = transform::AddSpirvBlockAttribute::SpirvBlockAttribute; using SpirvBlockAttribute = transform::AddBlockAttribute::BlockAttribute;
TEST_P(StructAttributeTest, IsValid) { TEST_P(StructAttributeTest, IsValid) {
auto& params = GetParam(); auto& params = GetParam();

View File

@ -12,8 +12,9 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include "src/tint/transform/add_spirv_block_attribute.h" #include "src/tint/transform/add_block_attribute.h"
#include <unordered_set>
#include <utility> #include <utility>
#include "src/tint/program_builder.h" #include "src/tint/program_builder.h"
@ -21,16 +22,29 @@
#include "src/tint/utils/hashmap.h" #include "src/tint/utils/hashmap.h"
#include "src/tint/utils/hashset.h" #include "src/tint/utils/hashset.h"
TINT_INSTANTIATE_TYPEINFO(tint::transform::AddSpirvBlockAttribute); TINT_INSTANTIATE_TYPEINFO(tint::transform::AddBlockAttribute);
TINT_INSTANTIATE_TYPEINFO(tint::transform::AddSpirvBlockAttribute::SpirvBlockAttribute); TINT_INSTANTIATE_TYPEINFO(tint::transform::AddBlockAttribute::BlockAttribute);
namespace tint::transform { namespace tint::transform {
AddSpirvBlockAttribute::AddSpirvBlockAttribute() = default; namespace {
AddSpirvBlockAttribute::~AddSpirvBlockAttribute() = default; bool IsUsedAsNonBuffer(const std::unordered_set<tint::ast::StorageClass>& uses) {
for (auto use : uses) {
if (!ast::IsHostShareable(use)) {
return true;
}
}
return false;
}
void AddSpirvBlockAttribute::Run(CloneContext& ctx, const DataMap&, DataMap&) const { } // namespace
AddBlockAttribute::AddBlockAttribute() = default;
AddBlockAttribute::~AddBlockAttribute() = default;
void AddBlockAttribute::Run(CloneContext& ctx, const DataMap&, DataMap&) const {
auto& sem = ctx.src->Sem(); auto& sem = ctx.src->Sem();
// Collect the set of structs that are nested in other types. // Collect the set of structs that are nested in other types.
@ -66,8 +80,10 @@ void AddSpirvBlockAttribute::Run(CloneContext& ctx, const DataMap&, DataMap&) co
auto* ty = var->Type()->UnwrapRef(); auto* ty = var->Type()->UnwrapRef();
auto* str = ty->As<sem::Struct>(); auto* str = ty->As<sem::Struct>();
bool needs_wrapping = !str || // Type is not a structure bool needs_wrapping =
nested_structs.Contains(str); // Structure is nested by another type !str || // Type is not a structure
nested_structs.Contains(str) || // Structure is nested by another type
IsUsedAsNonBuffer(str->StorageClassUsage()); // Structure is used as a non-buffer usage
if (needs_wrapping) { if (needs_wrapping) {
const char* kMemberName = "inner"; const char* kMemberName = "inner";
@ -75,8 +91,8 @@ void AddSpirvBlockAttribute::Run(CloneContext& ctx, const DataMap&, DataMap&) co
// This is a non-struct or a struct that is nested somewhere else, so we // This is a non-struct or a struct that is nested somewhere else, so we
// need to wrap it first. // need to wrap it first.
auto* wrapper = wrapper_structs.GetOrCreate(ty, [&] { auto* wrapper = wrapper_structs.GetOrCreate(ty, [&] {
auto* block = ctx.dst->ASTNodes().Create<SpirvBlockAttribute>( auto* block = ctx.dst->ASTNodes().Create<BlockAttribute>(ctx.dst->ID(),
ctx.dst->ID(), ctx.dst->AllocateNodeID()); ctx.dst->AllocateNodeID());
auto wrapper_name = ctx.src->Symbols().NameFor(global->symbol) + "_block"; auto wrapper_name = ctx.src->Symbols().NameFor(global->symbol) + "_block";
auto* ret = ctx.dst->create<ast::Struct>( auto* ret = ctx.dst->create<ast::Struct>(
ctx.dst->Symbols().New(wrapper_name), ctx.dst->Symbols().New(wrapper_name),
@ -95,8 +111,8 @@ void AddSpirvBlockAttribute::Run(CloneContext& ctx, const DataMap&, DataMap&) co
} }
} else { } else {
// Add a block attribute to this struct directly. // Add a block attribute to this struct directly.
auto* block = ctx.dst->ASTNodes().Create<SpirvBlockAttribute>( auto* block = ctx.dst->ASTNodes().Create<BlockAttribute>(ctx.dst->ID(),
ctx.dst->ID(), ctx.dst->AllocateNodeID()); ctx.dst->AllocateNodeID());
ctx.InsertFront(str->Declaration()->attributes, block); ctx.InsertFront(str->Declaration()->attributes, block);
} }
} }
@ -104,16 +120,16 @@ void AddSpirvBlockAttribute::Run(CloneContext& ctx, const DataMap&, DataMap&) co
ctx.Clone(); ctx.Clone();
} }
AddSpirvBlockAttribute::SpirvBlockAttribute::SpirvBlockAttribute(ProgramID pid, ast::NodeID nid) AddBlockAttribute::BlockAttribute::BlockAttribute(ProgramID pid, ast::NodeID nid)
: Base(pid, nid) {} : Base(pid, nid) {}
AddSpirvBlockAttribute::SpirvBlockAttribute::~SpirvBlockAttribute() = default; AddBlockAttribute::BlockAttribute::~BlockAttribute() = default;
std::string AddSpirvBlockAttribute::SpirvBlockAttribute::InternalName() const { std::string AddBlockAttribute::BlockAttribute::InternalName() const {
return "spirv_block"; return "block";
} }
const AddSpirvBlockAttribute::SpirvBlockAttribute* const AddBlockAttribute::BlockAttribute* AddBlockAttribute::BlockAttribute::Clone(
AddSpirvBlockAttribute::SpirvBlockAttribute::Clone(CloneContext* ctx) const { CloneContext* ctx) const {
return ctx->dst->ASTNodes().Create<AddSpirvBlockAttribute::SpirvBlockAttribute>( return ctx->dst->ASTNodes().Create<AddBlockAttribute::BlockAttribute>(
ctx->dst->ID(), ctx->dst->AllocateNodeID()); ctx->dst->ID(), ctx->dst->AllocateNodeID());
} }

View File

@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#ifndef SRC_TINT_TRANSFORM_ADD_SPIRV_BLOCK_ATTRIBUTE_H_ #ifndef SRC_TINT_TRANSFORM_ADD_BLOCK_ATTRIBUTE_H_
#define SRC_TINT_TRANSFORM_ADD_SPIRV_BLOCK_ATTRIBUTE_H_ #define SRC_TINT_TRANSFORM_ADD_BLOCK_ATTRIBUTE_H_
#include <string> #include <string>
@ -22,23 +22,23 @@
namespace tint::transform { namespace tint::transform {
/// AddSpirvBlockAttribute is a transform that adds an /// AddBlockAttribute is a transform that adds an
/// `@internal(spirv_block)` attribute to any structure that is used as the /// `@internal(block)` attribute to any structure that is used as the
/// store type of a buffer. If that structure is nested inside another structure /// store type of a buffer. If that structure is nested inside another structure
/// or an array, then it is wrapped inside another structure which gets the /// or an array, then it is wrapped inside another structure which gets the
/// `@internal(spirv_block)` attribute instead. /// `@internal(block)` attribute instead.
class AddSpirvBlockAttribute final : public Castable<AddSpirvBlockAttribute, Transform> { class AddBlockAttribute final : public Castable<AddBlockAttribute, Transform> {
public: public:
/// SpirvBlockAttribute is an InternalAttribute that is used to decorate a /// BlockAttribute is an InternalAttribute that is used to decorate a
// structure that needs a SPIR-V block attribute. // structure that is used as a buffer in SPIR-V or GLSL.
class SpirvBlockAttribute final : public Castable<SpirvBlockAttribute, ast::InternalAttribute> { class BlockAttribute final : public Castable<BlockAttribute, ast::InternalAttribute> {
public: public:
/// Constructor /// Constructor
/// @param program_id the identifier of the program that owns this node /// @param program_id the identifier of the program that owns this node
/// @param nid the unique node identifier /// @param nid the unique node identifier
SpirvBlockAttribute(ProgramID program_id, ast::NodeID nid); BlockAttribute(ProgramID program_id, ast::NodeID nid);
/// Destructor /// Destructor
~SpirvBlockAttribute() override; ~BlockAttribute() override;
/// @return a short description of the internal attribute which will be /// @return a short description of the internal attribute which will be
/// displayed as `@internal(<name>)` /// displayed as `@internal(<name>)`
@ -47,14 +47,14 @@ class AddSpirvBlockAttribute final : public Castable<AddSpirvBlockAttribute, Tra
/// Performs a deep clone of this object using the CloneContext `ctx`. /// Performs a deep clone of this object using the CloneContext `ctx`.
/// @param ctx the clone context /// @param ctx the clone context
/// @return the newly cloned object /// @return the newly cloned object
const SpirvBlockAttribute* Clone(CloneContext* ctx) const override; const BlockAttribute* Clone(CloneContext* ctx) const override;
}; };
/// Constructor /// Constructor
AddSpirvBlockAttribute(); AddBlockAttribute();
/// Destructor /// Destructor
~AddSpirvBlockAttribute() override; ~AddBlockAttribute() override;
protected: protected:
/// Runs the transform using the CloneContext built for transforming a /// Runs the transform using the CloneContext built for transforming a
@ -68,4 +68,4 @@ class AddSpirvBlockAttribute final : public Castable<AddSpirvBlockAttribute, Tra
} // namespace tint::transform } // namespace tint::transform
#endif // SRC_TINT_TRANSFORM_ADD_SPIRV_BLOCK_ATTRIBUTE_H_ #endif // SRC_TINT_TRANSFORM_ADD_BLOCK_ATTRIBUTE_H_

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include "src/tint/transform/add_spirv_block_attribute.h" #include "src/tint/transform/add_block_attribute.h"
#include <memory> #include <memory>
#include <utility> #include <utility>
@ -22,18 +22,18 @@
namespace tint::transform { namespace tint::transform {
namespace { namespace {
using AddSpirvBlockAttributeTest = TransformTest; using AddBlockAttributeTest = TransformTest;
TEST_F(AddSpirvBlockAttributeTest, EmptyModule) { TEST_F(AddBlockAttributeTest, EmptyModule) {
auto* src = ""; auto* src = "";
auto* expect = ""; auto* expect = "";
auto got = Run<AddSpirvBlockAttribute>(src); auto got = Run<AddBlockAttribute>(src);
EXPECT_EQ(expect, str(got)); EXPECT_EQ(expect, str(got));
} }
TEST_F(AddSpirvBlockAttributeTest, Noop_UsedForPrivateVar) { TEST_F(AddBlockAttributeTest, Noop_UsedForPrivateVar) {
auto* src = R"( auto* src = R"(
struct S { struct S {
f : f32, f : f32,
@ -48,12 +48,12 @@ fn main() {
)"; )";
auto* expect = src; auto* expect = src;
auto got = Run<AddSpirvBlockAttribute>(src); auto got = Run<AddBlockAttribute>(src);
EXPECT_EQ(expect, str(got)); EXPECT_EQ(expect, str(got));
} }
TEST_F(AddSpirvBlockAttributeTest, Noop_UsedForShaderIO) { TEST_F(AddBlockAttributeTest, Noop_UsedForShaderIO) {
auto* src = R"( auto* src = R"(
struct S { struct S {
@location(0) @location(0)
@ -67,12 +67,12 @@ fn main() -> S {
)"; )";
auto* expect = src; auto* expect = src;
auto got = Run<AddSpirvBlockAttribute>(src); auto got = Run<AddBlockAttribute>(src);
EXPECT_EQ(expect, str(got)); EXPECT_EQ(expect, str(got));
} }
TEST_F(AddSpirvBlockAttributeTest, BasicScalar) { TEST_F(AddBlockAttributeTest, BasicScalar) {
auto* src = R"( auto* src = R"(
@group(0) @binding(0) @group(0) @binding(0)
var<uniform> u : f32; var<uniform> u : f32;
@ -83,7 +83,7 @@ fn main() {
} }
)"; )";
auto* expect = R"( auto* expect = R"(
@internal(spirv_block) @internal(block)
struct u_block { struct u_block {
inner : f32, inner : f32,
} }
@ -96,12 +96,12 @@ fn main() {
} }
)"; )";
auto got = Run<AddSpirvBlockAttribute>(src); auto got = Run<AddBlockAttribute>(src);
EXPECT_EQ(expect, str(got)); EXPECT_EQ(expect, str(got));
} }
TEST_F(AddSpirvBlockAttributeTest, BasicArray) { TEST_F(AddBlockAttributeTest, BasicArray) {
auto* src = R"( auto* src = R"(
@group(0) @binding(0) @group(0) @binding(0)
var<uniform> u : array<vec4<f32>, 4u>; var<uniform> u : array<vec4<f32>, 4u>;
@ -112,7 +112,7 @@ fn main() {
} }
)"; )";
auto* expect = R"( auto* expect = R"(
@internal(spirv_block) @internal(block)
struct u_block { struct u_block {
inner : array<vec4<f32>, 4u>, inner : array<vec4<f32>, 4u>,
} }
@ -125,12 +125,12 @@ fn main() {
} }
)"; )";
auto got = Run<AddSpirvBlockAttribute>(src); auto got = Run<AddBlockAttribute>(src);
EXPECT_EQ(expect, str(got)); EXPECT_EQ(expect, str(got));
} }
TEST_F(AddSpirvBlockAttributeTest, BasicArray_Alias) { TEST_F(AddBlockAttributeTest, BasicArray_Alias) {
auto* src = R"( auto* src = R"(
type Numbers = array<vec4<f32>, 4u>; type Numbers = array<vec4<f32>, 4u>;
@ -145,7 +145,7 @@ fn main() {
auto* expect = R"( auto* expect = R"(
type Numbers = array<vec4<f32>, 4u>; type Numbers = array<vec4<f32>, 4u>;
@internal(spirv_block) @internal(block)
struct u_block { struct u_block {
inner : array<vec4<f32>, 4u>, inner : array<vec4<f32>, 4u>,
} }
@ -158,12 +158,12 @@ fn main() {
} }
)"; )";
auto got = Run<AddSpirvBlockAttribute>(src); auto got = Run<AddBlockAttribute>(src);
EXPECT_EQ(expect, str(got)); EXPECT_EQ(expect, str(got));
} }
TEST_F(AddSpirvBlockAttributeTest, BasicStruct_AccessRoot) { TEST_F(AddBlockAttributeTest, BasicStruct_AccessRoot) {
auto* src = R"( auto* src = R"(
struct S { struct S {
f : f32, f : f32,
@ -178,25 +178,29 @@ fn main() {
} }
)"; )";
auto* expect = R"( auto* expect = R"(
@internal(spirv_block)
struct S { struct S {
f : f32, f : f32,
} }
@group(0) @binding(0) var<uniform> u : S; @internal(block)
struct u_block {
inner : S,
}
@group(0) @binding(0) var<uniform> u : u_block;
@fragment @fragment
fn main() { fn main() {
let f = u; let f = u.inner;
} }
)"; )";
auto got = Run<AddSpirvBlockAttribute>(src); auto got = Run<AddBlockAttribute>(src);
EXPECT_EQ(expect, str(got)); EXPECT_EQ(expect, str(got));
} }
TEST_F(AddSpirvBlockAttributeTest, BasicStruct_AccessField) { TEST_F(AddBlockAttributeTest, BasicStruct_AccessField) {
auto* src = R"( auto* src = R"(
struct S { struct S {
f : f32, f : f32,
@ -211,7 +215,7 @@ fn main() {
} }
)"; )";
auto* expect = R"( auto* expect = R"(
@internal(spirv_block) @internal(block)
struct S { struct S {
f : f32, f : f32,
} }
@ -224,12 +228,12 @@ fn main() {
} }
)"; )";
auto got = Run<AddSpirvBlockAttribute>(src); auto got = Run<AddBlockAttribute>(src);
EXPECT_EQ(expect, str(got)); EXPECT_EQ(expect, str(got));
} }
TEST_F(AddSpirvBlockAttributeTest, BasicScalar_PushConstant) { TEST_F(AddBlockAttributeTest, BasicScalar_PushConstant) {
auto* src = R"( auto* src = R"(
enable chromium_experimental_push_constant; enable chromium_experimental_push_constant;
var<push_constant> u : f32; var<push_constant> u : f32;
@ -242,7 +246,7 @@ fn main() {
auto* expect = R"( auto* expect = R"(
enable chromium_experimental_push_constant; enable chromium_experimental_push_constant;
@internal(spirv_block) @internal(block)
struct u_block { struct u_block {
inner : f32, inner : f32,
} }
@ -255,12 +259,12 @@ fn main() {
} }
)"; )";
auto got = Run<AddSpirvBlockAttribute>(src); auto got = Run<AddBlockAttribute>(src);
EXPECT_EQ(expect, str(got)); EXPECT_EQ(expect, str(got));
} }
TEST_F(AddSpirvBlockAttributeTest, BasicStruct_PushConstant) { TEST_F(AddBlockAttributeTest, BasicStruct_PushConstant) {
auto* src = R"( auto* src = R"(
enable chromium_experimental_push_constant; enable chromium_experimental_push_constant;
struct S { struct S {
@ -276,7 +280,7 @@ fn main() {
auto* expect = R"( auto* expect = R"(
enable chromium_experimental_push_constant; enable chromium_experimental_push_constant;
@internal(spirv_block) @internal(block)
struct S { struct S {
f : f32, f : f32,
} }
@ -289,12 +293,12 @@ fn main() {
} }
)"; )";
auto got = Run<AddSpirvBlockAttribute>(src); auto got = Run<AddBlockAttribute>(src);
EXPECT_EQ(expect, str(got)); EXPECT_EQ(expect, str(got));
} }
TEST_F(AddSpirvBlockAttributeTest, Nested_OuterBuffer_InnerNotBuffer) { TEST_F(AddBlockAttributeTest, Nested_OuterBuffer_InnerNotBuffer) {
auto* src = R"( auto* src = R"(
struct Inner { struct Inner {
f : f32, f : f32,
@ -317,7 +321,7 @@ struct Inner {
f : f32, f : f32,
} }
@internal(spirv_block) @internal(block)
struct Outer { struct Outer {
i : Inner, i : Inner,
} }
@ -330,12 +334,12 @@ fn main() {
} }
)"; )";
auto got = Run<AddSpirvBlockAttribute>(src); auto got = Run<AddBlockAttribute>(src);
EXPECT_EQ(expect, str(got)); EXPECT_EQ(expect, str(got));
} }
TEST_F(AddSpirvBlockAttributeTest, Nested_OuterBuffer_InnerBuffer) { TEST_F(AddBlockAttributeTest, Nested_OuterBuffer_InnerBuffer) {
auto* src = R"( auto* src = R"(
struct Inner { struct Inner {
f : f32, f : f32,
@ -362,14 +366,14 @@ struct Inner {
f : f32, f : f32,
} }
@internal(spirv_block) @internal(block)
struct Outer { struct Outer {
i : Inner, i : Inner,
} }
@group(0) @binding(0) var<uniform> u0 : Outer; @group(0) @binding(0) var<uniform> u0 : Outer;
@internal(spirv_block) @internal(block)
struct u1_block { struct u1_block {
inner : Inner, inner : Inner,
} }
@ -383,12 +387,12 @@ fn main() {
} }
)"; )";
auto got = Run<AddSpirvBlockAttribute>(src); auto got = Run<AddBlockAttribute>(src);
EXPECT_EQ(expect, str(got)); EXPECT_EQ(expect, str(got));
} }
TEST_F(AddSpirvBlockAttributeTest, Nested_OuterNotBuffer_InnerBuffer) { TEST_F(AddBlockAttributeTest, Nested_OuterNotBuffer_InnerBuffer) {
auto* src = R"( auto* src = R"(
struct Inner { struct Inner {
f : f32, f : f32,
@ -420,7 +424,7 @@ struct Outer {
var<private> p : Outer; var<private> p : Outer;
@internal(spirv_block) @internal(block)
struct u_block { struct u_block {
inner : Inner, inner : Inner,
} }
@ -434,12 +438,12 @@ fn main() {
} }
)"; )";
auto got = Run<AddSpirvBlockAttribute>(src); auto got = Run<AddBlockAttribute>(src);
EXPECT_EQ(expect, str(got)); EXPECT_EQ(expect, str(got));
} }
TEST_F(AddSpirvBlockAttributeTest, Nested_InnerUsedForMultipleBuffers) { TEST_F(AddBlockAttributeTest, Nested_InnerUsedForMultipleBuffers) {
auto* src = R"( auto* src = R"(
struct Inner { struct Inner {
f : f32, f : f32,
@ -470,14 +474,14 @@ struct Inner {
f : f32, f : f32,
} }
@internal(spirv_block) @internal(block)
struct S { struct S {
i : Inner, i : Inner,
} }
@group(0) @binding(0) var<uniform> u0 : S; @group(0) @binding(0) var<uniform> u0 : S;
@internal(spirv_block) @internal(block)
struct u1_block { struct u1_block {
inner : Inner, inner : Inner,
} }
@ -494,12 +498,12 @@ fn main() {
} }
)"; )";
auto got = Run<AddSpirvBlockAttribute>(src); auto got = Run<AddBlockAttribute>(src);
EXPECT_EQ(expect, str(got)); EXPECT_EQ(expect, str(got));
} }
TEST_F(AddSpirvBlockAttributeTest, StructInArray) { TEST_F(AddBlockAttributeTest, StructInArray) {
auto* src = R"( auto* src = R"(
struct S { struct S {
f : f32, f : f32,
@ -519,7 +523,7 @@ struct S {
f : f32, f : f32,
} }
@internal(spirv_block) @internal(block)
struct u_block { struct u_block {
inner : S, inner : S,
} }
@ -533,12 +537,12 @@ fn main() {
} }
)"; )";
auto got = Run<AddSpirvBlockAttribute>(src); auto got = Run<AddBlockAttribute>(src);
EXPECT_EQ(expect, str(got)); EXPECT_EQ(expect, str(got));
} }
TEST_F(AddSpirvBlockAttributeTest, StructInArray_MultipleBuffers) { TEST_F(AddBlockAttributeTest, StructInArray_MultipleBuffers) {
auto* src = R"( auto* src = R"(
struct S { struct S {
f : f32, f : f32,
@ -562,7 +566,7 @@ struct S {
f : f32, f : f32,
} }
@internal(spirv_block) @internal(block)
struct u0_block { struct u0_block {
inner : S, inner : S,
} }
@ -579,12 +583,12 @@ fn main() {
} }
)"; )";
auto got = Run<AddSpirvBlockAttribute>(src); auto got = Run<AddBlockAttribute>(src);
EXPECT_EQ(expect, str(got)); EXPECT_EQ(expect, str(got));
} }
TEST_F(AddSpirvBlockAttributeTest, Aliases_Nested_OuterBuffer_InnerBuffer) { TEST_F(AddBlockAttributeTest, Aliases_Nested_OuterBuffer_InnerBuffer) {
auto* src = R"( auto* src = R"(
struct Inner { struct Inner {
f : f32, f : f32,
@ -617,7 +621,7 @@ struct Inner {
type MyInner = Inner; type MyInner = Inner;
@internal(spirv_block) @internal(block)
struct Outer { struct Outer {
i : MyInner, i : MyInner,
} }
@ -626,7 +630,7 @@ type MyOuter = Outer;
@group(0) @binding(0) var<uniform> u0 : MyOuter; @group(0) @binding(0) var<uniform> u0 : MyOuter;
@internal(spirv_block) @internal(block)
struct u1_block { struct u1_block {
inner : Inner, inner : Inner,
} }
@ -640,12 +644,12 @@ fn main() {
} }
)"; )";
auto got = Run<AddSpirvBlockAttribute>(src); auto got = Run<AddBlockAttribute>(src);
EXPECT_EQ(expect, str(got)); EXPECT_EQ(expect, str(got));
} }
TEST_F(AddSpirvBlockAttributeTest, Aliases_Nested_OuterBuffer_InnerBuffer_OutOfOrder) { TEST_F(AddBlockAttributeTest, Aliases_Nested_OuterBuffer_InnerBuffer_OutOfOrder) {
auto* src = R"( auto* src = R"(
@fragment @fragment
fn main() { fn main() {
@ -678,7 +682,7 @@ fn main() {
let f1 = u1.inner.f; let f1 = u1.inner.f;
} }
@internal(spirv_block) @internal(block)
struct u1_block { struct u1_block {
inner : Inner, inner : Inner,
} }
@ -691,7 +695,7 @@ type MyInner = Inner;
type MyOuter = Outer; type MyOuter = Outer;
@internal(spirv_block) @internal(block)
struct Outer { struct Outer {
i : MyInner, i : MyInner,
} }
@ -701,7 +705,147 @@ struct Inner {
} }
)"; )";
auto got = Run<AddSpirvBlockAttribute>(src); auto got = Run<AddBlockAttribute>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(AddBlockAttributeTest, UniformAndPrivateUsages) {
auto* src = R"(
struct S {
f : f32,
}
@group(0) @binding(0) var<uniform> u : S;
var<private> p : S;
@fragment
fn main() {
p = u;
}
)";
auto* expect = R"(
struct S {
f : f32,
}
@internal(block)
struct u_block {
inner : S,
}
@group(0) @binding(0) var<uniform> u : u_block;
var<private> p : S;
@fragment
fn main() {
p = u.inner;
}
)";
auto got = Run<AddBlockAttribute>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(AddBlockAttributeTest, StorageAndPrivateUsages) {
auto* src = R"(
struct S {
f : f32,
}
@group(0) @binding(0) var<storage, read_write> s : S;
var<private> p : S;
@fragment
fn main() {
p = s;
p.f = 1234.0;
s = p;
}
)";
auto* expect = R"(
struct S {
f : f32,
}
@internal(block)
struct s_block {
inner : S,
}
@group(0) @binding(0) var<storage, read_write> s : s_block;
var<private> p : S;
@fragment
fn main() {
p = s.inner;
p.f = 1234.0;
s.inner = p;
}
)";
auto got = Run<AddBlockAttribute>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(AddBlockAttributeTest, StorageAndUniformUsages) {
auto* src = R"(
struct S {
f : f32,
}
@group(0) @binding(0) var<uniform> u : S;
@group(0) @binding(1) var<storage, read_write> s : S;
@fragment
fn main() {
s = u;
}
)";
auto* expect = R"(
@internal(block) @internal(block)
struct S {
f : f32,
}
@group(0) @binding(0) var<uniform> u : S;
@group(0) @binding(1) var<storage, read_write> s : S;
@fragment
fn main() {
s = u;
}
)";
auto got = Run<AddBlockAttribute>(src);
EXPECT_EQ(expect, str(got));
}
TEST_F(AddBlockAttributeTest, PrivateUsageOnly) {
auto* src = R"(
struct S {
f : f32,
}
var<private> p : S;
@fragment
fn main() {
p.f = 4321.0f;
}
)";
auto* expect = src;
auto got = Run<AddBlockAttribute>(src);
EXPECT_EQ(expect, str(got)); EXPECT_EQ(expect, str(got));
} }

View File

@ -46,8 +46,8 @@
#include "src/tint/sem/type_constructor.h" #include "src/tint/sem/type_constructor.h"
#include "src/tint/sem/type_conversion.h" #include "src/tint/sem/type_conversion.h"
#include "src/tint/sem/variable.h" #include "src/tint/sem/variable.h"
#include "src/tint/transform/add_block_attribute.h"
#include "src/tint/transform/add_empty_entry_point.h" #include "src/tint/transform/add_empty_entry_point.h"
#include "src/tint/transform/add_spirv_block_attribute.h"
#include "src/tint/transform/binding_remapper.h" #include "src/tint/transform/binding_remapper.h"
#include "src/tint/transform/builtin_polyfill.h" #include "src/tint/transform/builtin_polyfill.h"
#include "src/tint/transform/canonicalize_entry_point_io.h" #include "src/tint/transform/canonicalize_entry_point_io.h"
@ -244,7 +244,7 @@ SanitizedResult Sanitize(const Program* in,
manager.Add<transform::PromoteInitializersToLet>(); manager.Add<transform::PromoteInitializersToLet>();
manager.Add<transform::AddEmptyEntryPoint>(); manager.Add<transform::AddEmptyEntryPoint>();
manager.Add<transform::AddSpirvBlockAttribute>(); manager.Add<transform::AddBlockAttribute>();
data.Add<transform::CanonicalizeEntryPointIO::Config>( data.Add<transform::CanonicalizeEntryPointIO::Config>(
transform::CanonicalizeEntryPointIO::ShaderStyle::kGlsl); transform::CanonicalizeEntryPointIO::ShaderStyle::kGlsl);
@ -284,18 +284,15 @@ bool GeneratorImpl::Generate() {
return false; return false;
} }
} else if (auto* str = decl->As<ast::Struct>()) { } else if (auto* str = decl->As<ast::Struct>()) {
// Skip emission if the struct contains a runtime-sized array, since its auto* sem = builder_.Sem().Get(str);
// only use will be as the store-type of a buffer and we emit those bool has_rt_arr = false;
// elsewhere. if (auto* arr = sem->Members().back()->Type()->As<sem::Array>()) {
// TODO(crbug.com/tint/1339): We could also avoid emitting any other has_rt_arr = arr->IsRuntimeSized();
// struct that is only used as a buffer store type. }
const sem::Struct* sem_str = builder_.Sem().Get(str); bool is_block =
const auto& members = sem_str->Members(); ast::HasAttribute<transform::AddBlockAttribute::BlockAttribute>(str->attributes);
TINT_ASSERT(Writer, members.size() > 0); if (!has_rt_arr && !is_block) {
auto* last_member = members[members.size() - 1]; if (!EmitStructType(current_buffer_, sem)) {
auto* arr = last_member->Type()->As<sem::Array>();
if (!arr || !arr->IsRuntimeSized()) {
if (!EmitStructType(current_buffer_, sem_str)) {
return false; return false;
} }
} }
@ -1915,7 +1912,7 @@ bool GeneratorImpl::EmitUniformVariable(const ast::Var* var, const sem::Variable
if (version_.IsDesktop()) { if (version_.IsDesktop()) {
out << ", std140"; out << ", std140";
} }
out << ") uniform " << UniqueIdentifier(StructName(str)) << " {"; out << ") uniform " << UniqueIdentifier(StructName(str) + "_ubo") << " {";
} }
EmitStructMembers(current_buffer_, str, /* emit_offsets */ true); EmitStructMembers(current_buffer_, str, /* emit_offsets */ true);
auto name = builder_.Symbols().NameFor(var->symbol); auto name = builder_.Symbols().NameFor(var->symbol);
@ -1934,10 +1931,12 @@ bool GeneratorImpl::EmitStorageVariable(const ast::Var* var, const sem::Variable
} }
auto bp = sem->As<sem::GlobalVariable>()->BindingPoint(); auto bp = sem->As<sem::GlobalVariable>()->BindingPoint();
line() << "layout(binding = " << bp.binding << ", std430) buffer " line() << "layout(binding = " << bp.binding << ", std430) buffer "
<< UniqueIdentifier(StructName(str)) << " {"; << UniqueIdentifier(StructName(str) + "_ssbo") << " {";
EmitStructMembers(current_buffer_, str, /* emit_offsets */ true); EmitStructMembers(current_buffer_, str, /* emit_offsets */ true);
auto name = builder_.Symbols().NameFor(var->symbol); auto name = builder_.Symbols().NameFor(var->symbol);
line() << "} " << name << ";"; line() << "} " << name << ";";
line();
return true; return true;
} }

View File

@ -384,7 +384,7 @@ struct UBO {
vec4 coord; vec4 coord;
}; };
layout(binding = 0) uniform UBO_1 { layout(binding = 0) uniform UBO_ubo {
vec4 coord; vec4 coord;
} ubo; } ubo;
@ -425,7 +425,7 @@ struct Uniforms {
vec4 coord; vec4 coord;
}; };
layout(binding = 0) uniform Uniforms_1 { layout(binding = 0) uniform Uniforms_ubo {
vec4 coord; vec4 coord;
} uniforms; } uniforms;
@ -462,15 +462,11 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_RW_Storage
EXPECT_EQ(gen.result(), R"(#version 310 es EXPECT_EQ(gen.result(), R"(#version 310 es
precision mediump float; precision mediump float;
struct Data { layout(binding = 0, std430) buffer Data_ssbo {
int a;
float b;
};
layout(binding = 0, std430) buffer Data_1 {
int a; int a;
float b; float b;
} coord; } coord;
void frag_main() { void frag_main() {
float v = coord.b; float v = coord.b;
return; return;
@ -510,15 +506,11 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_RO_Storage
R"(#version 310 es R"(#version 310 es
precision mediump float; precision mediump float;
struct Data { layout(binding = 0, std430) buffer Data_ssbo {
int a;
float b;
};
layout(binding = 0, std430) buffer Data_1 {
int a; int a;
float b; float b;
} coord; } coord;
void frag_main() { void frag_main() {
float v = coord.b; float v = coord.b;
return; return;
@ -555,15 +547,11 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_WO_Storage
EXPECT_EQ(gen.result(), R"(#version 310 es EXPECT_EQ(gen.result(), R"(#version 310 es
precision mediump float; precision mediump float;
struct Data { layout(binding = 0, std430) buffer Data_ssbo {
int a;
float b;
};
layout(binding = 0, std430) buffer Data_1 {
int a; int a;
float b; float b;
} coord; } coord;
void frag_main() { void frag_main() {
coord.b = 2.0f; coord.b = 2.0f;
return; return;
@ -600,15 +588,11 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_EntryPoint_With_StorageBuf
EXPECT_EQ(gen.result(), R"(#version 310 es EXPECT_EQ(gen.result(), R"(#version 310 es
precision mediump float; precision mediump float;
struct Data { layout(binding = 0, std430) buffer Data_ssbo {
int a;
float b;
};
layout(binding = 0, std430) buffer Data_1 {
int a; int a;
float b; float b;
} coord; } coord;
void frag_main() { void frag_main() {
coord.b = 2.0f; coord.b = 2.0f;
return; return;
@ -651,7 +635,7 @@ struct S {
float x; float x;
}; };
layout(binding = 0) uniform S_1 { layout(binding = 0) uniform S_ubo {
float x; float x;
} coord; } coord;
@ -694,13 +678,10 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Attribute_Called_By_EntryPoint_With_
R"(#version 310 es R"(#version 310 es
precision mediump float; precision mediump float;
struct S { layout(binding = 0, std430) buffer S_ssbo {
float x;
};
layout(binding = 0, std430) buffer S_1 {
float x; float x;
} coord; } coord;
float sub_func(float param) { float sub_func(float param) {
return coord.x; return coord.x;
} }
@ -930,13 +911,10 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Multiple_EntryPoint_With_Same_Module
ASSERT_TRUE(gen.Generate()) << gen.error(); ASSERT_TRUE(gen.Generate()) << gen.error();
EXPECT_EQ(gen.result(), R"(#version 310 es EXPECT_EQ(gen.result(), R"(#version 310 es
struct Data { layout(binding = 0, std430) buffer Data_ssbo {
float d;
};
layout(binding = 0, std430) buffer Data_1 {
float d; float d;
} data; } data;
void a() { void a() {
float v = data.d; float v = data.d;
return; return;

View File

@ -277,15 +277,11 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, StorageBuffer_Store_Matrix_Empty) {
R"(#version 310 es R"(#version 310 es
precision mediump float; precision mediump float;
struct Data { layout(binding = 0, std430) buffer Data_ssbo {
int a;
mat2x3 b;
};
layout(binding = 0, std430) buffer Data_1 {
int a; int a;
mat2x3 b; mat2x3 b;
} data; } data;
void tint_symbol() { void tint_symbol() {
data.b = mat2x3(vec3(0.0f), vec3(0.0f)); data.b = mat2x3(vec3(0.0f), vec3(0.0f));
} }
@ -322,15 +318,11 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, StorageBuffer_Load_Matrix_Single_El
R"(#version 310 es R"(#version 310 es
precision mediump float; precision mediump float;
struct Data { layout(binding = 0, std430) buffer Data_ssbo {
float z;
mat4x3 a;
};
layout(binding = 0, std430) buffer Data_1 {
float z; float z;
mat4x3 a; mat4x3 a;
} data; } data;
void tint_symbol() { void tint_symbol() {
float x = data.a[2][1]; float x = data.a[2][1];
} }
@ -367,15 +359,11 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor,
R"(#version 310 es R"(#version 310 es
precision mediump float; precision mediump float;
struct Data { layout(binding = 0, std430) buffer Data_ssbo {
float z;
int a[5];
};
layout(binding = 0, std430) buffer Data_1 {
float z; float z;
int a[5]; int a[5];
} data; } data;
void tint_symbol() { void tint_symbol() {
int x = data.a[2]; int x = data.a[2];
} }
@ -415,15 +403,11 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor,
R"(#version 310 es R"(#version 310 es
precision mediump float; precision mediump float;
struct Data { layout(binding = 0, std430) buffer Data_ssbo {
float z;
int a[5];
};
layout(binding = 0, std430) buffer Data_1 {
float z; float z;
int a[5]; int a[5];
} data; } data;
void tint_symbol() { void tint_symbol() {
int a = 2; int a = 2;
int b = 4; int b = 4;
@ -462,15 +446,11 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, StorageBuffer_Store_ToArray) {
R"(#version 310 es R"(#version 310 es
precision mediump float; precision mediump float;
struct Data { layout(binding = 0, std430) buffer Data_ssbo {
float z;
int a[5];
};
layout(binding = 0, std430) buffer Data_1 {
float z; float z;
int a[5]; int a[5];
} data; } data;
void tint_symbol() { void tint_symbol() {
data.a[2] = 2; data.a[2] = 2;
} }
@ -520,13 +500,10 @@ struct Inner {
vec3 b; vec3 b;
}; };
struct Data { layout(binding = 0, std430) buffer Data_ssbo {
Inner c[4];
};
layout(binding = 0, std430) buffer Data_1 {
Inner c[4]; Inner c[4];
} data; } data;
void tint_symbol() { void tint_symbol() {
vec3 x = data.c[2].b; vec3 x = data.c[2].b;
} }
@ -578,13 +555,10 @@ struct Inner {
vec3 b; vec3 b;
}; };
struct Data { layout(binding = 0, std430) buffer Data_ssbo {
Inner c[4];
};
layout(binding = 0, std430) buffer Data_1 {
Inner c[4]; Inner c[4];
} data; } data;
void tint_symbol() { void tint_symbol() {
vec2 x = data.c[2].b.xy; vec2 x = data.c[2].b.xy;
} }
@ -637,13 +611,10 @@ struct Inner {
vec3 b; vec3 b;
}; };
struct Data { layout(binding = 0, std430) buffer Data_ssbo {
Inner c[4];
};
layout(binding = 0, std430) buffer Data_1 {
Inner c[4]; Inner c[4];
} data; } data;
void tint_symbol() { void tint_symbol() {
float x = data.c[2].b.g; float x = data.c[2].b.g;
} }
@ -695,13 +666,10 @@ struct Inner {
vec3 b; vec3 b;
}; };
struct Data { layout(binding = 0, std430) buffer Data_ssbo {
Inner c[4];
};
layout(binding = 0, std430) buffer Data_1 {
Inner c[4]; Inner c[4];
} data; } data;
void tint_symbol() { void tint_symbol() {
float x = data.c[2].b[1]; float x = data.c[2].b[1];
} }
@ -752,13 +720,10 @@ struct Inner {
vec3 b; vec3 b;
}; };
struct Data { layout(binding = 0, std430) buffer Data_ssbo {
Inner c[4];
};
layout(binding = 0, std430) buffer Data_1 {
Inner c[4]; Inner c[4];
} data; } data;
void tint_symbol() { void tint_symbol() {
data.c[2].b = vec3(1.0f, 2.0f, 3.0f); data.c[2].b = vec3(1.0f, 2.0f, 3.0f);
} }
@ -810,13 +775,10 @@ struct Inner {
vec3 b; vec3 b;
}; };
struct Data { layout(binding = 0, std430) buffer Data_ssbo {
Inner c[4];
};
layout(binding = 0, std430) buffer Data_1 {
Inner c[4]; Inner c[4];
} data; } data;
void tint_symbol() { void tint_symbol() {
data.c[2].b.y = 1.0f; data.c[2].b.y = 1.0f;
} }

View File

@ -45,9 +45,10 @@ TEST_F(GlslSanitizerTest, Call_ArrayLength) {
auto* expect = R"(#version 310 es auto* expect = R"(#version 310 es
precision mediump float; precision mediump float;
layout(binding = 1, std430) buffer my_struct_1 { layout(binding = 1, std430) buffer my_struct_ssbo {
float a[]; float a[];
} b; } b;
void a_func() { void a_func() {
uint len = uint(b.a.length()); uint len = uint(b.a.length());
} }
@ -84,10 +85,11 @@ TEST_F(GlslSanitizerTest, Call_ArrayLength_OtherMembersInStruct) {
auto* expect = R"(#version 310 es auto* expect = R"(#version 310 es
precision mediump float; precision mediump float;
layout(binding = 1, std430) buffer my_struct_1 { layout(binding = 1, std430) buffer my_struct_ssbo {
float z; float z;
float a[]; float a[];
} b; } b;
void a_func() { void a_func() {
uint len = uint(b.a.length()); uint len = uint(b.a.length());
} }
@ -127,9 +129,10 @@ TEST_F(GlslSanitizerTest, Call_ArrayLength_ViaLets) {
auto* expect = R"(#version 310 es auto* expect = R"(#version 310 es
precision mediump float; precision mediump float;
layout(binding = 1, std430) buffer my_struct_1 { layout(binding = 1, std430) buffer my_struct_ssbo {
float a[]; float a[];
} b; } b;
void a_func() { void a_func() {
uint len = uint(b.a.length()); uint len = uint(b.a.length());
} }

View File

@ -57,11 +57,12 @@ struct Nephews {
float louie; float louie;
}; };
layout(binding = 0, std430) buffer Nephews_1 { layout(binding = 0, std430) buffer Nephews_ssbo {
float huey; float huey;
float dewey; float dewey;
float louie; float louie;
} nephews; } nephews;
)"); )");
} }
@ -79,11 +80,12 @@ struct Nephews {
float louie; float louie;
}; };
layout(binding = 0, std430) buffer Nephews_1 { layout(binding = 0, std430) buffer Nephews_ssbo {
float huey; float huey;
layout(offset=256) float dewey; layout(offset=256) float dewey;
layout(offset=512) float louie; layout(offset=512) float louie;
} nephews; } nephews;
)"); )");
} }

View File

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

View File

@ -43,7 +43,7 @@
#include "src/tint/sem/type_conversion.h" #include "src/tint/sem/type_conversion.h"
#include "src/tint/sem/variable.h" #include "src/tint/sem/variable.h"
#include "src/tint/sem/vector.h" #include "src/tint/sem/vector.h"
#include "src/tint/transform/add_spirv_block_attribute.h" #include "src/tint/transform/add_block_attribute.h"
#include "src/tint/utils/defer.h" #include "src/tint/utils/defer.h"
#include "src/tint/utils/map.h" #include "src/tint/utils/map.h"
#include "src/tint/writer/append_vector.h" #include "src/tint/writer/append_vector.h"
@ -4059,8 +4059,7 @@ bool Builder::GenerateStructType(const sem::Struct* struct_type, const Operand&
ops.push_back(result); ops.push_back(result);
auto* decl = struct_type->Declaration(); auto* decl = struct_type->Declaration();
if (decl && ast::HasAttribute<transform::AddSpirvBlockAttribute::SpirvBlockAttribute>( if (decl && ast::HasAttribute<transform::AddBlockAttribute::BlockAttribute>(decl->attributes)) {
decl->attributes)) {
push_annot(spv::Op::OpDecorate, {Operand(struct_id), U32Operand(SpvDecorationBlock)}); push_annot(spv::Op::OpDecorate, {Operand(struct_id), U32Operand(SpvDecorationBlock)});
} }

View File

@ -17,8 +17,8 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "src/tint/transform/add_block_attribute.h"
#include "src/tint/transform/add_empty_entry_point.h" #include "src/tint/transform/add_empty_entry_point.h"
#include "src/tint/transform/add_spirv_block_attribute.h"
#include "src/tint/transform/builtin_polyfill.h" #include "src/tint/transform/builtin_polyfill.h"
#include "src/tint/transform/canonicalize_entry_point_io.h" #include "src/tint/transform/canonicalize_entry_point_io.h"
#include "src/tint/transform/disable_uniformity_analysis.h" #include "src/tint/transform/disable_uniformity_analysis.h"
@ -86,7 +86,7 @@ SanitizedResult Sanitize(const Program* in, const Options& options) {
manager.Add<transform::WhileToLoop>(); // ZeroInitWorkgroupMemory manager.Add<transform::WhileToLoop>(); // ZeroInitWorkgroupMemory
manager.Add<transform::CanonicalizeEntryPointIO>(); manager.Add<transform::CanonicalizeEntryPointIO>();
manager.Add<transform::AddEmptyEntryPoint>(); manager.Add<transform::AddEmptyEntryPoint>();
manager.Add<transform::AddSpirvBlockAttribute>(); manager.Add<transform::AddBlockAttribute>();
manager.Add<transform::VarForDynamicIndex>(); manager.Add<transform::VarForDynamicIndex>();
data.Add<transform::CanonicalizeEntryPointIO::Config>( data.Add<transform::CanonicalizeEntryPointIO::Config>(

View File

@ -10,13 +10,14 @@ 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)); 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]; shared ivec4 src_workgroup[4];
layout(binding = 0) uniform S_1 { layout(binding = 0) uniform src_uniform_block_ubo {
ivec4 arr[4]; S inner;
} src_uniform; } src_uniform;
layout(binding = 1, std430) buffer S_2 { layout(binding = 1, std430) buffer src_uniform_block_ssbo {
ivec4 arr[4]; S inner;
} src_storage; } src_storage;
ivec4[4] ret_arr() { ivec4[4] ret_arr() {
ivec4 tint_symbol_1[4] = ivec4[4](ivec4(0), ivec4(0), ivec4(0), ivec4(0)); ivec4 tint_symbol_1[4] = ivec4[4](ivec4(0), ivec4(0), ivec4(0), ivec4(0));
return tint_symbol_1; return tint_symbol_1;
@ -41,8 +42,8 @@ void foo(ivec4 src_param[4]) {
dst = src_workgroup; dst = src_workgroup;
S tint_symbol = ret_struct_arr(); S tint_symbol = ret_struct_arr();
dst = tint_symbol.arr; dst = tint_symbol.arr;
dst = src_uniform.arr; dst = src_uniform.inner.arr;
dst = src_storage.arr; dst = src_storage.inner.arr;
int dst_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0))); int dst_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)));
int src_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0))); int src_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)));
dst_nested = src_nested; dst_nested = src_nested;

View File

@ -1,7 +1,7 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 64 ; Bound: 65
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -9,6 +9,8 @@
OpExecutionMode %unused_entry_point LocalSize 1 1 1 OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %src_private "src_private" OpName %src_private "src_private"
OpName %src_workgroup "src_workgroup" OpName %src_workgroup "src_workgroup"
OpName %src_uniform_block "src_uniform_block"
OpMemberName %src_uniform_block 0 "inner"
OpName %S "S" OpName %S "S"
OpMemberName %S 0 "arr" OpMemberName %S 0 "arr"
OpName %src_uniform "src_uniform" OpName %src_uniform "src_uniform"
@ -23,7 +25,8 @@
OpName %dst_nested "dst_nested" OpName %dst_nested "dst_nested"
OpName %src_nested "src_nested" OpName %src_nested "src_nested"
OpDecorate %_arr_v4int_uint_4 ArrayStride 16 OpDecorate %_arr_v4int_uint_4 ArrayStride 16
OpDecorate %S Block OpDecorate %src_uniform_block Block
OpMemberDecorate %src_uniform_block 0 Offset 0
OpMemberDecorate %S 0 Offset 0 OpMemberDecorate %S 0 Offset 0
OpDecorate %src_uniform NonWritable OpDecorate %src_uniform NonWritable
OpDecorate %src_uniform DescriptorSet 0 OpDecorate %src_uniform DescriptorSet 0
@ -44,24 +47,25 @@
%_ptr_Workgroup__arr_v4int_uint_4 = OpTypePointer Workgroup %_arr_v4int_uint_4 %_ptr_Workgroup__arr_v4int_uint_4 = OpTypePointer Workgroup %_arr_v4int_uint_4
%src_workgroup = OpVariable %_ptr_Workgroup__arr_v4int_uint_4 Workgroup %src_workgroup = OpVariable %_ptr_Workgroup__arr_v4int_uint_4 Workgroup
%S = OpTypeStruct %_arr_v4int_uint_4 %S = OpTypeStruct %_arr_v4int_uint_4
%_ptr_Uniform_S = OpTypePointer Uniform %S %src_uniform_block = OpTypeStruct %S
%src_uniform = OpVariable %_ptr_Uniform_S Uniform %_ptr_Uniform_src_uniform_block = OpTypePointer Uniform %src_uniform_block
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S %src_uniform = OpVariable %_ptr_Uniform_src_uniform_block Uniform
%src_storage = OpVariable %_ptr_StorageBuffer_S StorageBuffer %_ptr_StorageBuffer_src_uniform_block = OpTypePointer StorageBuffer %src_uniform_block
%src_storage = OpVariable %_ptr_StorageBuffer_src_uniform_block StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%16 = OpTypeFunction %void %17 = OpTypeFunction %void
%20 = OpTypeFunction %_arr_v4int_uint_4 %21 = OpTypeFunction %_arr_v4int_uint_4
%23 = OpTypeFunction %S %24 = OpTypeFunction %S
%26 = OpConstantNull %S %27 = OpConstantNull %S
%27 = OpTypeFunction %void %_arr_v4int_uint_4 %28 = OpTypeFunction %void %_arr_v4int_uint_4
%_ptr_Function__arr_v4int_uint_4 = OpTypePointer Function %_arr_v4int_uint_4 %_ptr_Function__arr_v4int_uint_4 = OpTypePointer Function %_arr_v4int_uint_4
%int_1 = OpConstant %int 1 %int_1 = OpConstant %int 1
%35 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 %36 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1
%int_2 = OpConstant %int 2 %int_2 = OpConstant %int 2
%37 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 %38 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%39 = OpConstantComposite %v4int %int_3 %int_3 %int_3 %int_3 %40 = OpConstantComposite %v4int %int_3 %int_3 %int_3 %int_3
%40 = OpConstantComposite %_arr_v4int_uint_4 %35 %37 %39 %39 %41 = OpConstantComposite %_arr_v4int_uint_4 %36 %38 %40 %40
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform__arr_v4int_uint_4 = OpTypePointer Uniform %_arr_v4int_uint_4 %_ptr_Uniform__arr_v4int_uint_4 = OpTypePointer Uniform %_arr_v4int_uint_4
%_ptr_StorageBuffer__arr_v4int_uint_4 = OpTypePointer StorageBuffer %_arr_v4int_uint_4 %_ptr_StorageBuffer__arr_v4int_uint_4 = OpTypePointer StorageBuffer %_arr_v4int_uint_4
@ -71,47 +75,47 @@
%_arr__arr_int_uint_2_uint_3 = OpTypeArray %_arr_int_uint_2 %uint_3 %_arr__arr_int_uint_2_uint_3 = OpTypeArray %_arr_int_uint_2 %uint_3
%_arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypeArray %_arr__arr_int_uint_2_uint_3 %uint_4 %_arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypeArray %_arr__arr_int_uint_2_uint_3 %uint_4
%_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer Function %_arr__arr__arr_int_uint_2_uint_3_uint_4 %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer Function %_arr__arr__arr_int_uint_2_uint_3_uint_4
%61 = OpConstantNull %_arr__arr__arr_int_uint_2_uint_3_uint_4 %62 = OpConstantNull %_arr__arr__arr_int_uint_2_uint_3_uint_4
%unused_entry_point = OpFunction %void None %16 %unused_entry_point = OpFunction %void None %17
%19 = OpLabel %20 = OpLabel
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%ret_arr = OpFunction %_arr_v4int_uint_4 None %20 %ret_arr = OpFunction %_arr_v4int_uint_4 None %21
%22 = OpLabel %23 = OpLabel
OpReturnValue %8 OpReturnValue %8
OpFunctionEnd OpFunctionEnd
%ret_struct_arr = OpFunction %S None %23 %ret_struct_arr = OpFunction %S None %24
%25 = OpLabel %26 = OpLabel
OpReturnValue %26 OpReturnValue %27
OpFunctionEnd OpFunctionEnd
%foo = OpFunction %void None %27 %foo = OpFunction %void None %28
%src_param = OpFunctionParameter %_arr_v4int_uint_4 %src_param = OpFunctionParameter %_arr_v4int_uint_4
%30 = OpLabel %31 = OpLabel
%src_function = OpVariable %_ptr_Function__arr_v4int_uint_4 Function %8 %src_function = OpVariable %_ptr_Function__arr_v4int_uint_4 Function %8
%dst = OpVariable %_ptr_Function__arr_v4int_uint_4 Function %8 %dst = OpVariable %_ptr_Function__arr_v4int_uint_4 Function %8
%dst_nested = OpVariable %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 Function %61 %dst_nested = OpVariable %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 Function %62
%src_nested = OpVariable %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 Function %61 %src_nested = OpVariable %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 Function %62
OpStore %dst %40
OpStore %dst %src_param
%41 = OpFunctionCall %_arr_v4int_uint_4 %ret_arr
OpStore %dst %41 OpStore %dst %41
OpStore %dst %8 OpStore %dst %src_param
%42 = OpLoad %_arr_v4int_uint_4 %src_function %42 = OpFunctionCall %_arr_v4int_uint_4 %ret_arr
OpStore %dst %42 OpStore %dst %42
%43 = OpLoad %_arr_v4int_uint_4 %src_private OpStore %dst %8
%43 = OpLoad %_arr_v4int_uint_4 %src_function
OpStore %dst %43 OpStore %dst %43
%44 = OpLoad %_arr_v4int_uint_4 %src_workgroup %44 = OpLoad %_arr_v4int_uint_4 %src_private
OpStore %dst %44 OpStore %dst %44
%45 = OpFunctionCall %S %ret_struct_arr %45 = OpLoad %_arr_v4int_uint_4 %src_workgroup
%46 = OpCompositeExtract %_arr_v4int_uint_4 %45 0 OpStore %dst %45
OpStore %dst %46 %46 = OpFunctionCall %S %ret_struct_arr
%49 = OpAccessChain %_ptr_Uniform__arr_v4int_uint_4 %src_uniform %uint_0 %47 = OpCompositeExtract %_arr_v4int_uint_4 %46 0
%50 = OpLoad %_arr_v4int_uint_4 %49 OpStore %dst %47
OpStore %dst %50 %50 = OpAccessChain %_ptr_Uniform__arr_v4int_uint_4 %src_uniform %uint_0 %uint_0
%52 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %src_storage %uint_0 %51 = OpLoad %_arr_v4int_uint_4 %50
%53 = OpLoad %_arr_v4int_uint_4 %52 OpStore %dst %51
OpStore %dst %53 %53 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %src_storage %uint_0 %uint_0
%63 = OpLoad %_arr__arr__arr_int_uint_2_uint_3_uint_4 %src_nested %54 = OpLoad %_arr_v4int_uint_4 %53
OpStore %dst_nested %63 OpStore %dst %54
%64 = OpLoad %_arr__arr__arr_int_uint_2_uint_3_uint_4 %src_nested
OpStore %dst_nested %64
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -10,13 +10,14 @@ 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)); 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]; shared ivec4 src_workgroup[4];
layout(binding = 0) uniform S_1 { layout(binding = 0) uniform src_uniform_block_ubo {
ivec4 arr[4]; S inner;
} src_uniform; } src_uniform;
layout(binding = 1, std430) buffer S_2 { layout(binding = 1, std430) buffer src_uniform_block_ssbo {
ivec4 arr[4]; S inner;
} src_storage; } src_storage;
ivec4 dst[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); ivec4 dst[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
int dst_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0))); int dst_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)));
ivec4[4] ret_arr() { ivec4[4] ret_arr() {
@ -42,8 +43,8 @@ void foo(ivec4 src_param[4]) {
dst = src_workgroup; dst = src_workgroup;
S tint_symbol = ret_struct_arr(); S tint_symbol = ret_struct_arr();
dst = tint_symbol.arr; dst = tint_symbol.arr;
dst = src_uniform.arr; dst = src_uniform.inner.arr;
dst = src_storage.arr; dst = src_storage.inner.arr;
int src_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0))); int src_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)));
dst_nested = src_nested; dst_nested = src_nested;
} }

View File

@ -1,7 +1,7 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 65 ; Bound: 66
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -9,6 +9,8 @@
OpExecutionMode %unused_entry_point LocalSize 1 1 1 OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %src_private "src_private" OpName %src_private "src_private"
OpName %src_workgroup "src_workgroup" OpName %src_workgroup "src_workgroup"
OpName %src_uniform_block "src_uniform_block"
OpMemberName %src_uniform_block 0 "inner"
OpName %S "S" OpName %S "S"
OpMemberName %S 0 "arr" OpMemberName %S 0 "arr"
OpName %src_uniform "src_uniform" OpName %src_uniform "src_uniform"
@ -23,7 +25,8 @@
OpName %src_function "src_function" OpName %src_function "src_function"
OpName %src_nested "src_nested" OpName %src_nested "src_nested"
OpDecorate %_arr_v4int_uint_4 ArrayStride 16 OpDecorate %_arr_v4int_uint_4 ArrayStride 16
OpDecorate %S Block OpDecorate %src_uniform_block Block
OpMemberDecorate %src_uniform_block 0 Offset 0
OpMemberDecorate %S 0 Offset 0 OpMemberDecorate %S 0 Offset 0
OpDecorate %src_uniform NonWritable OpDecorate %src_uniform NonWritable
OpDecorate %src_uniform DescriptorSet 0 OpDecorate %src_uniform DescriptorSet 0
@ -44,10 +47,11 @@
%_ptr_Workgroup__arr_v4int_uint_4 = OpTypePointer Workgroup %_arr_v4int_uint_4 %_ptr_Workgroup__arr_v4int_uint_4 = OpTypePointer Workgroup %_arr_v4int_uint_4
%src_workgroup = OpVariable %_ptr_Workgroup__arr_v4int_uint_4 Workgroup %src_workgroup = OpVariable %_ptr_Workgroup__arr_v4int_uint_4 Workgroup
%S = OpTypeStruct %_arr_v4int_uint_4 %S = OpTypeStruct %_arr_v4int_uint_4
%_ptr_Uniform_S = OpTypePointer Uniform %S %src_uniform_block = OpTypeStruct %S
%src_uniform = OpVariable %_ptr_Uniform_S Uniform %_ptr_Uniform_src_uniform_block = OpTypePointer Uniform %src_uniform_block
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S %src_uniform = OpVariable %_ptr_Uniform_src_uniform_block Uniform
%src_storage = OpVariable %_ptr_StorageBuffer_S StorageBuffer %_ptr_StorageBuffer_src_uniform_block = OpTypePointer StorageBuffer %src_uniform_block
%src_storage = OpVariable %_ptr_StorageBuffer_src_uniform_block StorageBuffer
%dst = OpVariable %_ptr_Private__arr_v4int_uint_4 Private %8 %dst = OpVariable %_ptr_Private__arr_v4int_uint_4 Private %8
%uint_2 = OpConstant %uint 2 %uint_2 = OpConstant %uint 2
%_arr_int_uint_2 = OpTypeArray %int %uint_2 %_arr_int_uint_2 = OpTypeArray %int %uint_2
@ -55,64 +59,64 @@
%_arr__arr_int_uint_2_uint_3 = OpTypeArray %_arr_int_uint_2 %uint_3 %_arr__arr_int_uint_2_uint_3 = OpTypeArray %_arr_int_uint_2 %uint_3
%_arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypeArray %_arr__arr_int_uint_2_uint_3 %uint_4 %_arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypeArray %_arr__arr_int_uint_2_uint_3 %uint_4
%_ptr_Private__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer Private %_arr__arr__arr_int_uint_2_uint_3_uint_4 %_ptr_Private__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer Private %_arr__arr__arr_int_uint_2_uint_3_uint_4
%24 = OpConstantNull %_arr__arr__arr_int_uint_2_uint_3_uint_4 %25 = OpConstantNull %_arr__arr__arr_int_uint_2_uint_3_uint_4
%dst_nested = OpVariable %_ptr_Private__arr__arr__arr_int_uint_2_uint_3_uint_4 Private %24 %dst_nested = OpVariable %_ptr_Private__arr__arr__arr_int_uint_2_uint_3_uint_4 Private %25
%void = OpTypeVoid %void = OpTypeVoid
%25 = OpTypeFunction %void %26 = OpTypeFunction %void
%29 = OpTypeFunction %_arr_v4int_uint_4 %30 = OpTypeFunction %_arr_v4int_uint_4
%32 = OpTypeFunction %S %33 = OpTypeFunction %S
%35 = OpConstantNull %S %36 = OpConstantNull %S
%36 = OpTypeFunction %void %_arr_v4int_uint_4 %37 = OpTypeFunction %void %_arr_v4int_uint_4
%_ptr_Function__arr_v4int_uint_4 = OpTypePointer Function %_arr_v4int_uint_4 %_ptr_Function__arr_v4int_uint_4 = OpTypePointer Function %_arr_v4int_uint_4
%int_1 = OpConstant %int 1 %int_1 = OpConstant %int 1
%43 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 %44 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1
%int_2 = OpConstant %int 2 %int_2 = OpConstant %int 2
%45 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 %46 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%47 = OpConstantComposite %v4int %int_3 %int_3 %int_3 %int_3 %48 = OpConstantComposite %v4int %int_3 %int_3 %int_3 %int_3
%48 = OpConstantComposite %_arr_v4int_uint_4 %43 %45 %47 %47 %49 = OpConstantComposite %_arr_v4int_uint_4 %44 %46 %48 %48
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform__arr_v4int_uint_4 = OpTypePointer Uniform %_arr_v4int_uint_4 %_ptr_Uniform__arr_v4int_uint_4 = OpTypePointer Uniform %_arr_v4int_uint_4
%_ptr_StorageBuffer__arr_v4int_uint_4 = OpTypePointer StorageBuffer %_arr_v4int_uint_4 %_ptr_StorageBuffer__arr_v4int_uint_4 = OpTypePointer StorageBuffer %_arr_v4int_uint_4
%_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer Function %_arr__arr__arr_int_uint_2_uint_3_uint_4 %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer Function %_arr__arr__arr_int_uint_2_uint_3_uint_4
%unused_entry_point = OpFunction %void None %25 %unused_entry_point = OpFunction %void None %26
%28 = OpLabel %29 = OpLabel
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%ret_arr = OpFunction %_arr_v4int_uint_4 None %29 %ret_arr = OpFunction %_arr_v4int_uint_4 None %30
%31 = OpLabel %32 = OpLabel
OpReturnValue %8 OpReturnValue %8
OpFunctionEnd OpFunctionEnd
%ret_struct_arr = OpFunction %S None %32 %ret_struct_arr = OpFunction %S None %33
%34 = OpLabel %35 = OpLabel
OpReturnValue %35 OpReturnValue %36
OpFunctionEnd OpFunctionEnd
%foo = OpFunction %void None %36 %foo = OpFunction %void None %37
%src_param = OpFunctionParameter %_arr_v4int_uint_4 %src_param = OpFunctionParameter %_arr_v4int_uint_4
%39 = OpLabel %40 = OpLabel
%src_function = OpVariable %_ptr_Function__arr_v4int_uint_4 Function %8 %src_function = OpVariable %_ptr_Function__arr_v4int_uint_4 Function %8
%src_nested = OpVariable %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 Function %24 %src_nested = OpVariable %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 Function %25
OpStore %dst %48
OpStore %dst %src_param
%49 = OpFunctionCall %_arr_v4int_uint_4 %ret_arr
OpStore %dst %49 OpStore %dst %49
OpStore %dst %8 OpStore %dst %src_param
%50 = OpLoad %_arr_v4int_uint_4 %src_function %50 = OpFunctionCall %_arr_v4int_uint_4 %ret_arr
OpStore %dst %50 OpStore %dst %50
%51 = OpLoad %_arr_v4int_uint_4 %src_private OpStore %dst %8
%51 = OpLoad %_arr_v4int_uint_4 %src_function
OpStore %dst %51 OpStore %dst %51
%52 = OpLoad %_arr_v4int_uint_4 %src_workgroup %52 = OpLoad %_arr_v4int_uint_4 %src_private
OpStore %dst %52 OpStore %dst %52
%53 = OpFunctionCall %S %ret_struct_arr %53 = OpLoad %_arr_v4int_uint_4 %src_workgroup
%54 = OpCompositeExtract %_arr_v4int_uint_4 %53 0 OpStore %dst %53
OpStore %dst %54 %54 = OpFunctionCall %S %ret_struct_arr
%57 = OpAccessChain %_ptr_Uniform__arr_v4int_uint_4 %src_uniform %uint_0 %55 = OpCompositeExtract %_arr_v4int_uint_4 %54 0
%58 = OpLoad %_arr_v4int_uint_4 %57 OpStore %dst %55
OpStore %dst %58 %58 = OpAccessChain %_ptr_Uniform__arr_v4int_uint_4 %src_uniform %uint_0 %uint_0
%60 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %src_storage %uint_0 %59 = OpLoad %_arr_v4int_uint_4 %58
%61 = OpLoad %_arr_v4int_uint_4 %60 OpStore %dst %59
OpStore %dst %61 %61 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %src_storage %uint_0 %uint_0
%64 = OpLoad %_arr__arr__arr_int_uint_2_uint_3_uint_4 %src_nested %62 = OpLoad %_arr_v4int_uint_4 %61
OpStore %dst_nested %64 OpStore %dst %62
%65 = OpLoad %_arr__arr__arr_int_uint_2_uint_3_uint_4 %src_nested
OpStore %dst_nested %65
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -8,25 +8,24 @@ struct S {
ivec4 arr[4]; ivec4 arr[4];
}; };
struct S_nested {
int arr[4][3][2];
};
ivec4 src_private[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); 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]; shared ivec4 src_workgroup[4];
layout(binding = 0) uniform S_1 { layout(binding = 0) uniform src_uniform_block_ubo {
ivec4 arr[4]; S inner;
} src_uniform; } src_uniform;
layout(binding = 1, std430) buffer S_2 { layout(binding = 1, std430) buffer src_uniform_block_ssbo {
ivec4 arr[4]; S inner;
} src_storage; } src_storage;
layout(binding = 2, std430) buffer S_3 {
ivec4 arr[4]; layout(binding = 2, std430) buffer src_uniform_block_ssbo_1 {
S inner;
} dst; } dst;
layout(binding = 3, std430) buffer S_nested_1 {
layout(binding = 3, std430) buffer S_nested_ssbo {
int arr[4][3][2]; int arr[4][3][2];
} dst_nested; } dst_nested;
ivec4[4] ret_arr() { ivec4[4] ret_arr() {
ivec4 tint_symbol_2[4] = ivec4[4](ivec4(0), ivec4(0), ivec4(0), ivec4(0)); ivec4 tint_symbol_2[4] = ivec4[4](ivec4(0), ivec4(0), ivec4(0), ivec4(0));
return tint_symbol_2; return tint_symbol_2;
@ -40,19 +39,19 @@ S ret_struct_arr() {
void foo(ivec4 src_param[4]) { void foo(ivec4 src_param[4]) {
ivec4 src_function[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); ivec4 src_function[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
ivec4 tint_symbol_4[4] = ivec4[4](ivec4(1), ivec4(2), ivec4(3), ivec4(3)); ivec4 tint_symbol_4[4] = ivec4[4](ivec4(1), ivec4(2), ivec4(3), ivec4(3));
dst.arr = tint_symbol_4; dst.inner.arr = tint_symbol_4;
dst.arr = src_param; dst.inner.arr = src_param;
ivec4 tint_symbol[4] = ret_arr(); ivec4 tint_symbol[4] = ret_arr();
dst.arr = tint_symbol; dst.inner.arr = tint_symbol;
ivec4 src_let[4] = ivec4[4](ivec4(0), ivec4(0), ivec4(0), ivec4(0)); ivec4 src_let[4] = ivec4[4](ivec4(0), ivec4(0), ivec4(0), ivec4(0));
dst.arr = src_let; dst.inner.arr = src_let;
dst.arr = src_function; dst.inner.arr = src_function;
dst.arr = src_private; dst.inner.arr = src_private;
dst.arr = src_workgroup; dst.inner.arr = src_workgroup;
S tint_symbol_1 = ret_struct_arr(); S tint_symbol_1 = ret_struct_arr();
dst.arr = tint_symbol_1.arr; dst.inner.arr = tint_symbol_1.arr;
dst.arr = src_uniform.arr; dst.inner.arr = src_uniform.inner.arr;
dst.arr = src_storage.arr; dst.inner.arr = src_storage.inner.arr;
int src_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0))); int src_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)));
dst_nested.arr = src_nested; dst_nested.arr = src_nested;
} }

View File

@ -1,7 +1,7 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 78 ; Bound: 79
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -9,6 +9,8 @@
OpExecutionMode %unused_entry_point LocalSize 1 1 1 OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %src_private "src_private" OpName %src_private "src_private"
OpName %src_workgroup "src_workgroup" OpName %src_workgroup "src_workgroup"
OpName %src_uniform_block "src_uniform_block"
OpMemberName %src_uniform_block 0 "inner"
OpName %S "S" OpName %S "S"
OpMemberName %S 0 "arr" OpMemberName %S 0 "arr"
OpName %src_uniform "src_uniform" OpName %src_uniform "src_uniform"
@ -25,7 +27,8 @@
OpName %src_function "src_function" OpName %src_function "src_function"
OpName %src_nested "src_nested" OpName %src_nested "src_nested"
OpDecorate %_arr_v4int_uint_4 ArrayStride 16 OpDecorate %_arr_v4int_uint_4 ArrayStride 16
OpDecorate %S Block OpDecorate %src_uniform_block Block
OpMemberDecorate %src_uniform_block 0 Offset 0
OpMemberDecorate %S 0 Offset 0 OpMemberDecorate %S 0 Offset 0
OpDecorate %src_uniform NonWritable OpDecorate %src_uniform NonWritable
OpDecorate %src_uniform DescriptorSet 0 OpDecorate %src_uniform DescriptorSet 0
@ -52,11 +55,12 @@
%_ptr_Workgroup__arr_v4int_uint_4 = OpTypePointer Workgroup %_arr_v4int_uint_4 %_ptr_Workgroup__arr_v4int_uint_4 = OpTypePointer Workgroup %_arr_v4int_uint_4
%src_workgroup = OpVariable %_ptr_Workgroup__arr_v4int_uint_4 Workgroup %src_workgroup = OpVariable %_ptr_Workgroup__arr_v4int_uint_4 Workgroup
%S = OpTypeStruct %_arr_v4int_uint_4 %S = OpTypeStruct %_arr_v4int_uint_4
%_ptr_Uniform_S = OpTypePointer Uniform %S %src_uniform_block = OpTypeStruct %S
%src_uniform = OpVariable %_ptr_Uniform_S Uniform %_ptr_Uniform_src_uniform_block = OpTypePointer Uniform %src_uniform_block
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S %src_uniform = OpVariable %_ptr_Uniform_src_uniform_block Uniform
%src_storage = OpVariable %_ptr_StorageBuffer_S StorageBuffer %_ptr_StorageBuffer_src_uniform_block = OpTypePointer StorageBuffer %src_uniform_block
%dst = OpVariable %_ptr_StorageBuffer_S StorageBuffer %src_storage = OpVariable %_ptr_StorageBuffer_src_uniform_block StorageBuffer
%dst = OpVariable %_ptr_StorageBuffer_src_uniform_block StorageBuffer
%uint_2 = OpConstant %uint 2 %uint_2 = OpConstant %uint 2
%_arr_int_uint_2 = OpTypeArray %int %uint_2 %_arr_int_uint_2 = OpTypeArray %int %uint_2
%uint_3 = OpConstant %uint 3 %uint_3 = OpConstant %uint 3
@ -66,74 +70,74 @@
%_ptr_StorageBuffer_S_nested = OpTypePointer StorageBuffer %S_nested %_ptr_StorageBuffer_S_nested = OpTypePointer StorageBuffer %S_nested
%dst_nested = OpVariable %_ptr_StorageBuffer_S_nested StorageBuffer %dst_nested = OpVariable %_ptr_StorageBuffer_S_nested StorageBuffer
%void = OpTypeVoid %void = OpTypeVoid
%25 = OpTypeFunction %void %26 = OpTypeFunction %void
%29 = OpTypeFunction %_arr_v4int_uint_4 %30 = OpTypeFunction %_arr_v4int_uint_4
%32 = OpTypeFunction %S %33 = OpTypeFunction %S
%35 = OpConstantNull %S %36 = OpConstantNull %S
%36 = OpTypeFunction %void %_arr_v4int_uint_4 %37 = OpTypeFunction %void %_arr_v4int_uint_4
%_ptr_Function__arr_v4int_uint_4 = OpTypePointer Function %_arr_v4int_uint_4 %_ptr_Function__arr_v4int_uint_4 = OpTypePointer Function %_arr_v4int_uint_4
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer__arr_v4int_uint_4 = OpTypePointer StorageBuffer %_arr_v4int_uint_4 %_ptr_StorageBuffer__arr_v4int_uint_4 = OpTypePointer StorageBuffer %_arr_v4int_uint_4
%int_1 = OpConstant %int 1 %int_1 = OpConstant %int 1
%46 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 %47 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1
%int_2 = OpConstant %int 2 %int_2 = OpConstant %int 2
%48 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 %49 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%50 = OpConstantComposite %v4int %int_3 %int_3 %int_3 %int_3 %51 = OpConstantComposite %v4int %int_3 %int_3 %int_3 %int_3
%51 = OpConstantComposite %_arr_v4int_uint_4 %46 %48 %50 %50 %52 = OpConstantComposite %_arr_v4int_uint_4 %47 %49 %51 %51
%_ptr_Uniform__arr_v4int_uint_4 = OpTypePointer Uniform %_arr_v4int_uint_4 %_ptr_Uniform__arr_v4int_uint_4 = OpTypePointer Uniform %_arr_v4int_uint_4
%_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer Function %_arr__arr__arr_int_uint_2_uint_3_uint_4 %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer Function %_arr__arr__arr_int_uint_2_uint_3_uint_4
%74 = OpConstantNull %_arr__arr__arr_int_uint_2_uint_3_uint_4 %75 = OpConstantNull %_arr__arr__arr_int_uint_2_uint_3_uint_4
%_ptr_StorageBuffer__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer StorageBuffer %_arr__arr__arr_int_uint_2_uint_3_uint_4 %_ptr_StorageBuffer__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer StorageBuffer %_arr__arr__arr_int_uint_2_uint_3_uint_4
%unused_entry_point = OpFunction %void None %25 %unused_entry_point = OpFunction %void None %26
%28 = OpLabel %29 = OpLabel
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%ret_arr = OpFunction %_arr_v4int_uint_4 None %29 %ret_arr = OpFunction %_arr_v4int_uint_4 None %30
%31 = OpLabel %32 = OpLabel
OpReturnValue %8 OpReturnValue %8
OpFunctionEnd OpFunctionEnd
%ret_struct_arr = OpFunction %S None %32 %ret_struct_arr = OpFunction %S None %33
%34 = OpLabel %35 = OpLabel
OpReturnValue %35 OpReturnValue %36
OpFunctionEnd OpFunctionEnd
%foo = OpFunction %void None %36 %foo = OpFunction %void None %37
%src_param = OpFunctionParameter %_arr_v4int_uint_4 %src_param = OpFunctionParameter %_arr_v4int_uint_4
%39 = OpLabel %40 = OpLabel
%src_function = OpVariable %_ptr_Function__arr_v4int_uint_4 Function %8 %src_function = OpVariable %_ptr_Function__arr_v4int_uint_4 Function %8
%src_nested = OpVariable %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 Function %74 %src_nested = OpVariable %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 Function %75
%44 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %45 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0
OpStore %44 %51 OpStore %45 %52
%52 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %53 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0
OpStore %52 %src_param OpStore %53 %src_param
%53 = OpFunctionCall %_arr_v4int_uint_4 %ret_arr %54 = OpFunctionCall %_arr_v4int_uint_4 %ret_arr
%54 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %55 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0
OpStore %54 %53 OpStore %55 %54
%55 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %56 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0
OpStore %55 %8 OpStore %56 %8
%56 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %57 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0
%57 = OpLoad %_arr_v4int_uint_4 %src_function %58 = OpLoad %_arr_v4int_uint_4 %src_function
OpStore %56 %57 OpStore %57 %58
%58 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %59 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0
%59 = OpLoad %_arr_v4int_uint_4 %src_private %60 = OpLoad %_arr_v4int_uint_4 %src_private
OpStore %58 %59 OpStore %59 %60
%60 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %61 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0
%61 = OpLoad %_arr_v4int_uint_4 %src_workgroup %62 = OpLoad %_arr_v4int_uint_4 %src_workgroup
OpStore %60 %61 OpStore %61 %62
%62 = OpFunctionCall %S %ret_struct_arr %63 = OpFunctionCall %S %ret_struct_arr
%63 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %64 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0
%64 = OpCompositeExtract %_arr_v4int_uint_4 %62 0 %65 = OpCompositeExtract %_arr_v4int_uint_4 %63 0
OpStore %63 %64 OpStore %64 %65
%65 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %66 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0
%67 = OpAccessChain %_ptr_Uniform__arr_v4int_uint_4 %src_uniform %uint_0 %68 = OpAccessChain %_ptr_Uniform__arr_v4int_uint_4 %src_uniform %uint_0 %uint_0
%68 = OpLoad %_arr_v4int_uint_4 %67 %69 = OpLoad %_arr_v4int_uint_4 %68
OpStore %65 %68 OpStore %66 %69
%69 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %70 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0 %uint_0
%70 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %src_storage %uint_0 %71 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %src_storage %uint_0 %uint_0
%71 = OpLoad %_arr_v4int_uint_4 %70 %72 = OpLoad %_arr_v4int_uint_4 %71
OpStore %69 %71 OpStore %70 %72
%76 = OpAccessChain %_ptr_StorageBuffer__arr__arr__arr_int_uint_2_uint_3_uint_4 %dst_nested %uint_0 %77 = OpAccessChain %_ptr_StorageBuffer__arr__arr__arr_int_uint_2_uint_3_uint_4 %dst_nested %uint_0
%77 = OpLoad %_arr__arr__arr_int_uint_2_uint_3_uint_4 %src_nested %78 = OpLoad %_arr__arr__arr_int_uint_2_uint_3_uint_4 %src_nested
OpStore %76 %77 OpStore %77 %78
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -10,13 +10,14 @@ 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)); 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]; shared ivec4 src_workgroup[4];
layout(binding = 0) uniform S_1 { layout(binding = 0) uniform src_uniform_block_ubo {
ivec4 arr[4]; S inner;
} src_uniform; } src_uniform;
layout(binding = 1, std430) buffer S_2 { layout(binding = 1, std430) buffer src_uniform_block_ssbo {
ivec4 arr[4]; S inner;
} src_storage; } src_storage;
shared ivec4 dst[4]; shared ivec4 dst[4];
shared int dst_nested[4][3][2]; shared int dst_nested[4][3][2];
ivec4[4] ret_arr() { ivec4[4] ret_arr() {
@ -42,8 +43,8 @@ void foo(ivec4 src_param[4]) {
dst = src_workgroup; dst = src_workgroup;
S tint_symbol = ret_struct_arr(); S tint_symbol = ret_struct_arr();
dst = tint_symbol.arr; dst = tint_symbol.arr;
dst = src_uniform.arr; dst = src_uniform.inner.arr;
dst = src_storage.arr; dst = src_storage.inner.arr;
int src_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0))); int src_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)));
dst_nested = src_nested; dst_nested = src_nested;
} }

View File

@ -1,7 +1,7 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 65 ; Bound: 66
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -9,6 +9,8 @@
OpExecutionMode %unused_entry_point LocalSize 1 1 1 OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %src_private "src_private" OpName %src_private "src_private"
OpName %src_workgroup "src_workgroup" OpName %src_workgroup "src_workgroup"
OpName %src_uniform_block "src_uniform_block"
OpMemberName %src_uniform_block 0 "inner"
OpName %S "S" OpName %S "S"
OpMemberName %S 0 "arr" OpMemberName %S 0 "arr"
OpName %src_uniform "src_uniform" OpName %src_uniform "src_uniform"
@ -23,7 +25,8 @@
OpName %src_function "src_function" OpName %src_function "src_function"
OpName %src_nested "src_nested" OpName %src_nested "src_nested"
OpDecorate %_arr_v4int_uint_4 ArrayStride 16 OpDecorate %_arr_v4int_uint_4 ArrayStride 16
OpDecorate %S Block OpDecorate %src_uniform_block Block
OpMemberDecorate %src_uniform_block 0 Offset 0
OpMemberDecorate %S 0 Offset 0 OpMemberDecorate %S 0 Offset 0
OpDecorate %src_uniform NonWritable OpDecorate %src_uniform NonWritable
OpDecorate %src_uniform DescriptorSet 0 OpDecorate %src_uniform DescriptorSet 0
@ -44,10 +47,11 @@
%_ptr_Workgroup__arr_v4int_uint_4 = OpTypePointer Workgroup %_arr_v4int_uint_4 %_ptr_Workgroup__arr_v4int_uint_4 = OpTypePointer Workgroup %_arr_v4int_uint_4
%src_workgroup = OpVariable %_ptr_Workgroup__arr_v4int_uint_4 Workgroup %src_workgroup = OpVariable %_ptr_Workgroup__arr_v4int_uint_4 Workgroup
%S = OpTypeStruct %_arr_v4int_uint_4 %S = OpTypeStruct %_arr_v4int_uint_4
%_ptr_Uniform_S = OpTypePointer Uniform %S %src_uniform_block = OpTypeStruct %S
%src_uniform = OpVariable %_ptr_Uniform_S Uniform %_ptr_Uniform_src_uniform_block = OpTypePointer Uniform %src_uniform_block
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S %src_uniform = OpVariable %_ptr_Uniform_src_uniform_block Uniform
%src_storage = OpVariable %_ptr_StorageBuffer_S StorageBuffer %_ptr_StorageBuffer_src_uniform_block = OpTypePointer StorageBuffer %src_uniform_block
%src_storage = OpVariable %_ptr_StorageBuffer_src_uniform_block StorageBuffer
%dst = OpVariable %_ptr_Workgroup__arr_v4int_uint_4 Workgroup %dst = OpVariable %_ptr_Workgroup__arr_v4int_uint_4 Workgroup
%uint_2 = OpConstant %uint 2 %uint_2 = OpConstant %uint 2
%_arr_int_uint_2 = OpTypeArray %int %uint_2 %_arr_int_uint_2 = OpTypeArray %int %uint_2
@ -57,62 +61,62 @@
%_ptr_Workgroup__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer Workgroup %_arr__arr__arr_int_uint_2_uint_3_uint_4 %_ptr_Workgroup__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer Workgroup %_arr__arr__arr_int_uint_2_uint_3_uint_4
%dst_nested = OpVariable %_ptr_Workgroup__arr__arr__arr_int_uint_2_uint_3_uint_4 Workgroup %dst_nested = OpVariable %_ptr_Workgroup__arr__arr__arr_int_uint_2_uint_3_uint_4 Workgroup
%void = OpTypeVoid %void = OpTypeVoid
%24 = OpTypeFunction %void %25 = OpTypeFunction %void
%28 = OpTypeFunction %_arr_v4int_uint_4 %29 = OpTypeFunction %_arr_v4int_uint_4
%31 = OpTypeFunction %S %32 = OpTypeFunction %S
%34 = OpConstantNull %S %35 = OpConstantNull %S
%35 = OpTypeFunction %void %_arr_v4int_uint_4 %36 = OpTypeFunction %void %_arr_v4int_uint_4
%_ptr_Function__arr_v4int_uint_4 = OpTypePointer Function %_arr_v4int_uint_4 %_ptr_Function__arr_v4int_uint_4 = OpTypePointer Function %_arr_v4int_uint_4
%int_1 = OpConstant %int 1 %int_1 = OpConstant %int 1
%42 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 %43 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1
%int_2 = OpConstant %int 2 %int_2 = OpConstant %int 2
%44 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 %45 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%46 = OpConstantComposite %v4int %int_3 %int_3 %int_3 %int_3 %47 = OpConstantComposite %v4int %int_3 %int_3 %int_3 %int_3
%47 = OpConstantComposite %_arr_v4int_uint_4 %42 %44 %46 %46 %48 = OpConstantComposite %_arr_v4int_uint_4 %43 %45 %47 %47
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform__arr_v4int_uint_4 = OpTypePointer Uniform %_arr_v4int_uint_4 %_ptr_Uniform__arr_v4int_uint_4 = OpTypePointer Uniform %_arr_v4int_uint_4
%_ptr_StorageBuffer__arr_v4int_uint_4 = OpTypePointer StorageBuffer %_arr_v4int_uint_4 %_ptr_StorageBuffer__arr_v4int_uint_4 = OpTypePointer StorageBuffer %_arr_v4int_uint_4
%_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer Function %_arr__arr__arr_int_uint_2_uint_3_uint_4 %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer Function %_arr__arr__arr_int_uint_2_uint_3_uint_4
%63 = OpConstantNull %_arr__arr__arr_int_uint_2_uint_3_uint_4 %64 = OpConstantNull %_arr__arr__arr_int_uint_2_uint_3_uint_4
%unused_entry_point = OpFunction %void None %24 %unused_entry_point = OpFunction %void None %25
%27 = OpLabel %28 = OpLabel
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%ret_arr = OpFunction %_arr_v4int_uint_4 None %28 %ret_arr = OpFunction %_arr_v4int_uint_4 None %29
%30 = OpLabel %31 = OpLabel
OpReturnValue %8 OpReturnValue %8
OpFunctionEnd OpFunctionEnd
%ret_struct_arr = OpFunction %S None %31 %ret_struct_arr = OpFunction %S None %32
%33 = OpLabel %34 = OpLabel
OpReturnValue %34 OpReturnValue %35
OpFunctionEnd OpFunctionEnd
%foo = OpFunction %void None %35 %foo = OpFunction %void None %36
%src_param = OpFunctionParameter %_arr_v4int_uint_4 %src_param = OpFunctionParameter %_arr_v4int_uint_4
%38 = OpLabel %39 = OpLabel
%src_function = OpVariable %_ptr_Function__arr_v4int_uint_4 Function %8 %src_function = OpVariable %_ptr_Function__arr_v4int_uint_4 Function %8
%src_nested = OpVariable %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 Function %63 %src_nested = OpVariable %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 Function %64
OpStore %dst %47
OpStore %dst %src_param
%48 = OpFunctionCall %_arr_v4int_uint_4 %ret_arr
OpStore %dst %48 OpStore %dst %48
OpStore %dst %8 OpStore %dst %src_param
%49 = OpLoad %_arr_v4int_uint_4 %src_function %49 = OpFunctionCall %_arr_v4int_uint_4 %ret_arr
OpStore %dst %49 OpStore %dst %49
%50 = OpLoad %_arr_v4int_uint_4 %src_private OpStore %dst %8
%50 = OpLoad %_arr_v4int_uint_4 %src_function
OpStore %dst %50 OpStore %dst %50
%51 = OpLoad %_arr_v4int_uint_4 %src_workgroup %51 = OpLoad %_arr_v4int_uint_4 %src_private
OpStore %dst %51 OpStore %dst %51
%52 = OpFunctionCall %S %ret_struct_arr %52 = OpLoad %_arr_v4int_uint_4 %src_workgroup
%53 = OpCompositeExtract %_arr_v4int_uint_4 %52 0 OpStore %dst %52
OpStore %dst %53 %53 = OpFunctionCall %S %ret_struct_arr
%56 = OpAccessChain %_ptr_Uniform__arr_v4int_uint_4 %src_uniform %uint_0 %54 = OpCompositeExtract %_arr_v4int_uint_4 %53 0
%57 = OpLoad %_arr_v4int_uint_4 %56 OpStore %dst %54
OpStore %dst %57 %57 = OpAccessChain %_ptr_Uniform__arr_v4int_uint_4 %src_uniform %uint_0 %uint_0
%59 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %src_storage %uint_0 %58 = OpLoad %_arr_v4int_uint_4 %57
%60 = OpLoad %_arr_v4int_uint_4 %59 OpStore %dst %58
OpStore %dst %60 %60 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %src_storage %uint_0 %uint_0
%64 = OpLoad %_arr__arr__arr_int_uint_2_uint_3_uint_4 %src_nested %61 = OpLoad %_arr_v4int_uint_4 %60
OpStore %dst_nested %64 OpStore %dst %61
%65 = OpLoad %_arr__arr__arr_int_uint_2_uint_3_uint_4 %src_nested
OpStore %dst_nested %65
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -8,13 +8,10 @@ struct strided_arr_1 {
strided_arr el[3][2]; strided_arr el[3][2];
}; };
struct S { layout(binding = 0, std430) buffer S_ssbo {
strided_arr_1 a[4];
};
layout(binding = 0, std430) buffer S_1 {
strided_arr_1 a[4]; strided_arr_1 a[4];
} s; } s;
void f_1() { void f_1() {
strided_arr_1 x_19[4] = s.a; strided_arr_1 x_19[4] = s.a;
strided_arr x_24[3][2] = s.a[3].el; strided_arr x_24[3][2] = s.a[3].el;

View File

@ -7,13 +7,7 @@ layout(location = 1) in vec4 color_1;
layout(location = 2) in vec2 quad_pos_1; layout(location = 2) in vec2 quad_pos_1;
layout(location = 0) out vec4 color_2; layout(location = 0) out vec4 color_2;
layout(location = 1) out vec2 quad_pos_2; layout(location = 1) out vec2 quad_pos_2;
struct RenderParams { layout(binding = 0) uniform RenderParams_ubo {
mat4 modelViewProjectionMatrix;
vec3 right;
vec3 up;
};
layout(binding = 0) uniform RenderParams_1 {
mat4 modelViewProjectionMatrix; mat4 modelViewProjectionMatrix;
vec3 right; vec3 right;
vec3 up; vec3 up;
@ -147,11 +141,6 @@ struct VertexOutput {
vec2 quad_pos; vec2 quad_pos;
}; };
struct SimulationParams {
float deltaTime;
vec4 seed;
};
struct Particle { struct Particle {
vec3 position; vec3 position;
float lifetime; float lifetime;
@ -159,14 +148,15 @@ struct Particle {
vec3 velocity; vec3 velocity;
}; };
layout(binding = 0) uniform SimulationParams_1 { layout(binding = 0) uniform SimulationParams_ubo {
float deltaTime; float deltaTime;
vec4 seed; vec4 seed;
} sim_params; } sim_params;
layout(binding = 1, std430) buffer Particles_1 { layout(binding = 1, std430) buffer Particles_ssbo {
Particle particles[]; Particle particles[];
} data; } data;
struct UBO { struct UBO {
uint width; uint width;
}; };
@ -214,8 +204,8 @@ void main() {
return; return;
} }
Error parsing GLSL shader: Error parsing GLSL shader:
ERROR: 0:64: 'textureQueryLevels' : no matching overloaded function found ERROR: 0:60: 'textureQueryLevels' : no matching overloaded function found
ERROR: 0:64: '' : compilation terminated ERROR: 0:60: '' : compilation terminated
ERROR: 2 compilation errors. No code generated. ERROR: 2 compilation errors. No code generated.
@ -252,20 +242,18 @@ struct Particle {
vec3 velocity; vec3 velocity;
}; };
struct UBO { layout(binding = 3) uniform UBO_ubo {
uint width;
};
layout(binding = 3) uniform UBO_1 {
uint width; uint width;
} ubo; } ubo;
layout(binding = 4, std430) buffer Buffer_1 { layout(binding = 4, std430) buffer Buffer_ssbo {
float weights[]; float weights[];
} buf_in; } buf_in;
layout(binding = 5, std430) buffer Buffer_2 {
layout(binding = 5, std430) buffer Buffer_ssbo_1 {
float weights[]; float weights[];
} buf_out; } buf_out;
uniform highp sampler2D tex_in_1; uniform highp sampler2D tex_in_1;
void import_level(uvec3 coord) { void import_level(uvec3 coord) {
uint offset = (coord.x + (coord.y * ubo.width)); uint offset = (coord.x + (coord.y * ubo.width));
@ -309,20 +297,18 @@ struct Particle {
vec3 velocity; vec3 velocity;
}; };
struct UBO { layout(binding = 3) uniform UBO_ubo {
uint width;
};
layout(binding = 3) uniform UBO_1 {
uint width; uint width;
} ubo; } ubo;
layout(binding = 4, std430) buffer Buffer_1 { layout(binding = 4, std430) buffer Buffer_ssbo {
float weights[]; float weights[];
} buf_in; } buf_in;
layout(binding = 5, std430) buffer Buffer_2 {
layout(binding = 5, std430) buffer Buffer_ssbo_1 {
float weights[]; float weights[];
} buf_out; } buf_out;
layout(rgba8) uniform highp writeonly image2D tex_out; layout(rgba8) uniform highp writeonly image2D tex_out;
void export_level(uvec3 coord) { void export_level(uvec3 coord) {
if (all(lessThan(coord.xy, uvec2(imageSize(tex_out))))) { if (all(lessThan(coord.xy, uvec2(imageSize(tex_out))))) {

View File

@ -12,9 +12,10 @@ struct Inner {
ivec4 i[4]; ivec4 i[4];
}; };
layout(binding = 0, std430) buffer S_1 { layout(binding = 0, std430) buffer S_ssbo {
Inner arr[]; Inner arr[];
} s; } s;
void tint_symbol(uint idx) { void tint_symbol(uint idx) {
ivec3 a = s.arr[idx].a; ivec3 a = s.arr[idx].a;
int b = s.arr[idx].b; int b = s.arr[idx].b;

View File

@ -12,9 +12,10 @@ struct Inner {
ivec4 i[4]; ivec4 i[4];
}; };
layout(binding = 0, std430) buffer S_1 { layout(binding = 0, std430) buffer S_ssbo {
Inner arr[]; Inner arr[];
} s; } s;
void tint_symbol(uint idx) { void tint_symbol(uint idx) {
s.arr[idx].a = ivec3(0); s.arr[idx].a = ivec3(0);
s.arr[idx].b = 0; s.arr[idx].b = 0;

View File

@ -4,20 +4,7 @@ struct Inner {
int x; int x;
}; };
struct S { layout(binding = 0, std430) buffer S_ssbo {
ivec3 a;
int b;
uvec3 c;
uint d;
vec3 e;
float f;
mat2x3 g;
mat3x2 h;
Inner i;
Inner j[4];
};
layout(binding = 0, std430) buffer S_1 {
ivec3 a; ivec3 a;
int b; int b;
uvec3 c; uvec3 c;
@ -29,6 +16,7 @@ layout(binding = 0, std430) buffer S_1 {
Inner i; Inner i;
Inner j[4]; Inner j[4];
} s; } s;
void tint_symbol() { void tint_symbol() {
ivec3 a = s.a; ivec3 a = s.a;
int b = s.b; int b = s.b;

View File

@ -4,20 +4,7 @@ struct Inner {
int x; int x;
}; };
struct S { layout(binding = 0, std430) buffer S_ssbo {
ivec3 a;
int b;
uvec3 c;
uint d;
vec3 e;
float f;
mat2x3 g;
mat3x2 h;
Inner i;
Inner j[4];
};
layout(binding = 0, std430) buffer S_1 {
ivec3 a; ivec3 a;
int b; int b;
uvec3 c; uvec3 c;
@ -29,6 +16,7 @@ layout(binding = 0, std430) buffer S_1 {
Inner i; Inner i;
Inner j[4]; Inner j[4];
} s; } s;
void tint_symbol() { void tint_symbol() {
s.a = ivec3(0); s.a = ivec3(0);
s.b = 0; s.b = 0;

View File

@ -1,15 +1,13 @@
#version 310 es #version 310 es
struct tint_symbol_block { layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
float inner[4];
};
layout(binding = 0, std430) buffer tint_symbol_block_1 {
float inner[4]; float inner[4];
} tint_symbol; } tint_symbol;
layout(binding = 1, std430) buffer tint_symbol_block_2 {
layout(binding = 1, std430) buffer tint_symbol_block_ssbo_1 {
float inner[4]; float inner[4];
} tint_symbol_1; } tint_symbol_1;
void tint_symbol_2() { void tint_symbol_2() {
tint_symbol_1.inner = tint_symbol.inner; tint_symbol_1.inner = tint_symbol.inner;
} }

View File

@ -1,15 +1,13 @@
#version 310 es #version 310 es
struct tint_symbol_block { layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
float inner;
};
layout(binding = 0, std430) buffer tint_symbol_block_1 {
float inner; float inner;
} tint_symbol; } tint_symbol;
layout(binding = 1, std430) buffer tint_symbol_block_2 {
layout(binding = 1, std430) buffer tint_symbol_block_ssbo_1 {
float inner; float inner;
} tint_symbol_1; } tint_symbol_1;
void tint_symbol_2() { void tint_symbol_2() {
tint_symbol_1.inner = tint_symbol.inner; tint_symbol_1.inner = tint_symbol.inner;
} }

View File

@ -1,15 +1,13 @@
#version 310 es #version 310 es
struct tint_symbol_block { layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
int inner;
};
layout(binding = 0, std430) buffer tint_symbol_block_1 {
int inner; int inner;
} tint_symbol; } tint_symbol;
layout(binding = 1, std430) buffer tint_symbol_block_2 {
layout(binding = 1, std430) buffer tint_symbol_block_ssbo_1 {
int inner; int inner;
} tint_symbol_1; } tint_symbol_1;
void tint_symbol_2() { void tint_symbol_2() {
tint_symbol_1.inner = tint_symbol.inner; tint_symbol_1.inner = tint_symbol.inner;
} }

View File

@ -1,15 +1,13 @@
#version 310 es #version 310 es
struct tint_symbol_block { layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
mat2 inner;
};
layout(binding = 0, std430) buffer tint_symbol_block_1 {
mat2 inner; mat2 inner;
} tint_symbol; } tint_symbol;
layout(binding = 1, std430) buffer tint_symbol_block_2 {
layout(binding = 1, std430) buffer tint_symbol_block_ssbo_1 {
mat2 inner; mat2 inner;
} tint_symbol_1; } tint_symbol_1;
void tint_symbol_2() { void tint_symbol_2() {
tint_symbol_1.inner = tint_symbol.inner; tint_symbol_1.inner = tint_symbol.inner;
} }

View File

@ -1,15 +1,13 @@
#version 310 es #version 310 es
struct tint_symbol_block { layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
mat2x3 inner;
};
layout(binding = 0, std430) buffer tint_symbol_block_1 {
mat2x3 inner; mat2x3 inner;
} tint_symbol; } tint_symbol;
layout(binding = 1, std430) buffer tint_symbol_block_2 {
layout(binding = 1, std430) buffer tint_symbol_block_ssbo_1 {
mat2x3 inner; mat2x3 inner;
} tint_symbol_1; } tint_symbol_1;
void tint_symbol_2() { void tint_symbol_2() {
tint_symbol_1.inner = tint_symbol.inner; tint_symbol_1.inner = tint_symbol.inner;
} }

View File

@ -1,15 +1,13 @@
#version 310 es #version 310 es
struct tint_symbol_block { layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
mat3x2 inner;
};
layout(binding = 0, std430) buffer tint_symbol_block_1 {
mat3x2 inner; mat3x2 inner;
} tint_symbol; } tint_symbol;
layout(binding = 1, std430) buffer tint_symbol_block_2 {
layout(binding = 1, std430) buffer tint_symbol_block_ssbo_1 {
mat3x2 inner; mat3x2 inner;
} tint_symbol_1; } tint_symbol_1;
void tint_symbol_2() { void tint_symbol_2() {
tint_symbol_1.inner = tint_symbol.inner; tint_symbol_1.inner = tint_symbol.inner;
} }

View File

@ -1,15 +1,13 @@
#version 310 es #version 310 es
struct tint_symbol_block { layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
mat4 inner;
};
layout(binding = 0, std430) buffer tint_symbol_block_1 {
mat4 inner; mat4 inner;
} tint_symbol; } tint_symbol;
layout(binding = 1, std430) buffer tint_symbol_block_2 {
layout(binding = 1, std430) buffer tint_symbol_block_ssbo_1 {
mat4 inner; mat4 inner;
} tint_symbol_1; } tint_symbol_1;
void tint_symbol_2() { void tint_symbol_2() {
tint_symbol_1.inner = tint_symbol.inner; tint_symbol_1.inner = tint_symbol.inner;
} }

View File

@ -4,12 +4,14 @@ struct S {
float f; float f;
}; };
layout(binding = 0, std430) buffer tint_symbol_block_1 { layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
S inner[]; S inner[];
} tint_symbol; } tint_symbol;
layout(binding = 1, std430) buffer tint_symbol_block_2 {
layout(binding = 1, std430) buffer tint_symbol_block_ssbo_1 {
S inner[]; S inner[];
} tint_symbol_1; } tint_symbol_1;
void tint_symbol_2() { void tint_symbol_2() {
tint_symbol_1.inner[0] = tint_symbol.inner[0]; tint_symbol_1.inner[0] = tint_symbol.inner[0];
} }

View File

@ -6,16 +6,14 @@ struct Inner {
float f; float f;
}; };
struct S { layout(binding = 0, std430) buffer S_ssbo {
Inner inner;
};
layout(binding = 0, std430) buffer S_1 {
Inner inner; Inner inner;
} tint_symbol; } tint_symbol;
layout(binding = 1, std430) buffer S_2 {
layout(binding = 1, std430) buffer S_ssbo_1 {
Inner inner; Inner inner;
} tint_symbol_1; } tint_symbol_1;
void tint_symbol_2() { void tint_symbol_2() {
tint_symbol_1 = tint_symbol; tint_symbol_1 = tint_symbol;
} }
@ -26,8 +24,8 @@ void main() {
return; return;
} }
Error parsing GLSL shader: Error parsing GLSL shader:
ERROR: 0:18: 'assign' : cannot convert from 'layout( binding=0 column_major std430) buffer block{layout( column_major std430 offset=0) buffer structure{ global highp float f} inner}' to 'layout( binding=1 column_major std430) buffer block{layout( column_major std430 offset=0) buffer structure{ global highp float f} inner}' ERROR: 0:16: 'assign' : cannot convert from 'layout( binding=0 column_major std430) buffer block{layout( column_major std430 offset=0) buffer structure{ global highp float f} inner}' to 'layout( binding=1 column_major std430) buffer block{layout( column_major std430 offset=0) buffer structure{ global highp float f} inner}'
ERROR: 0:18: '' : compilation terminated ERROR: 0:16: '' : compilation terminated
ERROR: 2 compilation errors. No code generated. ERROR: 2 compilation errors. No code generated.

View File

@ -1,15 +1,13 @@
#version 310 es #version 310 es
struct tint_symbol_block { layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
uint inner;
};
layout(binding = 0, std430) buffer tint_symbol_block_1 {
uint inner; uint inner;
} tint_symbol; } tint_symbol;
layout(binding = 1, std430) buffer tint_symbol_block_2 {
layout(binding = 1, std430) buffer tint_symbol_block_ssbo_1 {
uint inner; uint inner;
} tint_symbol_1; } tint_symbol_1;
void tint_symbol_2() { void tint_symbol_2() {
tint_symbol_1.inner = tint_symbol.inner; tint_symbol_1.inner = tint_symbol.inner;
} }

View File

@ -1,15 +1,13 @@
#version 310 es #version 310 es
struct tint_symbol_block { layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
ivec2 inner;
};
layout(binding = 0, std430) buffer tint_symbol_block_1 {
ivec2 inner; ivec2 inner;
} tint_symbol; } tint_symbol;
layout(binding = 1, std430) buffer tint_symbol_block_2 {
layout(binding = 1, std430) buffer tint_symbol_block_ssbo_1 {
ivec2 inner; ivec2 inner;
} tint_symbol_1; } tint_symbol_1;
void tint_symbol_2() { void tint_symbol_2() {
tint_symbol_1.inner = tint_symbol.inner; tint_symbol_1.inner = tint_symbol.inner;
} }

View File

@ -1,15 +1,13 @@
#version 310 es #version 310 es
struct tint_symbol_block { layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
uvec3 inner;
};
layout(binding = 0, std430) buffer tint_symbol_block_1 {
uvec3 inner; uvec3 inner;
} tint_symbol; } tint_symbol;
layout(binding = 1, std430) buffer tint_symbol_block_2 {
layout(binding = 1, std430) buffer tint_symbol_block_ssbo_1 {
uvec3 inner; uvec3 inner;
} tint_symbol_1; } tint_symbol_1;
void tint_symbol_2() { void tint_symbol_2() {
tint_symbol_1.inner = tint_symbol.inner; tint_symbol_1.inner = tint_symbol.inner;
} }

View File

@ -1,15 +1,13 @@
#version 310 es #version 310 es
struct tint_symbol_block { layout(binding = 0, std430) buffer tint_symbol_block_ssbo {
vec4 inner;
};
layout(binding = 0, std430) buffer tint_symbol_block_1 {
vec4 inner; vec4 inner;
} tint_symbol; } tint_symbol;
layout(binding = 1, std430) buffer tint_symbol_block_2 {
layout(binding = 1, std430) buffer tint_symbol_block_ssbo_1 {
vec4 inner; vec4 inner;
} tint_symbol_1; } tint_symbol_1;
void tint_symbol_2() { void tint_symbol_2() {
tint_symbol_1.inner = tint_symbol.inner; tint_symbol_1.inner = tint_symbol.inner;
} }

View File

@ -34,11 +34,7 @@ struct S {
Inner arr[8]; Inner arr[8];
}; };
struct S_std140 { layout(binding = 0) uniform S_std140_ubo {
Inner_std140 arr[8];
};
layout(binding = 0) uniform S_std140_1 {
Inner_std140 arr[8]; Inner_std140 arr[8];
} s; } s;

View File

@ -19,24 +19,7 @@ struct S {
Inner l[4]; Inner l[4];
}; };
struct S_std140 { layout(binding = 0) uniform S_std140_ubo {
ivec3 a;
int b;
uvec3 c;
uint d;
vec3 e;
float f;
ivec2 g;
ivec2 h;
mat2x3 i;
vec2 j_0;
vec2 j_1;
vec2 j_2;
Inner k;
Inner l[4];
};
layout(binding = 0) uniform S_std140_1 {
ivec3 a; ivec3 a;
int b; int b;
uvec3 c; uvec3 c;

View File

@ -17,11 +17,7 @@ struct Outer_std140 {
Inner_std140 a[4]; Inner_std140 a[4];
}; };
struct a_block { layout(binding = 0) uniform a_block_ubo {
Outer_std140 inner[4];
};
layout(binding = 0) uniform a_block_1 {
Outer_std140 inner[4]; Outer_std140 inner[4];
} a; } a;

View File

@ -17,11 +17,7 @@ struct Outer_std140 {
Inner_std140 a[4]; Inner_std140 a[4];
}; };
struct a_block { layout(binding = 0) uniform a_block_ubo {
Outer_std140 inner[4];
};
layout(binding = 0) uniform a_block_1 {
Outer_std140 inner[4]; Outer_std140 inner[4];
} a; } a;

View File

@ -13,11 +13,7 @@ struct S_std140 {
int after; int after;
}; };
struct u_block { layout(binding = 0) uniform u_block_ubo {
S_std140 inner[4];
};
layout(binding = 0) uniform u_block_1 {
S_std140 inner[4]; S_std140 inner[4];
} u; } u;

View File

@ -13,11 +13,7 @@ struct S_std140 {
int after; int after;
}; };
struct u_block { layout(binding = 0) uniform u_block_ubo {
S_std140 inner[4];
};
layout(binding = 0) uniform u_block_1 {
S_std140 inner[4]; S_std140 inner[4];
} u; } u;

View File

@ -13,11 +13,7 @@ struct S_std140 {
int after; int after;
}; };
struct u_block { layout(binding = 0) uniform u_block_ubo {
S_std140 inner[4];
};
layout(binding = 0) uniform u_block_1 {
S_std140 inner[4]; S_std140 inner[4];
} u; } u;

View File

@ -13,21 +13,14 @@ struct S_std140 {
int after; int after;
}; };
struct u_block { layout(binding = 0) uniform u_block_ubo {
S_std140 inner[4];
};
layout(binding = 0) uniform u_block_1 {
S_std140 inner[4]; S_std140 inner[4];
} u; } u;
struct s_block { layout(binding = 1, std430) buffer s_block_ssbo {
S inner[4];
};
layout(binding = 1, std430) buffer s_block_1 {
S inner[4]; S inner[4];
} s; } s;
S conv_S(S_std140 val) { 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, mat2(val.m_0, val.m_1), val.after);
return tint_symbol; return tint_symbol;

View File

@ -13,11 +13,7 @@ struct S_std140 {
int after; int after;
}; };
struct u_block { layout(binding = 0) uniform u_block_ubo {
S_std140 inner[4];
};
layout(binding = 0) uniform u_block_1 {
S_std140 inner[4]; S_std140 inner[4];
} u; } u;

View File

@ -18,11 +18,7 @@ struct Outer_std140 {
Inner_std140 a[4]; Inner_std140 a[4];
}; };
struct a_block { layout(binding = 0) uniform a_block_ubo {
Outer_std140 inner[4];
};
layout(binding = 0) uniform a_block_1 {
Outer_std140 inner[4]; Outer_std140 inner[4];
} a; } a;

View File

@ -18,11 +18,7 @@ struct Outer_std140 {
Inner_std140 a[4]; Inner_std140 a[4];
}; };
struct a_block { layout(binding = 0) uniform a_block_ubo {
Outer_std140 inner[4];
};
layout(binding = 0) uniform a_block_1 {
Outer_std140 inner[4]; Outer_std140 inner[4];
} a; } a;

View File

@ -14,11 +14,7 @@ struct S_std140 {
int after; int after;
}; };
struct u_block { layout(binding = 0) uniform u_block_ubo {
S_std140 inner[4];
};
layout(binding = 0) uniform u_block_1 {
S_std140 inner[4]; S_std140 inner[4];
} u; } u;

View File

@ -14,11 +14,7 @@ struct S_std140 {
int after; int after;
}; };
struct u_block { layout(binding = 0) uniform u_block_ubo {
S_std140 inner[4];
};
layout(binding = 0) uniform u_block_1 {
S_std140 inner[4]; S_std140 inner[4];
} u; } u;

View File

@ -14,11 +14,7 @@ struct S_std140 {
int after; int after;
}; };
struct u_block { layout(binding = 0) uniform u_block_ubo {
S_std140 inner[4];
};
layout(binding = 0) uniform u_block_1 {
S_std140 inner[4]; S_std140 inner[4];
} u; } u;

View File

@ -14,21 +14,14 @@ struct S_std140 {
int after; int after;
}; };
struct u_block { layout(binding = 0) uniform u_block_ubo {
S_std140 inner[4];
};
layout(binding = 0) uniform u_block_1 {
S_std140 inner[4]; S_std140 inner[4];
} u; } u;
struct s_block { layout(binding = 1, std430) buffer s_block_ssbo {
S inner[4];
};
layout(binding = 1, std430) buffer s_block_1 {
S inner[4]; S inner[4];
} s; } s;
S conv_S(S_std140 val) { 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, mat3x2(val.m_0, val.m_1, val.m_2), val.after);
return tint_symbol; return tint_symbol;

View File

@ -14,11 +14,7 @@ struct S_std140 {
int after; int after;
}; };
struct u_block { layout(binding = 0) uniform u_block_ubo {
S_std140 inner[4];
};
layout(binding = 0) uniform u_block_1 {
S_std140 inner[4]; S_std140 inner[4];
} u; } u;

View File

@ -19,11 +19,7 @@ struct Outer_std140 {
Inner_std140 a[4]; Inner_std140 a[4];
}; };
struct a_block { layout(binding = 0) uniform a_block_ubo {
Outer_std140 inner[4];
};
layout(binding = 0) uniform a_block_1 {
Outer_std140 inner[4]; Outer_std140 inner[4];
} a; } a;

View File

@ -19,11 +19,7 @@ struct Outer_std140 {
Inner_std140 a[4]; Inner_std140 a[4];
}; };
struct a_block { layout(binding = 0) uniform a_block_ubo {
Outer_std140 inner[4];
};
layout(binding = 0) uniform a_block_1 {
Outer_std140 inner[4]; Outer_std140 inner[4];
} a; } a;

View File

@ -15,11 +15,7 @@ struct S_std140 {
int after; int after;
}; };
struct u_block { layout(binding = 0) uniform u_block_ubo {
S_std140 inner[4];
};
layout(binding = 0) uniform u_block_1 {
S_std140 inner[4]; S_std140 inner[4];
} u; } u;

View File

@ -15,11 +15,7 @@ struct S_std140 {
int after; int after;
}; };
struct u_block { layout(binding = 0) uniform u_block_ubo {
S_std140 inner[4];
};
layout(binding = 0) uniform u_block_1 {
S_std140 inner[4]; S_std140 inner[4];
} u; } u;

View File

@ -15,11 +15,7 @@ struct S_std140 {
int after; int after;
}; };
struct u_block { layout(binding = 0) uniform u_block_ubo {
S_std140 inner[4];
};
layout(binding = 0) uniform u_block_1 {
S_std140 inner[4]; S_std140 inner[4];
} u; } u;

View File

@ -15,21 +15,14 @@ struct S_std140 {
int after; int after;
}; };
struct u_block { layout(binding = 0) uniform u_block_ubo {
S_std140 inner[4];
};
layout(binding = 0) uniform u_block_1 {
S_std140 inner[4]; S_std140 inner[4];
} u; } u;
struct s_block { layout(binding = 1, std430) buffer s_block_ssbo {
S inner[4];
};
layout(binding = 1, std430) buffer s_block_1 {
S inner[4]; S inner[4];
} s; } s;
S conv_S(S_std140 val) { 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, mat4x2(val.m_0, val.m_1, val.m_2, val.m_3), val.after);
return tint_symbol; return tint_symbol;

View File

@ -15,11 +15,7 @@ struct S_std140 {
int after; int after;
}; };
struct u_block { layout(binding = 0) uniform u_block_ubo {
S_std140 inner[4];
};
layout(binding = 0) uniform u_block_1 {
S_std140 inner[4]; S_std140 inner[4];
} u; } u;

View File

@ -1,10 +1,6 @@
#version 310 es #version 310 es
struct u_block { layout(binding = 0) uniform u_block_ubo {
vec4 inner[4];
};
layout(binding = 0) uniform u_block_1 {
vec4 inner[4]; vec4 inner[4];
} u; } u;

View File

@ -1,10 +1,6 @@
#version 310 es #version 310 es
struct u_block { layout(binding = 0) uniform u_block_ubo {
float inner;
};
layout(binding = 0) uniform u_block_1 {
float inner; float inner;
} u; } u;

View File

@ -1,10 +1,6 @@
#version 310 es #version 310 es
struct u_block { layout(binding = 0) uniform u_block_ubo {
int inner;
};
layout(binding = 0) uniform u_block_1 {
int inner; int inner;
} u; } u;

View File

@ -1,10 +1,6 @@
#version 310 es #version 310 es
struct u_block { layout(binding = 0) uniform u_block_ubo {
mat2 inner;
};
layout(binding = 0) uniform u_block_1 {
mat2 inner; mat2 inner;
} u; } u;

View File

@ -1,10 +1,6 @@
#version 310 es #version 310 es
struct u_block { layout(binding = 0) uniform u_block_ubo {
mat2x3 inner;
};
layout(binding = 0) uniform u_block_1 {
mat2x3 inner; mat2x3 inner;
} u; } u;

View File

@ -1,10 +1,6 @@
#version 310 es #version 310 es
struct u_block { layout(binding = 0) uniform u_block_ubo {
mat3x2 inner;
};
layout(binding = 0) uniform u_block_1 {
mat3x2 inner; mat3x2 inner;
} u; } u;

View File

@ -1,10 +1,6 @@
#version 310 es #version 310 es
struct u_block { layout(binding = 0) uniform u_block_ubo {
mat4 inner;
};
layout(binding = 0) uniform u_block_1 {
mat4 inner; mat4 inner;
} u; } u;

View File

@ -1,5 +1,3 @@
SKIP: FAILED
#version 310 es #version 310 es
struct Inner { struct Inner {
@ -10,12 +8,12 @@ struct S {
Inner inner; Inner inner;
}; };
layout(binding = 0) uniform S_1 { layout(binding = 0) uniform u_block_ubo {
Inner inner; S inner;
} u; } u;
void tint_symbol() { void tint_symbol() {
S x = u; S x = u.inner;
} }
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@ -23,10 +21,3 @@ void main() {
tint_symbol(); tint_symbol();
return; return;
} }
Error parsing GLSL shader:
ERROR: 0:16: '=' : cannot convert from 'layout( binding=0 column_major shared) uniform block{layout( column_major shared) uniform structure{ global highp float f} inner}' to ' temp structure{ global structure{ global highp float f} inner}'
ERROR: 0:16: '' : compilation terminated
ERROR: 2 compilation errors. No code generated.

View File

@ -1,19 +1,22 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 11 ; Bound: 16
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1 OpExecutionMode %main LocalSize 1 1 1
OpName %u_block "u_block"
OpMemberName %u_block 0 "inner"
OpName %S "S" OpName %S "S"
OpMemberName %S 0 "inner" OpMemberName %S 0 "inner"
OpName %Inner "Inner" OpName %Inner "Inner"
OpMemberName %Inner 0 "f" OpMemberName %Inner 0 "f"
OpName %u "u" OpName %u "u"
OpName %main "main" OpName %main "main"
OpDecorate %S Block OpDecorate %u_block Block
OpMemberDecorate %u_block 0 Offset 0
OpMemberDecorate %S 0 Offset 0 OpMemberDecorate %S 0 Offset 0
OpMemberDecorate %Inner 0 Offset 0 OpMemberDecorate %Inner 0 Offset 0
OpDecorate %u NonWritable OpDecorate %u NonWritable
@ -22,12 +25,17 @@
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%Inner = OpTypeStruct %float %Inner = OpTypeStruct %float
%S = OpTypeStruct %Inner %S = OpTypeStruct %Inner
%_ptr_Uniform_S = OpTypePointer Uniform %S %u_block = OpTypeStruct %S
%u = OpVariable %_ptr_Uniform_S Uniform %_ptr_Uniform_u_block = OpTypePointer Uniform %u_block
%u = OpVariable %_ptr_Uniform_u_block Uniform
%void = OpTypeVoid %void = OpTypeVoid
%6 = OpTypeFunction %void %7 = OpTypeFunction %void
%main = OpFunction %void None %6 %uint = OpTypeInt 32 0
%9 = OpLabel %uint_0 = OpConstant %uint 0
%10 = OpLoad %S %u %_ptr_Uniform_S = OpTypePointer Uniform %S
%main = OpFunction %void None %7
%10 = OpLabel
%14 = OpAccessChain %_ptr_Uniform_S %u %uint_0
%15 = OpLoad %S %14
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,10 +1,6 @@
#version 310 es #version 310 es
struct u_block { layout(binding = 0) uniform u_block_ubo {
uint inner;
};
layout(binding = 0) uniform u_block_1 {
uint inner; uint inner;
} u; } u;

View File

@ -1,10 +1,6 @@
#version 310 es #version 310 es
struct u_block { layout(binding = 0) uniform u_block_ubo {
ivec2 inner;
};
layout(binding = 0) uniform u_block_1 {
ivec2 inner; ivec2 inner;
} u; } u;

View File

@ -1,10 +1,6 @@
#version 310 es #version 310 es
struct u_block { layout(binding = 0) uniform u_block_ubo {
uvec3 inner;
};
layout(binding = 0) uniform u_block_1 {
uvec3 inner; uvec3 inner;
} u; } u;

View File

@ -1,10 +1,6 @@
#version 310 es #version 310 es
struct u_block { layout(binding = 0) uniform u_block_ubo {
vec4 inner;
};
layout(binding = 0) uniform u_block_1 {
vec4 inner; vec4 inner;
} u; } u;

View File

@ -1,30 +1,6 @@
#version 310 es #version 310 es
struct Uniforms { layout(binding = 0) uniform Uniforms_ubo {
uint numTriangles;
uint gridSize;
uint puuuuuuuuuuuuuuuuad1;
uint pad2;
vec3 bbMin;
vec3 bbMax;
};
struct Dbg {
uint offsetCounter;
uint pad0;
uint pad1;
uint pad2;
uint value0;
uint value1;
uint value2;
uint value3;
float value_f32_0;
float value_f32_1;
float value_f32_2;
float value_f32_3;
};
layout(binding = 0) uniform Uniforms_1 {
uint numTriangles; uint numTriangles;
uint gridSize; uint gridSize;
uint puuuuuuuuuuuuuuuuad1; uint puuuuuuuuuuuuuuuuad1;
@ -33,19 +9,23 @@ layout(binding = 0) uniform Uniforms_1 {
vec3 bbMax; vec3 bbMax;
} uniforms; } uniforms;
layout(binding = 10, std430) buffer U32s_1 { layout(binding = 10, std430) buffer U32s_ssbo {
uint values[]; uint values[];
} indices; } indices;
layout(binding = 11, std430) buffer F32s_1 {
layout(binding = 11, std430) buffer F32s_ssbo {
float values[]; float values[];
} positions; } positions;
layout(binding = 20, std430) buffer AU32s_1 {
layout(binding = 20, std430) buffer AU32s_ssbo {
uint values[]; uint values[];
} counters; } counters;
layout(binding = 21, std430) buffer AI32s_1 {
layout(binding = 21, std430) buffer AI32s_ssbo {
int values[]; int values[];
} LUT; } LUT;
layout(binding = 50, std430) buffer Dbg_1 {
layout(binding = 50, std430) buffer Dbg_ssbo {
uint offsetCounter; uint offsetCounter;
uint pad0; uint pad0;
uint pad1; uint pad1;
@ -59,6 +39,7 @@ layout(binding = 50, std430) buffer Dbg_1 {
float value_f32_2; float value_f32_2;
float value_f32_3; float value_f32_3;
} dbg; } dbg;
vec3 toVoxelPos(vec3 position) { vec3 toVoxelPos(vec3 position) {
vec3 bbMin = vec3(uniforms.bbMin.x, uniforms.bbMin.y, uniforms.bbMin.z); vec3 bbMin = vec3(uniforms.bbMin.x, uniforms.bbMin.y, uniforms.bbMin.z);
vec3 bbMax = vec3(uniforms.bbMax.x, uniforms.bbMax.y, uniforms.bbMax.z); vec3 bbMax = vec3(uniforms.bbMax.x, uniforms.bbMax.y, uniforms.bbMax.z);

View File

@ -4,9 +4,10 @@ struct S {
float f; float f;
}; };
layout(binding = 0, std430) buffer arr_block_1 { layout(binding = 0, std430) buffer arr_block_ssbo {
S inner[]; S inner[];
} arr; } arr;
void tint_symbol() { void tint_symbol() {
uint len = uint(arr.inner.length()); uint len = uint(arr.inner.length());
} }

View File

@ -13,12 +13,7 @@ bug/dawn/947.wgsl:55:33 note: reading from user-defined input 'texcoord' may res
#version 310 es #version 310 es
layout(location = 0) out vec2 texcoords_1; layout(location = 0) out vec2 texcoords_1;
struct Uniforms { layout(binding = 0) uniform Uniforms_ubo {
vec2 u_scale;
vec2 u_offset;
};
layout(binding = 0) uniform Uniforms_1 {
vec2 u_scale; vec2 u_scale;
vec2 u_offset; vec2 u_offset;
} uniforms; } uniforms;

View File

@ -1,10 +1,6 @@
#version 310 es #version 310 es
struct UBO { layout(binding = 0) uniform UBO_ubo {
int dynamic_idx;
};
layout(binding = 0) uniform UBO_1 {
int dynamic_idx; int dynamic_idx;
} ubo; } ubo;
@ -12,13 +8,10 @@ struct S {
int data[64]; int data[64];
}; };
struct Result { layout(binding = 1, std430) buffer Result_ssbo {
int tint_symbol;
};
layout(binding = 1, std430) buffer Result_1 {
int tint_symbol; int tint_symbol;
} result; } result;
void f() { void f() {
S s = S(int[64](0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); S s = S(int[64](0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
result.tint_symbol = s.data[ubo.dynamic_idx]; result.tint_symbol = s.data[ubo.dynamic_idx];

View File

@ -1,10 +1,6 @@
#version 310 es #version 310 es
struct UBO { layout(binding = 0) uniform UBO_ubo {
int dynamic_idx;
};
layout(binding = 0) uniform UBO_1 {
int dynamic_idx; int dynamic_idx;
} ubo; } ubo;
@ -12,13 +8,10 @@ struct S {
int data[64]; int data[64];
}; };
struct Result { layout(binding = 1, std430) buffer Result_ssbo {
int tint_symbol;
};
layout(binding = 1, std430) buffer Result_1 {
int tint_symbol; int tint_symbol;
} result; } result;
S s = S(int[64](0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); S s = S(int[64](0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
void f() { void f() {
result.tint_symbol = s.data[ubo.dynamic_idx]; result.tint_symbol = s.data[ubo.dynamic_idx];

View File

@ -1,27 +1,17 @@
#version 310 es #version 310 es
struct UBO { layout(binding = 0) uniform UBO_ubo {
int dynamic_idx;
};
layout(binding = 0) uniform UBO_1 {
int dynamic_idx; int dynamic_idx;
} ubo; } ubo;
struct Result { layout(binding = 2, std430) buffer Result_ssbo {
int tint_symbol;
};
layout(binding = 2, std430) buffer Result_1 {
int tint_symbol; int tint_symbol;
} result; } result;
struct SSBO {
int data[4];
};
layout(binding = 1, std430) buffer SSBO_1 { layout(binding = 1, std430) buffer SSBO_ssbo {
int data[4]; int data[4];
} ssbo; } ssbo;
void f() { void f() {
result.tint_symbol = ssbo.data[ubo.dynamic_idx]; result.tint_symbol = ssbo.data[ubo.dynamic_idx];
} }

View File

@ -1,22 +1,14 @@
#version 310 es #version 310 es
struct UBO { layout(binding = 0) uniform UBO_ubo {
ivec4 data[4];
int dynamic_idx;
};
layout(binding = 0) uniform UBO_1 {
ivec4 data[4]; ivec4 data[4];
int dynamic_idx; int dynamic_idx;
} ubo; } ubo;
struct Result { layout(binding = 2, std430) buffer Result_ssbo {
int tint_symbol;
};
layout(binding = 2, std430) buffer Result_1 {
int tint_symbol; int tint_symbol;
} result; } result;
void f() { void f() {
result.tint_symbol = ubo.data[ubo.dynamic_idx].x; result.tint_symbol = ubo.data[ubo.dynamic_idx].x;
} }

View File

@ -1,10 +1,6 @@
#version 310 es #version 310 es
struct UBO { layout(binding = 0) uniform UBO_ubo {
int dynamic_idx;
};
layout(binding = 0) uniform UBO_1 {
int dynamic_idx; int dynamic_idx;
} ubo; } ubo;
@ -12,13 +8,10 @@ struct S {
int data[64]; int data[64];
}; };
struct Result { layout(binding = 1, std430) buffer Result_ssbo {
int tint_symbol;
};
layout(binding = 1, std430) buffer Result_1 {
int tint_symbol; int tint_symbol;
} result; } result;
shared S s; shared S s;
void f(uint local_invocation_index) { void f(uint local_invocation_index) {
{ {

View File

@ -1,10 +1,6 @@
#version 310 es #version 310 es
struct UBO { layout(binding = 0) uniform UBO_ubo {
int dynamic_idx;
};
layout(binding = 0) uniform UBO_1 {
int dynamic_idx; int dynamic_idx;
} ubo; } ubo;
@ -12,13 +8,10 @@ struct S {
int data[64]; int data[64];
}; };
struct Result { layout(binding = 1, std430) buffer Result_ssbo {
int tint_symbol;
};
layout(binding = 1, std430) buffer Result_1 {
int tint_symbol; int tint_symbol;
} result; } result;
void f() { void f() {
S s = S(int[64](0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); S s = S(int[64](0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
s.data[ubo.dynamic_idx] = 1; s.data[ubo.dynamic_idx] = 1;

View File

@ -1,10 +1,6 @@
#version 310 es #version 310 es
struct UBO { layout(binding = 0) uniform UBO_ubo {
int dynamic_idx;
};
layout(binding = 0) uniform UBO_1 {
int dynamic_idx; int dynamic_idx;
} ubo; } ubo;
@ -12,13 +8,10 @@ struct S {
int data[64]; int data[64];
}; };
struct Result { layout(binding = 1, std430) buffer Result_ssbo {
int tint_symbol;
};
layout(binding = 1, std430) buffer Result_1 {
int tint_symbol; int tint_symbol;
} result; } result;
void x(inout S p) { void x(inout S p) {
p.data[ubo.dynamic_idx] = 1; p.data[ubo.dynamic_idx] = 1;
} }

View File

@ -1,10 +1,6 @@
#version 310 es #version 310 es
struct UBO { layout(binding = 0) uniform UBO_ubo {
int dynamic_idx;
};
layout(binding = 0) uniform UBO_1 {
int dynamic_idx; int dynamic_idx;
} ubo; } ubo;
@ -12,13 +8,10 @@ struct S {
int data[64]; int data[64];
}; };
struct Result { layout(binding = 1, std430) buffer Result_ssbo {
int tint_symbol;
};
layout(binding = 1, std430) buffer Result_1 {
int tint_symbol; int tint_symbol;
} result; } result;
S s = S(int[64](0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); S s = S(int[64](0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
void f() { void f() {
s.data[ubo.dynamic_idx] = 1; s.data[ubo.dynamic_idx] = 1;

View File

@ -1,10 +1,6 @@
#version 310 es #version 310 es
struct UBO { layout(binding = 0) uniform UBO_ubo {
int dynamic_idx;
};
layout(binding = 0) uniform UBO_1 {
int dynamic_idx; int dynamic_idx;
} ubo; } ubo;
@ -12,13 +8,10 @@ struct S {
int data[64]; int data[64];
}; };
struct Result { layout(binding = 1, std430) buffer Result_ssbo {
int tint_symbol;
};
layout(binding = 1, std430) buffer Result_1 {
int tint_symbol; int tint_symbol;
} result; } result;
S s = S(int[64](0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); S s = S(int[64](0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
void x(inout S p) { void x(inout S p) {
p.data[ubo.dynamic_idx] = 1; p.data[ubo.dynamic_idx] = 1;

View File

@ -1,27 +1,17 @@
#version 310 es #version 310 es
struct UBO { layout(binding = 0) uniform UBO_ubo {
int dynamic_idx;
};
layout(binding = 0) uniform UBO_1 {
int dynamic_idx; int dynamic_idx;
} ubo; } ubo;
struct Result { layout(binding = 2, std430) buffer Result_ssbo {
int tint_symbol;
};
layout(binding = 2, std430) buffer Result_1 {
int tint_symbol; int tint_symbol;
} result; } result;
struct SSBO {
int data[4];
};
layout(binding = 1, std430) buffer SSBO_1 { layout(binding = 1, std430) buffer SSBO_ssbo {
int data[4]; int data[4];
} ssbo; } ssbo;
void f() { void f() {
ssbo.data[ubo.dynamic_idx] = 1; ssbo.data[ubo.dynamic_idx] = 1;
result.tint_symbol = ssbo.data[3]; result.tint_symbol = ssbo.data[3];

View File

@ -1,10 +1,6 @@
#version 310 es #version 310 es
struct UBO { layout(binding = 0) uniform UBO_ubo {
int dynamic_idx;
};
layout(binding = 0) uniform UBO_1 {
int dynamic_idx; int dynamic_idx;
} ubo; } ubo;
@ -12,13 +8,10 @@ struct S {
int data[64]; int data[64];
}; };
struct Result { layout(binding = 1, std430) buffer Result_ssbo {
int tint_symbol;
};
layout(binding = 1, std430) buffer Result_1 {
int tint_symbol; int tint_symbol;
} result; } result;
shared S s; shared S s;
void f(uint local_invocation_index) { void f(uint local_invocation_index) {
{ {

View File

@ -1,9 +1,5 @@
#version 310 es #version 310 es
struct Simulation {
uint i;
};
struct Particle { struct Particle {
vec3 position[8]; vec3 position[8];
float lifetime; float lifetime;
@ -11,10 +7,11 @@ struct Particle {
vec3 velocity; vec3 velocity;
}; };
layout(binding = 3, std430) buffer Particles_1 { layout(binding = 3, std430) buffer Particles_ssbo {
Particle p[]; Particle p[];
} particles; } particles;
layout(binding = 4) uniform Simulation_1 {
layout(binding = 4) uniform Simulation_ubo {
uint i; uint i;
} sim; } sim;

View File

@ -1,11 +1,6 @@
#version 310 es #version 310 es
struct Uniforms { layout(binding = 4) uniform Uniforms_ubo {
uint i;
uint j;
};
layout(binding = 4) uniform Uniforms_1 {
uint i; uint i;
uint j; uint j;
} uniforms; } uniforms;

View File

@ -1,11 +1,6 @@
#version 310 es #version 310 es
struct Uniforms { layout(binding = 4) uniform Uniforms_ubo {
uint i;
uint j;
};
layout(binding = 4) uniform Uniforms_1 {
uint i; uint i;
uint j; uint j;
} uniforms; } uniforms;

View File

@ -1,11 +1,6 @@
#version 310 es #version 310 es
struct Uniforms { layout(binding = 4) uniform Uniforms_ubo {
uint i;
uint j;
};
layout(binding = 4) uniform Uniforms_1 {
uint i; uint i;
uint j; uint j;
} uniforms; } uniforms;

View File

@ -1,11 +1,6 @@
#version 310 es #version 310 es
struct Uniforms { layout(binding = 4) uniform Uniforms_ubo {
uint i;
uint j;
};
layout(binding = 4) uniform Uniforms_1 {
uint i; uint i;
uint j; uint j;
} uniforms; } uniforms;

View File

@ -1,11 +1,6 @@
#version 310 es #version 310 es
struct Uniforms { layout(binding = 4) uniform Uniforms_ubo {
uint i;
uint j;
};
layout(binding = 4) uniform Uniforms_1 {
uint i; uint i;
uint j; uint j;
} uniforms; } uniforms;

View File

@ -1,11 +1,6 @@
#version 310 es #version 310 es
struct Uniforms { layout(binding = 4) uniform Uniforms_ubo {
uint i;
uint j;
};
layout(binding = 4) uniform Uniforms_1 {
uint i; uint i;
uint j; uint j;
} uniforms; } uniforms;

View File

@ -1,11 +1,6 @@
#version 310 es #version 310 es
struct Uniforms { layout(binding = 4) uniform Uniforms_ubo {
uint i;
uint j;
};
layout(binding = 4) uniform Uniforms_1 {
uint i; uint i;
uint j; uint j;
} uniforms; } uniforms;

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