[tint] Move StructMemberAttributes out of struct.h
This allows us to reuse it for ir::Var and ir::FunctionParam, which
are both currently duplicating these fields.
Rename it to IOAttributes.
Bug: 340196362
Change-Id: Idda2feb9efcabc2e35a2b5b4862366b1788fe98e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/196837
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
diff --git a/src/tint/lang/core/BUILD.bazel b/src/tint/lang/core/BUILD.bazel
index 3da2201..1016968 100644
--- a/src/tint/lang/core/BUILD.bazel
+++ b/src/tint/lang/core/BUILD.bazel
@@ -66,6 +66,7 @@
"interpolation.h",
"interpolation_sampling.h",
"interpolation_type.h",
+ "io_attributes.h",
"number.h",
"parameter_usage.h",
"texel_format.h",
diff --git a/src/tint/lang/core/BUILD.cmake b/src/tint/lang/core/BUILD.cmake
index df3d872..762a6f0 100644
--- a/src/tint/lang/core/BUILD.cmake
+++ b/src/tint/lang/core/BUILD.cmake
@@ -66,6 +66,7 @@
lang/core/interpolation_sampling.h
lang/core/interpolation_type.cc
lang/core/interpolation_type.h
+ lang/core/io_attributes.h
lang/core/number.cc
lang/core/number.h
lang/core/parameter_usage.cc
diff --git a/src/tint/lang/core/BUILD.gn b/src/tint/lang/core/BUILD.gn
index 23718dc..19b128a 100644
--- a/src/tint/lang/core/BUILD.gn
+++ b/src/tint/lang/core/BUILD.gn
@@ -65,6 +65,7 @@
"interpolation_sampling.h",
"interpolation_type.cc",
"interpolation_type.h",
+ "io_attributes.h",
"number.cc",
"number.h",
"parameter_usage.cc",
diff --git a/src/tint/lang/core/io_attributes.h b/src/tint/lang/core/io_attributes.h
new file mode 100644
index 0000000..e15da0d
--- /dev/null
+++ b/src/tint/lang/core/io_attributes.h
@@ -0,0 +1,57 @@
+// Copyright 2024 The Dawn & Tint Authors
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this
+// list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef SRC_TINT_LANG_CORE_IO_ATTRIBUTES_H_
+#define SRC_TINT_LANG_CORE_IO_ATTRIBUTES_H_
+
+#include <cstdint>
+#include <optional>
+
+#include "src/tint/lang/core/builtin_value.h"
+#include "src/tint/lang/core/interpolation.h"
+
+namespace tint::core {
+
+/// Attributes that can be applied to an object that will be used for shader IO.
+struct IOAttributes {
+ /// The value of a `@location` attribute.
+ std::optional<uint32_t> location;
+ /// The value of a `@blend_src` attribute.
+ std::optional<uint32_t> blend_src;
+ /// The value of a `@color` attribute.
+ std::optional<uint32_t> color;
+ /// The value of a `@builtin` attribute.
+ std::optional<core::BuiltinValue> builtin;
+ /// The values of a `@interpolate` attribute.
+ std::optional<core::Interpolation> interpolation;
+ /// True if the object is annotated with `@invariant`.
+ bool invariant = false;
+};
+
+} // namespace tint::core
+
+#endif // SRC_TINT_LANG_CORE_IO_ATTRIBUTES_H_
diff --git a/src/tint/lang/core/ir/binary/decode.cc b/src/tint/lang/core/ir/binary/decode.cc
index 4382721..738b7bd 100644
--- a/src/tint/lang/core/ir/binary/decode.cc
+++ b/src/tint/lang/core/ir/binary/decode.cc
@@ -763,7 +763,7 @@
Error() << "struct member must have non-zero size";
size = 1;
}
- core::type::StructMemberAttributes attributes_out{};
+ core::IOAttributes attributes_out{};
if (member_in.has_attributes()) {
auto& attributes_in = member_in.attributes();
if (attributes_in.has_location()) {
diff --git a/src/tint/lang/core/ir/binary/roundtrip_test.cc b/src/tint/lang/core/ir/binary/roundtrip_test.cc
index 0669b82..4ad6d6e 100644
--- a/src/tint/lang/core/ir/binary/roundtrip_test.cc
+++ b/src/tint/lang/core/ir/binary/roundtrip_test.cc
@@ -27,6 +27,7 @@
#include "src/tint/lang/core/ir/ir_helper_test.h"
+#include "src/tint/lang/core/io_attributes.h"
#include "src/tint/lang/core/ir/binary/decode.h"
#include "src/tint/lang/core/ir/binary/encode.h"
#include "src/tint/lang/core/ir/disassembler.h"
@@ -258,24 +259,24 @@
Vector members{
ty.Get<core::type::StructMember>(b.ir.symbols.New("a"), ty.i32(), /* index */ 0u,
/* offset */ 0u, /* align */ 4u, /* size */ 4u,
- type::StructMemberAttributes{}),
+ core::IOAttributes{}),
ty.Get<core::type::StructMember>(b.ir.symbols.New("b"), ty.f32(), /* index */ 1u,
/* offset */ 4u, /* align */ 4u, /* size */ 32u,
- type::StructMemberAttributes{}),
+ core::IOAttributes{}),
ty.Get<core::type::StructMember>(b.ir.symbols.New("c"), ty.u32(), /* index */ 2u,
/* offset */ 36u, /* align */ 4u, /* size */ 4u,
- type::StructMemberAttributes{}),
+ core::IOAttributes{}),
ty.Get<core::type::StructMember>(b.ir.symbols.New("d"), ty.u32(), /* index */ 3u,
/* offset */ 64u, /* align */ 32u, /* size */ 4u,
- type::StructMemberAttributes{}),
+ core::IOAttributes{}),
};
auto* S = ty.Struct(b.ir.symbols.New("S"), std::move(members));
b.Append(b.ir.root_block, [&] { b.Var(ty.ptr<function, read_write>(S)); });
RUN_TEST();
}
-TEST_F(IRBinaryRoundtripTest, StructMemberAttributes) {
- type::StructMemberAttributes attrs{};
+TEST_F(IRBinaryRoundtripTest, IOAttributes) {
+ core::IOAttributes attrs{};
attrs.location = 1;
attrs.blend_src = 2;
attrs.color = 3;
diff --git a/src/tint/lang/core/ir/transform/shader_io.cc b/src/tint/lang/core/ir/transform/shader_io.cc
index f1038b2..86f7a74 100644
--- a/src/tint/lang/core/ir/transform/shader_io.cc
+++ b/src/tint/lang/core/ir/transform/shader_io.cc
@@ -114,7 +114,7 @@
if (ep->Stage() == Function::PipelineStage::kVertex && backend->NeedsVertexPointSize()) {
vertex_point_size_index =
backend->AddOutput(ir.symbols.New("vertex_point_size"), ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ std::nullopt,
/* index */ std::nullopt,
/* color */ std::nullopt,
@@ -172,7 +172,7 @@
}
} else {
// Pull out the IO attributes and remove them from the parameter.
- core::type::StructMemberAttributes attributes;
+ core::IOAttributes attributes;
if (auto loc = param->Location()) {
attributes.location = loc->value;
if (loc->interpolation && ep->Stage() == Function::PipelineStage::kFragment) {
@@ -209,7 +209,7 @@
}
} else {
// Pull out the IO attributes and remove them from the original function.
- core::type::StructMemberAttributes attributes;
+ core::IOAttributes attributes;
if (auto loc = ep->ReturnLocation()) {
attributes.location = loc->value;
if (loc->interpolation && ep->Stage() == Function::PipelineStage::kVertex) {
diff --git a/src/tint/lang/core/ir/transform/shader_io.h b/src/tint/lang/core/ir/transform/shader_io.h
index 106aa83..689cf87 100644
--- a/src/tint/lang/core/ir/transform/shader_io.h
+++ b/src/tint/lang/core/ir/transform/shader_io.h
@@ -53,7 +53,7 @@
/// @returns the index of the input
virtual uint32_t AddInput(Symbol name,
const core::type::Type* type,
- core::type::StructMemberAttributes attributes) {
+ core::IOAttributes attributes) {
inputs.Push({name, type, std::move(attributes)});
return uint32_t(inputs.Length() - 1);
}
@@ -65,7 +65,7 @@
/// @returns the index of the output
virtual uint32_t AddOutput(Symbol name,
const core::type::Type* type,
- core::type::StructMemberAttributes attributes) {
+ core::IOAttributes attributes) {
outputs.Push({name, type, std::move(attributes)});
return uint32_t(outputs.Length() - 1);
}
diff --git a/src/tint/lang/core/ir/transform/std140.cc b/src/tint/lang/core/ir/transform/std140.cc
index c21f490..db33b69 100644
--- a/src/tint/lang/core/ir/transform/std140.cc
+++ b/src/tint/lang/core/ir/transform/std140.cc
@@ -164,7 +164,7 @@
ss << member->Name().Name() << "_col" << std::to_string(i);
new_members.Push(ty.Get<core::type::StructMember>(
sym.New(ss.str()), col, member_index, offset, col->Align(),
- col->Size(), core::type::StructMemberAttributes{}));
+ col->Size(), core::IOAttributes{}));
offset += col->Align();
member_index++;
}
@@ -174,8 +174,7 @@
auto* new_member_ty = RewriteType(member->Type());
new_members.Push(ty.Get<core::type::StructMember>(
member->Name(), new_member_ty, member_index, member->Offset(),
- member->Align(), member->Size(),
- core::type::StructMemberAttributes{}));
+ member->Align(), member->Size(), core::IOAttributes{}));
member_index_map.Add(member, member_index);
member_index++;
if (new_member_ty != member->Type()) {
@@ -214,7 +213,7 @@
ss << "col" << std::to_string(i);
members.Push(ty.Get<core::type::StructMember>(
sym.New(ss.str()), col, i, offset, col->Align(), col->Size(),
- core::type::StructMemberAttributes{}));
+ core::IOAttributes{}));
offset += col->Align();
}
diff --git a/src/tint/lang/core/ir/transform/std140_test.cc b/src/tint/lang/core/ir/transform/std140_test.cc
index f139e38..6c7d449 100644
--- a/src/tint/lang/core/ir/transform/std140_test.cc
+++ b/src/tint/lang/core/ir/transform/std140_test.cc
@@ -1492,11 +1492,11 @@
mod.symbols.New("MyStruct"),
Vector{
ty.Get<core::type::StructMember>(mod.symbols.New("a"), ty.i32(), 0u, 0u, 0u, 16u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
ty.Get<core::type::StructMember>(mod.symbols.New("m"), mat, 1u, 64u, 32u, 64u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
ty.Get<core::type::StructMember>(mod.symbols.New("b"), ty.i32(), 2u, 128u, 8u, 32u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
},
128u, 256u, 160u);
structure->SetStructFlag(core::type::kBlock);
diff --git a/src/tint/lang/core/ir/transform/zero_init_workgroup_memory_test.cc b/src/tint/lang/core/ir/transform/zero_init_workgroup_memory_test.cc
index 1843665..45f122f 100644
--- a/src/tint/lang/core/ir/transform/zero_init_workgroup_memory_test.cc
+++ b/src/tint/lang/core/ir/transform/zero_init_workgroup_memory_test.cc
@@ -1533,7 +1533,7 @@
{
mod.symbols.New("global_id"),
ty.vec3<u32>(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ std::nullopt,
/* index */ std::nullopt,
/* color */ std::nullopt,
@@ -1545,7 +1545,7 @@
{
mod.symbols.New("index"),
ty.u32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ std::nullopt,
/* index */ std::nullopt,
/* color */ std::nullopt,
diff --git a/src/tint/lang/core/type/manager.h b/src/tint/lang/core/type/manager.h
index 74331f4..7b48603 100644
--- a/src/tint/lang/core/type/manager.h
+++ b/src/tint/lang/core/type/manager.h
@@ -500,7 +500,7 @@
/// The type of the struct member.
const core::type::Type* type = nullptr;
/// The optional struct member attributes.
- core::type::StructMemberAttributes attributes = {};
+ core::IOAttributes attributes = {};
};
/// Create a new structure declaration.
diff --git a/src/tint/lang/core/type/struct.cc b/src/tint/lang/core/type/struct.cc
index e3038b4..bf24da5 100644
--- a/src/tint/lang/core/type/struct.cc
+++ b/src/tint/lang/core/type/struct.cc
@@ -224,7 +224,7 @@
uint32_t offset,
uint32_t align,
uint32_t size,
- const StructMemberAttributes& attributes)
+ const IOAttributes& attributes)
: name_(name),
type_(type),
index_(index),
diff --git a/src/tint/lang/core/type/struct.h b/src/tint/lang/core/type/struct.h
index d95c084..405a708 100644
--- a/src/tint/lang/core/type/struct.h
+++ b/src/tint/lang/core/type/struct.h
@@ -36,6 +36,7 @@
#include "src/tint/lang/core/address_space.h"
#include "src/tint/lang/core/builtin_value.h"
#include "src/tint/lang/core/interpolation.h"
+#include "src/tint/lang/core/io_attributes.h"
#include "src/tint/lang/core/type/node.h"
#include "src/tint/lang/core/type/type.h"
#include "src/tint/utils/containers/hashset.h"
@@ -203,22 +204,6 @@
tint::Vector<const Struct*, 2> concrete_types_;
};
-/// Attributes that can be applied to the StructMember
-struct StructMemberAttributes {
- /// The value of a `@location` attribute
- std::optional<uint32_t> location;
- /// The value of a `@blend_src` attribute
- std::optional<uint32_t> blend_src;
- /// The value of a `@color` attribute
- std::optional<uint32_t> color;
- /// The value of a `@builtin` attribute
- std::optional<core::BuiltinValue> builtin;
- /// The values of a `@interpolate` attribute
- std::optional<core::Interpolation> interpolation;
- /// True if the member was annotated with `@invariant`
- bool invariant = false;
-};
-
/// StructMember holds the type information for structure members.
class StructMember : public Castable<StructMember, Node> {
public:
@@ -236,7 +221,7 @@
uint32_t offset,
uint32_t align,
uint32_t size,
- const StructMemberAttributes& attributes);
+ const IOAttributes& attributes);
/// Destructor
~StructMember() override;
@@ -267,11 +252,11 @@
uint32_t Size() const { return size_; }
/// @returns the optional attributes
- const StructMemberAttributes& Attributes() const { return attributes_; }
+ const IOAttributes& Attributes() const { return attributes_; }
/// Set the attributes of the struct member.
/// @param attributes the new attributes
- void SetAttributes(StructMemberAttributes&& attributes) { attributes_ = std::move(attributes); }
+ void SetAttributes(IOAttributes&& attributes) { attributes_ = std::move(attributes); }
/// @param ctx the clone context
/// @returns a clone of this struct member
@@ -285,7 +270,7 @@
const uint32_t offset_;
const uint32_t align_;
const uint32_t size_;
- StructMemberAttributes attributes_;
+ IOAttributes attributes_;
};
} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/struct_test.cc b/src/tint/lang/core/type/struct_test.cc
index e47ab66..65ec5d0 100644
--- a/src/tint/lang/core/type/struct_test.cc
+++ b/src/tint/lang/core/type/struct_test.cc
@@ -218,15 +218,15 @@
}
TEST_F(TypeStructTest, Clone) {
- core::type::StructMemberAttributes attrs_location_2;
+ core::IOAttributes attrs_location_2;
attrs_location_2.location = 2;
auto* s = create<Struct>(
Sym("my_struct"),
- tint::Vector{create<StructMember>(Sym("b"), create<Vector>(create<F32>(), 3u), 0u, 0u, 16u,
- 12u, attrs_location_2),
- create<StructMember>(Sym("a"), create<I32>(), 1u, 16u, 4u, 4u,
- core::type::StructMemberAttributes{})},
+ tint::Vector{
+ create<StructMember>(Sym("b"), create<Vector>(create<F32>(), 3u), 0u, 0u, 16u, 12u,
+ attrs_location_2),
+ create<StructMember>(Sym("a"), create<I32>(), 1u, 16u, 4u, 4u, core::IOAttributes{})},
4u /* align */, 8u /* size */, 16u /* size_no_padding */);
GenerationID id;
diff --git a/src/tint/lang/core/type/type_test.cc b/src/tint/lang/core/type/type_test.cc
index 48032f4..f9ac346 100644
--- a/src/tint/lang/core/type/type_test.cc
+++ b/src/tint/lang/core/type/type_test.cc
@@ -58,36 +58,34 @@
const Matrix* mat4x3_af = create<Matrix>(vec3_af, 4u);
const Reference* ref_u32 =
create<Reference>(core::AddressSpace::kPrivate, u32, core::Access::kReadWrite);
- const Struct* str_f32 =
- create<Struct>(Sym("str_f32"),
- tint::Vector{
- create<StructMember>(
- /* name */ Sym("x"),
- /* type */ f32,
- /* index */ 0u,
- /* offset */ 0u,
- /* align */ 4u,
- /* size */ 4u,
- /* attributes */ core::type::StructMemberAttributes{}),
- },
- /* align*/ 4u,
- /* size*/ 4u,
- /* size_no_padding*/ 4u);
- const Struct* str_f16 =
- create<Struct>(Sym("str_f16"),
- tint::Vector{
- create<StructMember>(
- /* name */ Sym("x"),
- /* type */ f16,
- /* index */ 0u,
- /* offset */ 0u,
- /* align */ 4u,
- /* size */ 4u,
- /* attributes */ core::type::StructMemberAttributes{}),
- },
- /* align*/ 4u,
- /* size*/ 4u,
- /* size_no_padding*/ 4u);
+ const Struct* str_f32 = create<Struct>(Sym("str_f32"),
+ tint::Vector{
+ create<StructMember>(
+ /* name */ Sym("x"),
+ /* type */ f32,
+ /* index */ 0u,
+ /* offset */ 0u,
+ /* align */ 4u,
+ /* size */ 4u,
+ /* attributes */ core::IOAttributes{}),
+ },
+ /* align*/ 4u,
+ /* size*/ 4u,
+ /* size_no_padding*/ 4u);
+ const Struct* str_f16 = create<Struct>(Sym("str_f16"),
+ tint::Vector{
+ create<StructMember>(
+ /* name */ Sym("x"),
+ /* type */ f16,
+ /* index */ 0u,
+ /* offset */ 0u,
+ /* align */ 4u,
+ /* size */ 4u,
+ /* attributes */ core::IOAttributes{}),
+ },
+ /* align*/ 4u,
+ /* size*/ 4u,
+ /* size_no_padding*/ 4u);
Struct* str_af = create<Struct>(Sym("str_af"),
tint::Vector{
create<StructMember>(
@@ -97,7 +95,7 @@
/* offset */ 0u,
/* align */ 4u,
/* size */ 4u,
- /* attributes */ core::type::StructMemberAttributes{}),
+ /* attributes */ core::IOAttributes{}),
},
/* align*/ 4u,
/* size*/ 4u,
diff --git a/src/tint/lang/hlsl/writer/access_test.cc b/src/tint/lang/hlsl/writer/access_test.cc
index 3bc2784..80964b2 100644
--- a/src/tint/lang/hlsl/writer/access_test.cc
+++ b/src/tint/lang/hlsl/writer/access_test.cc
@@ -57,9 +57,9 @@
TEST_F(HlslWriterTest, AccessStruct) {
Vector members{
ty.Get<core::type::StructMember>(b.ir.symbols.New("a"), ty.i32(), 0u, 0u, 4u, 4u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
ty.Get<core::type::StructMember>(b.ir.symbols.New("b"), ty.f32(), 1u, 4u, 4u, 4u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
};
auto* strct = ty.Struct(b.ir.symbols.New("S"), std::move(members));
@@ -180,19 +180,19 @@
TEST_F(HlslWriterTest, AccessNested) {
Vector members_a{
ty.Get<core::type::StructMember>(b.ir.symbols.New("d"), ty.i32(), 0u, 0u, 4u, 4u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
ty.Get<core::type::StructMember>(b.ir.symbols.New("e"), ty.array<f32, 3>(), 1u, 4u, 4u, 4u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
};
auto* a_strct = ty.Struct(b.ir.symbols.New("A"), std::move(members_a));
Vector members_s{
ty.Get<core::type::StructMember>(b.ir.symbols.New("a"), ty.i32(), 0u, 0u, 4u, 4u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
ty.Get<core::type::StructMember>(b.ir.symbols.New("b"), ty.f32(), 1u, 4u, 4u, 4u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
ty.Get<core::type::StructMember>(b.ir.symbols.New("c"), a_strct, 2u, 8u, 8u, 8u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
};
auto* s_strct = ty.Struct(b.ir.symbols.New("S"), std::move(members_s));
@@ -406,11 +406,10 @@
}
TEST_F(HlslWriterTest, AccessStorageStruct) {
- auto* SB = ty.Struct(mod.symbols.New("SB"),
- {
- {mod.symbols.New("a"), ty.i32(), core::type::StructMemberAttributes{}},
- {mod.symbols.New("b"), ty.f32(), core::type::StructMemberAttributes{}},
- });
+ auto* SB = ty.Struct(mod.symbols.New("SB"), {
+ {mod.symbols.New("a"), ty.i32()},
+ {mod.symbols.New("b"), ty.f32()},
+ });
auto* var = b.Var("v", storage, SB, core::Access::kRead);
var->SetBindingPoint(0, 0);
@@ -446,24 +445,20 @@
}
TEST_F(HlslWriterTest, AccessStorageNested) {
- auto* Inner = ty.Struct(
- mod.symbols.New("Inner"),
- {
- {mod.symbols.New("s"), ty.mat3x3<f32>(), core::type::StructMemberAttributes{}},
- {mod.symbols.New("t"), ty.array<vec3<f32>, 5>(), core::type::StructMemberAttributes{}},
- });
- auto* Outer =
- ty.Struct(mod.symbols.New("Outer"),
- {
- {mod.symbols.New("x"), ty.f32(), core::type::StructMemberAttributes{}},
- {mod.symbols.New("y"), Inner, core::type::StructMemberAttributes{}},
- });
+ auto* Inner =
+ ty.Struct(mod.symbols.New("Inner"), {
+ {mod.symbols.New("s"), ty.mat3x3<f32>()},
+ {mod.symbols.New("t"), ty.array<vec3<f32>, 5>()},
+ });
+ auto* Outer = ty.Struct(mod.symbols.New("Outer"), {
+ {mod.symbols.New("x"), ty.f32()},
+ {mod.symbols.New("y"), Inner},
+ });
- auto* SB = ty.Struct(mod.symbols.New("SB"),
- {
- {mod.symbols.New("a"), ty.i32(), core::type::StructMemberAttributes{}},
- {mod.symbols.New("b"), Outer, core::type::StructMemberAttributes{}},
- });
+ auto* SB = ty.Struct(mod.symbols.New("SB"), {
+ {mod.symbols.New("a"), ty.i32()},
+ {mod.symbols.New("b"), Outer},
+ });
auto* var = b.Var("v", storage, SB, core::Access::kRead);
var->SetBindingPoint(0, 0);
@@ -629,17 +624,14 @@
}
TEST_F(HlslWriterTest, AccessChainFromUnnamedAccessChain) {
- auto* Inner =
- ty.Struct(mod.symbols.New("Inner"),
- {
- {mod.symbols.New("c"), ty.f32(), core::type::StructMemberAttributes{}},
- {mod.symbols.New("d"), ty.u32(), core::type::StructMemberAttributes{}},
- });
- auto* sb = ty.Struct(mod.symbols.New("SB"),
- {
- {mod.symbols.New("a"), ty.i32(), core::type::StructMemberAttributes{}},
- {mod.symbols.New("b"), Inner, core::type::StructMemberAttributes{}},
- });
+ auto* Inner = ty.Struct(mod.symbols.New("Inner"), {
+ {mod.symbols.New("c"), ty.f32()},
+ {mod.symbols.New("d"), ty.u32()},
+ });
+ auto* sb = ty.Struct(mod.symbols.New("SB"), {
+ {mod.symbols.New("a"), ty.i32()},
+ {mod.symbols.New("b"), Inner},
+ });
auto* var = b.Var("v", storage, sb, core::Access::kReadWrite);
var->SetBindingPoint(0, 0);
@@ -665,16 +657,13 @@
}
TEST_F(HlslWriterTest, AccessChainFromLetAccessChain) {
- auto* Inner =
- ty.Struct(mod.symbols.New("Inner"),
- {
- {mod.symbols.New("c"), ty.f32(), core::type::StructMemberAttributes{}},
- });
- auto* sb = ty.Struct(mod.symbols.New("SB"),
- {
- {mod.symbols.New("a"), ty.i32(), core::type::StructMemberAttributes{}},
- {mod.symbols.New("b"), Inner, core::type::StructMemberAttributes{}},
- });
+ auto* Inner = ty.Struct(mod.symbols.New("Inner"), {
+ {mod.symbols.New("c"), ty.f32()},
+ });
+ auto* sb = ty.Struct(mod.symbols.New("SB"), {
+ {mod.symbols.New("a"), ty.i32()},
+ {mod.symbols.New("b"), Inner},
+ });
auto* var = b.Var("v", storage, sb, core::Access::kReadWrite);
var->SetBindingPoint(0, 0);
diff --git a/src/tint/lang/hlsl/writer/constant_test.cc b/src/tint/lang/hlsl/writer/constant_test.cc
index 0dcf0b1..f8e1673 100644
--- a/src/tint/lang/hlsl/writer/constant_test.cc
+++ b/src/tint/lang/hlsl/writer/constant_test.cc
@@ -575,19 +575,19 @@
TEST_F(HlslWriterTest, ConstantTypeStructNestedEmpty) {
Vector members_a{
ty.Get<core::type::StructMember>(b.ir.symbols.New("d"), ty.i32(), 0u, 0u, 4u, 4u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
ty.Get<core::type::StructMember>(b.ir.symbols.New("e"), ty.f32(), 1u, 4u, 4u, 4u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
};
auto* a_strct = ty.Struct(b.ir.symbols.New("A"), std::move(members_a));
Vector members_s{
ty.Get<core::type::StructMember>(b.ir.symbols.New("a"), ty.i32(), 0u, 0u, 4u, 4u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
ty.Get<core::type::StructMember>(b.ir.symbols.New("b"), ty.f32(), 1u, 4u, 4u, 4u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
ty.Get<core::type::StructMember>(b.ir.symbols.New("c"), a_strct, 2u, 8u, 8u, 8u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
};
auto* s_strct = ty.Struct(b.ir.symbols.New("S"), std::move(members_s));
@@ -622,13 +622,13 @@
TEST_F(HlslWriterTest, ConstantTypeStructNested) {
Vector members_a{
ty.Get<core::type::StructMember>(b.ir.symbols.New("e"), ty.vec4<f32>(), 0u, 0u, 16u, 16u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
};
auto* a_strct = ty.Struct(b.ir.symbols.New("A"), std::move(members_a));
Vector members_s{
ty.Get<core::type::StructMember>(b.ir.symbols.New("c"), a_strct, 0u, 0u, 16u, 16u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
};
auto* s_strct = ty.Struct(b.ir.symbols.New("S"), std::move(members_s));
@@ -663,13 +663,13 @@
TEST_F(HlslWriterTest, ConstantTypeLetStructComposite) {
Vector members_a{
ty.Get<core::type::StructMember>(b.ir.symbols.New("e"), ty.vec4<f32>(), 0u, 0u, 16u, 16u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
};
auto* a_strct = ty.Struct(b.ir.symbols.New("A"), std::move(members_a));
Vector members_s{
ty.Get<core::type::StructMember>(b.ir.symbols.New("c"), a_strct, 0u, 0u, 16u, 16u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
};
auto* s_strct = ty.Struct(b.ir.symbols.New("S"), std::move(members_s));
@@ -704,13 +704,13 @@
TEST_F(HlslWriterTest, ConstantTypeLetStructCompositeModuleScoped) {
Vector members_a{
ty.Get<core::type::StructMember>(b.ir.symbols.New("e"), ty.vec4<f32>(), 0u, 0u, 16u, 16u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
};
auto* a_strct = ty.Struct(b.ir.symbols.New("A"), std::move(members_a));
Vector members_s{
ty.Get<core::type::StructMember>(b.ir.symbols.New("c"), a_strct, 0u, 0u, 16u, 16u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
};
auto* s_strct = ty.Struct(b.ir.symbols.New("S"), std::move(members_s));
@@ -752,13 +752,13 @@
TEST_F(HlslWriterTest, ConstantTypeStructEmpty) {
Vector members{
ty.Get<core::type::StructMember>(b.ir.symbols.New("a"), ty.i32(), 0u, 0u, 4u, 4u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
ty.Get<core::type::StructMember>(b.ir.symbols.New("b"), ty.f32(), 1u, 4u, 4u, 4u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
ty.Get<core::type::StructMember>(b.ir.symbols.New("c"), ty.vec3<i32>(), 2u, 8u, 16u, 16u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
ty.Get<core::type::StructMember>(b.ir.symbols.New("d"), ty.array<f32, 3>(), 2u, 8u, 16u,
- 16u, core::type::StructMemberAttributes{}),
+ 16u, core::IOAttributes{}),
};
auto* strct = ty.Struct(b.ir.symbols.New("S"), std::move(members));
@@ -789,13 +789,13 @@
TEST_F(HlslWriterTest, ConstantTypeStruct) {
Vector members{
ty.Get<core::type::StructMember>(b.ir.symbols.New("a"), ty.i32(), 0u, 0u, 4u, 4u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
ty.Get<core::type::StructMember>(b.ir.symbols.New("b"), ty.f32(), 1u, 4u, 4u, 4u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
ty.Get<core::type::StructMember>(b.ir.symbols.New("c"), ty.vec3<i32>(), 2u, 16u, 16u, 16u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
ty.Get<core::type::StructMember>(b.ir.symbols.New("d"), ty.vec4<f32>(), 2u, 32u, 16u, 16u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
};
auto* strct = ty.Struct(b.ir.symbols.New("S"), std::move(members));
@@ -829,13 +829,13 @@
TEST_F(HlslWriterTest, ConstantTypeLetStruct) {
Vector members{
ty.Get<core::type::StructMember>(b.ir.symbols.New("a"), ty.i32(), 0u, 0u, 4u, 4u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
ty.Get<core::type::StructMember>(b.ir.symbols.New("b"), ty.f32(), 1u, 4u, 4u, 4u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
ty.Get<core::type::StructMember>(b.ir.symbols.New("c"), ty.vec3<i32>(), 2u, 16u, 16u, 16u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
ty.Get<core::type::StructMember>(b.ir.symbols.New("d"), ty.vec4<f32>(), 2u, 32u, 16u, 16u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
};
auto* strct = ty.Struct(b.ir.symbols.New("S"), std::move(members));
@@ -870,7 +870,7 @@
TEST_F(HlslWriterTest, ConstantTypeStructStaticEmpty) {
Vector members{
ty.Get<core::type::StructMember>(b.ir.symbols.New("a"), ty.i32(), 0u, 0u, 4u, 4u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
};
auto* strct = ty.Struct(b.ir.symbols.New("S"), std::move(members));
@@ -894,7 +894,7 @@
TEST_F(HlslWriterTest, ConstantTypeStructStatic) {
Vector members{
ty.Get<core::type::StructMember>(b.ir.symbols.New("a"), ty.i32(), 0u, 0u, 4u, 4u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
};
auto* strct = ty.Struct(b.ir.symbols.New("S"), std::move(members));
@@ -917,18 +917,15 @@
TEST_F(HlslWriterTest, ConstantTypeMultiStructAndArray) {
auto* a_ty = ty.Struct(mod.symbols.New("A"), {
- {mod.symbols.New("a"), ty.array<i32, 2>(),
- core::type::StructMemberAttributes{}},
+ {mod.symbols.New("a"), ty.array<i32, 2>()},
});
auto* b_ty =
ty.Struct(mod.symbols.New("B"), {
- {mod.symbols.New("b"), ty.array<array<i32, 4>, 1>(),
- core::type::StructMemberAttributes{}},
+ {mod.symbols.New("b"), ty.array<array<i32, 4>, 1>()},
});
- auto* c_ty = ty.Struct(mod.symbols.New("C"),
- {
- {mod.symbols.New("a"), a_ty, core::type::StructMemberAttributes{}},
- });
+ auto* c_ty = ty.Struct(mod.symbols.New("C"), {
+ {mod.symbols.New("a"), a_ty},
+ });
b.Append(b.ir.root_block, [&] {
b.Var<private_>("a", b.Composite(a_ty, b.Composite(ty.array<i32, 2>(), 9_i, 10_i)));
diff --git a/src/tint/lang/hlsl/writer/construct_test.cc b/src/tint/lang/hlsl/writer/construct_test.cc
index 7008ac7..c313e8d 100644
--- a/src/tint/lang/hlsl/writer/construct_test.cc
+++ b/src/tint/lang/hlsl/writer/construct_test.cc
@@ -246,11 +246,11 @@
TEST_F(HlslWriterTest, ConstructStruct) {
Vector members{
ty.Get<core::type::StructMember>(b.ir.symbols.New("a"), ty.i32(), 0u, 0u, 4u, 4u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
ty.Get<core::type::StructMember>(b.ir.symbols.New("b"), ty.f32(), 1u, 4u, 4u, 4u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
ty.Get<core::type::StructMember>(b.ir.symbols.New("c"), ty.vec3<i32>(), 2u, 8u, 16u, 16u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
};
auto* strct = ty.Struct(b.ir.symbols.New("S"), std::move(members));
diff --git a/src/tint/lang/hlsl/writer/function_test.cc b/src/tint/lang/hlsl/writer/function_test.cc
index ff7f741..89f5eb6 100644
--- a/src/tint/lang/hlsl/writer/function_test.cc
+++ b/src/tint/lang/hlsl/writer/function_test.cc
@@ -90,7 +90,7 @@
}
TEST_F(HlslWriterTest, FunctionEntryPointWithParams) {
- core::type::StructMemberAttributes pos_attrs{};
+ core::IOAttributes pos_attrs{};
pos_attrs.builtin = core::BuiltinValue::kPosition;
Vector members{
@@ -239,11 +239,11 @@
// const p = inputs.pos;
// }
- core::type::StructMemberAttributes pos_attrs{};
+ core::IOAttributes pos_attrs{};
pos_attrs.builtin = core::BuiltinValue::kPosition;
- core::type::StructMemberAttributes col1_attrs{};
+ core::IOAttributes col1_attrs{};
col1_attrs.location = 1;
- core::type::StructMemberAttributes col2_attrs{};
+ core::IOAttributes col2_attrs{};
col2_attrs.location = 2;
Vector members{
@@ -338,7 +338,7 @@
// return foo(0.25);
// }
- core::type::StructMemberAttributes pos_attrs{};
+ core::IOAttributes pos_attrs{};
pos_attrs.builtin = core::BuiltinValue::kPosition;
Vector members{ty.Get<core::type::StructMember>(b.ir.symbols.New("pos"), ty.vec4<f32>(), 0u, 0u,
@@ -425,13 +425,12 @@
// var v = sub_func(1f);
// }
- Vector inner_members{ty.Get<core::type::StructMember>(
- b.ir.symbols.New("coord"), ty.f32(), 0u, 0u, 4u, 4u, core::type::StructMemberAttributes{})};
+ Vector inner_members{ty.Get<core::type::StructMember>(b.ir.symbols.New("coord"), ty.f32(), 0u,
+ 0u, 4u, 4u, core::IOAttributes{})};
auto* inner_strct = ty.Struct(b.ir.symbols.New("Inner"), std::move(inner_members));
Vector members{ty.Get<core::type::StructMember>(b.ir.symbols.New("coord"), inner_strct, 0u, 0u,
- 16u, 16u,
- core::type::StructMemberAttributes{})};
+ 16u, 16u, core::IOAttributes{})};
auto* strct = ty.Struct(b.ir.symbols.New("Uniforms"), std::move(members));
auto* ubo = b.Var("ubo", uniform, strct);
@@ -482,13 +481,12 @@
// var v = ubo.coord.x;
// }
- Vector inner_members{ty.Get<core::type::StructMember>(
- b.ir.symbols.New("coord"), ty.f32(), 0u, 0u, 4u, 4u, core::type::StructMemberAttributes{})};
+ Vector inner_members{ty.Get<core::type::StructMember>(b.ir.symbols.New("coord"), ty.f32(), 0u,
+ 0u, 4u, 4u, core::IOAttributes{})};
auto* inner_strct = ty.Struct(b.ir.symbols.New("Inner"), std::move(inner_members));
Vector members{ty.Get<core::type::StructMember>(b.ir.symbols.New("coord"), inner_strct, 0u, 0u,
- 16u, 16u,
- core::type::StructMemberAttributes{})};
+ 16u, 16u, core::IOAttributes{})};
auto* strct = ty.Struct(b.ir.symbols.New("Uniforms"), std::move(members));
auto* ubo = b.Var("ubo", uniform, strct);
@@ -527,9 +525,9 @@
// }
Vector members{ty.Get<core::type::StructMember>(b.ir.symbols.New("a"), ty.i32(), 0u, 0u, 4u, 4u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
ty.Get<core::type::StructMember>(b.ir.symbols.New("b"), ty.f32(), 1u, 4u, 4u, 4u,
- core::type::StructMemberAttributes{})};
+ core::IOAttributes{})};
auto* strct = ty.Struct(b.ir.symbols.New("Data"), std::move(members));
auto* coord = b.Var("coord", storage, strct, read_write);
@@ -567,9 +565,9 @@
// }
Vector members{ty.Get<core::type::StructMember>(b.ir.symbols.New("a"), ty.i32(), 0u, 0u, 4u, 4u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
ty.Get<core::type::StructMember>(b.ir.symbols.New("b"), ty.f32(), 1u, 4u, 4u, 4u,
- core::type::StructMemberAttributes{})};
+ core::IOAttributes{})};
auto* strct = ty.Struct(b.ir.symbols.New("Data"), std::move(members));
auto* coord = b.Var("coord", storage, strct, core::Access::kRead);
@@ -606,9 +604,9 @@
// }
Vector members{ty.Get<core::type::StructMember>(b.ir.symbols.New("a"), ty.i32(), 0u, 0u, 4u, 4u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
ty.Get<core::type::StructMember>(b.ir.symbols.New("b"), ty.f32(), 1u, 4u, 4u, 4u,
- core::type::StructMemberAttributes{})};
+ core::IOAttributes{})};
auto* strct = ty.Struct(b.ir.symbols.New("Data"), std::move(members));
auto* coord = b.Var("coord", storage, strct, core::Access::kReadWrite);
@@ -645,9 +643,9 @@
// }
Vector members{ty.Get<core::type::StructMember>(b.ir.symbols.New("a"), ty.i32(), 0u, 0u, 4u, 4u,
- core::type::StructMemberAttributes{}),
+ core::IOAttributes{}),
ty.Get<core::type::StructMember>(b.ir.symbols.New("b"), ty.f32(), 1u, 4u, 4u, 4u,
- core::type::StructMemberAttributes{})};
+ core::IOAttributes{})};
auto* strct = ty.Struct(b.ir.symbols.New("Data"), std::move(members));
auto* coord = b.Var("coord", storage, strct, read_write);
@@ -686,7 +684,7 @@
// }
Vector members{ty.Get<core::type::StructMember>(b.ir.symbols.New("x"), ty.f32(), 0u, 0u, 4u, 4u,
- core::type::StructMemberAttributes{})};
+ core::IOAttributes{})};
auto* strct = ty.Struct(b.ir.symbols.New("S"), std::move(members));
auto* coord = b.Var("coord", uniform, strct);
@@ -736,7 +734,7 @@
// }
Vector members{ty.Get<core::type::StructMember>(b.ir.symbols.New("x"), ty.f32(), 0u, 0u, 4u, 4u,
- core::type::StructMemberAttributes{})};
+ core::IOAttributes{})};
auto* strct = ty.Struct(b.ir.symbols.New("S"), std::move(members));
auto* coord = b.Var("coord", storage, strct, core::Access::kReadWrite);
@@ -939,7 +937,7 @@
// }
Vector members{ty.Get<core::type::StructMember>(b.ir.symbols.New("d"), ty.f32(), 0u, 0u, 4u, 4u,
- core::type::StructMemberAttributes{})};
+ core::IOAttributes{})};
auto* strct = ty.Struct(b.ir.symbols.New("Data"), std::move(members));
auto* data = b.Var("data", storage, strct, read_write);
diff --git a/src/tint/lang/hlsl/writer/raise/decompose_memory_access_test.cc b/src/tint/lang/hlsl/writer/raise/decompose_memory_access_test.cc
index 9d4a22b..1821fab 100644
--- a/src/tint/lang/hlsl/writer/raise/decompose_memory_access_test.cc
+++ b/src/tint/lang/hlsl/writer/raise/decompose_memory_access_test.cc
@@ -178,17 +178,14 @@
}
TEST_F(HlslWriterDecomposeMemoryAccessTest, AccessChainFromUnnamedAccessChain) {
- auto* Inner =
- ty.Struct(mod.symbols.New("Inner"),
- {
- {mod.symbols.New("c"), ty.f32(), core::type::StructMemberAttributes{}},
- {mod.symbols.New("d"), ty.u32(), core::type::StructMemberAttributes{}},
- });
- auto* sb = ty.Struct(mod.symbols.New("SB"),
- {
- {mod.symbols.New("a"), ty.i32(), core::type::StructMemberAttributes{}},
- {mod.symbols.New("b"), Inner, core::type::StructMemberAttributes{}},
- });
+ auto* Inner = ty.Struct(mod.symbols.New("Inner"), {
+ {mod.symbols.New("c"), ty.f32()},
+ {mod.symbols.New("d"), ty.u32()},
+ });
+ auto* sb = ty.Struct(mod.symbols.New("SB"), {
+ {mod.symbols.New("a"), ty.i32()},
+ {mod.symbols.New("b"), Inner},
+ });
auto* var = b.Var("v", storage, sb, core::Access::kReadWrite);
var->SetBindingPoint(0, 0);
@@ -261,16 +258,13 @@
}
TEST_F(HlslWriterDecomposeMemoryAccessTest, AccessChainFromLetAccessChain) {
- auto* Inner =
- ty.Struct(mod.symbols.New("Inner"),
- {
- {mod.symbols.New("c"), ty.f32(), core::type::StructMemberAttributes{}},
- });
- auto* sb = ty.Struct(mod.symbols.New("SB"),
- {
- {mod.symbols.New("a"), ty.i32(), core::type::StructMemberAttributes{}},
- {mod.symbols.New("b"), Inner, core::type::StructMemberAttributes{}},
- });
+ auto* Inner = ty.Struct(mod.symbols.New("Inner"), {
+ {mod.symbols.New("c"), ty.f32()},
+ });
+ auto* sb = ty.Struct(mod.symbols.New("SB"), {
+ {mod.symbols.New("a"), ty.i32()},
+ {mod.symbols.New("b"), Inner},
+ });
auto* var = b.Var("v", storage, sb, core::Access::kReadWrite);
var->SetBindingPoint(0, 0);
@@ -345,12 +339,10 @@
}
TEST_F(HlslWriterDecomposeMemoryAccessTest, AccessRwByteAddressBuffer) {
- auto* sb =
- ty.Struct(mod.symbols.New("SB"),
- {
- {mod.symbols.New("a"), ty.i32(), core::type::StructMemberAttributes{}},
- {mod.symbols.New("b"), ty.vec3<f32>(), core::type::StructMemberAttributes{}},
- });
+ auto* sb = ty.Struct(mod.symbols.New("SB"), {
+ {mod.symbols.New("a"), ty.i32()},
+ {mod.symbols.New("b"), ty.vec3<f32>()},
+ });
auto* var = b.Var("v", storage, sb, core::Access::kReadWrite);
b.ir.root_block->Append(var);
@@ -415,10 +407,9 @@
}
TEST_F(HlslWriterDecomposeMemoryAccessTest, AccessByteAddressBuffer) {
- auto* sb = ty.Struct(mod.symbols.New("SB"),
- {
- {mod.symbols.New("a"), ty.i32(), core::type::StructMemberAttributes{}},
- });
+ auto* sb = ty.Struct(mod.symbols.New("SB"), {
+ {mod.symbols.New("a"), ty.i32()},
+ });
auto* var = b.Var("v", storage, sb, core::Access::kRead);
b.ir.root_block->Append(var);
@@ -841,11 +832,10 @@
}
TEST_F(HlslWriterDecomposeMemoryAccessTest, AccessStorageStruct) {
- auto* SB = ty.Struct(mod.symbols.New("SB"),
- {
- {mod.symbols.New("a"), ty.i32(), core::type::StructMemberAttributes{}},
- {mod.symbols.New("b"), ty.f32(), core::type::StructMemberAttributes{}},
- });
+ auto* SB = ty.Struct(mod.symbols.New("SB"), {
+ {mod.symbols.New("a"), ty.i32()},
+ {mod.symbols.New("b"), ty.f32()},
+ });
auto* var = b.Var("v", storage, SB, core::Access::kRead);
var->SetBindingPoint(0, 0);
@@ -919,24 +909,20 @@
}
TEST_F(HlslWriterDecomposeMemoryAccessTest, AccessStorageNested) {
- auto* Inner = ty.Struct(
- mod.symbols.New("Inner"),
- {
- {mod.symbols.New("s"), ty.mat3x3<f32>(), core::type::StructMemberAttributes{}},
- {mod.symbols.New("t"), ty.array<vec3<f32>, 5>(), core::type::StructMemberAttributes{}},
- });
- auto* Outer =
- ty.Struct(mod.symbols.New("Outer"),
- {
- {mod.symbols.New("x"), ty.f32(), core::type::StructMemberAttributes{}},
- {mod.symbols.New("y"), Inner, core::type::StructMemberAttributes{}},
- });
+ auto* Inner =
+ ty.Struct(mod.symbols.New("Inner"), {
+ {mod.symbols.New("s"), ty.mat3x3<f32>()},
+ {mod.symbols.New("t"), ty.array<vec3<f32>, 5>()},
+ });
+ auto* Outer = ty.Struct(mod.symbols.New("Outer"), {
+ {mod.symbols.New("x"), ty.f32()},
+ {mod.symbols.New("y"), Inner},
+ });
- auto* SB = ty.Struct(mod.symbols.New("SB"),
- {
- {mod.symbols.New("a"), ty.i32(), core::type::StructMemberAttributes{}},
- {mod.symbols.New("b"), Outer, core::type::StructMemberAttributes{}},
- });
+ auto* SB = ty.Struct(mod.symbols.New("SB"), {
+ {mod.symbols.New("a"), ty.i32()},
+ {mod.symbols.New("b"), Outer},
+ });
auto* var = b.Var("v", storage, SB, core::Access::kRead);
var->SetBindingPoint(0, 0);
diff --git a/src/tint/lang/hlsl/writer/raise/promote_initializers_test.cc b/src/tint/lang/hlsl/writer/raise/promote_initializers_test.cc
index 3aea052..b3f3464 100644
--- a/src/tint/lang/hlsl/writer/raise/promote_initializers_test.cc
+++ b/src/tint/lang/hlsl/writer/raise/promote_initializers_test.cc
@@ -64,11 +64,9 @@
}
TEST_F(HlslWriterPromoteInitializersTest, StructInVarNoChange) {
- auto* str_ty =
- ty.Struct(mod.symbols.New("S"),
- {
- {mod.symbols.New("a"), ty.i32(), core::type::StructMemberAttributes{}},
- });
+ auto* str_ty = ty.Struct(mod.symbols.New("S"), {
+ {mod.symbols.New("a"), ty.i32()},
+ });
auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
b.Append(func->Block(), [&] {
@@ -120,11 +118,9 @@
}
TEST_F(HlslWriterPromoteInitializersTest, StructInLetNoChange) {
- auto* str_ty =
- ty.Struct(mod.symbols.New("S"),
- {
- {mod.symbols.New("a"), ty.i32(), core::type::StructMemberAttributes{}},
- });
+ auto* str_ty = ty.Struct(mod.symbols.New("S"), {
+ {mod.symbols.New("a"), ty.i32()},
+ });
auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
b.Append(func->Block(), [&] {
@@ -176,11 +172,9 @@
}
TEST_F(HlslWriterPromoteInitializersTest, StructInCall) {
- auto* str_ty =
- ty.Struct(mod.symbols.New("S"),
- {
- {mod.symbols.New("a"), ty.i32(), core::type::StructMemberAttributes{}},
- });
+ auto* str_ty = ty.Struct(mod.symbols.New("S"), {
+ {mod.symbols.New("a"), ty.i32()},
+ });
auto* p = b.FunctionParam("p", str_ty);
auto* dst = b.Function("dst", ty.void_());
@@ -284,11 +278,9 @@
TEST_F(HlslWriterPromoteInitializersTest, ModuleScopedStruct) {
capabilities = core::ir::Capabilities{core::ir::Capability::kAllowModuleScopeLets};
- auto* str_ty =
- ty.Struct(mod.symbols.New("S"),
- {
- {mod.symbols.New("a"), ty.i32(), core::type::StructMemberAttributes{}},
- });
+ auto* str_ty = ty.Struct(mod.symbols.New("S"), {
+ {mod.symbols.New("a"), ty.i32()},
+ });
b.ir.root_block->Append(b.Var<private_>("a", b.Composite(str_ty, 1_i)));
@@ -349,23 +341,18 @@
TEST_F(HlslWriterPromoteInitializersTest, ModuleScopedStructNested) {
capabilities = core::ir::Capabilities{core::ir::Capability::kAllowModuleScopeLets};
- auto* b_ty =
- ty.Struct(mod.symbols.New("B"),
- {
- {mod.symbols.New("c"), ty.f32(), core::type::StructMemberAttributes{}},
- });
+ auto* b_ty = ty.Struct(mod.symbols.New("B"), {
+ {mod.symbols.New("c"), ty.f32()},
+ });
- auto* a_ty =
- ty.Struct(mod.symbols.New("A"),
- {
- {mod.symbols.New("z"), ty.i32(), core::type::StructMemberAttributes{}},
- {mod.symbols.New("b"), b_ty, core::type::StructMemberAttributes{}},
- });
+ auto* a_ty = ty.Struct(mod.symbols.New("A"), {
+ {mod.symbols.New("z"), ty.i32()},
+ {mod.symbols.New("b"), b_ty},
+ });
- auto* str_ty = ty.Struct(mod.symbols.New("S"),
- {
- {mod.symbols.New("a"), a_ty, core::type::StructMemberAttributes{}},
- });
+ auto* str_ty = ty.Struct(mod.symbols.New("S"), {
+ {mod.symbols.New("a"), a_ty},
+ });
b.ir.root_block->Append(
b.Var<private_>("a", b.Composite(str_ty, b.Composite(a_ty, 1_i, b.Composite(b_ty, 1_f)))));
@@ -425,8 +412,7 @@
capabilities = core::ir::Capabilities{core::ir::Capability::kAllowModuleScopeLets};
auto* str_ty = ty.Struct(mod.symbols.New("S"), {
- {mod.symbols.New("a"), ty.array<i32, 3>(),
- core::type::StructMemberAttributes{}},
+ {mod.symbols.New("a"), ty.array<i32, 3>()},
});
b.ir.root_block->Append(b.Var<private_>("a", b.Composite(str_ty, b.Zero(ty.array<i32, 3>()))));
@@ -464,18 +450,15 @@
capabilities = core::ir::Capabilities{core::ir::Capability::kAllowModuleScopeLets};
auto* a_ty = ty.Struct(mod.symbols.New("A"), {
- {mod.symbols.New("a"), ty.array<i32, 2>(),
- core::type::StructMemberAttributes{}},
+ {mod.symbols.New("a"), ty.array<i32, 2>()},
});
auto* b_ty =
ty.Struct(mod.symbols.New("B"), {
- {mod.symbols.New("b"), ty.array<array<i32, 4>, 1>(),
- core::type::StructMemberAttributes{}},
+ {mod.symbols.New("b"), ty.array<array<i32, 4>, 1>()},
});
- auto* c_ty = ty.Struct(mod.symbols.New("C"),
- {
- {mod.symbols.New("a"), a_ty, core::type::StructMemberAttributes{}},
- });
+ auto* c_ty = ty.Struct(mod.symbols.New("C"), {
+ {mod.symbols.New("a"), a_ty},
+ });
b.Append(b.ir.root_block, [&] {
b.Var<private_>("a", b.Composite(a_ty, b.Composite(ty.array<i32, 2>(), 9_i, 10_i)));
@@ -605,11 +588,9 @@
TEST_F(HlslWriterPromoteInitializersTest, DuplicateConstantInBlock) {
capabilities = core::ir::Capabilities{core::ir::Capability::kAllowModuleScopeLets};
- auto* a_ty =
- ty.Struct(mod.symbols.New("A"),
- {
- {mod.symbols.New("a"), ty.i32(), core::type::StructMemberAttributes{}},
- });
+ auto* a_ty = ty.Struct(mod.symbols.New("A"), {
+ {mod.symbols.New("a"), ty.i32()},
+ });
auto* param = b.FunctionParam("a", a_ty);
auto* bar = b.Function("bar", ty.void_());
diff --git a/src/tint/lang/hlsl/writer/raise/shader_io_test.cc b/src/tint/lang/hlsl/writer/raise/shader_io_test.cc
index 8d01531..98dad86 100644
--- a/src/tint/lang/hlsl/writer/raise/shader_io_test.cc
+++ b/src/tint/lang/hlsl/writer/raise/shader_io_test.cc
@@ -150,7 +150,7 @@
{
mod.symbols.New("front_facing"),
ty.bool_(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ std::nullopt,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -162,7 +162,7 @@
{
mod.symbols.New("position"),
ty.vec4<f32>(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ std::nullopt,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -174,7 +174,7 @@
{
mod.symbols.New("color1"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 0u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -186,7 +186,7 @@
{
mod.symbols.New("color2"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 1u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -304,7 +304,7 @@
{
mod.symbols.New("position"),
ty.vec4<f32>(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ std::nullopt,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -316,7 +316,7 @@
{
mod.symbols.New("color1"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 0u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -511,7 +511,7 @@
{
mod.symbols.New("position"),
ty.vec4<f32>(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ std::nullopt,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -523,7 +523,7 @@
{
mod.symbols.New("color1"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 0u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -535,7 +535,7 @@
{
mod.symbols.New("color2"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 1u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -616,7 +616,7 @@
{
mod.symbols.New("color1"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 0u,
/* blend_src */ 0u,
/* color */ std::nullopt,
@@ -628,7 +628,7 @@
{
mod.symbols.New("color2"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 0u,
/* blend_src */ 1u,
/* color */ std::nullopt,
@@ -696,7 +696,7 @@
{
mod.symbols.New("position"),
ty.vec4<f32>(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ std::nullopt,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -708,7 +708,7 @@
{
mod.symbols.New("color"),
ty.vec3<f32>(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 0u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -844,7 +844,7 @@
{
mod.symbols.New("position"),
ty.vec4<f32>(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ std::nullopt,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -856,7 +856,7 @@
{
mod.symbols.New("color"),
ty.vec3<f32>(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 0u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -937,7 +937,7 @@
{
mod.symbols.New("position"),
vec4f,
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ std::nullopt,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -949,7 +949,7 @@
{
mod.symbols.New("color"),
vec4f,
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 0u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
diff --git a/src/tint/lang/msl/writer/raise/shader_io_test.cc b/src/tint/lang/msl/writer/raise/shader_io_test.cc
index eb2f01d..c38d4c1 100644
--- a/src/tint/lang/msl/writer/raise/shader_io_test.cc
+++ b/src/tint/lang/msl/writer/raise/shader_io_test.cc
@@ -146,7 +146,7 @@
{
mod.symbols.New("front_facing"),
ty.bool_(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ std::nullopt,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -158,7 +158,7 @@
{
mod.symbols.New("position"),
ty.vec4<f32>(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ std::nullopt,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -170,7 +170,7 @@
{
mod.symbols.New("color1"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 0u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -182,7 +182,7 @@
{
mod.symbols.New("color2"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 1u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -293,7 +293,7 @@
{
mod.symbols.New("position"),
ty.vec4<f32>(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ std::nullopt,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -305,7 +305,7 @@
{
mod.symbols.New("color1"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 0u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -500,7 +500,7 @@
{
mod.symbols.New("position"),
ty.vec4<f32>(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ std::nullopt,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -512,7 +512,7 @@
{
mod.symbols.New("color1"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 0u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -524,7 +524,7 @@
{
mod.symbols.New("color2"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 1u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -607,7 +607,7 @@
{
mod.symbols.New("color1"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 0u,
/* blend_src */ 0u,
/* color */ std::nullopt,
@@ -619,7 +619,7 @@
{
mod.symbols.New("color2"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 0u,
/* blend_src */ 1u,
/* color */ std::nullopt,
@@ -693,7 +693,7 @@
{
mod.symbols.New("position"),
vec4f,
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ std::nullopt,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -705,7 +705,7 @@
{
mod.symbols.New("color"),
vec4f,
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 0u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -836,7 +836,7 @@
{
mod.symbols.New("position"),
vec4f,
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ std::nullopt,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -848,7 +848,7 @@
{
mod.symbols.New("color"),
vec4f,
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 0u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -933,7 +933,7 @@
{
mod.symbols.New("position"),
vec4f,
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ std::nullopt,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -945,7 +945,7 @@
{
mod.symbols.New("color"),
vec4f,
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 0u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
diff --git a/src/tint/lang/msl/writer/type_test.cc b/src/tint/lang/msl/writer/type_test.cc
index 6241253..7efe302 100644
--- a/src/tint/lang/msl/writer/type_test.cc
+++ b/src/tint/lang/msl/writer/type_test.cc
@@ -439,8 +439,8 @@
uint32_t mem_size = d.size == 0 ? d.type->Size() : d.size;
uint32_t offset = tint::RoundUp(mem_align, size);
- members.Push(ty.Get<core::type::StructMember>(
- d.name, d.type, i, offset, mem_align, mem_size, core::type::StructMemberAttributes{}));
+ members.Push(ty.Get<core::type::StructMember>(d.name, d.type, i, offset, mem_align,
+ mem_size, core::IOAttributes{}));
align = std::max(align, mem_align);
size = offset + mem_size;
diff --git a/src/tint/lang/spirv/reader/lower/shader_io.cc b/src/tint/lang/spirv/reader/lower/shader_io.cc
index a786791..0a076f9 100644
--- a/src/tint/lang/spirv/reader/lower/shader_io.cc
+++ b/src/tint/lang/spirv/reader/lower/shader_io.cc
@@ -179,7 +179,7 @@
Vector<core::ir::Value*, 4> results;
Vector<core::type::Manager::StructMemberDesc, 4> output_descriptors;
auto add_output = [&](Symbol name, const core::type::Type* type,
- core::type::StructMemberAttributes attributes) {
+ core::IOAttributes attributes) {
if (!name) {
name = ir.symbols.New();
}
@@ -194,7 +194,7 @@
// Copy the variable attributes to the struct member.
const auto& original_attributes = var->Attributes();
- core::type::StructMemberAttributes var_attributes;
+ core::IOAttributes var_attributes;
var_attributes.invariant = original_attributes.invariant;
var_attributes.builtin = original_attributes.builtin;
var_attributes.location = original_attributes.location;
diff --git a/src/tint/lang/spirv/reader/lower/shader_io_test.cc b/src/tint/lang/spirv/reader/lower/shader_io_test.cc
index 349db27..24a3d7e 100644
--- a/src/tint/lang/spirv/reader/lower/shader_io_test.cc
+++ b/src/tint/lang/spirv/reader/lower/shader_io_test.cc
@@ -39,15 +39,15 @@
class SpirvReader_ShaderIOTest : public core::ir::transform::TransformTest {
protected:
- core::type::StructMemberAttributes BuiltinAttrs(core::BuiltinValue builtin) {
- core::type::StructMemberAttributes attrs;
+ core::IOAttributes BuiltinAttrs(core::BuiltinValue builtin) {
+ core::IOAttributes attrs;
attrs.builtin = builtin;
return attrs;
}
- core::type::StructMemberAttributes LocationAttrs(
+ core::IOAttributes LocationAttrs(
uint32_t location,
std::optional<core::Interpolation> interpolation = std::nullopt) {
- core::type::StructMemberAttributes attrs;
+ core::IOAttributes attrs;
attrs.location = location;
attrs.interpolation = interpolation;
return attrs;
@@ -800,7 +800,7 @@
core::type::Manager::StructMemberDesc{
mod.symbols.New("color2"),
ty.vec4<f32>(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ std::nullopt,
/* index */ std::nullopt,
/* color */ std::nullopt,
@@ -1526,7 +1526,7 @@
core::type::Manager::StructMemberDesc{
mod.symbols.New("color2"),
ty.vec4<f32>(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ std::nullopt,
/* index */ std::nullopt,
/* color */ std::nullopt,
diff --git a/src/tint/lang/spirv/reader/parser/parser.cc b/src/tint/lang/spirv/reader/parser/parser.cc
index 6dd8fb0..ce7e223 100644
--- a/src/tint/lang/spirv/reader/parser/parser.cc
+++ b/src/tint/lang/spirv/reader/parser/parser.cc
@@ -257,7 +257,7 @@
auto* member_ty = Type(struct_ty->element_types()[i]);
uint32_t align = std::max<uint32_t>(member_ty->Align(), 1u);
uint32_t offset = tint::RoundUp(align, current_size);
- core::type::StructMemberAttributes attributes;
+ core::IOAttributes attributes;
auto interpolation = [&]() -> core::Interpolation& {
// Create the interpolation field with the default values on first call.
if (!attributes.interpolation.has_value()) {
diff --git a/src/tint/lang/spirv/writer/function_test.cc b/src/tint/lang/spirv/writer/function_test.cc
index b6e40be..fb45a3a 100644
--- a/src/tint/lang/spirv/writer/function_test.cc
+++ b/src/tint/lang/spirv/writer/function_test.cc
@@ -464,7 +464,7 @@
{
mod.symbols.Register("a"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 0u,
/* index */ 0u,
/* color */ std::nullopt,
@@ -476,7 +476,7 @@
{
mod.symbols.Register("b"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 0u,
/* index */ 1u,
/* color */ std::nullopt,
diff --git a/src/tint/lang/spirv/writer/raise/shader_io_test.cc b/src/tint/lang/spirv/writer/raise/shader_io_test.cc
index 838954b..dcb6c83 100644
--- a/src/tint/lang/spirv/writer/raise/shader_io_test.cc
+++ b/src/tint/lang/spirv/writer/raise/shader_io_test.cc
@@ -152,7 +152,7 @@
{
mod.symbols.New("front_facing"),
ty.bool_(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ std::nullopt,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -164,7 +164,7 @@
{
mod.symbols.New("position"),
ty.vec4<f32>(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ std::nullopt,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -176,7 +176,7 @@
{
mod.symbols.New("color1"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 0u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -188,7 +188,7 @@
{
mod.symbols.New("color2"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 1u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -304,7 +304,7 @@
{
mod.symbols.New("position"),
ty.vec4<f32>(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ std::nullopt,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -316,7 +316,7 @@
{
mod.symbols.New("color1"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 0u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -518,7 +518,7 @@
{
mod.symbols.New("position"),
ty.vec4<f32>(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ std::nullopt,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -530,7 +530,7 @@
{
mod.symbols.New("color1"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 0u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -542,7 +542,7 @@
{
mod.symbols.New("color2"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 1u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -628,7 +628,7 @@
{
mod.symbols.New("color1"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 0u,
/* blend_src */ 0u,
/* color */ std::nullopt,
@@ -640,7 +640,7 @@
{
mod.symbols.New("color2"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 0u,
/* blend_src */ 1u,
/* color */ std::nullopt,
@@ -716,7 +716,7 @@
{
mod.symbols.New("position"),
vec4f,
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ std::nullopt,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -728,7 +728,7 @@
{
mod.symbols.New("color"),
vec4f,
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 0u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -857,7 +857,7 @@
{
mod.symbols.New("position"),
vec4f,
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ std::nullopt,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -869,7 +869,7 @@
{
mod.symbols.New("color"),
vec4f,
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 0u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -952,7 +952,7 @@
{
mod.symbols.New("color"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 0u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -964,7 +964,7 @@
{
mod.symbols.New("mask"),
ty.u32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ std::nullopt,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -1048,7 +1048,7 @@
{
mod.symbols.New("color"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 1u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -1196,7 +1196,7 @@
{
mod.symbols.New("color"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 0u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -1208,7 +1208,7 @@
{
mod.symbols.New("depth"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ std::nullopt,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -1293,7 +1293,7 @@
{
mod.symbols.New("color"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 0u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -1305,7 +1305,7 @@
{
mod.symbols.New("depth"),
ty.f32(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ std::nullopt,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -1498,7 +1498,7 @@
{
mod.symbols.New("out1"),
ty.f16(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 1u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -1510,7 +1510,7 @@
{
mod.symbols.New("out2"),
ty.vec4<f16>(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 2u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -1592,7 +1592,7 @@
{
mod.symbols.New("out1"),
ty.f16(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 1u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
@@ -1604,7 +1604,7 @@
{
mod.symbols.New("out2"),
ty.vec4<f16>(),
- core::type::StructMemberAttributes{
+ core::IOAttributes{
/* location */ 2u,
/* blend_src */ std::nullopt,
/* color */ std::nullopt,
diff --git a/src/tint/lang/wgsl/resolver/inferred_type_test.cc b/src/tint/lang/wgsl/resolver/inferred_type_test.cc
index ba549b1..5d73398 100644
--- a/src/tint/lang/wgsl/resolver/inferred_type_test.cc
+++ b/src/tint/lang/wgsl/resolver/inferred_type_test.cc
@@ -157,7 +157,7 @@
auto* expected_type = create<sem::Struct>(
str, str->name->symbol,
Vector{create<sem::StructMember>(member, member->name->symbol, create<core::type::I32>(),
- 0u, 0u, 0u, 4u, core::type::StructMemberAttributes{})},
+ 0u, 0u, 0u, 4u, core::IOAttributes{})},
0u, 4u, 4u);
auto* ctor_expr = Call(ty.Of(str));
diff --git a/src/tint/lang/wgsl/resolver/resolver.cc b/src/tint/lang/wgsl/resolver/resolver.cc
index 4b95a76..2362908 100644
--- a/src/tint/lang/wgsl/resolver/resolver.cc
+++ b/src/tint/lang/wgsl/resolver/resolver.cc
@@ -4380,7 +4380,7 @@
bool has_offset_attr = false;
bool has_align_attr = false;
bool has_size_attr = false;
- core::type::StructMemberAttributes attributes;
+ core::IOAttributes attributes;
for (auto* attribute : member->attributes) {
Mark(attribute);
bool ok = Switch(
diff --git a/src/tint/lang/wgsl/sem/struct.cc b/src/tint/lang/wgsl/sem/struct.cc
index 3d94cab..fe2d8c0 100644
--- a/src/tint/lang/wgsl/sem/struct.cc
+++ b/src/tint/lang/wgsl/sem/struct.cc
@@ -53,7 +53,7 @@
uint32_t offset,
uint32_t align,
uint32_t size,
- const core::type::StructMemberAttributes& attributes)
+ const core::IOAttributes& attributes)
: Base(name, type, index, offset, align, size, attributes), declaration_(declaration) {
TINT_ASSERT(declaration != nullptr);
}
diff --git a/src/tint/lang/wgsl/sem/struct.h b/src/tint/lang/wgsl/sem/struct.h
index edb58d4..2cc1bc2 100644
--- a/src/tint/lang/wgsl/sem/struct.h
+++ b/src/tint/lang/wgsl/sem/struct.h
@@ -103,7 +103,7 @@
uint32_t offset,
uint32_t align,
uint32_t size,
- const core::type::StructMemberAttributes& attributes);
+ const core::IOAttributes& attributes);
/// Destructor
~StructMember() override;