Add symbol to member name.
This CL adds the symbol to the struct member. The name will eventually be removed when the symbol is used everywhere. Change-Id: Ie97f61509804992b44b22396773a635efbc4458e Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35780 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Auto-Submit: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
parent
be96376d8e
commit
36e22f0f3b
|
@ -24,10 +24,12 @@ namespace tint {
|
|||
namespace ast {
|
||||
|
||||
StructMember::StructMember(const Source& source,
|
||||
const Symbol& sym,
|
||||
const std::string& name,
|
||||
type::Type* type,
|
||||
StructMemberDecorationList decorations)
|
||||
: Base(source),
|
||||
symbol_(sym),
|
||||
name_(name),
|
||||
type_(type),
|
||||
decorations_(std::move(decorations)) {}
|
||||
|
@ -56,11 +58,12 @@ uint32_t StructMember::offset() const {
|
|||
|
||||
StructMember* StructMember::Clone(CloneContext* ctx) const {
|
||||
return ctx->mod->create<StructMember>(
|
||||
ctx->Clone(source()), name_, ctx->Clone(type_), ctx->Clone(decorations_));
|
||||
ctx->Clone(source()), ctx->Clone(symbol_), name_, ctx->Clone(type_),
|
||||
ctx->Clone(decorations_));
|
||||
}
|
||||
|
||||
bool StructMember::IsValid() const {
|
||||
if (name_.empty() || type_ == nullptr) {
|
||||
if (name_.empty() || type_ == nullptr || !symbol_.IsValid()) {
|
||||
return false;
|
||||
}
|
||||
for (auto* deco : decorations_) {
|
||||
|
@ -81,7 +84,7 @@ void StructMember::to_str(std::ostream& out, size_t indent) const {
|
|||
out << "]] ";
|
||||
}
|
||||
|
||||
out << name_ << ": " << type_->type_name() << "}" << std::endl;
|
||||
out << symbol_.to_str() << ": " << type_->type_name() << "}" << std::endl;
|
||||
}
|
||||
|
||||
} // namespace ast
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "src/ast/node.h"
|
||||
#include "src/ast/struct_member_decoration.h"
|
||||
#include "src/ast/type/type.h"
|
||||
#include "src/symbol.h"
|
||||
|
||||
namespace tint {
|
||||
namespace ast {
|
||||
|
@ -33,10 +34,12 @@ class StructMember : public Castable<StructMember, Node> {
|
|||
public:
|
||||
/// Create a new struct member statement
|
||||
/// @param source The input source for the struct member statement
|
||||
/// @param sym The struct member symbol
|
||||
/// @param name The struct member name
|
||||
/// @param type The struct member type
|
||||
/// @param decorations The struct member decorations
|
||||
StructMember(const Source& source,
|
||||
const Symbol& sym,
|
||||
const std::string& name,
|
||||
type::Type* type,
|
||||
StructMemberDecorationList decorations);
|
||||
|
@ -45,6 +48,8 @@ class StructMember : public Castable<StructMember, Node> {
|
|||
|
||||
~StructMember() override;
|
||||
|
||||
/// @returns the symbol
|
||||
const Symbol& symbol() const { return symbol_; }
|
||||
/// @returns the name
|
||||
const std::string& name() const { return name_; }
|
||||
/// @returns the type
|
||||
|
@ -77,6 +82,7 @@ class StructMember : public Castable<StructMember, Node> {
|
|||
private:
|
||||
StructMember(const StructMember&) = delete;
|
||||
|
||||
Symbol const symbol_;
|
||||
std::string const name_;
|
||||
type::Type* const type_;
|
||||
StructMemberDecorationList const decorations_;
|
||||
|
|
|
@ -31,7 +31,9 @@ TEST_F(StructMemberTest, Creation) {
|
|||
StructMemberDecorationList decorations;
|
||||
decorations.emplace_back(create<StructMemberOffsetDecoration>(4));
|
||||
|
||||
auto* st = create<StructMember>("a", ty.i32, decorations);
|
||||
auto* st =
|
||||
create<StructMember>(mod->RegisterSymbol("a"), "a", ty.i32, decorations);
|
||||
EXPECT_EQ(st->symbol(), Symbol(1));
|
||||
EXPECT_EQ(st->name(), "a");
|
||||
EXPECT_EQ(st->type(), ty.i32);
|
||||
EXPECT_EQ(st->decorations().size(), 1u);
|
||||
|
@ -45,7 +47,8 @@ TEST_F(StructMemberTest, Creation) {
|
|||
TEST_F(StructMemberTest, CreationWithSource) {
|
||||
auto* st = create<StructMember>(
|
||||
Source{Source::Range{Source::Location{27, 4}, Source::Location{27, 8}}},
|
||||
"a", ty.i32, StructMemberDecorationList{});
|
||||
mod->RegisterSymbol("a"), "a", ty.i32, StructMemberDecorationList{});
|
||||
EXPECT_EQ(st->symbol(), Symbol(1));
|
||||
EXPECT_EQ(st->name(), "a");
|
||||
EXPECT_EQ(st->type(), ty.i32);
|
||||
EXPECT_EQ(st->decorations().size(), 0u);
|
||||
|
@ -56,17 +59,20 @@ TEST_F(StructMemberTest, CreationWithSource) {
|
|||
}
|
||||
|
||||
TEST_F(StructMemberTest, IsValid) {
|
||||
auto* st = create<StructMember>("a", ty.i32, StructMemberDecorationList{});
|
||||
auto* st = create<StructMember>(mod->RegisterSymbol("a"), "a", ty.i32,
|
||||
StructMemberDecorationList{});
|
||||
EXPECT_TRUE(st->IsValid());
|
||||
}
|
||||
|
||||
TEST_F(StructMemberTest, IsValid_EmptyName) {
|
||||
auto* st = create<StructMember>("", ty.i32, StructMemberDecorationList{});
|
||||
TEST_F(StructMemberTest, IsValid_EmptySymbol) {
|
||||
auto* st = create<StructMember>(mod->RegisterSymbol(""), "", ty.i32,
|
||||
StructMemberDecorationList{});
|
||||
EXPECT_FALSE(st->IsValid());
|
||||
}
|
||||
|
||||
TEST_F(StructMemberTest, IsValid_NullType) {
|
||||
auto* st = create<StructMember>("a", nullptr, StructMemberDecorationList{});
|
||||
auto* st = create<StructMember>(mod->RegisterSymbol("a"), "a", nullptr,
|
||||
StructMemberDecorationList{});
|
||||
EXPECT_FALSE(st->IsValid());
|
||||
}
|
||||
|
||||
|
@ -75,7 +81,8 @@ TEST_F(StructMemberTest, IsValid_Null_Decoration) {
|
|||
decorations.emplace_back(create<StructMemberOffsetDecoration>(4));
|
||||
decorations.push_back(nullptr);
|
||||
|
||||
auto* st = create<StructMember>("a", ty.i32, decorations);
|
||||
auto* st =
|
||||
create<StructMember>(mod->RegisterSymbol("a"), "a", ty.i32, decorations);
|
||||
EXPECT_FALSE(st->IsValid());
|
||||
}
|
||||
|
||||
|
@ -83,17 +90,19 @@ TEST_F(StructMemberTest, ToStr) {
|
|||
StructMemberDecorationList decorations;
|
||||
decorations.emplace_back(create<StructMemberOffsetDecoration>(4));
|
||||
|
||||
auto* st = create<StructMember>("a", ty.i32, decorations);
|
||||
auto* st =
|
||||
create<StructMember>(mod->RegisterSymbol("a"), "a", ty.i32, decorations);
|
||||
std::ostringstream out;
|
||||
st->to_str(out, 2);
|
||||
EXPECT_EQ(out.str(), " StructMember{[[ offset 4 ]] a: __i32}\n");
|
||||
EXPECT_EQ(demangle(out.str()), " StructMember{[[ offset 4 ]] a: __i32}\n");
|
||||
}
|
||||
|
||||
TEST_F(StructMemberTest, ToStrNoDecorations) {
|
||||
auto* st = create<StructMember>("a", ty.i32, StructMemberDecorationList{});
|
||||
auto* st = create<StructMember>(mod->RegisterSymbol("a"), "a", ty.i32,
|
||||
StructMemberDecorationList{});
|
||||
std::ostringstream out;
|
||||
st->to_str(out, 2);
|
||||
EXPECT_EQ(out.str(), " StructMember{a: __i32}\n");
|
||||
EXPECT_EQ(demangle(out.str()), " StructMember{a: __i32}\n");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -31,8 +31,8 @@ using StructTest = TestHelper;
|
|||
|
||||
TEST_F(StructTest, Creation) {
|
||||
StructMemberList members;
|
||||
members.push_back(
|
||||
create<StructMember>("a", ty.i32, StructMemberDecorationList{}));
|
||||
members.push_back(create<StructMember>(mod->RegisterSymbol("a"), "a", ty.i32,
|
||||
StructMemberDecorationList{}));
|
||||
|
||||
auto* s = create<Struct>(members, ast::StructDecorationList{});
|
||||
EXPECT_EQ(s->members().size(), 1u);
|
||||
|
@ -45,8 +45,8 @@ TEST_F(StructTest, Creation) {
|
|||
|
||||
TEST_F(StructTest, Creation_WithDecorations) {
|
||||
StructMemberList members;
|
||||
members.push_back(
|
||||
create<StructMember>("a", ty.i32, StructMemberDecorationList{}));
|
||||
members.push_back(create<StructMember>(mod->RegisterSymbol("a"), "a", ty.i32,
|
||||
StructMemberDecorationList{}));
|
||||
|
||||
StructDecorationList decos;
|
||||
decos.push_back(create<StructBlockDecoration>());
|
||||
|
@ -63,8 +63,8 @@ TEST_F(StructTest, Creation_WithDecorations) {
|
|||
|
||||
TEST_F(StructTest, CreationWithSourceAndDecorations) {
|
||||
StructMemberList members;
|
||||
members.emplace_back(
|
||||
create<StructMember>("a", ty.i32, StructMemberDecorationList{}));
|
||||
members.emplace_back(create<StructMember>(
|
||||
mod->RegisterSymbol("a"), "a", ty.i32, StructMemberDecorationList{}));
|
||||
|
||||
StructDecorationList decos;
|
||||
decos.push_back(create<StructBlockDecoration>());
|
||||
|
@ -88,8 +88,8 @@ TEST_F(StructTest, IsValid) {
|
|||
|
||||
TEST_F(StructTest, IsValid_Null_StructMember) {
|
||||
StructMemberList members;
|
||||
members.push_back(
|
||||
create<StructMember>("a", ty.i32, StructMemberDecorationList{}));
|
||||
members.push_back(create<StructMember>(mod->RegisterSymbol("a"), "a", ty.i32,
|
||||
StructMemberDecorationList{}));
|
||||
members.push_back(nullptr);
|
||||
|
||||
auto* s = create<Struct>(members, ast::StructDecorationList{});
|
||||
|
@ -98,8 +98,8 @@ TEST_F(StructTest, IsValid_Null_StructMember) {
|
|||
|
||||
TEST_F(StructTest, IsValid_Invalid_StructMember) {
|
||||
StructMemberList members;
|
||||
members.push_back(
|
||||
create<StructMember>("", ty.i32, StructMemberDecorationList{}));
|
||||
members.push_back(create<StructMember>(mod->RegisterSymbol(""), "", ty.i32,
|
||||
StructMemberDecorationList{}));
|
||||
|
||||
auto* s = create<Struct>(members, ast::StructDecorationList{});
|
||||
EXPECT_FALSE(s->IsValid());
|
||||
|
@ -107,8 +107,8 @@ TEST_F(StructTest, IsValid_Invalid_StructMember) {
|
|||
|
||||
TEST_F(StructTest, ToStr) {
|
||||
StructMemberList members;
|
||||
members.emplace_back(
|
||||
create<StructMember>("a", ty.i32, StructMemberDecorationList{}));
|
||||
members.emplace_back(create<StructMember>(
|
||||
mod->RegisterSymbol("a"), "a", ty.i32, StructMemberDecorationList{}));
|
||||
|
||||
StructDecorationList decos;
|
||||
decos.push_back(create<StructBlockDecoration>());
|
||||
|
@ -117,7 +117,7 @@ TEST_F(StructTest, ToStr) {
|
|||
|
||||
std::ostringstream out;
|
||||
s->to_str(out, 2);
|
||||
EXPECT_EQ(out.str(), R"(Struct{
|
||||
EXPECT_EQ(demangle(out.str()), R"(Struct{
|
||||
[[block]]
|
||||
StructMember{a: __i32}
|
||||
}
|
||||
|
|
|
@ -124,11 +124,13 @@ TEST_F(AccessControlTest, MinBufferBindingSizeStruct) {
|
|||
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<StructMember>("foo", &u32, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("foo"), "foo", &u32, deco));
|
||||
|
||||
deco = StructMemberDecorationList();
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(4));
|
||||
members.push_back(create<StructMember>("bar", &u32, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("bar"), "bar", &u32, deco));
|
||||
|
||||
StructDecorationList decos;
|
||||
|
||||
|
@ -166,12 +168,14 @@ TEST_F(AccessControlTest, BaseAlignmentStruct) {
|
|||
{
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<StructMember>("foo", &u32, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("foo"), "foo", &u32, deco));
|
||||
}
|
||||
{
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(4));
|
||||
members.push_back(create<StructMember>("bar", &u32, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("bar"), "bar", &u32, deco));
|
||||
}
|
||||
StructDecorationList decos;
|
||||
|
||||
|
|
|
@ -198,12 +198,14 @@ TEST_F(AliasTest, MinBufferBindingSizeStruct) {
|
|||
{
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<StructMember>("foo", &u32, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("foo"), "foo", &u32, deco));
|
||||
}
|
||||
{
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(4));
|
||||
members.push_back(create<StructMember>("bar", &u32, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("bar"), "bar", &u32, deco));
|
||||
}
|
||||
StructDecorationList decos;
|
||||
|
||||
|
@ -247,12 +249,14 @@ TEST_F(AliasTest, BaseAlignmentStruct) {
|
|||
{
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<StructMember>("foo", &u32, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("foo"), "foo", &u32, deco));
|
||||
}
|
||||
{
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(4));
|
||||
members.push_back(create<StructMember>("bar", &u32, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("bar"), "bar", &u32, deco));
|
||||
}
|
||||
StructDecorationList decos;
|
||||
|
||||
|
|
|
@ -81,12 +81,14 @@ TEST_F(StructTest, MinBufferBindingSize) {
|
|||
{
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<StructMember>("foo", &u32, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("foo"), "foo", &u32, deco));
|
||||
}
|
||||
{
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(4));
|
||||
members.push_back(create<StructMember>("bar", &u32, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("bar"), "bar", &u32, deco));
|
||||
}
|
||||
StructDecorationList decos;
|
||||
|
||||
|
@ -105,17 +107,20 @@ TEST_F(StructTest, MinBufferBindingSizeArray) {
|
|||
{
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<StructMember>("foo", &u32, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("foo"), "foo", &u32, deco));
|
||||
}
|
||||
{
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(4));
|
||||
members.push_back(create<StructMember>("bar", &u32, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("bar"), "bar", &u32, deco));
|
||||
}
|
||||
{
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(8));
|
||||
members.push_back(create<StructMember>("bar", &arr, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("bar"), "bar", &arr, deco));
|
||||
}
|
||||
StructDecorationList decos;
|
||||
|
||||
|
@ -135,17 +140,20 @@ TEST_F(StructTest, MinBufferBindingSizeRuntimeArray) {
|
|||
{
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<StructMember>("foo", &u32, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("foo"), "foo", &u32, deco));
|
||||
}
|
||||
{
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(4));
|
||||
members.push_back(create<StructMember>("bar", &u32, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("bar"), "bar", &u32, deco));
|
||||
}
|
||||
{
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(8));
|
||||
members.push_back(create<StructMember>("bar", &u32, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("bar"), "bar", &u32, deco));
|
||||
}
|
||||
StructDecorationList decos;
|
||||
|
||||
|
@ -163,7 +171,8 @@ TEST_F(StructTest, MinBufferBindingSizeVec2) {
|
|||
{
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<StructMember>("foo", &vec2, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("foo"), "foo", &vec2, deco));
|
||||
}
|
||||
StructDecorationList decos;
|
||||
|
||||
|
@ -182,7 +191,8 @@ TEST_F(StructTest, MinBufferBindingSizeVec3) {
|
|||
{
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<StructMember>("foo", &vec3, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("foo"), "foo", &vec3, deco));
|
||||
}
|
||||
StructDecorationList decos;
|
||||
|
||||
|
@ -202,7 +212,8 @@ TEST_F(StructTest, MinBufferBindingSizeVec4) {
|
|||
{
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<StructMember>("foo", &vec4, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("foo"), "foo", &vec4, deco));
|
||||
}
|
||||
StructDecorationList decos;
|
||||
|
||||
|
@ -221,12 +232,14 @@ TEST_F(StructTest, BaseAlignment) {
|
|||
{
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<StructMember>("foo", &u32, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("foo"), "foo", &u32, deco));
|
||||
}
|
||||
{
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(4));
|
||||
members.push_back(create<StructMember>("bar", &u32, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("bar"), "bar", &u32, deco));
|
||||
}
|
||||
StructDecorationList decos;
|
||||
|
||||
|
@ -244,17 +257,20 @@ TEST_F(StructTest, BaseAlignmentArray) {
|
|||
{
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<StructMember>("foo", &u32, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("foo"), "foo", &u32, deco));
|
||||
}
|
||||
{
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(4));
|
||||
members.push_back(create<StructMember>("bar", &u32, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("bar"), "bar", &u32, deco));
|
||||
}
|
||||
{
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(8));
|
||||
members.push_back(create<StructMember>("bar", &arr, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("bar"), "bar", &arr, deco));
|
||||
}
|
||||
StructDecorationList decos;
|
||||
|
||||
|
@ -272,17 +288,20 @@ TEST_F(StructTest, BaseAlignmentRuntimeArray) {
|
|||
{
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<StructMember>("foo", &u32, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("foo"), "foo", &u32, deco));
|
||||
}
|
||||
{
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(4));
|
||||
members.push_back(create<StructMember>("bar", &u32, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("bar"), "bar", &u32, deco));
|
||||
}
|
||||
{
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(8));
|
||||
members.push_back(create<StructMember>("bar", &u32, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("bar"), "bar", &u32, deco));
|
||||
}
|
||||
StructDecorationList decos;
|
||||
|
||||
|
@ -299,7 +318,8 @@ TEST_F(StructTest, BaseAlignmentVec2) {
|
|||
{
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<StructMember>("foo", &vec2, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("foo"), "foo", &vec2, deco));
|
||||
}
|
||||
StructDecorationList decos;
|
||||
|
||||
|
@ -317,7 +337,8 @@ TEST_F(StructTest, BaseAlignmentVec3) {
|
|||
{
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<StructMember>("foo", &vec3, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("foo"), "foo", &vec3, deco));
|
||||
}
|
||||
StructDecorationList decos;
|
||||
|
||||
|
@ -335,7 +356,8 @@ TEST_F(StructTest, BaseAlignmentVec4) {
|
|||
{
|
||||
StructMemberDecorationList deco;
|
||||
deco.push_back(create<StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<StructMember>("foo", &vec4, deco));
|
||||
members.push_back(
|
||||
create<StructMember>(mod->RegisterSymbol("foo"), "foo", &vec4, deco));
|
||||
}
|
||||
StructDecorationList decos;
|
||||
|
||||
|
|
|
@ -305,8 +305,10 @@ class InspectorHelper {
|
|||
deco.push_back(
|
||||
create<ast::StructMemberOffsetDecoration>(Source{}, offset));
|
||||
|
||||
auto member_name = StructMemberName(members.size(), type);
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, StructMemberName(members.size(), type), type, deco));
|
||||
Source{}, mod()->RegisterSymbol(member_name), member_name, type,
|
||||
deco));
|
||||
}
|
||||
|
||||
ast::StructDecorationList decos;
|
||||
|
@ -1460,9 +1462,9 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, MissingBlockDeco) {
|
|||
ast::StructMemberDecorationList deco;
|
||||
deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
|
||||
|
||||
auto name = StructMemberName(members.size(), i32_type());
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, StructMemberName(members.size(), i32_type()), i32_type(),
|
||||
deco));
|
||||
Source{}, mod()->RegisterSymbol(name), name, i32_type(), deco));
|
||||
|
||||
ast::StructDecorationList decos;
|
||||
|
||||
|
|
|
@ -940,9 +940,9 @@ ast::type::Type* ParserImpl::ConvertType(
|
|||
++num_non_writable_members;
|
||||
}
|
||||
const auto member_name = namer_.GetMemberName(type_id, member_index);
|
||||
auto* ast_struct_member =
|
||||
create<ast::StructMember>(Source{}, member_name, ast_member_ty,
|
||||
std::move(ast_member_decorations));
|
||||
auto* ast_struct_member = create<ast::StructMember>(
|
||||
Source{}, ast_module_.RegisterSymbol(member_name), member_name,
|
||||
ast_member_ty, std::move(ast_member_decorations));
|
||||
ast_members.push_back(ast_struct_member);
|
||||
}
|
||||
|
||||
|
|
|
@ -566,7 +566,7 @@ TEST_F(SpvParserTest, ConvertType_StructTwoMembers) {
|
|||
EXPECT_TRUE(type->Is<ast::type::Struct>());
|
||||
std::stringstream ss;
|
||||
type->As<ast::type::Struct>()->impl()->to_str(ss, 0);
|
||||
EXPECT_THAT(ss.str(), Eq(R"(Struct{
|
||||
EXPECT_THAT(Demangler().Demangle(p->get_module(), ss.str()), Eq(R"(Struct{
|
||||
StructMember{field0: __u32}
|
||||
StructMember{field1: __f32}
|
||||
}
|
||||
|
@ -587,7 +587,7 @@ TEST_F(SpvParserTest, ConvertType_StructWithBlockDecoration) {
|
|||
EXPECT_TRUE(type->Is<ast::type::Struct>());
|
||||
std::stringstream ss;
|
||||
type->As<ast::type::Struct>()->impl()->to_str(ss, 0);
|
||||
EXPECT_THAT(ss.str(), Eq(R"(Struct{
|
||||
EXPECT_THAT(Demangler().Demangle(p->get_module(), ss.str()), Eq(R"(Struct{
|
||||
[[block]]
|
||||
StructMember{field0: __u32}
|
||||
}
|
||||
|
@ -612,7 +612,7 @@ TEST_F(SpvParserTest, ConvertType_StructWithMemberDecorations) {
|
|||
EXPECT_TRUE(type->Is<ast::type::Struct>());
|
||||
std::stringstream ss;
|
||||
type->As<ast::type::Struct>()->impl()->to_str(ss, 0);
|
||||
EXPECT_THAT(ss.str(), Eq(R"(Struct{
|
||||
EXPECT_THAT(Demangler().Demangle(p->get_module(), ss.str()), Eq(R"(Struct{
|
||||
StructMember{[[ offset 0 ]] field0: __f32}
|
||||
StructMember{[[ offset 8 ]] field1: __vec_2__f32}
|
||||
StructMember{[[ offset 16 ]] field2: __mat_2_2__f32}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "src/ast/type/matrix_type.h"
|
||||
#include "src/ast/type/struct_type.h"
|
||||
#include "src/ast/type/vector_type.h"
|
||||
#include "src/demangler.h"
|
||||
#include "src/reader/spirv/parser_impl.h"
|
||||
#include "src/reader/spirv/parser_impl_test_helper.h"
|
||||
#include "src/reader/spirv/spirv_tools_helpers_test.h"
|
||||
|
@ -59,7 +60,8 @@ TEST_F(SpvParserTest, NamedTypes_Dup_EmitBoth) {
|
|||
%s2 = OpTypeStruct %uint %uint
|
||||
)"));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule()) << p->error();
|
||||
EXPECT_THAT(p->module().to_str(), HasSubstr(R"(S Struct{
|
||||
EXPECT_THAT(Demangler().Demangle(p->get_module(), p->get_module().to_str()),
|
||||
HasSubstr(R"(S Struct{
|
||||
StructMember{field0: __u32}
|
||||
StructMember{field1: __u32}
|
||||
}
|
||||
|
|
|
@ -1246,8 +1246,9 @@ Expect<ast::StructMember*> ParserImpl::expect_struct_member(
|
|||
if (!expect("struct member", Token::Type::kSemicolon))
|
||||
return Failure::kErrored;
|
||||
|
||||
return create<ast::StructMember>(decl->source, decl->name, decl->type,
|
||||
std::move(member_decos.value));
|
||||
return create<ast::StructMember>(
|
||||
decl->source, module_.RegisterSymbol(decl->name), decl->name, decl->type,
|
||||
std::move(member_decos.value));
|
||||
}
|
||||
|
||||
// function_decl
|
||||
|
|
|
@ -87,7 +87,8 @@ TEST_F(ParserImplTest, VariableIdentDecl_ParsesWithAccessDeco_Read) {
|
|||
|
||||
auto p = parser("my_var : [[access(read)]] S");
|
||||
|
||||
ast::StructMember mem(Source{}, "a", &i32, ast::StructMemberDecorationList{});
|
||||
ast::StructMember mem(Source{}, p->get_module().RegisterSymbol("a"), "a",
|
||||
&i32, ast::StructMemberDecorationList{});
|
||||
ast::StructMemberList members;
|
||||
members.push_back(&mem);
|
||||
|
||||
|
@ -114,7 +115,8 @@ TEST_F(ParserImplTest, VariableIdentDecl_ParsesWithAccessDeco_ReadWrite) {
|
|||
|
||||
auto p = parser("my_var : [[access(read_write)]] S");
|
||||
|
||||
ast::StructMember mem(Source{}, "a", &i32, ast::StructMemberDecorationList{});
|
||||
ast::StructMember mem(Source{}, p->get_module().RegisterSymbol("a"), "a",
|
||||
&i32, ast::StructMemberDecorationList{});
|
||||
ast::StructMemberList members;
|
||||
members.push_back(&mem);
|
||||
|
||||
|
@ -141,7 +143,8 @@ TEST_F(ParserImplTest, VariableIdentDecl_MultipleAccessDecoFail) {
|
|||
|
||||
auto p = parser("my_var : [[access(read), access(read_write)]] S");
|
||||
|
||||
ast::StructMember mem(Source{}, "a", &i32, ast::StructMemberDecorationList{});
|
||||
ast::StructMember mem(Source{}, p->get_module().RegisterSymbol("a"), "a",
|
||||
&i32, ast::StructMemberDecorationList{});
|
||||
ast::StructMemberList members;
|
||||
members.push_back(&mem);
|
||||
|
||||
|
@ -165,7 +168,8 @@ TEST_F(ParserImplTest, VariableIdentDecl_MultipleAccessDeco_MultiBlock_Fail) {
|
|||
|
||||
auto p = parser("my_var : [[access(read)]][[access(read_write)]] S");
|
||||
|
||||
ast::StructMember mem(Source{}, "a", &i32, ast::StructMemberDecorationList{});
|
||||
ast::StructMember mem(Source{}, p->get_module().RegisterSymbol("a"), "a",
|
||||
&i32, ast::StructMemberDecorationList{});
|
||||
ast::StructMemberList members;
|
||||
members.push_back(&mem);
|
||||
|
||||
|
@ -205,7 +209,8 @@ TEST_F(ParserImplTest, VariableIdentDecl_NonAccessDecoFail) {
|
|||
|
||||
auto p = parser("my_var : [[stride(1)]] S");
|
||||
|
||||
ast::StructMember mem(Source{}, "a", &i32, ast::StructMemberDecorationList{});
|
||||
ast::StructMember mem(Source{}, p->get_module().RegisterSymbol("a"), "a",
|
||||
&i32, ast::StructMemberDecorationList{});
|
||||
ast::StructMemberList members;
|
||||
members.push_back(&mem);
|
||||
|
||||
|
|
|
@ -201,7 +201,8 @@ ast::Variable* FirstIndexOffset::AddUniformBuffer(ast::Module* mod) {
|
|||
member_dec.push_back(
|
||||
mod->create<ast::StructMemberOffsetDecoration>(Source{}, offset));
|
||||
members.push_back(mod->create<ast::StructMember>(
|
||||
Source{}, kFirstVertexName, u32_type, std::move(member_dec)));
|
||||
Source{}, mod->RegisterSymbol(kFirstVertexName), kFirstVertexName,
|
||||
u32_type, std::move(member_dec)));
|
||||
vertex_index_offset_ = offset;
|
||||
offset += 4;
|
||||
}
|
||||
|
@ -211,7 +212,8 @@ ast::Variable* FirstIndexOffset::AddUniformBuffer(ast::Module* mod) {
|
|||
member_dec.push_back(
|
||||
mod->create<ast::StructMemberOffsetDecoration>(Source{}, offset));
|
||||
members.push_back(mod->create<ast::StructMember>(
|
||||
Source{}, kFirstInstanceName, u32_type, std::move(member_dec)));
|
||||
Source{}, mod->RegisterSymbol(kFirstInstanceName), kFirstInstanceName,
|
||||
u32_type, std::move(member_dec)));
|
||||
instance_index_offset_ = offset;
|
||||
offset += 4;
|
||||
}
|
||||
|
|
|
@ -270,7 +270,8 @@ void VertexPulling::State::AddVertexStorageBuffers() {
|
|||
out->create<ast::StructMemberOffsetDecoration>(Source{}, 0u));
|
||||
|
||||
members.push_back(out->create<ast::StructMember>(
|
||||
Source{}, kStructBufferName, internal_array_type, std::move(member_dec)));
|
||||
Source{}, out->RegisterSymbol(kStructBufferName), kStructBufferName,
|
||||
internal_array_type, std::move(member_dec)));
|
||||
|
||||
ast::StructDecorationList decos;
|
||||
decos.push_back(out->create<ast::StructBlockDecoration>(Source{}));
|
||||
|
|
|
@ -787,8 +787,10 @@ TEST_F(TypeDeterminerTest, Function_NotRegisterFunctionVariable) {
|
|||
TEST_F(TypeDeterminerTest, Expr_MemberAccessor_Struct) {
|
||||
ast::StructMemberDecorationList decos;
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>("first_member", ty.i32, decos));
|
||||
members.push_back(create<ast::StructMember>("second_member", ty.f32, decos));
|
||||
members.push_back(create<ast::StructMember>(
|
||||
mod->RegisterSymbol("first_member"), "first_member", ty.i32, decos));
|
||||
members.push_back(create<ast::StructMember>(
|
||||
mod->RegisterSymbol("second_member"), "second_member", ty.f32, decos));
|
||||
|
||||
auto* strct = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
|
@ -812,8 +814,10 @@ TEST_F(TypeDeterminerTest, Expr_MemberAccessor_Struct) {
|
|||
TEST_F(TypeDeterminerTest, Expr_MemberAccessor_Struct_Alias) {
|
||||
ast::StructMemberDecorationList decos;
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>("first_member", ty.i32, decos));
|
||||
members.push_back(create<ast::StructMember>("second_member", ty.f32, decos));
|
||||
members.push_back(create<ast::StructMember>(
|
||||
mod->RegisterSymbol("first_member"), "first_member", ty.i32, decos));
|
||||
members.push_back(create<ast::StructMember>(
|
||||
mod->RegisterSymbol("second_member"), "second_member", ty.f32, decos));
|
||||
|
||||
auto* strct = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
|
@ -896,7 +900,8 @@ TEST_F(TypeDeterminerTest, Expr_Accessor_MultiLevel) {
|
|||
|
||||
ast::StructMemberDecorationList decos;
|
||||
ast::StructMemberList b_members;
|
||||
b_members.push_back(create<ast::StructMember>("foo", ty.vec4<f32>(), decos));
|
||||
b_members.push_back(create<ast::StructMember>(mod->RegisterSymbol("foo"),
|
||||
"foo", ty.vec4<f32>(), decos));
|
||||
|
||||
auto* strctB = create<ast::Struct>(b_members, ast::StructDecorationList{});
|
||||
ast::type::Struct stB(mod->RegisterSymbol("B"), "B", strctB);
|
||||
|
@ -904,7 +909,8 @@ TEST_F(TypeDeterminerTest, Expr_Accessor_MultiLevel) {
|
|||
ast::type::Vector vecB(&stB, 3);
|
||||
|
||||
ast::StructMemberList a_members;
|
||||
a_members.push_back(create<ast::StructMember>("mem", &vecB, decos));
|
||||
a_members.push_back(create<ast::StructMember>(mod->RegisterSymbol("mem"),
|
||||
"mem", &vecB, decos));
|
||||
|
||||
auto* strctA = create<ast::Struct>(a_members, ast::StructDecorationList{});
|
||||
|
||||
|
|
|
@ -45,12 +45,14 @@ TEST_F(ValidatorTypeTest, RuntimeArrayIsLast_Pass) {
|
|||
ast::StructMemberList members;
|
||||
{
|
||||
ast::StructMemberDecorationList deco;
|
||||
members.push_back(create<ast::StructMember>("vf", ty.f32, deco));
|
||||
members.push_back(create<ast::StructMember>(mod->RegisterSymbol("vf"), "vf",
|
||||
ty.f32, deco));
|
||||
}
|
||||
{
|
||||
ast::StructMemberDecorationList deco;
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{Source::Location{12, 34}}, "rt", ty.array<f32>(), deco));
|
||||
Source{Source::Location{12, 34}}, mod->RegisterSymbol("rt"), "rt",
|
||||
ty.array<f32>(), deco));
|
||||
}
|
||||
ast::StructDecorationList decos;
|
||||
decos.push_back(create<ast::StructBlockDecoration>());
|
||||
|
@ -70,12 +72,14 @@ TEST_F(ValidatorTypeTest, RuntimeArrayIsLastNoBlock_Fail) {
|
|||
ast::StructMemberList members;
|
||||
{
|
||||
ast::StructMemberDecorationList deco;
|
||||
members.push_back(create<ast::StructMember>("vf", ty.f32, deco));
|
||||
members.push_back(create<ast::StructMember>(mod->RegisterSymbol("vf"), "vf",
|
||||
ty.f32, deco));
|
||||
}
|
||||
{
|
||||
ast::StructMemberDecorationList deco;
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{Source::Location{12, 34}}, "rt", ty.array<f32>(), deco));
|
||||
Source{Source::Location{12, 34}}, mod->RegisterSymbol("rt"), "rt",
|
||||
ty.array<f32>(), deco));
|
||||
}
|
||||
ast::StructDecorationList decos;
|
||||
auto* st = create<ast::Struct>(members, decos);
|
||||
|
@ -99,11 +103,13 @@ TEST_F(ValidatorTypeTest, RuntimeArrayIsNotLast_Fail) {
|
|||
{
|
||||
ast::StructMemberDecorationList deco;
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{Source::Location{12, 34}}, "rt", ty.array<f32>(), deco));
|
||||
Source{Source::Location{12, 34}}, mod->RegisterSymbol("rt"), "rt",
|
||||
ty.array<f32>(), deco));
|
||||
}
|
||||
{
|
||||
ast::StructMemberDecorationList deco;
|
||||
members.push_back(create<ast::StructMember>("vf", ty.f32, deco));
|
||||
members.push_back(create<ast::StructMember>(mod->RegisterSymbol("vf"), "vf",
|
||||
ty.f32, deco));
|
||||
}
|
||||
ast::StructDecorationList decos;
|
||||
decos.push_back(create<ast::StructBlockDecoration>());
|
||||
|
@ -131,12 +137,14 @@ TEST_F(ValidatorTypeTest, AliasRuntimeArrayIsNotLast_Fail) {
|
|||
ast::StructMemberList members;
|
||||
{
|
||||
ast::StructMemberDecorationList deco;
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{Source::Location{12, 34}}, "b", &alias, deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(Source{Source::Location{12, 34}},
|
||||
mod->RegisterSymbol("b"), "b", &alias, deco));
|
||||
}
|
||||
{
|
||||
ast::StructMemberDecorationList deco;
|
||||
members.push_back(create<ast::StructMember>("a", ty.u32, deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("a"), "a", ty.u32, deco));
|
||||
}
|
||||
|
||||
ast::StructDecorationList decos;
|
||||
|
@ -164,12 +172,14 @@ TEST_F(ValidatorTypeTest, AliasRuntimeArrayIsLast_Pass) {
|
|||
ast::StructMemberList members;
|
||||
{
|
||||
ast::StructMemberDecorationList deco;
|
||||
members.push_back(create<ast::StructMember>("a", ty.u32, deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("a"), "a", ty.u32, deco));
|
||||
}
|
||||
{
|
||||
ast::StructMemberDecorationList deco;
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{Source::Location{12, 34}}, "b", &alias, deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(Source{Source::Location{12, 34}},
|
||||
mod->RegisterSymbol("b"), "b", &alias, deco));
|
||||
}
|
||||
ast::StructDecorationList decos;
|
||||
decos.push_back(create<ast::StructBlockDecoration>());
|
||||
|
|
|
@ -48,10 +48,10 @@ TEST_F(HlslGeneratorImplTest_Alias, EmitAlias_Struct) {
|
|||
auto* str = create<ast::Struct>(
|
||||
|
||||
ast::StructMemberList{
|
||||
create<ast::StructMember>("a", ty.f32,
|
||||
create<ast::StructMember>(mod->RegisterSymbol("a"), "a", ty.f32,
|
||||
ast::StructMemberDecorationList{}),
|
||||
create<ast::StructMember>(
|
||||
"b", ty.i32,
|
||||
mod->RegisterSymbol("b"), "b", ty.i32,
|
||||
ast::StructMemberDecorationList{
|
||||
create<ast::StructMemberOffsetDecoration>(4)}),
|
||||
},
|
||||
|
|
|
@ -261,7 +261,8 @@ TEST_F(HlslGeneratorImplTest_Function,
|
|||
Emit_FunctionDecoration_EntryPoint_With_UniformStruct) {
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>(
|
||||
"coord", ty.vec4<f32>(), ast::StructMemberDecorationList{}));
|
||||
mod->RegisterSymbol("coord"), "coord", ty.vec4<f32>(),
|
||||
ast::StructMemberDecorationList{}));
|
||||
|
||||
auto* str = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
|
@ -317,11 +318,13 @@ TEST_F(HlslGeneratorImplTest_Function,
|
|||
ast::StructMemberList members;
|
||||
ast::StructMemberDecorationList a_deco;
|
||||
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<ast::StructMember>("a", ty.i32, a_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("a"), "a", ty.i32, a_deco));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4));
|
||||
members.push_back(create<ast::StructMember>("b", ty.f32, b_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("b"), "b", ty.f32, b_deco));
|
||||
|
||||
auto* str = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
|
@ -371,11 +374,13 @@ TEST_F(HlslGeneratorImplTest_Function,
|
|||
ast::StructMemberList members;
|
||||
ast::StructMemberDecorationList a_deco;
|
||||
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<ast::StructMember>("a", ty.i32, a_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("a"), "a", ty.i32, a_deco));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4));
|
||||
members.push_back(create<ast::StructMember>("b", ty.f32, b_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("b"), "b", ty.f32, b_deco));
|
||||
|
||||
auto* str = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
|
@ -426,11 +431,13 @@ TEST_F(HlslGeneratorImplTest_Function,
|
|||
ast::StructMemberList members;
|
||||
ast::StructMemberDecorationList a_deco;
|
||||
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<ast::StructMember>("a", ty.i32, a_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("a"), "a", ty.i32, a_deco));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4));
|
||||
members.push_back(create<ast::StructMember>("b", ty.f32, b_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("b"), "b", ty.f32, b_deco));
|
||||
|
||||
auto* str = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
|
@ -962,7 +969,8 @@ TEST_F(HlslGeneratorImplTest_Function,
|
|||
ast::StructMemberList members;
|
||||
ast::StructMemberDecorationList a_deco;
|
||||
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<ast::StructMember>("d", ty.f32, a_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("d"), "d", ty.f32, a_deco));
|
||||
|
||||
ast::StructDecorationList s_decos;
|
||||
s_decos.push_back(create<ast::StructBlockDecoration>());
|
||||
|
|
|
@ -43,7 +43,8 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor) {
|
|||
ast::StructMemberList members;
|
||||
ast::StructMemberDecorationList deco;
|
||||
deco.push_back(create<ast::StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<ast::StructMember>("mem", ty.f32, deco));
|
||||
members.push_back(create<ast::StructMember>(mod->RegisterSymbol("mem"), "mem",
|
||||
ty.f32, deco));
|
||||
|
||||
auto* strct = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
|
@ -76,18 +77,17 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
|||
ast::StructMemberList members;
|
||||
ast::StructMemberDecorationList a_deco;
|
||||
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<ast::StructMember>("a", ty.i32, a_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("a"), "a", ty.i32, a_deco));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4));
|
||||
members.push_back(create<ast::StructMember>("b", ty.f32, b_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("b"), "b", ty.f32, b_deco));
|
||||
|
||||
auto* str = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
ast::type::Struct s(mod->RegisterSymbol("Data"), "Data", str);
|
||||
|
||||
auto* coord_var = Var("data", ast::StorageClass::kStorageBuffer, &s);
|
||||
|
||||
auto* expr = Member("data", "b");
|
||||
|
||||
td.RegisterVariableForTesting(coord_var);
|
||||
|
@ -115,18 +115,17 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
|||
ast::StructMemberList members;
|
||||
ast::StructMemberDecorationList a_deco;
|
||||
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<ast::StructMember>("a", ty.i32, a_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("a"), "a", ty.i32, a_deco));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4));
|
||||
members.push_back(create<ast::StructMember>("b", ty.f32, b_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("b"), "b", ty.f32, b_deco));
|
||||
|
||||
auto* str = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
ast::type::Struct s(mod->RegisterSymbol("Data"), "Data", str);
|
||||
|
||||
auto* coord_var = Var("data", ast::StorageClass::kStorageBuffer, &s);
|
||||
|
||||
auto* expr = Member("data", "a");
|
||||
|
||||
td.RegisterVariableForTesting(coord_var);
|
||||
|
@ -156,11 +155,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
|||
auto* str = create<ast::Struct>(
|
||||
ast::StructMemberList{
|
||||
create<ast::StructMember>(
|
||||
"z", ty.i32,
|
||||
mod->RegisterSymbol("z"), "z", ty.i32,
|
||||
ast::StructMemberDecorationList{
|
||||
create<ast::StructMemberOffsetDecoration>(0)}),
|
||||
create<ast::StructMember>(
|
||||
"a", ty.mat2x3<f32>(),
|
||||
mod->RegisterSymbol("z"), "a", ty.mat2x3<f32>(),
|
||||
ast::StructMemberDecorationList{
|
||||
create<ast::StructMemberOffsetDecoration>(4)}),
|
||||
},
|
||||
|
@ -211,11 +210,13 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
|||
ast::StructMemberList members;
|
||||
ast::StructMemberDecorationList a_deco;
|
||||
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<ast::StructMember>("z", ty.i32, a_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("z"), "z", ty.i32, a_deco));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4));
|
||||
members.push_back(create<ast::StructMember>("a", ty.mat2x3<f32>(), b_deco));
|
||||
members.push_back(create<ast::StructMember>(mod->RegisterSymbol("a"), "a",
|
||||
ty.mat2x3<f32>(), b_deco));
|
||||
|
||||
auto* str = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
|
@ -259,11 +260,13 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
|||
ast::StructMemberList members;
|
||||
ast::StructMemberDecorationList a_deco;
|
||||
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<ast::StructMember>("z", ty.i32, a_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("z"), "z", ty.i32, a_deco));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4));
|
||||
members.push_back(create<ast::StructMember>("a", ty.mat3x2<f32>(), b_deco));
|
||||
members.push_back(create<ast::StructMember>(mod->RegisterSymbol("a"), "a",
|
||||
ty.mat3x2<f32>(), b_deco));
|
||||
|
||||
auto* str = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
|
@ -304,18 +307,17 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
|||
ast::StructMemberList members;
|
||||
ast::StructMemberDecorationList a_deco;
|
||||
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<ast::StructMember>("z", ty.i32, a_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("z"), "z", ty.i32, a_deco));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4));
|
||||
members.push_back(create<ast::StructMember>("a", ty.mat2x3<f32>(), b_deco));
|
||||
members.push_back(create<ast::StructMember>(mod->RegisterSymbol("a"), "a",
|
||||
ty.mat2x3<f32>(), b_deco));
|
||||
|
||||
auto* str = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
ast::type::Struct s(mod->RegisterSymbol("Data"), "Data", str);
|
||||
|
||||
auto* coord_var = Var("data", ast::StorageClass::kStorageBuffer, &s);
|
||||
|
||||
auto* expr = Member("data", "a");
|
||||
|
||||
td.RegisterVariableForTesting(coord_var);
|
||||
|
@ -345,14 +347,12 @@ TEST_F(
|
|||
ast::StructMemberList members;
|
||||
ast::StructMemberDecorationList deco;
|
||||
deco.push_back(create<ast::StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<ast::StructMember>("a", ty.mat3x3<f32>(), deco));
|
||||
members.push_back(create<ast::StructMember>(mod->RegisterSymbol("a"), "a",
|
||||
ty.mat3x3<f32>(), deco));
|
||||
|
||||
auto* str = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
ast::type::Struct s(mod->RegisterSymbol("Data"), "Data", str);
|
||||
|
||||
auto* coord_var = Var("data", ast::StorageClass::kStorageBuffer, &s);
|
||||
|
||||
auto* expr = Member("data", "a");
|
||||
|
||||
td.RegisterVariableForTesting(coord_var);
|
||||
|
@ -382,18 +382,17 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
|||
ast::StructMemberList members;
|
||||
ast::StructMemberDecorationList a_deco;
|
||||
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<ast::StructMember>("z", ty.i32, a_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("z"), "z", ty.i32, a_deco));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(16));
|
||||
members.push_back(create<ast::StructMember>("a", ty.mat4x3<f32>(), b_deco));
|
||||
members.push_back(create<ast::StructMember>(mod->RegisterSymbol("a"), "a",
|
||||
ty.mat4x3<f32>(), b_deco));
|
||||
|
||||
auto* str = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
ast::type::Struct s(mod->RegisterSymbol("Data"), "Data", str);
|
||||
|
||||
auto* coord_var = Var("data", ast::StorageClass::kStorageBuffer, &s);
|
||||
|
||||
auto* expr = Index(Index(Member("data", "a"), Expr(2)), Expr(1));
|
||||
|
||||
td.RegisterVariableForTesting(coord_var);
|
||||
|
@ -424,14 +423,12 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
|||
ast::StructMemberList members;
|
||||
ast::StructMemberDecorationList a_deco;
|
||||
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<ast::StructMember>("a", &ary, a_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("a"), "a", &ary, a_deco));
|
||||
|
||||
auto* str = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
ast::type::Struct s(mod->RegisterSymbol("Data"), "Data", str);
|
||||
|
||||
auto* coord_var = Var("data", ast::StorageClass::kStorageBuffer, &s);
|
||||
|
||||
auto* expr = Index(Member("data", "a"), Expr(2));
|
||||
|
||||
td.RegisterVariableForTesting(coord_var);
|
||||
|
@ -462,14 +459,12 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
|||
ast::StructMemberList members;
|
||||
ast::StructMemberDecorationList a_deco;
|
||||
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<ast::StructMember>("a", &ary, a_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("a"), "a", &ary, a_deco));
|
||||
|
||||
auto* str = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
ast::type::Struct s(mod->RegisterSymbol("Data"), "Data", str);
|
||||
|
||||
auto* coord_var = Var("data", ast::StorageClass::kStorageBuffer, &s);
|
||||
|
||||
auto* expr = Index(Member("data", "a"), Sub(Add(Expr(2), Expr(4)), Expr(3)));
|
||||
|
||||
td.RegisterVariableForTesting(coord_var);
|
||||
|
@ -497,16 +492,16 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
|||
ast::StructMemberList members;
|
||||
ast::StructMemberDecorationList a_deco;
|
||||
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<ast::StructMember>("a", ty.i32, a_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("a"), "a", ty.i32, a_deco));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4));
|
||||
members.push_back(create<ast::StructMember>("b", ty.f32, b_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("b"), "b", ty.f32, b_deco));
|
||||
|
||||
auto* str = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
ast::type::Struct s(mod->RegisterSymbol("Data"), "Data", str);
|
||||
|
||||
auto* coord_var = Var("data", ast::StorageClass::kStorageBuffer, &s);
|
||||
|
||||
td.RegisterVariableForTesting(coord_var);
|
||||
|
@ -543,7 +538,8 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
|||
ast::StructMemberList members;
|
||||
ast::StructMemberDecorationList a_deco;
|
||||
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<ast::StructMember>("a", &ary, a_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("a"), "a", &ary, a_deco));
|
||||
|
||||
auto* str = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
|
@ -581,16 +577,16 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
|||
ast::StructMemberList members;
|
||||
ast::StructMemberDecorationList a_deco;
|
||||
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<ast::StructMember>("a", ty.i32, a_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("a"), "a", ty.i32, a_deco));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4));
|
||||
members.push_back(create<ast::StructMember>("b", ty.f32, b_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("b"), "b", ty.f32, b_deco));
|
||||
|
||||
auto* str = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
ast::type::Struct s(mod->RegisterSymbol("Data"), "Data", str);
|
||||
|
||||
auto* coord_var = Var("data", ast::StorageClass::kStorageBuffer, &s);
|
||||
|
||||
td.RegisterVariableForTesting(coord_var);
|
||||
|
@ -623,16 +619,16 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
|||
ast::StructMemberList members;
|
||||
ast::StructMemberDecorationList a_deco;
|
||||
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<ast::StructMember>("a", ty.vec3<i32>(), a_deco));
|
||||
members.push_back(create<ast::StructMember>(mod->RegisterSymbol("a"), "a",
|
||||
ty.vec3<i32>(), a_deco));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(16));
|
||||
members.push_back(create<ast::StructMember>("b", ty.vec3<f32>(), b_deco));
|
||||
members.push_back(create<ast::StructMember>(mod->RegisterSymbol("b"), "b",
|
||||
ty.vec3<f32>(), b_deco));
|
||||
|
||||
auto* str = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
ast::type::Struct s(mod->RegisterSymbol("Data"), "Data", str);
|
||||
|
||||
auto* coord_var = Var("data", ast::StorageClass::kStorageBuffer, &s);
|
||||
|
||||
td.RegisterVariableForTesting(coord_var);
|
||||
|
@ -662,11 +658,13 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
|||
ast::StructMemberList members;
|
||||
ast::StructMemberDecorationList a_deco;
|
||||
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<ast::StructMember>("a", ty.vec3<i32>(), a_deco));
|
||||
members.push_back(create<ast::StructMember>(mod->RegisterSymbol("a"), "a",
|
||||
ty.vec3<i32>(), a_deco));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(16));
|
||||
members.push_back(create<ast::StructMember>("b", ty.vec3<f32>(), b_deco));
|
||||
members.push_back(create<ast::StructMember>(mod->RegisterSymbol("b"), "b",
|
||||
ty.vec3<f32>(), b_deco));
|
||||
|
||||
auto* str = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
|
@ -710,11 +708,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
|||
auto* data_str = create<ast::Struct>(
|
||||
ast::StructMemberList{
|
||||
create<ast::StructMember>(
|
||||
"a", ty.vec3<i32>(),
|
||||
mod->RegisterSymbol("a"), "a", ty.vec3<i32>(),
|
||||
ast::StructMemberDecorationList{
|
||||
create<ast::StructMemberOffsetDecoration>(0)}),
|
||||
create<ast::StructMember>(
|
||||
"b", ty.vec3<f32>(),
|
||||
mod->RegisterSymbol("b"), "b", ty.vec3<f32>(),
|
||||
ast::StructMemberDecorationList{
|
||||
create<ast::StructMemberOffsetDecoration>(16)}),
|
||||
},
|
||||
|
@ -730,7 +728,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
|||
auto* pre_str = create<ast::Struct>(
|
||||
ast::StructMemberList{
|
||||
create<ast::StructMember>(
|
||||
"c", &ary,
|
||||
mod->RegisterSymbol("c"), "c", &ary,
|
||||
ast::StructMemberDecorationList{
|
||||
create<ast::StructMemberOffsetDecoration>(0)}),
|
||||
},
|
||||
|
@ -774,11 +772,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
|||
auto* data_str = create<ast::Struct>(
|
||||
ast::StructMemberList{
|
||||
create<ast::StructMember>(
|
||||
"a", ty.vec3<i32>(),
|
||||
mod->RegisterSymbol("a"), "a", ty.vec3<i32>(),
|
||||
ast::StructMemberDecorationList{
|
||||
create<ast::StructMemberOffsetDecoration>(0)}),
|
||||
create<ast::StructMember>(
|
||||
"b", ty.vec3<f32>(),
|
||||
mod->RegisterSymbol("b"), "b", ty.vec3<f32>(),
|
||||
ast::StructMemberDecorationList{
|
||||
create<ast::StructMemberOffsetDecoration>(16)}),
|
||||
},
|
||||
|
@ -791,7 +789,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
|||
|
||||
auto* pre_str = create<ast::Struct>(
|
||||
ast::StructMemberList{create<ast::StructMember>(
|
||||
"c", &ary,
|
||||
mod->RegisterSymbol("c"), "c", &ary,
|
||||
ast::StructMemberDecorationList{
|
||||
create<ast::StructMemberOffsetDecoration>(0)})},
|
||||
ast::StructDecorationList{});
|
||||
|
@ -832,11 +830,11 @@ TEST_F(
|
|||
auto* data_str = create<ast::Struct>(
|
||||
ast::StructMemberList{
|
||||
create<ast::StructMember>(
|
||||
"a", ty.vec3<i32>(),
|
||||
mod->RegisterSymbol("a"), "a", ty.vec3<i32>(),
|
||||
ast::StructMemberDecorationList{
|
||||
create<ast::StructMemberOffsetDecoration>(0)}),
|
||||
create<ast::StructMember>(
|
||||
"b", ty.vec3<f32>(),
|
||||
mod->RegisterSymbol("b"), "b", ty.vec3<f32>(),
|
||||
ast::StructMemberDecorationList{
|
||||
create<ast::StructMemberOffsetDecoration>(16)}),
|
||||
},
|
||||
|
@ -851,7 +849,7 @@ TEST_F(
|
|||
|
||||
auto* pre_str = create<ast::Struct>(
|
||||
ast::StructMemberList{create<ast::StructMember>(
|
||||
"c", &ary,
|
||||
mod->RegisterSymbol("c"), "c", &ary,
|
||||
ast::StructMemberDecorationList{
|
||||
create<ast::StructMemberOffsetDecoration>(0)})},
|
||||
ast::StructDecorationList{});
|
||||
|
@ -891,11 +889,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
|||
auto* data_str = create<ast::Struct>(
|
||||
ast::StructMemberList{
|
||||
create<ast::StructMember>(
|
||||
"a", ty.vec3<i32>(),
|
||||
mod->RegisterSymbol("a"), "a", ty.vec3<i32>(),
|
||||
ast::StructMemberDecorationList{
|
||||
create<ast::StructMemberOffsetDecoration>(0)}),
|
||||
create<ast::StructMember>(
|
||||
"b", ty.vec3<f32>(),
|
||||
mod->RegisterSymbol("b"), "b", ty.vec3<f32>(),
|
||||
ast::StructMemberDecorationList{
|
||||
create<ast::StructMemberOffsetDecoration>(16)}),
|
||||
},
|
||||
|
@ -910,7 +908,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
|||
|
||||
auto* pre_str = create<ast::Struct>(
|
||||
ast::StructMemberList{create<ast::StructMember>(
|
||||
"c", &ary,
|
||||
mod->RegisterSymbol("c"), "c", &ary,
|
||||
ast::StructMemberDecorationList{
|
||||
create<ast::StructMemberOffsetDecoration>(0)})},
|
||||
ast::StructDecorationList{});
|
||||
|
@ -950,11 +948,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
|||
auto* data_str = create<ast::Struct>(
|
||||
ast::StructMemberList{
|
||||
create<ast::StructMember>(
|
||||
"a", ty.vec3<i32>(),
|
||||
mod->RegisterSymbol("a"), "a", ty.vec3<i32>(),
|
||||
ast::StructMemberDecorationList{
|
||||
create<ast::StructMemberOffsetDecoration>(0)}),
|
||||
create<ast::StructMember>(
|
||||
"b", ty.vec3<f32>(),
|
||||
mod->RegisterSymbol("b"), "b", ty.vec3<f32>(),
|
||||
ast::StructMemberDecorationList{
|
||||
create<ast::StructMemberOffsetDecoration>(16)}),
|
||||
},
|
||||
|
@ -969,7 +967,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
|||
|
||||
auto* pre_str = create<ast::Struct>(
|
||||
ast::StructMemberList{create<ast::StructMember>(
|
||||
"c", &ary,
|
||||
mod->RegisterSymbol("c"), "c", &ary,
|
||||
ast::StructMemberDecorationList{
|
||||
create<ast::StructMemberOffsetDecoration>(0)})},
|
||||
ast::StructDecorationList{});
|
||||
|
@ -1014,11 +1012,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
|||
auto* data_str = create<ast::Struct>(
|
||||
ast::StructMemberList{
|
||||
create<ast::StructMember>(
|
||||
"a", ty.vec3<i32>(),
|
||||
mod->RegisterSymbol("a"), "a", ty.vec3<i32>(),
|
||||
ast::StructMemberDecorationList{
|
||||
create<ast::StructMemberOffsetDecoration>(0)}),
|
||||
create<ast::StructMember>(
|
||||
"b", ty.vec3<f32>(),
|
||||
mod->RegisterSymbol("b"), "b", ty.vec3<f32>(),
|
||||
ast::StructMemberDecorationList{
|
||||
create<ast::StructMemberOffsetDecoration>(16)}),
|
||||
},
|
||||
|
@ -1033,7 +1031,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
|||
|
||||
auto* pre_str = create<ast::Struct>(
|
||||
ast::StructMemberList{create<ast::StructMember>(
|
||||
"c", &ary,
|
||||
mod->RegisterSymbol("c"), "c", &ary,
|
||||
ast::StructMemberDecorationList{
|
||||
create<ast::StructMemberOffsetDecoration>(0)})},
|
||||
ast::StructDecorationList{});
|
||||
|
|
|
@ -133,12 +133,14 @@ TEST_F(HlslGeneratorImplTest_Type, DISABLED_EmitType_Pointer) {
|
|||
|
||||
TEST_F(HlslGeneratorImplTest_Type, EmitType_StructDecl) {
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>(
|
||||
"a", ty.i32, ast::StructMemberDecorationList{}));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("a"), "a", ty.i32,
|
||||
ast::StructMemberDecorationList{}));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4));
|
||||
members.push_back(create<ast::StructMember>("b", ty.f32, b_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("b"), "b", ty.f32, b_deco));
|
||||
|
||||
auto* str = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
|
@ -154,12 +156,14 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_StructDecl) {
|
|||
|
||||
TEST_F(HlslGeneratorImplTest_Type, EmitType_Struct) {
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>(
|
||||
"a", ty.i32, ast::StructMemberDecorationList{}));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("a"), "a", ty.i32,
|
||||
ast::StructMemberDecorationList{}));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4));
|
||||
members.push_back(create<ast::StructMember>("b", ty.f32, b_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("b"), "b", ty.f32, b_deco));
|
||||
|
||||
auto* str = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
|
@ -174,13 +178,16 @@ TEST_F(HlslGeneratorImplTest_Type, DISABLED_EmitType_Struct_InjectPadding) {
|
|||
decos.push_back(create<ast::StructMemberOffsetDecoration>(4));
|
||||
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>("a", ty.i32, decos));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("a"), "a", ty.i32, decos));
|
||||
|
||||
decos.push_back(create<ast::StructMemberOffsetDecoration>(32));
|
||||
members.push_back(create<ast::StructMember>("b", ty.f32, decos));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("b"), "b", ty.f32, decos));
|
||||
|
||||
decos.push_back(create<ast::StructMemberOffsetDecoration>(128));
|
||||
members.push_back(create<ast::StructMember>("c", ty.f32, decos));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("c"), "c", ty.f32, decos));
|
||||
|
||||
auto* str = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
|
@ -199,11 +206,13 @@ TEST_F(HlslGeneratorImplTest_Type, DISABLED_EmitType_Struct_InjectPadding) {
|
|||
|
||||
TEST_F(HlslGeneratorImplTest_Type, EmitType_Struct_NameCollision) {
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>(
|
||||
"double", ty.i32, ast::StructMemberDecorationList{}));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("double"), "double", ty.i32,
|
||||
ast::StructMemberDecorationList{}));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
members.push_back(create<ast::StructMember>("float", ty.f32, b_deco));
|
||||
members.push_back(create<ast::StructMember>(mod->RegisterSymbol("float"),
|
||||
"float", ty.f32, b_deco));
|
||||
|
||||
auto* str = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
|
@ -220,12 +229,14 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_Struct_NameCollision) {
|
|||
// TODO(dsinclair): How to translate [[block]]
|
||||
TEST_F(HlslGeneratorImplTest_Type, DISABLED_EmitType_Struct_WithDecoration) {
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>(
|
||||
"a", ty.i32, ast::StructMemberDecorationList{}));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("a"), "a", ty.i32,
|
||||
ast::StructMemberDecorationList{}));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4));
|
||||
members.push_back(create<ast::StructMember>("b", ty.f32, b_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("b"), "b", ty.f32, b_deco));
|
||||
|
||||
ast::StructDecorationList decos;
|
||||
decos.push_back(create<ast::StructBlockDecoration>());
|
||||
|
|
|
@ -54,12 +54,14 @@ TEST_F(MslGeneratorImplTest, EmitConstructedType_Struct) {
|
|||
ast::type::F32 f32;
|
||||
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, "a", &f32, ast::StructMemberDecorationList{}));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(Source{}, mod.RegisterSymbol("a"), "a", &f32,
|
||||
ast::StructMemberDecorationList{}));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
|
||||
members.push_back(create<ast::StructMember>(Source{}, "b", &i32, b_deco));
|
||||
members.push_back(create<ast::StructMember>(Source{}, mod.RegisterSymbol("b"),
|
||||
"b", &i32, b_deco));
|
||||
|
||||
auto* str =
|
||||
create<ast::Struct>(Source{}, members, ast::StructDecorationList{});
|
||||
|
@ -79,12 +81,14 @@ TEST_F(MslGeneratorImplTest, EmitConstructedType_AliasStructIdent) {
|
|||
ast::type::F32 f32;
|
||||
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, "a", &f32, ast::StructMemberDecorationList{}));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(Source{}, mod.RegisterSymbol("a"), "a", &f32,
|
||||
ast::StructMemberDecorationList{}));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
|
||||
members.push_back(create<ast::StructMember>(Source{}, "b", &i32, b_deco));
|
||||
members.push_back(create<ast::StructMember>(Source{}, mod.RegisterSymbol("b"),
|
||||
"b", &i32, b_deco));
|
||||
|
||||
auto* str =
|
||||
create<ast::Struct>(Source{}, members, ast::StructDecorationList{});
|
||||
|
|
|
@ -377,11 +377,13 @@ TEST_F(MslGeneratorImplTest,
|
|||
ast::StructMemberList members;
|
||||
ast::StructMemberDecorationList a_deco;
|
||||
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
|
||||
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
|
||||
members.push_back(create<ast::StructMember>(Source{}, mod.RegisterSymbol("a"),
|
||||
"a", &i32, a_deco));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
|
||||
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||
members.push_back(create<ast::StructMember>(Source{}, mod.RegisterSymbol("b"),
|
||||
"b", &f32, b_deco));
|
||||
|
||||
auto* str =
|
||||
create<ast::Struct>(Source{}, members, ast::StructDecorationList{});
|
||||
|
@ -463,11 +465,13 @@ TEST_F(MslGeneratorImplTest,
|
|||
ast::StructMemberList members;
|
||||
ast::StructMemberDecorationList a_deco;
|
||||
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
|
||||
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
|
||||
members.push_back(create<ast::StructMember>(Source{}, mod.RegisterSymbol("a"),
|
||||
"a", &i32, a_deco));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
|
||||
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||
members.push_back(create<ast::StructMember>(Source{}, mod.RegisterSymbol("b"),
|
||||
"b", &f32, b_deco));
|
||||
|
||||
auto* str =
|
||||
create<ast::Struct>(Source{}, members, ast::StructDecorationList{});
|
||||
|
@ -1001,11 +1005,13 @@ TEST_F(MslGeneratorImplTest,
|
|||
ast::StructMemberList members;
|
||||
ast::StructMemberDecorationList a_deco;
|
||||
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
|
||||
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
|
||||
members.push_back(create<ast::StructMember>(Source{}, mod.RegisterSymbol("a"),
|
||||
"a", &i32, a_deco));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
|
||||
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||
members.push_back(create<ast::StructMember>(Source{}, mod.RegisterSymbol("b"),
|
||||
"b", &f32, b_deco));
|
||||
|
||||
auto* str =
|
||||
create<ast::Struct>(Source{}, members, ast::StructDecorationList{});
|
||||
|
@ -1121,11 +1127,13 @@ TEST_F(MslGeneratorImplTest,
|
|||
ast::StructMemberList members;
|
||||
ast::StructMemberDecorationList a_deco;
|
||||
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
|
||||
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
|
||||
members.push_back(create<ast::StructMember>(Source{}, mod.RegisterSymbol("a"),
|
||||
"a", &i32, a_deco));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
|
||||
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||
members.push_back(create<ast::StructMember>(Source{}, mod.RegisterSymbol("b"),
|
||||
"b", &f32, b_deco));
|
||||
|
||||
auto* str =
|
||||
create<ast::Struct>(Source{}, members, ast::StructDecorationList{});
|
||||
|
@ -1393,7 +1401,8 @@ TEST_F(MslGeneratorImplTest,
|
|||
ast::StructMemberList members;
|
||||
ast::StructMemberDecorationList a_deco;
|
||||
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
|
||||
members.push_back(create<ast::StructMember>(Source{}, "d", &f32, a_deco));
|
||||
members.push_back(create<ast::StructMember>(Source{}, mod.RegisterSymbol("d"),
|
||||
"d", &f32, a_deco));
|
||||
|
||||
ast::StructDecorationList s_decos;
|
||||
s_decos.push_back(create<ast::StructBlockDecoration>(Source{}));
|
||||
|
|
|
@ -163,13 +163,16 @@ TEST_F(MslGeneratorImplTest, calculate_alignment_size_struct) {
|
|||
decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
|
||||
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, decos));
|
||||
members.push_back(create<ast::StructMember>(Source{}, mod.RegisterSymbol("a"),
|
||||
"a", &i32, decos));
|
||||
|
||||
decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 32));
|
||||
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, decos));
|
||||
members.push_back(create<ast::StructMember>(Source{}, mod.RegisterSymbol("b"),
|
||||
"b", &f32, decos));
|
||||
|
||||
decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 128));
|
||||
members.push_back(create<ast::StructMember>(Source{}, "c", &f32, decos));
|
||||
members.push_back(create<ast::StructMember>(Source{}, mod.RegisterSymbol("c"),
|
||||
"c", &f32, decos));
|
||||
|
||||
auto* str =
|
||||
create<ast::Struct>(Source{}, members, ast::StructDecorationList{});
|
||||
|
@ -188,13 +191,16 @@ TEST_F(MslGeneratorImplTest, calculate_alignment_size_struct_of_struct) {
|
|||
decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
|
||||
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, decos));
|
||||
members.push_back(create<ast::StructMember>(Source{}, mod.RegisterSymbol("a"),
|
||||
"a", &i32, decos));
|
||||
|
||||
decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 16));
|
||||
members.push_back(create<ast::StructMember>(Source{}, "b", &fvec, decos));
|
||||
members.push_back(create<ast::StructMember>(Source{}, mod.RegisterSymbol("b"),
|
||||
"b", &fvec, decos));
|
||||
|
||||
decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 32));
|
||||
members.push_back(create<ast::StructMember>(Source{}, "c", &f32, decos));
|
||||
members.push_back(create<ast::StructMember>(Source{}, mod.RegisterSymbol("c"),
|
||||
"c", &f32, decos));
|
||||
|
||||
auto* inner_str =
|
||||
create<ast::Struct>(Source{}, members, ast::StructDecorationList{});
|
||||
|
@ -202,13 +208,16 @@ TEST_F(MslGeneratorImplTest, calculate_alignment_size_struct_of_struct) {
|
|||
ast::type::Struct inner_s(mod.RegisterSymbol("Inner"), "Inner", inner_str);
|
||||
|
||||
decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
|
||||
members.push_back(create<ast::StructMember>(Source{}, "d", &f32, decos));
|
||||
members.push_back(create<ast::StructMember>(Source{}, mod.RegisterSymbol("d"),
|
||||
"d", &f32, decos));
|
||||
|
||||
decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 32));
|
||||
members.push_back(create<ast::StructMember>(Source{}, "e", &inner_s, decos));
|
||||
members.push_back(create<ast::StructMember>(Source{}, mod.RegisterSymbol("e"),
|
||||
"e", &inner_s, decos));
|
||||
|
||||
decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 64));
|
||||
members.push_back(create<ast::StructMember>(Source{}, "f", &f32, decos));
|
||||
members.push_back(create<ast::StructMember>(Source{}, mod.RegisterSymbol("f"),
|
||||
"f", &f32, decos));
|
||||
|
||||
auto* outer_str =
|
||||
create<ast::Struct>(Source{}, members, ast::StructDecorationList{});
|
||||
|
|
|
@ -175,12 +175,14 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct) {
|
|||
ast::type::F32 f32;
|
||||
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(Source{}, mod.RegisterSymbol("a"), "a", &i32,
|
||||
ast::StructMemberDecorationList{}));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
|
||||
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||
members.push_back(create<ast::StructMember>(Source{}, mod.RegisterSymbol("b"),
|
||||
"b", &f32, b_deco));
|
||||
|
||||
auto* str =
|
||||
create<ast::Struct>(Source{}, members, ast::StructDecorationList{});
|
||||
|
@ -196,12 +198,14 @@ TEST_F(MslGeneratorImplTest, EmitType_StructDecl) {
|
|||
ast::type::F32 f32;
|
||||
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(Source{}, mod.RegisterSymbol("a"), "a", &i32,
|
||||
ast::StructMemberDecorationList{}));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
|
||||
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||
members.push_back(create<ast::StructMember>(Source{}, mod.RegisterSymbol("b"),
|
||||
"b", &f32, b_deco));
|
||||
|
||||
auto* str =
|
||||
create<ast::Struct>(Source{}, members, ast::StructDecorationList{});
|
||||
|
@ -224,15 +228,15 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_InjectPadding) {
|
|||
Source{},
|
||||
ast::StructMemberList{
|
||||
create<ast::StructMember>(
|
||||
Source{}, "a", &i32,
|
||||
Source{}, mod.RegisterSymbol("a"), "a", &i32,
|
||||
ast::StructMemberDecorationList{
|
||||
create<ast::StructMemberOffsetDecoration>(Source{}, 4)}),
|
||||
create<ast::StructMember>(
|
||||
Source{}, "b", &f32,
|
||||
Source{}, mod.RegisterSymbol("b"), "b", &f32,
|
||||
ast::StructMemberDecorationList{
|
||||
create<ast::StructMemberOffsetDecoration>(Source{}, 32)}),
|
||||
create<ast::StructMember>(
|
||||
Source{}, "c", &f32,
|
||||
Source{}, mod.RegisterSymbol("c"), "c", &f32,
|
||||
ast::StructMemberDecorationList{
|
||||
create<ast::StructMemberOffsetDecoration>(Source{}, 128)}),
|
||||
},
|
||||
|
@ -257,11 +261,13 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_NameCollision) {
|
|||
ast::type::F32 f32;
|
||||
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, "main", &i32, ast::StructMemberDecorationList{}));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(Source{}, mod.RegisterSymbol("main"), "main",
|
||||
&i32, ast::StructMemberDecorationList{}));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
members.push_back(create<ast::StructMember>(Source{}, "float", &f32, b_deco));
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, mod.RegisterSymbol("float"), "float", &f32, b_deco));
|
||||
|
||||
auto* str =
|
||||
create<ast::Struct>(Source{}, members, ast::StructDecorationList{});
|
||||
|
@ -282,12 +288,14 @@ TEST_F(MslGeneratorImplTest, DISABLED_EmitType_Struct_WithDecoration) {
|
|||
ast::type::F32 f32;
|
||||
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(Source{}, mod.RegisterSymbol("a"), "a", &i32,
|
||||
ast::StructMemberDecorationList{}));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
|
||||
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||
members.push_back(create<ast::StructMember>(Source{}, mod.RegisterSymbol("b"),
|
||||
"b", &f32, b_deco));
|
||||
|
||||
ast::StructDecorationList decos;
|
||||
decos.push_back(create<ast::StructBlockDecoration>(Source{}));
|
||||
|
|
|
@ -103,12 +103,14 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Struct) {
|
|||
ast::type::F32 f32;
|
||||
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, "a", &f32, ast::StructMemberDecorationList{}));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(Source{}, mod.RegisterSymbol("a"), "a", &f32,
|
||||
ast::StructMemberDecorationList{}));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
|
||||
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||
members.push_back(create<ast::StructMember>(Source{}, mod.RegisterSymbol("b"),
|
||||
"b", &f32, b_deco));
|
||||
|
||||
auto* str =
|
||||
create<ast::Struct>(Source{}, members, ast::StructDecorationList{});
|
||||
|
|
|
@ -245,8 +245,10 @@ TEST_F(BuilderTest, MemberAccessor) {
|
|||
|
||||
ast::StructMemberDecorationList decos;
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>("a", ty.f32, decos));
|
||||
members.push_back(create<ast::StructMember>("b", ty.f32, decos));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("a"), "a", ty.f32, decos));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("b"), "b", ty.f32, decos));
|
||||
|
||||
auto* s = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
ast::type::Struct s_type(mod->RegisterSymbol("my_struct"), "my_struct", s);
|
||||
|
@ -291,16 +293,18 @@ TEST_F(BuilderTest, MemberAccessor_Nested) {
|
|||
// ident.inner.a
|
||||
ast::StructMemberDecorationList decos;
|
||||
ast::StructMemberList inner_members;
|
||||
inner_members.push_back(create<ast::StructMember>("a", ty.f32, decos));
|
||||
inner_members.push_back(create<ast::StructMember>("b", ty.f32, decos));
|
||||
inner_members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("a"), "a", ty.f32, decos));
|
||||
inner_members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("b"), "b", ty.f32, decos));
|
||||
|
||||
ast::type::Struct inner_struct(
|
||||
mod->RegisterSymbol("Inner"), "Inner",
|
||||
create<ast::Struct>(inner_members, ast::StructDecorationList{}));
|
||||
|
||||
ast::StructMemberList outer_members;
|
||||
outer_members.push_back(
|
||||
create<ast::StructMember>("inner", &inner_struct, decos));
|
||||
outer_members.push_back(create<ast::StructMember>(
|
||||
mod->RegisterSymbol("inner"), "inner", &inner_struct, decos));
|
||||
|
||||
ast::type::Struct s_type(
|
||||
mod->RegisterSymbol("my_struct"), "my_struct",
|
||||
|
@ -348,8 +352,10 @@ TEST_F(BuilderTest, MemberAccessor_Nested_WithAlias) {
|
|||
// ident.inner.a
|
||||
ast::StructMemberDecorationList decos;
|
||||
ast::StructMemberList inner_members;
|
||||
inner_members.push_back(create<ast::StructMember>("a", ty.f32, decos));
|
||||
inner_members.push_back(create<ast::StructMember>("b", ty.f32, decos));
|
||||
inner_members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("a"), "a", ty.f32, decos));
|
||||
inner_members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("b"), "b", ty.f32, decos));
|
||||
|
||||
ast::type::Struct inner_struct(
|
||||
mod->RegisterSymbol("Inner"), "Inner",
|
||||
|
@ -358,7 +364,8 @@ TEST_F(BuilderTest, MemberAccessor_Nested_WithAlias) {
|
|||
ast::type::Alias alias(mod->RegisterSymbol("Inner"), "Inner", &inner_struct);
|
||||
|
||||
ast::StructMemberList outer_members;
|
||||
outer_members.push_back(create<ast::StructMember>("inner", &alias, decos));
|
||||
outer_members.push_back(create<ast::StructMember>(
|
||||
mod->RegisterSymbol("inner"), "inner", &alias, decos));
|
||||
|
||||
ast::type::Struct s_type(
|
||||
mod->RegisterSymbol("Outer"), "Outer",
|
||||
|
@ -406,16 +413,18 @@ TEST_F(BuilderTest, MemberAccessor_Nested_Assignment_LHS) {
|
|||
|
||||
ast::StructMemberDecorationList decos;
|
||||
ast::StructMemberList inner_members;
|
||||
inner_members.push_back(create<ast::StructMember>("a", ty.f32, decos));
|
||||
inner_members.push_back(create<ast::StructMember>("b", ty.f32, decos));
|
||||
inner_members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("a"), "a", ty.f32, decos));
|
||||
inner_members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("b"), "b", ty.f32, decos));
|
||||
|
||||
ast::type::Struct inner_struct(
|
||||
mod->RegisterSymbol("Inner"), "Inner",
|
||||
create<ast::Struct>(inner_members, ast::StructDecorationList{}));
|
||||
|
||||
ast::StructMemberList outer_members;
|
||||
outer_members.push_back(
|
||||
create<ast::StructMember>("inner", &inner_struct, decos));
|
||||
outer_members.push_back(create<ast::StructMember>(
|
||||
mod->RegisterSymbol("inner"), "inner", &inner_struct, decos));
|
||||
|
||||
ast::type::Struct s_type(
|
||||
mod->RegisterSymbol("my_struct"), "my_struct",
|
||||
|
@ -469,16 +478,18 @@ TEST_F(BuilderTest, MemberAccessor_Nested_Assignment_RHS) {
|
|||
|
||||
ast::StructMemberDecorationList decos;
|
||||
ast::StructMemberList inner_members;
|
||||
inner_members.push_back(create<ast::StructMember>("a", ty.f32, decos));
|
||||
inner_members.push_back(create<ast::StructMember>("b", ty.f32, decos));
|
||||
inner_members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("a"), "a", ty.f32, decos));
|
||||
inner_members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("b"), "b", ty.f32, decos));
|
||||
|
||||
ast::type::Struct inner_struct(
|
||||
mod->RegisterSymbol("Inner"), "Inner",
|
||||
create<ast::Struct>(inner_members, ast::StructDecorationList{}));
|
||||
|
||||
ast::StructMemberList outer_members;
|
||||
outer_members.push_back(
|
||||
create<ast::StructMember>("inner", &inner_struct, decos));
|
||||
outer_members.push_back(create<ast::StructMember>(
|
||||
mod->RegisterSymbol("inner"), "inner", &inner_struct, decos));
|
||||
|
||||
ast::type::Struct s_type(
|
||||
mod->RegisterSymbol("my_struct"), "my_struct",
|
||||
|
@ -692,21 +703,24 @@ TEST_F(BuilderTest, Accessor_Mixed_ArrayAndMember) {
|
|||
|
||||
ast::StructMemberDecorationList decos;
|
||||
|
||||
auto* s = create<ast::Struct>(ast::StructMemberList{create<ast::StructMember>(
|
||||
"baz", ty.vec3<f32>(), decos)},
|
||||
ast::StructDecorationList{});
|
||||
auto* s = create<ast::Struct>(
|
||||
ast::StructMemberList{create<ast::StructMember>(
|
||||
mod->RegisterSymbol("baz"), "baz", ty.vec3<f32>(), decos)},
|
||||
ast::StructDecorationList{});
|
||||
ast::type::Struct c_type(mod->RegisterSymbol("C"), "C", s);
|
||||
|
||||
s = create<ast::Struct>(
|
||||
ast::StructMemberList{create<ast::StructMember>("bar", &c_type, decos)},
|
||||
ast::StructMemberList{create<ast::StructMember>(
|
||||
mod->RegisterSymbol("bar"), "bar", &c_type, decos)},
|
||||
ast::StructDecorationList{});
|
||||
ast::type::Struct b_type(mod->RegisterSymbol("B"), "B", s);
|
||||
|
||||
ast::type::Array b_ary_type(&b_type, 3, ast::ArrayDecorationList{});
|
||||
|
||||
s = create<ast::Struct>(ast::StructMemberList{create<ast::StructMember>(
|
||||
"foo", &b_ary_type, decos)},
|
||||
ast::StructDecorationList{});
|
||||
s = create<ast::Struct>(
|
||||
ast::StructMemberList{create<ast::StructMember>(
|
||||
mod->RegisterSymbol("foo"), "foo", &b_ary_type, decos)},
|
||||
ast::StructDecorationList{});
|
||||
ast::type::Struct a_type(mod->RegisterSymbol("A"), "A", s);
|
||||
|
||||
ast::type::Array a_ary_type(&a_type, 2, ast::ArrayDecorationList{});
|
||||
|
|
|
@ -231,8 +231,10 @@ TEST_F(BuilderTest, Assign_StructMember) {
|
|||
|
||||
ast::StructMemberDecorationList decos;
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>(Source{}, "a", &f32, decos));
|
||||
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, decos));
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, mod->RegisterSymbol("a"), "a", &f32, decos));
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, mod->RegisterSymbol("b"), "b", &f32, decos));
|
||||
|
||||
auto* s = create<ast::Struct>(Source{}, members, ast::StructDecorationList{});
|
||||
ast::type::Struct s_type(mod->RegisterSymbol("my_struct"), "my_struct", s);
|
||||
|
|
|
@ -945,8 +945,10 @@ TEST_F(SpvBuilderConstructorTest, Type_Struct) {
|
|||
auto* s = create<ast::Struct>(
|
||||
Source{},
|
||||
ast::StructMemberList{
|
||||
create<ast::StructMember>(Source{}, "a", ty.f32, decos),
|
||||
create<ast::StructMember>(Source{}, "b", ty.vec3<f32>(), decos),
|
||||
create<ast::StructMember>(Source{}, mod->RegisterSymbol("a"), "a",
|
||||
ty.f32, decos),
|
||||
create<ast::StructMember>(Source{}, mod->RegisterSymbol("b"), "b",
|
||||
ty.vec3<f32>(), decos),
|
||||
},
|
||||
ast::StructDecorationList{});
|
||||
ast::type::Struct s_type(mod->RegisterSymbol("my_struct"), "my_struct", s);
|
||||
|
@ -1085,7 +1087,8 @@ TEST_F(SpvBuilderConstructorTest, Type_ZeroInit_Struct) {
|
|||
auto* s = create<ast::Struct>(
|
||||
Source{},
|
||||
ast::StructMemberList{
|
||||
create<ast::StructMember>(Source{}, "a", ty.f32, decos),
|
||||
create<ast::StructMember>(Source{}, mod->RegisterSymbol("a"), "a",
|
||||
ty.f32, decos),
|
||||
},
|
||||
ast::StructDecorationList{});
|
||||
ast::type::Struct s_type(mod->RegisterSymbol("my_struct"), "my_struct", s);
|
||||
|
@ -1500,8 +1503,10 @@ TEST_F(SpvBuilderConstructorTest, IsConstructorConst_Struct) {
|
|||
auto* s = create<ast::Struct>(
|
||||
Source{},
|
||||
ast::StructMemberList{
|
||||
create<ast::StructMember>(Source{}, "a", ty.f32, decos),
|
||||
create<ast::StructMember>(Source{}, "b", ty.vec3<f32>(), decos),
|
||||
create<ast::StructMember>(Source{}, mod->RegisterSymbol("a"), "a",
|
||||
ty.f32, decos),
|
||||
create<ast::StructMember>(Source{}, mod->RegisterSymbol("b"), "b",
|
||||
ty.vec3<f32>(), decos),
|
||||
},
|
||||
ast::StructDecorationList{});
|
||||
ast::type::Struct s_type(mod->RegisterSymbol("my_struct"), "my_struct", s);
|
||||
|
@ -1520,8 +1525,10 @@ TEST_F(SpvBuilderConstructorTest,
|
|||
auto* s = create<ast::Struct>(
|
||||
Source{},
|
||||
ast::StructMemberList{
|
||||
create<ast::StructMember>(Source{}, "a", ty.f32, decos),
|
||||
create<ast::StructMember>(Source{}, "b", ty.vec3<f32>(), decos),
|
||||
create<ast::StructMember>(Source{}, mod->RegisterSymbol("a"), "a",
|
||||
ty.f32, decos),
|
||||
create<ast::StructMember>(Source{}, mod->RegisterSymbol("b"), "b",
|
||||
ty.vec3<f32>(), decos),
|
||||
},
|
||||
ast::StructDecorationList{});
|
||||
|
||||
|
|
|
@ -275,7 +275,8 @@ TEST_F(BuilderTest, Emit_Multiple_EntryPoint_With_Same_ModuleVar) {
|
|||
ast::StructMemberList members;
|
||||
ast::StructMemberDecorationList a_deco;
|
||||
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
|
||||
members.push_back(create<ast::StructMember>(Source{}, "d", &f32, a_deco));
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, mod->RegisterSymbol("d"), "d", &f32, a_deco));
|
||||
|
||||
ast::StructDecorationList s_decos;
|
||||
s_decos.push_back(create<ast::StructBlockDecoration>(Source{}));
|
||||
|
|
|
@ -530,8 +530,10 @@ TEST_F(BuilderTest, GlobalVar_DeclReadOnly) {
|
|||
|
||||
ast::StructMemberDecorationList decos;
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, decos));
|
||||
members.push_back(create<ast::StructMember>(Source{}, "b", &i32, decos));
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, mod->RegisterSymbol("a"), "a", &i32, decos));
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, mod->RegisterSymbol("b"), "b", &i32, decos));
|
||||
|
||||
ast::type::Struct A(
|
||||
mod->RegisterSymbol("A"), "A",
|
||||
|
@ -569,7 +571,8 @@ TEST_F(BuilderTest, GlobalVar_TypeAliasDeclReadOnly) {
|
|||
|
||||
ast::StructMemberDecorationList decos;
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, decos));
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, mod->RegisterSymbol("a"), "a", &i32, decos));
|
||||
|
||||
ast::type::Struct A(
|
||||
mod->RegisterSymbol("A"), "A",
|
||||
|
@ -606,7 +609,8 @@ TEST_F(BuilderTest, GlobalVar_TypeAliasAssignReadOnly) {
|
|||
|
||||
ast::StructMemberDecorationList decos;
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, decos));
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, mod->RegisterSymbol("a"), "a", &i32, decos));
|
||||
|
||||
ast::type::Struct A(
|
||||
mod->RegisterSymbol("A"), "A",
|
||||
|
@ -643,7 +647,8 @@ TEST_F(BuilderTest, GlobalVar_TwoVarDeclReadOnly) {
|
|||
|
||||
ast::StructMemberDecorationList decos;
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, decos));
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, mod->RegisterSymbol("a"), "a", &i32, decos));
|
||||
|
||||
ast::type::Struct A(
|
||||
mod->RegisterSymbol("A"), "A",
|
||||
|
|
|
@ -1334,7 +1334,8 @@ OpFunctionEnd
|
|||
TEST_F(IntrinsicBuilderTest, Call_ArrayLength) {
|
||||
ast::StructMemberDecorationList decos;
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>("a", ty.array<f32>(), decos));
|
||||
members.push_back(create<ast::StructMember>(mod->RegisterSymbol("a"), "a",
|
||||
ty.array<f32>(), decos));
|
||||
|
||||
auto* s = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
ast::type::Struct s_type(mod->RegisterSymbol("my_struct"), "my_struct", s);
|
||||
|
@ -1375,8 +1376,10 @@ TEST_F(IntrinsicBuilderTest, Call_ArrayLength) {
|
|||
TEST_F(IntrinsicBuilderTest, Call_ArrayLength_OtherMembersInStruct) {
|
||||
ast::StructMemberDecorationList decos;
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>("z", ty.f32, decos));
|
||||
members.push_back(create<ast::StructMember>("a", ty.array<f32>(), decos));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("z"), "z", ty.f32, decos));
|
||||
members.push_back(create<ast::StructMember>(mod->RegisterSymbol("a"), "a",
|
||||
ty.array<f32>(), decos));
|
||||
|
||||
auto* s = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
ast::type::Struct s_type(mod->RegisterSymbol("my_struct"), "my_struct", s);
|
||||
|
@ -1419,8 +1422,10 @@ TEST_F(IntrinsicBuilderTest, DISABLED_Call_ArrayLength_Ptr) {
|
|||
|
||||
ast::StructMemberDecorationList decos;
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>("z", ty.f32, decos));
|
||||
members.push_back(create<ast::StructMember>("a", ty.array<f32>(), decos));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("z"), "z", ty.f32, decos));
|
||||
members.push_back(create<ast::StructMember>(mod->RegisterSymbol("a"), "a",
|
||||
ty.array<f32>(), decos));
|
||||
|
||||
auto* s = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
ast::type::Struct s_type(mod->RegisterSymbol("my_struct"), "my_struct", s);
|
||||
|
|
|
@ -298,7 +298,8 @@ TEST_F(BuilderTest_Type, GenerateStruct) {
|
|||
|
||||
ast::StructMemberDecorationList decos;
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>(Source{}, "a", &f32, decos));
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, mod->RegisterSymbol("a"), "a", &f32, decos));
|
||||
|
||||
auto* s = create<ast::Struct>(Source{}, members, ast::StructDecorationList{});
|
||||
ast::type::Struct s_type(mod->RegisterSymbol("my_struct"), "my_struct", s);
|
||||
|
@ -320,7 +321,8 @@ TEST_F(BuilderTest_Type, GenerateStruct_Decorated) {
|
|||
|
||||
ast::StructMemberDecorationList decos;
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>(Source{}, "a", &f32, decos));
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, mod->RegisterSymbol("a"), "a", &f32, decos));
|
||||
|
||||
ast::StructDecorationList struct_decos;
|
||||
struct_decos.push_back(create<ast::StructBlockDecoration>(Source{}));
|
||||
|
@ -351,8 +353,10 @@ TEST_F(BuilderTest_Type, GenerateStruct_DecoratedMembers) {
|
|||
b_decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 8));
|
||||
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>(Source{}, "a", &f32, a_decos));
|
||||
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_decos));
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, mod->RegisterSymbol("a"), "a", &f32, a_decos));
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, mod->RegisterSymbol("b"), "b", &f32, b_decos));
|
||||
|
||||
auto* s = create<ast::Struct>(Source{}, members, ast::StructDecorationList{});
|
||||
ast::type::Struct s_type(mod->RegisterSymbol("S"), "S", s);
|
||||
|
@ -384,12 +388,12 @@ TEST_F(BuilderTest_Type, GenerateStruct_NonLayout_Matrix) {
|
|||
ast::StructMemberDecorationList empty_b;
|
||||
ast::StructMemberDecorationList empty_c;
|
||||
ast::StructMemberList members;
|
||||
members.push_back(
|
||||
create<ast::StructMember>(Source{}, "a", &glsl_mat2x2, empty_a));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(Source{}, "b", &glsl_mat2x3, empty_b));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(Source{}, "c", &glsl_mat4x4, empty_c));
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, mod->RegisterSymbol("a"), "a", &glsl_mat2x2, empty_a));
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, mod->RegisterSymbol("b"), "b", &glsl_mat2x3, empty_b));
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, mod->RegisterSymbol("c"), "c", &glsl_mat4x4, empty_c));
|
||||
|
||||
auto* s = create<ast::Struct>(Source{}, members, ast::StructDecorationList{});
|
||||
ast::type::Struct s_type(mod->RegisterSymbol("S"), "S", s);
|
||||
|
@ -430,12 +434,12 @@ TEST_F(BuilderTest_Type, GenerateStruct_DecoratedMembers_LayoutMatrix) {
|
|||
c_decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 48));
|
||||
|
||||
ast::StructMemberList members;
|
||||
members.push_back(
|
||||
create<ast::StructMember>(Source{}, "a", &glsl_mat2x2, a_decos));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(Source{}, "b", &glsl_mat2x3, b_decos));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(Source{}, "c", &glsl_mat4x4, c_decos));
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, mod->RegisterSymbol("a"), "a", &glsl_mat2x2, a_decos));
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, mod->RegisterSymbol("b"), "b", &glsl_mat2x3, b_decos));
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, mod->RegisterSymbol("c"), "c", &glsl_mat4x4, c_decos));
|
||||
|
||||
auto* s = create<ast::Struct>(Source{}, members, ast::StructDecorationList{});
|
||||
ast::type::Struct s_type(mod->RegisterSymbol("S"), "S", s);
|
||||
|
@ -497,12 +501,12 @@ TEST_F(BuilderTest_Type, GenerateStruct_DecoratedMembers_LayoutArraysOfMatrix) {
|
|||
c_decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 48));
|
||||
|
||||
ast::StructMemberList members;
|
||||
members.push_back(
|
||||
create<ast::StructMember>(Source{}, "a", &glsl_mat2x2, a_decos));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(Source{}, "b", &glsl_mat2x3, b_decos));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(Source{}, "c", &glsl_mat4x4, c_decos));
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, mod->RegisterSymbol("a"), "a", &glsl_mat2x2, a_decos));
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, mod->RegisterSymbol("b"), "b", &glsl_mat2x3, b_decos));
|
||||
members.push_back(create<ast::StructMember>(
|
||||
Source{}, mod->RegisterSymbol("c"), "c", &glsl_mat4x4, c_decos));
|
||||
|
||||
auto* s = create<ast::Struct>(Source{}, members, ast::StructDecorationList{});
|
||||
ast::type::Struct s_type(mod->RegisterSymbol("S"), "S", s);
|
||||
|
|
|
@ -40,12 +40,14 @@ TEST_F(WgslGeneratorImplTest, EmitAlias_F32) {
|
|||
|
||||
TEST_F(WgslGeneratorImplTest, EmitConstructedType_Struct) {
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>(
|
||||
"a", ty.f32, ast::StructMemberDecorationList{}));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("a"), "a", ty.f32,
|
||||
ast::StructMemberDecorationList{}));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4));
|
||||
members.push_back(create<ast::StructMember>("b", ty.i32, b_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("b"), "b", ty.i32, b_deco));
|
||||
|
||||
auto* str = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
|
@ -65,12 +67,14 @@ type B = A;
|
|||
|
||||
TEST_F(WgslGeneratorImplTest, EmitAlias_ToStruct) {
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>(
|
||||
"a", ty.f32, ast::StructMemberDecorationList{}));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("a"), "a", ty.f32,
|
||||
ast::StructMemberDecorationList{}));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4));
|
||||
members.push_back(create<ast::StructMember>("b", ty.i32, b_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("b"), "b", ty.i32, b_deco));
|
||||
|
||||
auto* str = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
|
|
|
@ -179,7 +179,8 @@ TEST_F(WgslGeneratorImplTest,
|
|||
ast::StructMemberList members;
|
||||
ast::StructMemberDecorationList a_deco;
|
||||
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0));
|
||||
members.push_back(create<ast::StructMember>("d", ty.f32, a_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("d"), "d", ty.f32, a_deco));
|
||||
|
||||
ast::StructDecorationList s_decos;
|
||||
s_decos.push_back(create<ast::StructBlockDecoration>());
|
||||
|
|
|
@ -60,8 +60,8 @@ TEST_F(WgslGeneratorImplTest, EmitType_Array) {
|
|||
}
|
||||
|
||||
TEST_F(WgslGeneratorImplTest, EmitType_AccessControl_Read) {
|
||||
auto* mem =
|
||||
create<ast::StructMember>("a", ty.i32, ast::StructMemberDecorationList{});
|
||||
auto* mem = create<ast::StructMember>(mod->RegisterSymbol("a"), "a", ty.i32,
|
||||
ast::StructMemberDecorationList{});
|
||||
ast::StructMemberList members;
|
||||
members.push_back(mem);
|
||||
|
||||
|
@ -79,8 +79,8 @@ TEST_F(WgslGeneratorImplTest, EmitType_AccessControl_Read) {
|
|||
}
|
||||
|
||||
TEST_F(WgslGeneratorImplTest, EmitType_AccessControl_ReadWrite) {
|
||||
auto* mem =
|
||||
create<ast::StructMember>("a", ty.i32, ast::StructMemberDecorationList{});
|
||||
auto* mem = create<ast::StructMember>(mod->RegisterSymbol("a"), "a", ty.i32,
|
||||
ast::StructMemberDecorationList{});
|
||||
ast::StructMemberList members;
|
||||
members.push_back(mem);
|
||||
|
||||
|
@ -154,12 +154,14 @@ TEST_F(WgslGeneratorImplTest, EmitType_Pointer) {
|
|||
|
||||
TEST_F(WgslGeneratorImplTest, EmitType_Struct) {
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>(
|
||||
"a", ty.i32, ast::StructMemberDecorationList{}));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("a"), "a", ty.i32,
|
||||
ast::StructMemberDecorationList{}));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4));
|
||||
members.push_back(create<ast::StructMember>("b", ty.f32, b_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("b"), "b", ty.f32, b_deco));
|
||||
|
||||
auto* str = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
|
@ -171,12 +173,14 @@ TEST_F(WgslGeneratorImplTest, EmitType_Struct) {
|
|||
|
||||
TEST_F(WgslGeneratorImplTest, EmitType_StructDecl) {
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>(
|
||||
"a", ty.i32, ast::StructMemberDecorationList{}));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("a"), "a", ty.i32,
|
||||
ast::StructMemberDecorationList{}));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4));
|
||||
members.push_back(create<ast::StructMember>("b", ty.f32, b_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("b"), "b", ty.f32, b_deco));
|
||||
|
||||
auto* str = create<ast::Struct>(members, ast::StructDecorationList{});
|
||||
|
||||
|
@ -193,12 +197,14 @@ TEST_F(WgslGeneratorImplTest, EmitType_StructDecl) {
|
|||
|
||||
TEST_F(WgslGeneratorImplTest, EmitType_Struct_WithDecoration) {
|
||||
ast::StructMemberList members;
|
||||
members.push_back(create<ast::StructMember>(
|
||||
"a", ty.i32, ast::StructMemberDecorationList{}));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("a"), "a", ty.i32,
|
||||
ast::StructMemberDecorationList{}));
|
||||
|
||||
ast::StructMemberDecorationList b_deco;
|
||||
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4));
|
||||
members.push_back(create<ast::StructMember>("b", ty.f32, b_deco));
|
||||
members.push_back(
|
||||
create<ast::StructMember>(mod->RegisterSymbol("b"), "b", ty.f32, b_deco));
|
||||
|
||||
ast::StructDecorationList decos;
|
||||
decos.push_back(create<ast::StructBlockDecoration>());
|
||||
|
|
Loading…
Reference in New Issue