SymbolTable: Change behavior of anonymous symbols

SymbolTable::New() used to build and return a symbol without a registered name. When you asked for the name of the symbol it would return tint_symbol_N, where N is the numerical identifier for the symbol.

This approach was a major tripping hazzard for  transforms that liked to fetch the source program name, and register it in the new program (in this situation, you should always use `CloneContext::Clone(Symbol)`).
Without special casing for unnamed symbols, you could end up promoting the unnamed symbol to a named symbol, and then colliding against a new unnamed symbol.
This is exactly what happened in tint:711.

Instead, with this change:

* The concept of unnamed symbols has been removed. All symbols  now have a name.
* The signature of `SymbolTable::New()` has been changed to take a name parameter (which defaults to 'tint_symbol'). This can be used to create a new, unique named symbol (possibly with a suffix), which will not collide with any existing symbols. Note these symbols may still collide if `SymbolTable::Register()` is called with the same name. All Transforms that currently use `SymbolTable::Register()` will be fixed in another change.
* The CloneContext has been updated to use `SymbolTable::New()` instead of `Register()`. This means that any symbols defined before a clone will not collide.
* `CloneContext::CloneSymbols()` has been added which allows a transform to pre-clone all the symbols from the source program. This can be used to avoid the authored identifiers being suffixed with a number, in the case a transform calls New() before the symbol is cloned.
* `Symbol::to_str()` has been changed to return `$<id>` instead of `tint_symbol_N`. This is to avoid any confusion between the actual name and the symbol ID.

Bug: tint:711
Bug: tint:712
Change-Id: I526e4b49b7027545613859de487e6a275686107a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/47631
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Ben Clayton 2021-04-13 20:07:57 +00:00 committed by Commit Bot service account
parent 46bb2bc935
commit 363a2e26e3
27 changed files with 689 additions and 623 deletions

View File

@ -14,6 +14,8 @@
#include "src/clone_context.h"
#include <string>
#include "src/program_builder.h"
#include "src/utils/get_or_create.h"
@ -33,13 +35,15 @@ Symbol CloneContext::Clone(Symbol s) {
if (symbol_transform_) {
return symbol_transform_(s);
}
if (!src->Symbols().HasName(s)) {
return dst->Symbols().New();
}
return dst->Symbols().Register(src->Symbols().NameFor(s));
return dst->Symbols().New(src->Symbols().NameFor(s));
});
}
CloneContext& CloneContext::CloneSymbols() {
src->Symbols().Foreach([&](Symbol s, const std::string&) { Clone(s); });
return *this;
}
void CloneContext::Clone() {
dst->AST().Copy(this, &src->AST());
}

View File

@ -134,7 +134,7 @@ class CloneContext {
return CheckedCast<T>(c);
}
/// Clones the Source `s` into `dst`
/// Clones the Source `s` into #dst
/// TODO(bclayton) - Currently this 'clone' is a shallow copy. If/when
/// `Source.File`s are owned by the Program this should make a copy of the
/// file.
@ -142,7 +142,7 @@ class CloneContext {
/// @return the cloned source
Source Clone(const Source& s) const { return s; }
/// Clones the Symbol `s` into `dst`
/// Clones the Symbol `s` into #dst
///
/// The Symbol `s` must be owned by the Program #src.
///
@ -150,6 +150,12 @@ class CloneContext {
/// @return the cloned source
Symbol Clone(Symbol s);
/// Clones all the Symbols in `src->Symbols()` into #dst.
/// This may be used to ensure that authored symbols are not suffixed with a
/// unique identifier if they collide with other symbols.
/// @returns this CloneContext so calls can be chained
CloneContext& CloneSymbols();
/// Clones each of the elements of the vector `v` into the ProgramBuilder
/// #dst.
///

View File

@ -60,15 +60,12 @@ struct NotANode : public Castable<NotANode, ast::Node> {
TEST(CloneContext, Clone) {
ProgramBuilder builder;
auto* original_root =
builder.create<Node>(builder.Symbols().Register("root"));
original_root->a = builder.create<Node>(builder.Symbols().Register("a"));
original_root->a->b =
builder.create<Node>(builder.Symbols().Register("a->b"));
original_root->b = builder.create<Node>(builder.Symbols().Register("b"));
auto* original_root = builder.create<Node>(builder.Symbols().New("root"));
original_root->a = builder.create<Node>(builder.Symbols().New("a"));
original_root->a->b = builder.create<Node>(builder.Symbols().New("a->b"));
original_root->b = builder.create<Node>(builder.Symbols().New("b"));
original_root->b->a = original_root->a; // Aliased
original_root->b->b =
builder.create<Node>(builder.Symbols().Register("b->b"));
original_root->b->b = builder.create<Node>(builder.Symbols().New("b->b"));
original_root->c = original_root->b; // Aliased
Program original(std::move(builder));
@ -114,13 +111,11 @@ TEST(CloneContext, Clone) {
TEST(CloneContext, CloneWithReplaceAll_Cloneable) {
ProgramBuilder builder;
auto* original_root =
builder.create<Node>(builder.Symbols().Register("root"));
original_root->a = builder.create<Node>(builder.Symbols().Register("a"));
auto* original_root = builder.create<Node>(builder.Symbols().New("root"));
original_root->a = builder.create<Node>(builder.Symbols().New("a"));
original_root->a->b =
builder.create<Replaceable>(builder.Symbols().Register("a->b"));
original_root->b =
builder.create<Replaceable>(builder.Symbols().Register("b"));
builder.create<Replaceable>(builder.Symbols().New("a->b"));
original_root->b = builder.create<Replaceable>(builder.Symbols().New("b"));
original_root->b->a = original_root->a; // Aliased
original_root->c = original_root->b; // Aliased
Program original(std::move(builder));
@ -140,10 +135,10 @@ TEST(CloneContext, CloneWithReplaceAll_Cloneable) {
CloneContext ctx(&cloned, &original);
ctx.ReplaceAll([&](Replaceable* in) {
auto out_name = cloned.Symbols().Register(
"replacement:" + original.Symbols().NameFor(in->name));
auto b_name = cloned.Symbols().Register(
"replacement-child:" + original.Symbols().NameFor(in->name));
auto out_name = cloned.Symbols().New("replacement:" +
original.Symbols().NameFor(in->name));
auto b_name = cloned.Symbols().New("replacement-child:" +
original.Symbols().NameFor(in->name));
auto* out = cloned.create<Replacement>(out_name);
out->b = cloned.create<Node>(b_name);
out->c = ctx.Clone(in->a);
@ -205,15 +200,12 @@ TEST(CloneContext, CloneWithReplaceAll_Cloneable) {
TEST(CloneContext, CloneWithReplaceAll_Symbols) {
ProgramBuilder builder;
auto* original_root =
builder.create<Node>(builder.Symbols().Register("root"));
original_root->a = builder.create<Node>(builder.Symbols().Register("a"));
original_root->a->b =
builder.create<Node>(builder.Symbols().Register("a->b"));
original_root->b = builder.create<Node>(builder.Symbols().Register("b"));
auto* original_root = builder.create<Node>(builder.Symbols().New("root"));
original_root->a = builder.create<Node>(builder.Symbols().New("a"));
original_root->a->b = builder.create<Node>(builder.Symbols().New("a->b"));
original_root->b = builder.create<Node>(builder.Symbols().New("b"));
original_root->b->a = original_root->a; // Aliased
original_root->b->b =
builder.create<Node>(builder.Symbols().Register("b->b"));
original_root->b->b = builder.create<Node>(builder.Symbols().New("b->b"));
original_root->c = original_root->b; // Aliased
Program original(std::move(builder));
@ -232,7 +224,7 @@ TEST(CloneContext, CloneWithReplaceAll_Symbols) {
.ReplaceAll([&](Symbol sym) {
auto in = original.Symbols().NameFor(sym);
auto out = "transformed<" + in + ">";
return cloned.Symbols().Register(out);
return cloned.Symbols().New(out);
})
.Clone(original_root);
@ -245,15 +237,14 @@ TEST(CloneContext, CloneWithReplaceAll_Symbols) {
TEST(CloneContext, CloneWithoutTransform) {
ProgramBuilder builder;
auto* original_node =
builder.create<Node>(builder.Symbols().Register("root"));
auto* original_node = builder.create<Node>(builder.Symbols().New("root"));
Program original(std::move(builder));
ProgramBuilder cloned;
CloneContext ctx(&cloned, &original);
ctx.ReplaceAll([&](Node*) {
return cloned.create<Replacement>(
builder.Symbols().Register("<unexpected-node>"));
builder.Symbols().New("<unexpected-node>"));
});
auto* cloned_node = ctx.CloneWithoutTransform(original_node);
@ -263,11 +254,10 @@ TEST(CloneContext, CloneWithoutTransform) {
TEST(CloneContext, CloneWithReplace) {
ProgramBuilder builder;
auto* original_root =
builder.create<Node>(builder.Symbols().Register("root"));
original_root->a = builder.create<Node>(builder.Symbols().Register("a"));
original_root->b = builder.create<Node>(builder.Symbols().Register("b"));
original_root->c = builder.create<Node>(builder.Symbols().Register("c"));
auto* original_root = builder.create<Node>(builder.Symbols().New("root"));
original_root->a = builder.create<Node>(builder.Symbols().New("a"));
original_root->b = builder.create<Node>(builder.Symbols().New("b"));
original_root->c = builder.create<Node>(builder.Symbols().New("c"));
Program original(std::move(builder));
// root
@ -276,8 +266,7 @@ TEST(CloneContext, CloneWithReplace) {
// Replaced
ProgramBuilder cloned;
auto* replacement =
cloned.create<Node>(cloned.Symbols().Register("replacement"));
auto* replacement = cloned.create<Node>(cloned.Symbols().New("replacement"));
auto* cloned_root = CloneContext(&cloned, &original)
.Replace(original_root->b, replacement)
@ -295,16 +284,15 @@ TEST(CloneContext, CloneWithReplace) {
TEST(CloneContext, CloneWithInsertBefore) {
ProgramBuilder builder;
auto* original_root =
builder.create<Node>(builder.Symbols().Register("root"));
original_root->a = builder.create<Node>(builder.Symbols().Register("a"));
original_root->b = builder.create<Node>(builder.Symbols().Register("b"));
original_root->c = builder.create<Node>(builder.Symbols().Register("c"));
auto* original_root = builder.create<Node>(builder.Symbols().New("root"));
original_root->a = builder.create<Node>(builder.Symbols().New("a"));
original_root->b = builder.create<Node>(builder.Symbols().New("b"));
original_root->c = builder.create<Node>(builder.Symbols().New("c"));
original_root->vec = {original_root->a, original_root->b, original_root->c};
Program original(std::move(builder));
ProgramBuilder cloned;
auto* insertion = cloned.create<Node>(cloned.Symbols().Register("insertion"));
auto* insertion = cloned.create<Node>(cloned.Symbols().New("insertion"));
auto* cloned_root =
CloneContext(&cloned, &original)
@ -325,16 +313,15 @@ TEST(CloneContext, CloneWithInsertBefore) {
TEST(CloneContext, CloneWithInsertAfter) {
ProgramBuilder builder;
auto* original_root =
builder.create<Node>(builder.Symbols().Register("root"));
original_root->a = builder.create<Node>(builder.Symbols().Register("a"));
original_root->b = builder.create<Node>(builder.Symbols().Register("b"));
original_root->c = builder.create<Node>(builder.Symbols().Register("c"));
auto* original_root = builder.create<Node>(builder.Symbols().New("root"));
original_root->a = builder.create<Node>(builder.Symbols().New("a"));
original_root->b = builder.create<Node>(builder.Symbols().New("b"));
original_root->c = builder.create<Node>(builder.Symbols().New("c"));
original_root->vec = {original_root->a, original_root->b, original_root->c};
Program original(std::move(builder));
ProgramBuilder cloned;
auto* insertion = cloned.create<Node>(cloned.Symbols().Register("insertion"));
auto* insertion = cloned.create<Node>(cloned.Symbols().New("insertion"));
auto* cloned_root =
CloneContext(&cloned, &original)
@ -410,13 +397,10 @@ TEST(CloneContext, CloneWithReplace_WithNotANode) {
{
ProgramBuilder builder;
auto* original_root =
builder.create<Node>(builder.Symbols().Register("root"));
original_root->a =
builder.create<Node>(builder.Symbols().Register("a"));
original_root->b =
builder.create<Node>(builder.Symbols().Register("b"));
original_root->c =
builder.create<Node>(builder.Symbols().Register("c"));
builder.create<Node>(builder.Symbols().New("root"));
original_root->a = builder.create<Node>(builder.Symbols().New("a"));
original_root->b = builder.create<Node>(builder.Symbols().New("b"));
original_root->c = builder.create<Node>(builder.Symbols().New("c"));
Program original(std::move(builder));
// root
@ -435,25 +419,89 @@ TEST(CloneContext, CloneWithReplace_WithNotANode) {
"internal compiler error");
}
TEST(CloneContext, CloneUnnamedSymbols) {
TEST(CloneContext, CloneNewUnnamedSymbols) {
ProgramBuilder builder;
Symbol old_a = builder.Symbols().New();
Symbol old_b = builder.Symbols().New();
Symbol old_c = builder.Symbols().New();
EXPECT_EQ(builder.Symbols().NameFor(old_a), "tint_symbol");
EXPECT_EQ(builder.Symbols().NameFor(old_b), "tint_symbol_1");
EXPECT_EQ(builder.Symbols().NameFor(old_c), "tint_symbol_2");
Program original(std::move(builder));
ProgramBuilder cloned;
CloneContext ctx(&cloned, &original);
Symbol new_a = ctx.Clone(old_a);
Symbol new_x = cloned.Symbols().New();
Symbol new_b = ctx.Clone(old_b);
Symbol new_a = ctx.Clone(old_a);
Symbol new_y = cloned.Symbols().New();
Symbol new_c = ctx.Clone(old_c);
Symbol new_b = ctx.Clone(old_b);
Symbol new_z = cloned.Symbols().New();
Symbol new_c = ctx.Clone(old_c);
std::unordered_set<Symbol> all{new_a, new_x, new_b, new_y, new_c, new_z};
EXPECT_EQ(all.size(), 6u);
EXPECT_EQ(cloned.Symbols().NameFor(new_x), "tint_symbol");
EXPECT_EQ(cloned.Symbols().NameFor(new_a), "tint_symbol_1");
EXPECT_EQ(cloned.Symbols().NameFor(new_y), "tint_symbol_2");
EXPECT_EQ(cloned.Symbols().NameFor(new_b), "tint_symbol_1_1");
EXPECT_EQ(cloned.Symbols().NameFor(new_z), "tint_symbol_3");
EXPECT_EQ(cloned.Symbols().NameFor(new_c), "tint_symbol_2_1");
}
TEST(CloneContext, CloneNewSymbols) {
ProgramBuilder builder;
Symbol old_a = builder.Symbols().New("a");
Symbol old_b = builder.Symbols().New("b");
Symbol old_c = builder.Symbols().New("c");
EXPECT_EQ(builder.Symbols().NameFor(old_a), "a");
EXPECT_EQ(builder.Symbols().NameFor(old_b), "b");
EXPECT_EQ(builder.Symbols().NameFor(old_c), "c");
Program original(std::move(builder));
ProgramBuilder cloned;
CloneContext ctx(&cloned, &original);
Symbol new_x = cloned.Symbols().New("a");
Symbol new_a = ctx.Clone(old_a);
Symbol new_y = cloned.Symbols().New("b");
Symbol new_b = ctx.Clone(old_b);
Symbol new_z = cloned.Symbols().New("c");
Symbol new_c = ctx.Clone(old_c);
EXPECT_EQ(cloned.Symbols().NameFor(new_x), "a");
EXPECT_EQ(cloned.Symbols().NameFor(new_a), "a_1");
EXPECT_EQ(cloned.Symbols().NameFor(new_y), "b");
EXPECT_EQ(cloned.Symbols().NameFor(new_b), "b_1");
EXPECT_EQ(cloned.Symbols().NameFor(new_z), "c");
EXPECT_EQ(cloned.Symbols().NameFor(new_c), "c_1");
}
TEST(CloneContext, CloneNewSymbols_AfterCloneSymbols) {
ProgramBuilder builder;
Symbol old_a = builder.Symbols().New("a");
Symbol old_b = builder.Symbols().New("b");
Symbol old_c = builder.Symbols().New("c");
EXPECT_EQ(builder.Symbols().NameFor(old_a), "a");
EXPECT_EQ(builder.Symbols().NameFor(old_b), "b");
EXPECT_EQ(builder.Symbols().NameFor(old_c), "c");
Program original(std::move(builder));
ProgramBuilder cloned;
CloneContext ctx(&cloned, &original);
ctx.CloneSymbols();
Symbol new_x = cloned.Symbols().New("a");
Symbol new_a = ctx.Clone(old_a);
Symbol new_y = cloned.Symbols().New("b");
Symbol new_b = ctx.Clone(old_b);
Symbol new_z = cloned.Symbols().New("c");
Symbol new_c = ctx.Clone(old_c);
EXPECT_EQ(cloned.Symbols().NameFor(new_x), "a_1");
EXPECT_EQ(cloned.Symbols().NameFor(new_a), "a");
EXPECT_EQ(cloned.Symbols().NameFor(new_y), "b_1");
EXPECT_EQ(cloned.Symbols().NameFor(new_b), "b");
EXPECT_EQ(cloned.Symbols().NameFor(new_z), "c_1");
EXPECT_EQ(cloned.Symbols().NameFor(new_c), "c");
}
} // namespace

View File

@ -19,7 +19,7 @@
namespace tint {
namespace {
constexpr char kSymbol[] = "tint_symbol_";
constexpr char kSymbol[] = "$";
constexpr size_t kSymbolLen = sizeof(kSymbol) - 1;
} // namespace

View File

@ -35,7 +35,7 @@ TEST_F(DemanglerTest, Symbol) {
t.Register("sym1");
Demangler d;
EXPECT_EQ("test sym1 str", d.Demangle(t, "test tint_symbol_1 str"));
EXPECT_EQ("test sym1 str", d.Demangle(t, "test $1 str"));
}
TEST_F(DemanglerTest, MultipleSymbols) {
@ -44,9 +44,7 @@ TEST_F(DemanglerTest, MultipleSymbols) {
t.Register("sym2");
Demangler d;
EXPECT_EQ(
"test sym1 sym2 sym1 str",
d.Demangle(t, "test tint_symbol_1 tint_symbol_2 tint_symbol_1 str"));
EXPECT_EQ("test sym1 sym2 sym1 str", d.Demangle(t, "test $1 $2 $1 str"));
}
} // namespace

View File

@ -44,16 +44,16 @@ TEST_F(SpvParserTest, EmitStatement_VoidCallNoParams) {
ASSERT_TRUE(p->BuildAndParseInternalModule()) << p->error();
const auto got = p->program().to_str(false);
const char* expect = R"(Module{
Function tint_symbol_1 -> __void
Function $1 -> __void
()
{
Return{}
}
Function tint_symbol_2 -> __void
Function $2 -> __void
()
{
Call[not set]{
Identifier[not set]{tint_symbol_1}
Identifier[not set]{$1}
(
)
}

View File

@ -35,7 +35,7 @@ bool Symbol::operator==(const Symbol& other) const {
}
std::string Symbol::to_str() const {
return "tint_symbol_" + std::to_string(val_);
return "$" + std::to_string(val_);
}
} // namespace tint

View File

@ -50,11 +50,6 @@ Symbol SymbolTable::Get(const std::string& name) const {
return it != name_to_symbol_.end() ? it->second : Symbol();
}
bool SymbolTable::HasName(const Symbol symbol) const {
auto it = symbol_to_name_.find(symbol);
return it != symbol_to_name_.end();
}
std::string SymbolTable::NameFor(const Symbol symbol) const {
auto it = symbol_to_name_.find(symbol);
if (it == symbol_to_name_.end()) {
@ -64,8 +59,17 @@ std::string SymbolTable::NameFor(const Symbol symbol) const {
return it->second;
}
Symbol SymbolTable::New() {
return Symbol(next_symbol_++);
Symbol SymbolTable::New(std::string prefix /* = "tint_symbol" */) {
auto it = name_to_symbol_.find(prefix);
if (it == name_to_symbol_.end()) {
return Register(prefix);
}
std::string name;
size_t i = 1;
do {
name = prefix + "_" + std::to_string(i++);
} while (name_to_symbol_.count(name));
return Register(name);
}
} // namespace tint

View File

@ -53,17 +53,28 @@ class SymbolTable {
/// @returns the symbol for the name or symbol::kInvalid if not found.
Symbol Get(const std::string& name) const;
/// @returns true if the symbol has a name
/// @param symbol the symbol to query
bool HasName(const Symbol symbol) const;
/// Returns the name for the given symbol
/// @param symbol the symbol to retrieve the name for
/// @returns the symbol name or "" if not found
std::string NameFor(const Symbol symbol) const;
/// @returns a new, unnamed symbol
Symbol New();
/// Returns a new unique symbol with the given name, possibly suffixed with a
/// unique number.
/// @param name the symbol name
/// @returns a new, unnamed symbol with the given name. If the name is already
/// taken then this will be suffixed with an underscore and a unique numerical
/// value
Symbol New(std::string name = "tint_symbol");
/// Foreach calls the callback function `F` for each symbol in the table.
/// @param callback must be a function or function-like object with the
/// signature: `void(Symbol, const std::string&)`
template <typename F>
void Foreach(F&& callback) const {
for (auto it : symbol_to_name_) {
callback(it.first, it.second);
}
}
private:
// The value to be associated to the next registered symbol table entry.

View File

@ -42,7 +42,7 @@ TEST_F(SymbolTableTest, ReturnsNameForSymbol) {
TEST_F(SymbolTableTest, ReturnsBlankForMissingSymbol) {
SymbolTable s;
EXPECT_EQ("tint_symbol_2", s.NameFor(Symbol(2)));
EXPECT_EQ("$2", s.NameFor(Symbol(2)));
}
TEST_F(SymbolTableTest, ReturnsInvalidForBlankString) {

View File

@ -23,7 +23,7 @@ using SymbolTest = testing::Test;
TEST_F(SymbolTest, ToStr) {
Symbol sym(1);
EXPECT_EQ("tint_symbol_1", sym.to_str());
EXPECT_EQ("$1", sym.to_str());
}
TEST_F(SymbolTest, CopyAssign) {

View File

@ -46,16 +46,16 @@ struct SB {
};
[[internal(intrinsic_buffer_size)]]
fn tint_symbol_1(buffer : SB, result : ptr<function, u32>)
fn tint_symbol(buffer : SB, result : ptr<function, u32>)
var<storage> sb : SB;
[[stage(vertex)]]
fn main() {
var tint_symbol_7 : u32 = 0u;
tint_symbol_1(sb, tint_symbol_7);
let tint_symbol_9 : u32 = ((tint_symbol_7 - 4u) / 4u);
var len : u32 = tint_symbol_9;
var tint_symbol_1 : u32 = 0u;
tint_symbol(sb, tint_symbol_1);
let tint_symbol_2 : u32 = ((tint_symbol_1 - 4u) / 4u);
var len : u32 = tint_symbol_2;
}
)";
@ -90,18 +90,18 @@ struct SB {
};
[[internal(intrinsic_buffer_size)]]
fn tint_symbol_1(buffer : SB, result : ptr<function, u32>)
fn tint_symbol(buffer : SB, result : ptr<function, u32>)
var<storage> sb : SB;
[[stage(vertex)]]
fn main() {
var tint_symbol_7 : u32 = 0u;
tint_symbol_1(sb, tint_symbol_7);
let tint_symbol_9 : u32 = ((tint_symbol_7 - 4u) / 4u);
var a : u32 = tint_symbol_9;
var b : u32 = tint_symbol_9;
var c : u32 = tint_symbol_9;
var tint_symbol_1 : u32 = 0u;
tint_symbol(sb, tint_symbol_1);
let tint_symbol_2 : u32 = ((tint_symbol_1 - 4u) / 4u);
var a : u32 = tint_symbol_2;
var b : u32 = tint_symbol_2;
var c : u32 = tint_symbol_2;
}
)";
@ -136,16 +136,16 @@ struct SB {
};
[[internal(intrinsic_buffer_size)]]
fn tint_symbol_1(buffer : SB, result : ptr<function, u32>)
fn tint_symbol(buffer : SB, result : ptr<function, u32>)
var<storage> sb : SB;
[[stage(vertex)]]
fn main() {
var tint_symbol_8 : u32 = 0u;
tint_symbol_1(sb, tint_symbol_8);
let tint_symbol_10 : u32 = ((tint_symbol_8 - 8u) / 64u);
var len : u32 = tint_symbol_10;
var tint_symbol_1 : u32 = 0u;
tint_symbol(sb, tint_symbol_1);
let tint_symbol_2 : u32 = ((tint_symbol_1 - 8u) / 64u);
var len : u32 = tint_symbol_2;
}
)";
@ -184,23 +184,23 @@ struct SB {
};
[[internal(intrinsic_buffer_size)]]
fn tint_symbol_1(buffer : SB, result : ptr<function, u32>)
fn tint_symbol(buffer : SB, result : ptr<function, u32>)
var<storage> sb : SB;
[[stage(vertex)]]
fn main() {
if (true) {
var tint_symbol_7 : u32 = 0u;
tint_symbol_1(sb, tint_symbol_7);
let tint_symbol_9 : u32 = ((tint_symbol_7 - 4u) / 4u);
var len : u32 = tint_symbol_9;
var tint_symbol_1 : u32 = 0u;
tint_symbol(sb, tint_symbol_1);
let tint_symbol_2 : u32 = ((tint_symbol_1 - 4u) / 4u);
var len : u32 = tint_symbol_2;
} else {
if (true) {
var tint_symbol_10 : u32 = 0u;
tint_symbol_1(sb, tint_symbol_10);
let tint_symbol_11 : u32 = ((tint_symbol_10 - 4u) / 4u);
var len : u32 = tint_symbol_11;
var tint_symbol_3 : u32 = 0u;
tint_symbol(sb, tint_symbol_3);
let tint_symbol_4 : u32 = ((tint_symbol_3 - 4u) / 4u);
var len : u32 = tint_symbol_4;
}
}
}
@ -245,7 +245,7 @@ struct SB1 {
};
[[internal(intrinsic_buffer_size)]]
fn tint_symbol_1(buffer : SB1, result : ptr<function, u32>)
fn tint_symbol(buffer : SB1, result : ptr<function, u32>)
[[block]]
struct SB2 {
@ -254,7 +254,7 @@ struct SB2 {
};
[[internal(intrinsic_buffer_size)]]
fn tint_symbol_10(buffer : SB2, result : ptr<function, u32>)
fn tint_symbol_3(buffer : SB2, result : ptr<function, u32>)
var<storage> sb1 : SB1;
@ -262,14 +262,14 @@ var<storage> sb2 : SB2;
[[stage(vertex)]]
fn main() {
var tint_symbol_7 : u32 = 0u;
tint_symbol_1(sb1, tint_symbol_7);
let tint_symbol_9 : u32 = ((tint_symbol_7 - 4u) / 4u);
var tint_symbol_13 : u32 = 0u;
tint_symbol_10(sb2, tint_symbol_13);
let tint_symbol_15 : u32 = ((tint_symbol_13 - 16u) / 16u);
var len1 : u32 = tint_symbol_9;
var len2 : u32 = tint_symbol_15;
var tint_symbol_1 : u32 = 0u;
tint_symbol(sb1, tint_symbol_1);
let tint_symbol_2 : u32 = ((tint_symbol_1 - 4u) / 4u);
var tint_symbol_4 : u32 = 0u;
tint_symbol_3(sb2, tint_symbol_4);
let tint_symbol_5 : u32 = ((tint_symbol_4 - 16u) / 16u);
var len1 : u32 = tint_symbol_2;
var len2 : u32 = tint_symbol_5;
var x : u32 = (len1 + len2);
}
)";

View File

@ -33,7 +33,7 @@ fn frag_main([[builtin(frag_coord)]] coord : vec4<f32>,
)";
auto* expect = R"(
struct tint_symbol_5 {
struct tint_symbol_1 {
[[builtin(frag_coord)]]
coord : vec4<f32>;
[[location(1)]]
@ -43,10 +43,10 @@ struct tint_symbol_5 {
};
[[stage(fragment)]]
fn frag_main(tint_symbol_1 : tint_symbol_5) {
let coord : vec4<f32> = tint_symbol_1.coord;
let loc1 : f32 = tint_symbol_1.loc1;
let loc2 : vec4<u32> = tint_symbol_1.loc2;
fn frag_main(tint_symbol : tint_symbol_1) {
let coord : vec4<f32> = tint_symbol.coord;
let loc1 : f32 = tint_symbol.loc1;
let loc2 : vec4<u32> = tint_symbol.loc2;
var col : f32 = (coord.x * loc1);
}
)";
@ -69,14 +69,14 @@ fn frag_main([[location(1)]] loc1 : myf32) {
auto* expect = R"(
type myf32 = f32;
struct tint_symbol_4 {
struct tint_symbol_1 {
[[location(1)]]
loc1 : myf32;
};
[[stage(fragment)]]
fn frag_main(tint_symbol_1 : tint_symbol_4) {
let loc1 : myf32 = tint_symbol_1.loc1;
fn frag_main(tint_symbol : tint_symbol_1) {
let loc1 : myf32 = tint_symbol.loc1;
var x : myf32 = loc1;
}
)";
@ -96,7 +96,7 @@ fn frag_main([[builtin(frag_coord)]] coord : vec4<f32>,
)";
auto* expect = R"(
struct tint_symbol_5 {
struct tint_symbol_1 {
[[builtin(frag_coord)]]
coord : vec4<f32>;
[[location(1)]]
@ -106,7 +106,7 @@ struct tint_symbol_5 {
};
[[stage(fragment)]]
fn frag_main(tint_symbol_1 : tint_symbol_5) {
fn frag_main(tint_symbol : tint_symbol_1) {
}
)";
@ -143,7 +143,7 @@ struct FragLocations {
loc2 : vec4<u32>;
};
struct tint_symbol_10 {
struct tint_symbol_1 {
[[builtin(frag_coord)]]
coord : vec4<f32>;
[[location(1)]]
@ -155,10 +155,10 @@ struct tint_symbol_10 {
};
[[stage(fragment)]]
fn frag_main(tint_symbol_6 : tint_symbol_10) {
let builtins : FragBuiltins = FragBuiltins(tint_symbol_6.coord);
let locations : FragLocations = FragLocations(tint_symbol_6.loc1, tint_symbol_6.loc2);
let loc0 : f32 = tint_symbol_6.loc0;
fn frag_main(tint_symbol : tint_symbol_1) {
let builtins : FragBuiltins = FragBuiltins(tint_symbol.coord);
let locations : FragLocations = FragLocations(tint_symbol.loc1, tint_symbol.loc2);
let loc0 : f32 = tint_symbol.loc0;
var col : f32 = ((builtins.coord.x * locations.loc1) + loc0);
}
)";
@ -177,14 +177,14 @@ fn frag_main() -> [[builtin(frag_depth)]] f32 {
)";
auto* expect = R"(
struct tint_symbol_2 {
struct tint_symbol {
[[builtin(frag_depth)]]
value : f32;
};
[[stage(fragment)]]
fn frag_main() -> tint_symbol_2 {
return tint_symbol_2(1.0);
fn frag_main() -> tint_symbol {
return tint_symbol(1.0);
}
)";
@ -218,7 +218,7 @@ struct FragOutput {
color : vec4<f32>;
};
struct tint_symbol_5 {
struct tint_symbol {
[[builtin(frag_depth)]]
depth : f32;
[[builtin(sample_mask_out)]]
@ -228,12 +228,12 @@ struct tint_symbol_5 {
};
[[stage(fragment)]]
fn frag_main() -> tint_symbol_5 {
fn frag_main() -> tint_symbol {
var output : FragOutput;
output.depth = 1.0;
output.mask = 7u;
output.color = vec4<f32>(0.5, 0.5, 0.5, 1.0);
return tint_symbol_5(output.depth, output.mask, output.color);
return tint_symbol(output.depth, output.mask, output.color);
}
)";
@ -274,7 +274,7 @@ fn foo(x : FragmentInput) -> f32 {
return (x.value * x.mul);
}
struct tint_symbol_6 {
struct tint_symbol_1 {
[[location(0)]]
value : f32;
[[location(1)]]
@ -282,12 +282,12 @@ struct tint_symbol_6 {
};
[[stage(fragment)]]
fn frag_main1(tint_symbol_4 : tint_symbol_6) {
let inputs : FragmentInput = FragmentInput(tint_symbol_4.value, tint_symbol_4.mul);
fn frag_main1(tint_symbol : tint_symbol_1) {
let inputs : FragmentInput = FragmentInput(tint_symbol.value, tint_symbol.mul);
var x : f32 = foo(inputs);
}
struct tint_symbol_11 {
struct tint_symbol_3 {
[[location(0)]]
value : f32;
[[location(1)]]
@ -295,8 +295,8 @@ struct tint_symbol_11 {
};
[[stage(fragment)]]
fn frag_main2(tint_symbol_10 : tint_symbol_11) {
let inputs : FragmentInput = FragmentInput(tint_symbol_10.value, tint_symbol_10.mul);
fn frag_main2(tint_symbol_2 : tint_symbol_3) {
let inputs : FragmentInput = FragmentInput(tint_symbol_2.value, tint_symbol_2.mul);
var x : f32 = foo(inputs);
}
)";
@ -347,7 +347,7 @@ fn bar() -> f32 {
return (global_inputs.col2 * 2.0);
}
struct tint_symbol_6 {
struct tint_symbol_1 {
[[location(0)]]
col1 : f32;
[[location(1)]]
@ -355,8 +355,8 @@ struct tint_symbol_6 {
};
[[stage(fragment)]]
fn frag_main1(tint_symbol_4 : tint_symbol_6) {
let inputs : FragmentInput = FragmentInput(tint_symbol_4.col1, tint_symbol_4.col2);
fn frag_main1(tint_symbol : tint_symbol_1) {
let inputs : FragmentInput = FragmentInput(tint_symbol.col1, tint_symbol.col2);
global_inputs = inputs;
var r : f32 = foo();
var g : f32 = bar();
@ -418,14 +418,14 @@ fn foo(x : MyFragmentInput) -> myf32 {
return x.col1;
}
struct tint_symbol_9 {
struct tint_symbol_1 {
[[location(0)]]
col1 : myf32;
[[location(1)]]
col2 : myf32;
};
struct tint_symbol_10 {
struct tint_symbol_2 {
[[location(0)]]
col1 : myf32;
[[location(1)]]
@ -433,11 +433,11 @@ struct tint_symbol_10 {
};
[[stage(fragment)]]
fn frag_main(tint_symbol_6 : tint_symbol_9) -> tint_symbol_10 {
let inputs : MyFragmentInput = MyFragmentInput(tint_symbol_6.col1, tint_symbol_6.col2);
fn frag_main(tint_symbol : tint_symbol_1) -> tint_symbol_2 {
let inputs : MyFragmentInput = MyFragmentInput(tint_symbol.col1, tint_symbol.col2);
var x : myf32 = foo(inputs);
let tint_symbol_13 : FragmentOutput = MyFragmentOutput(x, inputs.col2);
return tint_symbol_10(tint_symbol_13.col1, tint_symbol_13.col2);
let tint_symbol_3 : FragmentOutput = MyFragmentOutput(x, inputs.col2);
return tint_symbol_2(tint_symbol_3.col1, tint_symbol_3.col2);
}
)";
@ -478,23 +478,23 @@ struct FragmentOutput {
value : f32;
};
struct tint_symbol_7 {
struct tint_symbol_1 {
[[location(1)]]
value : f32;
[[builtin(frag_coord)]]
coord : vec4<f32>;
};
struct tint_symbol_8 {
struct tint_symbol_2 {
[[location(1)]]
value : f32;
};
[[stage(fragment)]]
fn frag_main(tint_symbol_5 : tint_symbol_7) -> tint_symbol_8 {
let inputs : FragmentInput = FragmentInput(tint_symbol_5.value, tint_symbol_5.coord);
let tint_symbol_10 : FragmentOutput = FragmentOutput((inputs.coord.x * inputs.value));
return tint_symbol_8(tint_symbol_10.value);
fn frag_main(tint_symbol : tint_symbol_1) -> tint_symbol_2 {
let inputs : FragmentInput = FragmentInput(tint_symbol.value, tint_symbol.coord);
let tint_symbol_3 : FragmentOutput = FragmentOutput((inputs.coord.x * inputs.value));
return tint_symbol_2(tint_symbol_3.value);
}
)";

View File

@ -613,6 +613,10 @@ Transform::Output DecomposeStorageAccess::Run(const Program* in,
ProgramBuilder out;
CloneContext ctx(&out, in);
// Start by cloning all the symbols. This ensures that the authored symbols
// won't get renamed if they collide with new symbols below.
ctx.CloneSymbols();
auto& sem = ctx.src->Sem();
State state;

View File

@ -107,116 +107,116 @@ struct SB {
};
[[internal(intrinsic_load_i32)]]
fn tint_symbol_26(buffer : SB, offset : u32) -> i32
fn tint_symbol(buffer : SB, offset : u32) -> i32
[[internal(intrinsic_load_u32)]]
fn tint_symbol_28(buffer : SB, offset : u32) -> u32
fn tint_symbol_1(buffer : SB, offset : u32) -> u32
[[internal(intrinsic_load_f32)]]
fn tint_symbol_29(buffer : SB, offset : u32) -> f32
fn tint_symbol_2(buffer : SB, offset : u32) -> f32
[[internal(intrinsic_load_vec2_i32)]]
fn tint_symbol_30(buffer : SB, offset : u32) -> vec2<i32>
fn tint_symbol_3(buffer : SB, offset : u32) -> vec2<i32>
[[internal(intrinsic_load_vec2_u32)]]
fn tint_symbol_31(buffer : SB, offset : u32) -> vec2<u32>
fn tint_symbol_4(buffer : SB, offset : u32) -> vec2<u32>
[[internal(intrinsic_load_vec2_f32)]]
fn tint_symbol_32(buffer : SB, offset : u32) -> vec2<f32>
fn tint_symbol_5(buffer : SB, offset : u32) -> vec2<f32>
[[internal(intrinsic_load_vec3_i32)]]
fn tint_symbol_33(buffer : SB, offset : u32) -> vec3<i32>
fn tint_symbol_6(buffer : SB, offset : u32) -> vec3<i32>
[[internal(intrinsic_load_vec3_u32)]]
fn tint_symbol_34(buffer : SB, offset : u32) -> vec3<u32>
fn tint_symbol_7(buffer : SB, offset : u32) -> vec3<u32>
[[internal(intrinsic_load_vec3_f32)]]
fn tint_symbol_35(buffer : SB, offset : u32) -> vec3<f32>
fn tint_symbol_8(buffer : SB, offset : u32) -> vec3<f32>
[[internal(intrinsic_load_vec4_i32)]]
fn tint_symbol_36(buffer : SB, offset : u32) -> vec4<i32>
fn tint_symbol_9(buffer : SB, offset : u32) -> vec4<i32>
[[internal(intrinsic_load_vec4_u32)]]
fn tint_symbol_37(buffer : SB, offset : u32) -> vec4<u32>
fn tint_symbol_10(buffer : SB, offset : u32) -> vec4<u32>
[[internal(intrinsic_load_vec4_f32)]]
fn tint_symbol_38(buffer : SB, offset : u32) -> vec4<f32>
fn tint_symbol_11(buffer : SB, offset : u32) -> vec4<f32>
[[internal(intrinsic_load_vec2_f32)]]
fn tint_symbol_39(buffer : SB, offset : u32) -> vec2<f32>
fn tint_symbol_12(buffer : SB, offset : u32) -> vec2<f32>
fn tint_symbol_40(buffer : SB, offset : u32) -> mat2x2<f32> {
return mat2x2<f32>(tint_symbol_39(buffer, (offset + 0u)), tint_symbol_39(buffer, (offset + 8u)));
fn tint_symbol_13(buffer : SB, offset : u32) -> mat2x2<f32> {
return mat2x2<f32>(tint_symbol_12(buffer, (offset + 0u)), tint_symbol_12(buffer, (offset + 8u)));
}
[[internal(intrinsic_load_vec3_f32)]]
fn tint_symbol_41(buffer : SB, offset : u32) -> vec3<f32>
fn tint_symbol_14(buffer : SB, offset : u32) -> vec3<f32>
fn tint_symbol_42(buffer : SB, offset : u32) -> mat2x3<f32> {
return mat2x3<f32>(tint_symbol_41(buffer, (offset + 0u)), tint_symbol_41(buffer, (offset + 16u)));
fn tint_symbol_15(buffer : SB, offset : u32) -> mat2x3<f32> {
return mat2x3<f32>(tint_symbol_14(buffer, (offset + 0u)), tint_symbol_14(buffer, (offset + 16u)));
}
[[internal(intrinsic_load_vec4_f32)]]
fn tint_symbol_43(buffer : SB, offset : u32) -> vec4<f32>
fn tint_symbol_16(buffer : SB, offset : u32) -> vec4<f32>
fn tint_symbol_44(buffer : SB, offset : u32) -> mat2x4<f32> {
return mat2x4<f32>(tint_symbol_43(buffer, (offset + 0u)), tint_symbol_43(buffer, (offset + 16u)));
fn tint_symbol_17(buffer : SB, offset : u32) -> mat2x4<f32> {
return mat2x4<f32>(tint_symbol_16(buffer, (offset + 0u)), tint_symbol_16(buffer, (offset + 16u)));
}
fn tint_symbol_45(buffer : SB, offset : u32) -> mat3x2<f32> {
return mat3x2<f32>(tint_symbol_39(buffer, (offset + 0u)), tint_symbol_39(buffer, (offset + 8u)), tint_symbol_39(buffer, (offset + 16u)));
fn tint_symbol_18(buffer : SB, offset : u32) -> mat3x2<f32> {
return mat3x2<f32>(tint_symbol_12(buffer, (offset + 0u)), tint_symbol_12(buffer, (offset + 8u)), tint_symbol_12(buffer, (offset + 16u)));
}
fn tint_symbol_46(buffer : SB, offset : u32) -> mat3x3<f32> {
return mat3x3<f32>(tint_symbol_41(buffer, (offset + 0u)), tint_symbol_41(buffer, (offset + 16u)), tint_symbol_41(buffer, (offset + 32u)));
fn tint_symbol_19(buffer : SB, offset : u32) -> mat3x3<f32> {
return mat3x3<f32>(tint_symbol_14(buffer, (offset + 0u)), tint_symbol_14(buffer, (offset + 16u)), tint_symbol_14(buffer, (offset + 32u)));
}
fn tint_symbol_47(buffer : SB, offset : u32) -> mat3x4<f32> {
return mat3x4<f32>(tint_symbol_43(buffer, (offset + 0u)), tint_symbol_43(buffer, (offset + 16u)), tint_symbol_43(buffer, (offset + 32u)));
fn tint_symbol_20(buffer : SB, offset : u32) -> mat3x4<f32> {
return mat3x4<f32>(tint_symbol_16(buffer, (offset + 0u)), tint_symbol_16(buffer, (offset + 16u)), tint_symbol_16(buffer, (offset + 32u)));
}
fn tint_symbol_48(buffer : SB, offset : u32) -> mat4x2<f32> {
return mat4x2<f32>(tint_symbol_39(buffer, (offset + 0u)), tint_symbol_39(buffer, (offset + 8u)), tint_symbol_39(buffer, (offset + 16u)), tint_symbol_39(buffer, (offset + 24u)));
fn tint_symbol_21(buffer : SB, offset : u32) -> mat4x2<f32> {
return mat4x2<f32>(tint_symbol_12(buffer, (offset + 0u)), tint_symbol_12(buffer, (offset + 8u)), tint_symbol_12(buffer, (offset + 16u)), tint_symbol_12(buffer, (offset + 24u)));
}
fn tint_symbol_49(buffer : SB, offset : u32) -> mat4x3<f32> {
return mat4x3<f32>(tint_symbol_41(buffer, (offset + 0u)), tint_symbol_41(buffer, (offset + 16u)), tint_symbol_41(buffer, (offset + 32u)), tint_symbol_41(buffer, (offset + 48u)));
fn tint_symbol_22(buffer : SB, offset : u32) -> mat4x3<f32> {
return mat4x3<f32>(tint_symbol_14(buffer, (offset + 0u)), tint_symbol_14(buffer, (offset + 16u)), tint_symbol_14(buffer, (offset + 32u)), tint_symbol_14(buffer, (offset + 48u)));
}
fn tint_symbol_50(buffer : SB, offset : u32) -> mat4x4<f32> {
return mat4x4<f32>(tint_symbol_43(buffer, (offset + 0u)), tint_symbol_43(buffer, (offset + 16u)), tint_symbol_43(buffer, (offset + 32u)), tint_symbol_43(buffer, (offset + 48u)));
fn tint_symbol_23(buffer : SB, offset : u32) -> mat4x4<f32> {
return mat4x4<f32>(tint_symbol_16(buffer, (offset + 0u)), tint_symbol_16(buffer, (offset + 16u)), tint_symbol_16(buffer, (offset + 32u)), tint_symbol_16(buffer, (offset + 48u)));
}
fn tint_symbol_51(buffer : SB, offset : u32) -> array<vec3<f32>, 2> {
return array<vec3<f32>, 2>(tint_symbol_35(buffer, (offset + 0u)), tint_symbol_35(buffer, (offset + 16u)));
fn tint_symbol_24(buffer : SB, offset : u32) -> array<vec3<f32>, 2> {
return array<vec3<f32>, 2>(tint_symbol_8(buffer, (offset + 0u)), tint_symbol_8(buffer, (offset + 16u)));
}
var<storage> sb : SB;
[[stage(compute)]]
fn main() {
var a : i32 = tint_symbol_26(sb, 0u);
var b : u32 = tint_symbol_28(sb, 4u);
var c : f32 = tint_symbol_29(sb, 8u);
var d : vec2<i32> = tint_symbol_30(sb, 16u);
var e : vec2<u32> = tint_symbol_31(sb, 24u);
var f : vec2<f32> = tint_symbol_32(sb, 32u);
var g : vec3<i32> = tint_symbol_33(sb, 48u);
var h : vec3<u32> = tint_symbol_34(sb, 64u);
var i : vec3<f32> = tint_symbol_35(sb, 80u);
var j : vec4<i32> = tint_symbol_36(sb, 96u);
var k : vec4<u32> = tint_symbol_37(sb, 112u);
var l : vec4<f32> = tint_symbol_38(sb, 128u);
var m : mat2x2<f32> = tint_symbol_40(sb, 144u);
var n : mat2x3<f32> = tint_symbol_42(sb, 160u);
var o : mat2x4<f32> = tint_symbol_44(sb, 192u);
var p : mat3x2<f32> = tint_symbol_45(sb, 224u);
var q : mat3x3<f32> = tint_symbol_46(sb, 256u);
var r : mat3x4<f32> = tint_symbol_47(sb, 304u);
var s : mat4x2<f32> = tint_symbol_48(sb, 352u);
var t : mat4x3<f32> = tint_symbol_49(sb, 384u);
var u : mat4x4<f32> = tint_symbol_50(sb, 448u);
var v : array<vec3<f32>, 2> = tint_symbol_51(sb, 512u);
var a : i32 = tint_symbol(sb, 0u);
var b : u32 = tint_symbol_1(sb, 4u);
var c : f32 = tint_symbol_2(sb, 8u);
var d : vec2<i32> = tint_symbol_3(sb, 16u);
var e : vec2<u32> = tint_symbol_4(sb, 24u);
var f : vec2<f32> = tint_symbol_5(sb, 32u);
var g : vec3<i32> = tint_symbol_6(sb, 48u);
var h : vec3<u32> = tint_symbol_7(sb, 64u);
var i : vec3<f32> = tint_symbol_8(sb, 80u);
var j : vec4<i32> = tint_symbol_9(sb, 96u);
var k : vec4<u32> = tint_symbol_10(sb, 112u);
var l : vec4<f32> = tint_symbol_11(sb, 128u);
var m : mat2x2<f32> = tint_symbol_13(sb, 144u);
var n : mat2x3<f32> = tint_symbol_15(sb, 160u);
var o : mat2x4<f32> = tint_symbol_17(sb, 192u);
var p : mat3x2<f32> = tint_symbol_18(sb, 224u);
var q : mat3x3<f32> = tint_symbol_19(sb, 256u);
var r : mat3x4<f32> = tint_symbol_20(sb, 304u);
var s : mat4x2<f32> = tint_symbol_21(sb, 352u);
var t : mat4x3<f32> = tint_symbol_22(sb, 384u);
var u : mat4x4<f32> = tint_symbol_23(sb, 448u);
var v : array<vec3<f32>, 2> = tint_symbol_24(sb, 512u);
}
)";
@ -310,135 +310,135 @@ struct SB {
};
[[internal(intrinsic_store_i32)]]
fn tint_symbol_27(buffer : SB, offset : u32, value : i32)
fn tint_symbol(buffer : SB, offset : u32, value : i32)
[[internal(intrinsic_store_u32)]]
fn tint_symbol_29(buffer : SB, offset : u32, value : u32)
fn tint_symbol_1(buffer : SB, offset : u32, value : u32)
[[internal(intrinsic_store_f32)]]
fn tint_symbol_30(buffer : SB, offset : u32, value : f32)
fn tint_symbol_2(buffer : SB, offset : u32, value : f32)
[[internal(intrinsic_store_vec2_u32)]]
fn tint_symbol_31(buffer : SB, offset : u32, value : vec2<i32>)
fn tint_symbol_3(buffer : SB, offset : u32, value : vec2<i32>)
[[internal(intrinsic_store_vec2_f32)]]
fn tint_symbol_32(buffer : SB, offset : u32, value : vec2<u32>)
fn tint_symbol_4(buffer : SB, offset : u32, value : vec2<u32>)
[[internal(intrinsic_store_vec2_i32)]]
fn tint_symbol_33(buffer : SB, offset : u32, value : vec2<f32>)
fn tint_symbol_5(buffer : SB, offset : u32, value : vec2<f32>)
[[internal(intrinsic_store_vec3_u32)]]
fn tint_symbol_34(buffer : SB, offset : u32, value : vec3<i32>)
fn tint_symbol_6(buffer : SB, offset : u32, value : vec3<i32>)
[[internal(intrinsic_store_vec3_f32)]]
fn tint_symbol_35(buffer : SB, offset : u32, value : vec3<u32>)
fn tint_symbol_7(buffer : SB, offset : u32, value : vec3<u32>)
[[internal(intrinsic_store_vec3_i32)]]
fn tint_symbol_36(buffer : SB, offset : u32, value : vec3<f32>)
fn tint_symbol_8(buffer : SB, offset : u32, value : vec3<f32>)
[[internal(intrinsic_store_vec4_u32)]]
fn tint_symbol_37(buffer : SB, offset : u32, value : vec4<i32>)
fn tint_symbol_9(buffer : SB, offset : u32, value : vec4<i32>)
[[internal(intrinsic_store_vec4_f32)]]
fn tint_symbol_38(buffer : SB, offset : u32, value : vec4<u32>)
fn tint_symbol_10(buffer : SB, offset : u32, value : vec4<u32>)
[[internal(intrinsic_store_vec4_i32)]]
fn tint_symbol_39(buffer : SB, offset : u32, value : vec4<f32>)
fn tint_symbol_11(buffer : SB, offset : u32, value : vec4<f32>)
[[internal(intrinsic_store_vec2_i32)]]
fn tint_symbol_40(buffer : SB, offset : u32, value : vec2<f32>)
fn tint_symbol_12(buffer : SB, offset : u32, value : vec2<f32>)
fn tint_symbol_41(buffer : SB, offset : u32, value : mat2x2<f32>) {
tint_symbol_40(buffer, (offset + 0u), value[0u]);
tint_symbol_40(buffer, (offset + 8u), value[1u]);
fn tint_symbol_13(buffer : SB, offset : u32, value : mat2x2<f32>) {
tint_symbol_12(buffer, (offset + 0u), value[0u]);
tint_symbol_12(buffer, (offset + 8u), value[1u]);
}
[[internal(intrinsic_store_vec3_i32)]]
fn tint_symbol_42(buffer : SB, offset : u32, value : vec3<f32>)
fn tint_symbol_14(buffer : SB, offset : u32, value : vec3<f32>)
fn tint_symbol_43(buffer : SB, offset : u32, value : mat2x3<f32>) {
tint_symbol_42(buffer, (offset + 0u), value[0u]);
tint_symbol_42(buffer, (offset + 16u), value[1u]);
fn tint_symbol_15(buffer : SB, offset : u32, value : mat2x3<f32>) {
tint_symbol_14(buffer, (offset + 0u), value[0u]);
tint_symbol_14(buffer, (offset + 16u), value[1u]);
}
[[internal(intrinsic_store_vec4_i32)]]
fn tint_symbol_44(buffer : SB, offset : u32, value : vec4<f32>)
fn tint_symbol_16(buffer : SB, offset : u32, value : vec4<f32>)
fn tint_symbol_45(buffer : SB, offset : u32, value : mat2x4<f32>) {
tint_symbol_44(buffer, (offset + 0u), value[0u]);
tint_symbol_44(buffer, (offset + 16u), value[1u]);
fn tint_symbol_17(buffer : SB, offset : u32, value : mat2x4<f32>) {
tint_symbol_16(buffer, (offset + 0u), value[0u]);
tint_symbol_16(buffer, (offset + 16u), value[1u]);
}
fn tint_symbol_46(buffer : SB, offset : u32, value : mat3x2<f32>) {
tint_symbol_40(buffer, (offset + 0u), value[0u]);
tint_symbol_40(buffer, (offset + 8u), value[1u]);
tint_symbol_40(buffer, (offset + 16u), value[2u]);
fn tint_symbol_18(buffer : SB, offset : u32, value : mat3x2<f32>) {
tint_symbol_12(buffer, (offset + 0u), value[0u]);
tint_symbol_12(buffer, (offset + 8u), value[1u]);
tint_symbol_12(buffer, (offset + 16u), value[2u]);
}
fn tint_symbol_47(buffer : SB, offset : u32, value : mat3x3<f32>) {
tint_symbol_42(buffer, (offset + 0u), value[0u]);
tint_symbol_42(buffer, (offset + 16u), value[1u]);
tint_symbol_42(buffer, (offset + 32u), value[2u]);
fn tint_symbol_19(buffer : SB, offset : u32, value : mat3x3<f32>) {
tint_symbol_14(buffer, (offset + 0u), value[0u]);
tint_symbol_14(buffer, (offset + 16u), value[1u]);
tint_symbol_14(buffer, (offset + 32u), value[2u]);
}
fn tint_symbol_48(buffer : SB, offset : u32, value : mat3x4<f32>) {
tint_symbol_44(buffer, (offset + 0u), value[0u]);
tint_symbol_44(buffer, (offset + 16u), value[1u]);
tint_symbol_44(buffer, (offset + 32u), value[2u]);
fn tint_symbol_20(buffer : SB, offset : u32, value : mat3x4<f32>) {
tint_symbol_16(buffer, (offset + 0u), value[0u]);
tint_symbol_16(buffer, (offset + 16u), value[1u]);
tint_symbol_16(buffer, (offset + 32u), value[2u]);
}
fn tint_symbol_49(buffer : SB, offset : u32, value : mat4x2<f32>) {
tint_symbol_40(buffer, (offset + 0u), value[0u]);
tint_symbol_40(buffer, (offset + 8u), value[1u]);
tint_symbol_40(buffer, (offset + 16u), value[2u]);
tint_symbol_40(buffer, (offset + 24u), value[3u]);
fn tint_symbol_21(buffer : SB, offset : u32, value : mat4x2<f32>) {
tint_symbol_12(buffer, (offset + 0u), value[0u]);
tint_symbol_12(buffer, (offset + 8u), value[1u]);
tint_symbol_12(buffer, (offset + 16u), value[2u]);
tint_symbol_12(buffer, (offset + 24u), value[3u]);
}
fn tint_symbol_50(buffer : SB, offset : u32, value : mat4x3<f32>) {
tint_symbol_42(buffer, (offset + 0u), value[0u]);
tint_symbol_42(buffer, (offset + 16u), value[1u]);
tint_symbol_42(buffer, (offset + 32u), value[2u]);
tint_symbol_42(buffer, (offset + 48u), value[3u]);
fn tint_symbol_22(buffer : SB, offset : u32, value : mat4x3<f32>) {
tint_symbol_14(buffer, (offset + 0u), value[0u]);
tint_symbol_14(buffer, (offset + 16u), value[1u]);
tint_symbol_14(buffer, (offset + 32u), value[2u]);
tint_symbol_14(buffer, (offset + 48u), value[3u]);
}
fn tint_symbol_51(buffer : SB, offset : u32, value : mat4x4<f32>) {
tint_symbol_44(buffer, (offset + 0u), value[0u]);
tint_symbol_44(buffer, (offset + 16u), value[1u]);
tint_symbol_44(buffer, (offset + 32u), value[2u]);
tint_symbol_44(buffer, (offset + 48u), value[3u]);
fn tint_symbol_23(buffer : SB, offset : u32, value : mat4x4<f32>) {
tint_symbol_16(buffer, (offset + 0u), value[0u]);
tint_symbol_16(buffer, (offset + 16u), value[1u]);
tint_symbol_16(buffer, (offset + 32u), value[2u]);
tint_symbol_16(buffer, (offset + 48u), value[3u]);
}
fn tint_symbol_52(buffer : SB, offset : u32, value : array<vec3<f32>, 2>) {
tint_symbol_36(buffer, (offset + 0u), value[0u]);
tint_symbol_36(buffer, (offset + 16u), value[1u]);
fn tint_symbol_24(buffer : SB, offset : u32, value : array<vec3<f32>, 2>) {
tint_symbol_8(buffer, (offset + 0u), value[0u]);
tint_symbol_8(buffer, (offset + 16u), value[1u]);
}
var<storage> sb : SB;
[[stage(compute)]]
fn main() {
tint_symbol_27(sb, 0u, i32());
tint_symbol_29(sb, 4u, u32());
tint_symbol_30(sb, 8u, f32());
tint_symbol_31(sb, 16u, vec2<i32>());
tint_symbol_32(sb, 24u, vec2<u32>());
tint_symbol_33(sb, 32u, vec2<f32>());
tint_symbol_34(sb, 48u, vec3<i32>());
tint_symbol_35(sb, 64u, vec3<u32>());
tint_symbol_36(sb, 80u, vec3<f32>());
tint_symbol_37(sb, 96u, vec4<i32>());
tint_symbol_38(sb, 112u, vec4<u32>());
tint_symbol_39(sb, 128u, vec4<f32>());
tint_symbol_41(sb, 144u, mat2x2<f32>());
tint_symbol_43(sb, 160u, mat2x3<f32>());
tint_symbol_45(sb, 192u, mat2x4<f32>());
tint_symbol_46(sb, 224u, mat3x2<f32>());
tint_symbol_47(sb, 256u, mat3x3<f32>());
tint_symbol_48(sb, 304u, mat3x4<f32>());
tint_symbol_49(sb, 352u, mat4x2<f32>());
tint_symbol_50(sb, 384u, mat4x3<f32>());
tint_symbol_51(sb, 448u, mat4x4<f32>());
tint_symbol_52(sb, 512u, array<vec3<f32>, 2>());
tint_symbol(sb, 0u, i32());
tint_symbol_1(sb, 4u, u32());
tint_symbol_2(sb, 8u, f32());
tint_symbol_3(sb, 16u, vec2<i32>());
tint_symbol_4(sb, 24u, vec2<u32>());
tint_symbol_5(sb, 32u, vec2<f32>());
tint_symbol_6(sb, 48u, vec3<i32>());
tint_symbol_7(sb, 64u, vec3<u32>());
tint_symbol_8(sb, 80u, vec3<f32>());
tint_symbol_9(sb, 96u, vec4<i32>());
tint_symbol_10(sb, 112u, vec4<u32>());
tint_symbol_11(sb, 128u, vec4<f32>());
tint_symbol_13(sb, 144u, mat2x2<f32>());
tint_symbol_15(sb, 160u, mat2x3<f32>());
tint_symbol_17(sb, 192u, mat2x4<f32>());
tint_symbol_18(sb, 224u, mat3x2<f32>());
tint_symbol_19(sb, 256u, mat3x3<f32>());
tint_symbol_20(sb, 304u, mat3x4<f32>());
tint_symbol_21(sb, 352u, mat4x2<f32>());
tint_symbol_22(sb, 384u, mat4x3<f32>());
tint_symbol_23(sb, 448u, mat4x4<f32>());
tint_symbol_24(sb, 512u, array<vec3<f32>, 2>());
}
)";
@ -511,99 +511,99 @@ struct SB {
};
[[internal(intrinsic_load_i32)]]
fn tint_symbol_26(buffer : SB, offset : u32) -> i32
fn tint_symbol(buffer : SB, offset : u32) -> i32
[[internal(intrinsic_load_u32)]]
fn tint_symbol_27(buffer : SB, offset : u32) -> u32
fn tint_symbol_1(buffer : SB, offset : u32) -> u32
[[internal(intrinsic_load_f32)]]
fn tint_symbol_28(buffer : SB, offset : u32) -> f32
fn tint_symbol_2(buffer : SB, offset : u32) -> f32
[[internal(intrinsic_load_vec2_i32)]]
fn tint_symbol_29(buffer : SB, offset : u32) -> vec2<i32>
fn tint_symbol_3(buffer : SB, offset : u32) -> vec2<i32>
[[internal(intrinsic_load_vec2_u32)]]
fn tint_symbol_30(buffer : SB, offset : u32) -> vec2<u32>
fn tint_symbol_4(buffer : SB, offset : u32) -> vec2<u32>
[[internal(intrinsic_load_vec2_f32)]]
fn tint_symbol_31(buffer : SB, offset : u32) -> vec2<f32>
fn tint_symbol_5(buffer : SB, offset : u32) -> vec2<f32>
[[internal(intrinsic_load_vec3_i32)]]
fn tint_symbol_32(buffer : SB, offset : u32) -> vec3<i32>
fn tint_symbol_6(buffer : SB, offset : u32) -> vec3<i32>
[[internal(intrinsic_load_vec3_u32)]]
fn tint_symbol_33(buffer : SB, offset : u32) -> vec3<u32>
fn tint_symbol_7(buffer : SB, offset : u32) -> vec3<u32>
[[internal(intrinsic_load_vec3_f32)]]
fn tint_symbol_34(buffer : SB, offset : u32) -> vec3<f32>
fn tint_symbol_8(buffer : SB, offset : u32) -> vec3<f32>
[[internal(intrinsic_load_vec4_i32)]]
fn tint_symbol_35(buffer : SB, offset : u32) -> vec4<i32>
fn tint_symbol_9(buffer : SB, offset : u32) -> vec4<i32>
[[internal(intrinsic_load_vec4_u32)]]
fn tint_symbol_36(buffer : SB, offset : u32) -> vec4<u32>
fn tint_symbol_10(buffer : SB, offset : u32) -> vec4<u32>
[[internal(intrinsic_load_vec4_f32)]]
fn tint_symbol_37(buffer : SB, offset : u32) -> vec4<f32>
fn tint_symbol_11(buffer : SB, offset : u32) -> vec4<f32>
[[internal(intrinsic_load_vec2_f32)]]
fn tint_symbol_38(buffer : SB, offset : u32) -> vec2<f32>
fn tint_symbol_12(buffer : SB, offset : u32) -> vec2<f32>
fn tint_symbol_39(buffer : SB, offset : u32) -> mat2x2<f32> {
return mat2x2<f32>(tint_symbol_38(buffer, (offset + 0u)), tint_symbol_38(buffer, (offset + 8u)));
fn tint_symbol_13(buffer : SB, offset : u32) -> mat2x2<f32> {
return mat2x2<f32>(tint_symbol_12(buffer, (offset + 0u)), tint_symbol_12(buffer, (offset + 8u)));
}
[[internal(intrinsic_load_vec3_f32)]]
fn tint_symbol_40(buffer : SB, offset : u32) -> vec3<f32>
fn tint_symbol_14(buffer : SB, offset : u32) -> vec3<f32>
fn tint_symbol_41(buffer : SB, offset : u32) -> mat2x3<f32> {
return mat2x3<f32>(tint_symbol_40(buffer, (offset + 0u)), tint_symbol_40(buffer, (offset + 16u)));
fn tint_symbol_15(buffer : SB, offset : u32) -> mat2x3<f32> {
return mat2x3<f32>(tint_symbol_14(buffer, (offset + 0u)), tint_symbol_14(buffer, (offset + 16u)));
}
[[internal(intrinsic_load_vec4_f32)]]
fn tint_symbol_42(buffer : SB, offset : u32) -> vec4<f32>
fn tint_symbol_16(buffer : SB, offset : u32) -> vec4<f32>
fn tint_symbol_43(buffer : SB, offset : u32) -> mat2x4<f32> {
return mat2x4<f32>(tint_symbol_42(buffer, (offset + 0u)), tint_symbol_42(buffer, (offset + 16u)));
fn tint_symbol_17(buffer : SB, offset : u32) -> mat2x4<f32> {
return mat2x4<f32>(tint_symbol_16(buffer, (offset + 0u)), tint_symbol_16(buffer, (offset + 16u)));
}
fn tint_symbol_44(buffer : SB, offset : u32) -> mat3x2<f32> {
return mat3x2<f32>(tint_symbol_38(buffer, (offset + 0u)), tint_symbol_38(buffer, (offset + 8u)), tint_symbol_38(buffer, (offset + 16u)));
fn tint_symbol_18(buffer : SB, offset : u32) -> mat3x2<f32> {
return mat3x2<f32>(tint_symbol_12(buffer, (offset + 0u)), tint_symbol_12(buffer, (offset + 8u)), tint_symbol_12(buffer, (offset + 16u)));
}
fn tint_symbol_45(buffer : SB, offset : u32) -> mat3x3<f32> {
return mat3x3<f32>(tint_symbol_40(buffer, (offset + 0u)), tint_symbol_40(buffer, (offset + 16u)), tint_symbol_40(buffer, (offset + 32u)));
fn tint_symbol_19(buffer : SB, offset : u32) -> mat3x3<f32> {
return mat3x3<f32>(tint_symbol_14(buffer, (offset + 0u)), tint_symbol_14(buffer, (offset + 16u)), tint_symbol_14(buffer, (offset + 32u)));
}
fn tint_symbol_46(buffer : SB, offset : u32) -> mat3x4<f32> {
return mat3x4<f32>(tint_symbol_42(buffer, (offset + 0u)), tint_symbol_42(buffer, (offset + 16u)), tint_symbol_42(buffer, (offset + 32u)));
fn tint_symbol_20(buffer : SB, offset : u32) -> mat3x4<f32> {
return mat3x4<f32>(tint_symbol_16(buffer, (offset + 0u)), tint_symbol_16(buffer, (offset + 16u)), tint_symbol_16(buffer, (offset + 32u)));
}
fn tint_symbol_47(buffer : SB, offset : u32) -> mat4x2<f32> {
return mat4x2<f32>(tint_symbol_38(buffer, (offset + 0u)), tint_symbol_38(buffer, (offset + 8u)), tint_symbol_38(buffer, (offset + 16u)), tint_symbol_38(buffer, (offset + 24u)));
fn tint_symbol_21(buffer : SB, offset : u32) -> mat4x2<f32> {
return mat4x2<f32>(tint_symbol_12(buffer, (offset + 0u)), tint_symbol_12(buffer, (offset + 8u)), tint_symbol_12(buffer, (offset + 16u)), tint_symbol_12(buffer, (offset + 24u)));
}
fn tint_symbol_48(buffer : SB, offset : u32) -> mat4x3<f32> {
return mat4x3<f32>(tint_symbol_40(buffer, (offset + 0u)), tint_symbol_40(buffer, (offset + 16u)), tint_symbol_40(buffer, (offset + 32u)), tint_symbol_40(buffer, (offset + 48u)));
fn tint_symbol_22(buffer : SB, offset : u32) -> mat4x3<f32> {
return mat4x3<f32>(tint_symbol_14(buffer, (offset + 0u)), tint_symbol_14(buffer, (offset + 16u)), tint_symbol_14(buffer, (offset + 32u)), tint_symbol_14(buffer, (offset + 48u)));
}
fn tint_symbol_49(buffer : SB, offset : u32) -> mat4x4<f32> {
return mat4x4<f32>(tint_symbol_42(buffer, (offset + 0u)), tint_symbol_42(buffer, (offset + 16u)), tint_symbol_42(buffer, (offset + 32u)), tint_symbol_42(buffer, (offset + 48u)));
fn tint_symbol_23(buffer : SB, offset : u32) -> mat4x4<f32> {
return mat4x4<f32>(tint_symbol_16(buffer, (offset + 0u)), tint_symbol_16(buffer, (offset + 16u)), tint_symbol_16(buffer, (offset + 32u)), tint_symbol_16(buffer, (offset + 48u)));
}
fn tint_symbol_50(buffer : SB, offset : u32) -> array<vec3<f32>, 2> {
return array<vec3<f32>, 2>(tint_symbol_34(buffer, (offset + 0u)), tint_symbol_34(buffer, (offset + 16u)));
fn tint_symbol_24(buffer : SB, offset : u32) -> array<vec3<f32>, 2> {
return array<vec3<f32>, 2>(tint_symbol_8(buffer, (offset + 0u)), tint_symbol_8(buffer, (offset + 16u)));
}
fn tint_symbol_51(buffer : SB, offset : u32) -> SB {
return SB(tint_symbol_26(buffer, (offset + 0u)), tint_symbol_27(buffer, (offset + 4u)), tint_symbol_28(buffer, (offset + 8u)), tint_symbol_29(buffer, (offset + 16u)), tint_symbol_30(buffer, (offset + 24u)), tint_symbol_31(buffer, (offset + 32u)), tint_symbol_32(buffer, (offset + 48u)), tint_symbol_33(buffer, (offset + 64u)), tint_symbol_34(buffer, (offset + 80u)), tint_symbol_35(buffer, (offset + 96u)), tint_symbol_36(buffer, (offset + 112u)), tint_symbol_37(buffer, (offset + 128u)), tint_symbol_39(buffer, (offset + 144u)), tint_symbol_41(buffer, (offset + 160u)), tint_symbol_43(buffer, (offset + 192u)), tint_symbol_44(buffer, (offset + 224u)), tint_symbol_45(buffer, (offset + 256u)), tint_symbol_46(buffer, (offset + 304u)), tint_symbol_47(buffer, (offset + 352u)), tint_symbol_48(buffer, (offset + 384u)), tint_symbol_49(buffer, (offset + 448u)), tint_symbol_50(buffer, (offset + 512u)));
fn tint_symbol_25(buffer : SB, offset : u32) -> SB {
return SB(tint_symbol(buffer, (offset + 0u)), tint_symbol_1(buffer, (offset + 4u)), tint_symbol_2(buffer, (offset + 8u)), tint_symbol_3(buffer, (offset + 16u)), tint_symbol_4(buffer, (offset + 24u)), tint_symbol_5(buffer, (offset + 32u)), tint_symbol_6(buffer, (offset + 48u)), tint_symbol_7(buffer, (offset + 64u)), tint_symbol_8(buffer, (offset + 80u)), tint_symbol_9(buffer, (offset + 96u)), tint_symbol_10(buffer, (offset + 112u)), tint_symbol_11(buffer, (offset + 128u)), tint_symbol_13(buffer, (offset + 144u)), tint_symbol_15(buffer, (offset + 160u)), tint_symbol_17(buffer, (offset + 192u)), tint_symbol_18(buffer, (offset + 224u)), tint_symbol_19(buffer, (offset + 256u)), tint_symbol_20(buffer, (offset + 304u)), tint_symbol_21(buffer, (offset + 352u)), tint_symbol_22(buffer, (offset + 384u)), tint_symbol_23(buffer, (offset + 448u)), tint_symbol_24(buffer, (offset + 512u)));
}
var<storage> sb : SB;
[[stage(compute)]]
fn main() {
var x : SB = tint_symbol_51(sb, 0u);
var x : SB = tint_symbol_25(sb, 0u);
}
)";
@ -676,139 +676,139 @@ struct SB {
};
[[internal(intrinsic_store_i32)]]
fn tint_symbol_27(buffer : SB, offset : u32, value : i32)
fn tint_symbol(buffer : SB, offset : u32, value : i32)
[[internal(intrinsic_store_u32)]]
fn tint_symbol_28(buffer : SB, offset : u32, value : u32)
fn tint_symbol_1(buffer : SB, offset : u32, value : u32)
[[internal(intrinsic_store_f32)]]
fn tint_symbol_29(buffer : SB, offset : u32, value : f32)
fn tint_symbol_2(buffer : SB, offset : u32, value : f32)
[[internal(intrinsic_store_vec2_u32)]]
fn tint_symbol_30(buffer : SB, offset : u32, value : vec2<i32>)
fn tint_symbol_3(buffer : SB, offset : u32, value : vec2<i32>)
[[internal(intrinsic_store_vec2_f32)]]
fn tint_symbol_31(buffer : SB, offset : u32, value : vec2<u32>)
fn tint_symbol_4(buffer : SB, offset : u32, value : vec2<u32>)
[[internal(intrinsic_store_vec2_i32)]]
fn tint_symbol_32(buffer : SB, offset : u32, value : vec2<f32>)
fn tint_symbol_5(buffer : SB, offset : u32, value : vec2<f32>)
[[internal(intrinsic_store_vec3_u32)]]
fn tint_symbol_33(buffer : SB, offset : u32, value : vec3<i32>)
fn tint_symbol_6(buffer : SB, offset : u32, value : vec3<i32>)
[[internal(intrinsic_store_vec3_f32)]]
fn tint_symbol_34(buffer : SB, offset : u32, value : vec3<u32>)
fn tint_symbol_7(buffer : SB, offset : u32, value : vec3<u32>)
[[internal(intrinsic_store_vec3_i32)]]
fn tint_symbol_35(buffer : SB, offset : u32, value : vec3<f32>)
fn tint_symbol_8(buffer : SB, offset : u32, value : vec3<f32>)
[[internal(intrinsic_store_vec4_u32)]]
fn tint_symbol_36(buffer : SB, offset : u32, value : vec4<i32>)
fn tint_symbol_9(buffer : SB, offset : u32, value : vec4<i32>)
[[internal(intrinsic_store_vec4_f32)]]
fn tint_symbol_37(buffer : SB, offset : u32, value : vec4<u32>)
fn tint_symbol_10(buffer : SB, offset : u32, value : vec4<u32>)
[[internal(intrinsic_store_vec4_i32)]]
fn tint_symbol_38(buffer : SB, offset : u32, value : vec4<f32>)
fn tint_symbol_11(buffer : SB, offset : u32, value : vec4<f32>)
[[internal(intrinsic_store_vec2_i32)]]
fn tint_symbol_39(buffer : SB, offset : u32, value : vec2<f32>)
fn tint_symbol_12(buffer : SB, offset : u32, value : vec2<f32>)
fn tint_symbol_40(buffer : SB, offset : u32, value : mat2x2<f32>) {
tint_symbol_39(buffer, (offset + 0u), value[0u]);
tint_symbol_39(buffer, (offset + 8u), value[1u]);
fn tint_symbol_13(buffer : SB, offset : u32, value : mat2x2<f32>) {
tint_symbol_12(buffer, (offset + 0u), value[0u]);
tint_symbol_12(buffer, (offset + 8u), value[1u]);
}
[[internal(intrinsic_store_vec3_i32)]]
fn tint_symbol_41(buffer : SB, offset : u32, value : vec3<f32>)
fn tint_symbol_14(buffer : SB, offset : u32, value : vec3<f32>)
fn tint_symbol_42(buffer : SB, offset : u32, value : mat2x3<f32>) {
tint_symbol_41(buffer, (offset + 0u), value[0u]);
tint_symbol_41(buffer, (offset + 16u), value[1u]);
fn tint_symbol_15(buffer : SB, offset : u32, value : mat2x3<f32>) {
tint_symbol_14(buffer, (offset + 0u), value[0u]);
tint_symbol_14(buffer, (offset + 16u), value[1u]);
}
[[internal(intrinsic_store_vec4_i32)]]
fn tint_symbol_43(buffer : SB, offset : u32, value : vec4<f32>)
fn tint_symbol_16(buffer : SB, offset : u32, value : vec4<f32>)
fn tint_symbol_44(buffer : SB, offset : u32, value : mat2x4<f32>) {
tint_symbol_43(buffer, (offset + 0u), value[0u]);
tint_symbol_43(buffer, (offset + 16u), value[1u]);
fn tint_symbol_17(buffer : SB, offset : u32, value : mat2x4<f32>) {
tint_symbol_16(buffer, (offset + 0u), value[0u]);
tint_symbol_16(buffer, (offset + 16u), value[1u]);
}
fn tint_symbol_45(buffer : SB, offset : u32, value : mat3x2<f32>) {
tint_symbol_39(buffer, (offset + 0u), value[0u]);
tint_symbol_39(buffer, (offset + 8u), value[1u]);
tint_symbol_39(buffer, (offset + 16u), value[2u]);
fn tint_symbol_18(buffer : SB, offset : u32, value : mat3x2<f32>) {
tint_symbol_12(buffer, (offset + 0u), value[0u]);
tint_symbol_12(buffer, (offset + 8u), value[1u]);
tint_symbol_12(buffer, (offset + 16u), value[2u]);
}
fn tint_symbol_46(buffer : SB, offset : u32, value : mat3x3<f32>) {
tint_symbol_41(buffer, (offset + 0u), value[0u]);
tint_symbol_41(buffer, (offset + 16u), value[1u]);
tint_symbol_41(buffer, (offset + 32u), value[2u]);
fn tint_symbol_19(buffer : SB, offset : u32, value : mat3x3<f32>) {
tint_symbol_14(buffer, (offset + 0u), value[0u]);
tint_symbol_14(buffer, (offset + 16u), value[1u]);
tint_symbol_14(buffer, (offset + 32u), value[2u]);
}
fn tint_symbol_47(buffer : SB, offset : u32, value : mat3x4<f32>) {
tint_symbol_43(buffer, (offset + 0u), value[0u]);
tint_symbol_43(buffer, (offset + 16u), value[1u]);
tint_symbol_43(buffer, (offset + 32u), value[2u]);
fn tint_symbol_20(buffer : SB, offset : u32, value : mat3x4<f32>) {
tint_symbol_16(buffer, (offset + 0u), value[0u]);
tint_symbol_16(buffer, (offset + 16u), value[1u]);
tint_symbol_16(buffer, (offset + 32u), value[2u]);
}
fn tint_symbol_48(buffer : SB, offset : u32, value : mat4x2<f32>) {
tint_symbol_39(buffer, (offset + 0u), value[0u]);
tint_symbol_39(buffer, (offset + 8u), value[1u]);
tint_symbol_39(buffer, (offset + 16u), value[2u]);
tint_symbol_39(buffer, (offset + 24u), value[3u]);
fn tint_symbol_21(buffer : SB, offset : u32, value : mat4x2<f32>) {
tint_symbol_12(buffer, (offset + 0u), value[0u]);
tint_symbol_12(buffer, (offset + 8u), value[1u]);
tint_symbol_12(buffer, (offset + 16u), value[2u]);
tint_symbol_12(buffer, (offset + 24u), value[3u]);
}
fn tint_symbol_49(buffer : SB, offset : u32, value : mat4x3<f32>) {
tint_symbol_41(buffer, (offset + 0u), value[0u]);
tint_symbol_41(buffer, (offset + 16u), value[1u]);
tint_symbol_41(buffer, (offset + 32u), value[2u]);
tint_symbol_41(buffer, (offset + 48u), value[3u]);
fn tint_symbol_22(buffer : SB, offset : u32, value : mat4x3<f32>) {
tint_symbol_14(buffer, (offset + 0u), value[0u]);
tint_symbol_14(buffer, (offset + 16u), value[1u]);
tint_symbol_14(buffer, (offset + 32u), value[2u]);
tint_symbol_14(buffer, (offset + 48u), value[3u]);
}
fn tint_symbol_50(buffer : SB, offset : u32, value : mat4x4<f32>) {
tint_symbol_43(buffer, (offset + 0u), value[0u]);
tint_symbol_43(buffer, (offset + 16u), value[1u]);
tint_symbol_43(buffer, (offset + 32u), value[2u]);
tint_symbol_43(buffer, (offset + 48u), value[3u]);
fn tint_symbol_23(buffer : SB, offset : u32, value : mat4x4<f32>) {
tint_symbol_16(buffer, (offset + 0u), value[0u]);
tint_symbol_16(buffer, (offset + 16u), value[1u]);
tint_symbol_16(buffer, (offset + 32u), value[2u]);
tint_symbol_16(buffer, (offset + 48u), value[3u]);
}
fn tint_symbol_51(buffer : SB, offset : u32, value : array<vec3<f32>, 2>) {
tint_symbol_35(buffer, (offset + 0u), value[0u]);
tint_symbol_35(buffer, (offset + 16u), value[1u]);
fn tint_symbol_24(buffer : SB, offset : u32, value : array<vec3<f32>, 2>) {
tint_symbol_8(buffer, (offset + 0u), value[0u]);
tint_symbol_8(buffer, (offset + 16u), value[1u]);
}
fn tint_symbol_52(buffer : SB, offset : u32, value : SB) {
tint_symbol_27(buffer, (offset + 0u), value.a);
tint_symbol_28(buffer, (offset + 4u), value.b);
tint_symbol_29(buffer, (offset + 8u), value.c);
tint_symbol_30(buffer, (offset + 16u), value.d);
tint_symbol_31(buffer, (offset + 24u), value.e);
tint_symbol_32(buffer, (offset + 32u), value.f);
tint_symbol_33(buffer, (offset + 48u), value.g);
tint_symbol_34(buffer, (offset + 64u), value.h);
tint_symbol_35(buffer, (offset + 80u), value.i);
tint_symbol_36(buffer, (offset + 96u), value.j);
tint_symbol_37(buffer, (offset + 112u), value.k);
tint_symbol_38(buffer, (offset + 128u), value.l);
tint_symbol_40(buffer, (offset + 144u), value.m);
tint_symbol_42(buffer, (offset + 160u), value.n);
tint_symbol_44(buffer, (offset + 192u), value.o);
tint_symbol_45(buffer, (offset + 224u), value.p);
tint_symbol_46(buffer, (offset + 256u), value.q);
tint_symbol_47(buffer, (offset + 304u), value.r);
tint_symbol_48(buffer, (offset + 352u), value.s);
tint_symbol_49(buffer, (offset + 384u), value.t);
tint_symbol_50(buffer, (offset + 448u), value.u);
tint_symbol_51(buffer, (offset + 512u), value.v);
fn tint_symbol_25(buffer : SB, offset : u32, value : SB) {
tint_symbol(buffer, (offset + 0u), value.a);
tint_symbol_1(buffer, (offset + 4u), value.b);
tint_symbol_2(buffer, (offset + 8u), value.c);
tint_symbol_3(buffer, (offset + 16u), value.d);
tint_symbol_4(buffer, (offset + 24u), value.e);
tint_symbol_5(buffer, (offset + 32u), value.f);
tint_symbol_6(buffer, (offset + 48u), value.g);
tint_symbol_7(buffer, (offset + 64u), value.h);
tint_symbol_8(buffer, (offset + 80u), value.i);
tint_symbol_9(buffer, (offset + 96u), value.j);
tint_symbol_10(buffer, (offset + 112u), value.k);
tint_symbol_11(buffer, (offset + 128u), value.l);
tint_symbol_13(buffer, (offset + 144u), value.m);
tint_symbol_15(buffer, (offset + 160u), value.n);
tint_symbol_17(buffer, (offset + 192u), value.o);
tint_symbol_18(buffer, (offset + 224u), value.p);
tint_symbol_19(buffer, (offset + 256u), value.q);
tint_symbol_20(buffer, (offset + 304u), value.r);
tint_symbol_21(buffer, (offset + 352u), value.s);
tint_symbol_22(buffer, (offset + 384u), value.t);
tint_symbol_23(buffer, (offset + 448u), value.u);
tint_symbol_24(buffer, (offset + 512u), value.v);
}
var<storage> sb : SB;
[[stage(compute)]]
fn main() {
tint_symbol_52(sb, 0u, SB());
tint_symbol_25(sb, 0u, SB());
}
)";
@ -874,13 +874,13 @@ struct SB {
};
[[internal(intrinsic_load_f32)]]
fn tint_symbol_9(buffer : SB, offset : u32) -> f32
fn tint_symbol(buffer : SB, offset : u32) -> f32
var<storage> sb : SB;
[[stage(compute)]]
fn main() {
var x : f32 = tint_symbol_9(sb, 1224u);
var x : f32 = tint_symbol(sb, 1224u);
}
)";
@ -942,7 +942,7 @@ struct SB {
};
[[internal(intrinsic_load_f32)]]
fn tint_symbol_12(buffer : SB, offset : u32) -> f32
fn tint_symbol(buffer : SB, offset : u32) -> f32
var<storage> sb : SB;
@ -951,7 +951,7 @@ fn main() {
var i : i32 = 4;
var j : u32 = 1u;
var k : i32 = 2;
var x : f32 = tint_symbol_12(sb, (((((128u + (256u * u32(i))) + 16u) + (32u * j)) + 16u) + (4u * u32(k))));
var x : f32 = tint_symbol(sb, (((((128u + (256u * u32(i))) + 16u) + (32u * j)) + 16u) + (4u * u32(k))));
}
)";
@ -1029,7 +1029,7 @@ struct SB {
};
[[internal(intrinsic_load_f32)]]
fn tint_symbol_14(buffer : SB, offset : u32) -> f32
fn tint_symbol(buffer : SB, offset : u32) -> f32
var<storage> sb : SB;
@ -1038,7 +1038,7 @@ fn main() {
var i : i32 = 4;
var j : u32 = 1u;
var k : i32 = 2;
var x : f32 = tint_symbol_14(sb, (((((128u + (256u * u32(i))) + 16u) + (32u * j)) + 16u) + (4u * u32(k))));
var x : f32 = tint_symbol(sb, (((((128u + (256u * u32(i))) + 16u) + (32u * j)) + 16u) + (4u * u32(k))));
}
)";

View File

@ -59,11 +59,11 @@ fn entry([[builtin(vertex_index)]] vert_idx : u32) {
auto* expect = R"(
[[block]]
struct tint_symbol_2 {
struct tint_symbol {
first_vertex_index : u32;
};
[[binding(1), group(2)]] var<uniform> tint_symbol_3 : tint_symbol_2;
[[binding(1), group(2)]] var<uniform> tint_symbol_1 : tint_symbol;
fn test(vert_idx : u32) -> u32 {
return vert_idx;
@ -71,7 +71,7 @@ fn test(vert_idx : u32) -> u32 {
[[stage(vertex)]]
fn entry([[builtin(vertex_index)]] vert_idx : u32) {
test((vert_idx + tint_symbol_3.first_vertex_index));
test((vert_idx + tint_symbol_1.first_vertex_index));
}
)";
@ -104,11 +104,11 @@ fn entry([[builtin(instance_index)]] inst_idx : u32) {
auto* expect = R"(
[[block]]
struct tint_symbol_2 {
struct tint_symbol {
first_instance_index : u32;
};
[[binding(1), group(7)]] var<uniform> tint_symbol_3 : tint_symbol_2;
[[binding(1), group(7)]] var<uniform> tint_symbol_1 : tint_symbol;
fn test(inst_idx : u32) -> u32 {
return inst_idx;
@ -116,7 +116,7 @@ fn test(inst_idx : u32) -> u32 {
[[stage(vertex)]]
fn entry([[builtin(instance_index)]] inst_idx : u32) {
test((inst_idx + tint_symbol_3.first_instance_index));
test((inst_idx + tint_symbol_1.first_instance_index));
}
)";
@ -154,12 +154,12 @@ fn entry(inputs : Inputs) {
auto* expect = R"(
[[block]]
struct tint_symbol_3 {
struct tint_symbol {
first_vertex_index : u32;
first_instance_index : u32;
};
[[binding(1), group(2)]] var<uniform> tint_symbol_4 : tint_symbol_3;
[[binding(1), group(2)]] var<uniform> tint_symbol_1 : tint_symbol;
fn test(instance_idx : u32, vert_idx : u32) -> u32 {
return (instance_idx + vert_idx);
@ -174,7 +174,7 @@ struct Inputs {
[[stage(vertex)]]
fn entry(inputs : Inputs) {
test((inputs.instance_idx + tint_symbol_4.first_instance_index), (inputs.vert_idx + tint_symbol_4.first_vertex_index));
test((inputs.instance_idx + tint_symbol_1.first_instance_index), (inputs.vert_idx + tint_symbol_1.first_vertex_index));
}
)";
@ -211,11 +211,11 @@ fn entry([[builtin(vertex_index)]] vert_idx : u32) {
auto* expect = R"(
[[block]]
struct tint_symbol_2 {
struct tint_symbol {
first_vertex_index : u32;
};
[[binding(1), group(2)]] var<uniform> tint_symbol_3 : tint_symbol_2;
[[binding(1), group(2)]] var<uniform> tint_symbol_1 : tint_symbol;
fn func1(vert_idx : u32) -> u32 {
return vert_idx;
@ -227,7 +227,7 @@ fn func2(vert_idx : u32) -> u32 {
[[stage(vertex)]]
fn entry([[builtin(vertex_index)]] vert_idx : u32) {
func2((vert_idx + tint_symbol_3.first_vertex_index));
func2((vert_idx + tint_symbol_1.first_vertex_index));
}
)";
@ -270,12 +270,12 @@ fn entry_c([[builtin(instance_index)]] inst_idx : u32) {
auto* expect = R"(
[[block]]
struct tint_symbol_3 {
struct tint_symbol {
first_vertex_index : u32;
first_instance_index : u32;
};
[[binding(1), group(2)]] var<uniform> tint_symbol_4 : tint_symbol_3;
[[binding(1), group(2)]] var<uniform> tint_symbol_1 : tint_symbol;
fn func(i : u32) -> u32 {
return i;
@ -283,17 +283,17 @@ fn func(i : u32) -> u32 {
[[stage(vertex)]]
fn entry_a([[builtin(vertex_index)]] vert_idx : u32) {
func((vert_idx + tint_symbol_4.first_vertex_index));
func((vert_idx + tint_symbol_1.first_vertex_index));
}
[[stage(vertex)]]
fn entry_b([[builtin(vertex_index)]] vert_idx : u32, [[builtin(instance_index)]] inst_idx : u32) {
func(((vert_idx + tint_symbol_4.first_vertex_index) + (inst_idx + tint_symbol_4.first_instance_index)));
func(((vert_idx + tint_symbol_1.first_vertex_index) + (inst_idx + tint_symbol_1.first_instance_index)));
}
[[stage(vertex)]]
fn entry_c([[builtin(instance_index)]] inst_idx : u32) {
func((inst_idx + tint_symbol_4.first_instance_index));
func((inst_idx + tint_symbol_1.first_instance_index));
}
)";
@ -328,16 +328,16 @@ fn entry() {
auto* expect = R"(
[[block]]
struct tint_symbol_2 {
struct tint_symbol {
first_vertex_index : u32;
};
[[binding(1), group(2)]] var<uniform> tint_symbol_3 : tint_symbol_2;
[[binding(1), group(2)]] var<uniform> tint_symbol_1 : tint_symbol;
[[builtin(vertex_index)]] var<in> vert_idx : u32;
fn test() -> u32 {
return (vert_idx + tint_symbol_3.first_vertex_index);
return (vert_idx + tint_symbol_1.first_vertex_index);
}
[[stage(vertex)]]
@ -375,16 +375,16 @@ fn entry() {
auto* expect = R"(
[[block]]
struct tint_symbol_2 {
struct tint_symbol {
first_instance_index : u32;
};
[[binding(1), group(7)]] var<uniform> tint_symbol_3 : tint_symbol_2;
[[binding(1), group(7)]] var<uniform> tint_symbol_1 : tint_symbol;
[[builtin(instance_index)]] var<in> inst_idx : u32;
fn test() -> u32 {
return (inst_idx + tint_symbol_3.first_instance_index);
return (inst_idx + tint_symbol_1.first_instance_index);
}
[[stage(vertex)]]
@ -423,19 +423,19 @@ fn entry() {
auto* expect = R"(
[[block]]
struct tint_symbol_3 {
struct tint_symbol {
first_vertex_index : u32;
first_instance_index : u32;
};
[[binding(1), group(2)]] var<uniform> tint_symbol_4 : tint_symbol_3;
[[binding(1), group(2)]] var<uniform> tint_symbol_1 : tint_symbol;
[[builtin(instance_index)]] var<in> instance_idx : u32;
[[builtin(vertex_index)]] var<in> vert_idx : u32;
fn test() -> u32 {
return ((instance_idx + tint_symbol_4.first_instance_index) + (vert_idx + tint_symbol_4.first_vertex_index));
return ((instance_idx + tint_symbol_1.first_instance_index) + (vert_idx + tint_symbol_1.first_vertex_index));
}
[[stage(vertex)]]
@ -477,16 +477,16 @@ fn entry() {
auto* expect = R"(
[[block]]
struct tint_symbol_2 {
struct tint_symbol {
first_vertex_index : u32;
};
[[binding(1), group(2)]] var<uniform> tint_symbol_3 : tint_symbol_2;
[[binding(1), group(2)]] var<uniform> tint_symbol_1 : tint_symbol;
[[builtin(vertex_index)]] var<in> vert_idx : u32;
fn func1() -> u32 {
return (vert_idx + tint_symbol_3.first_vertex_index);
return (vert_idx + tint_symbol_1.first_vertex_index);
}
fn func2() -> u32 {

View File

@ -43,8 +43,8 @@ fn main() {
var f1 : f32 = 2.0;
var f2 : f32 = 3.0;
var f3 : f32 = 4.0;
let tint_symbol_1 : array<f32, 4> = array<f32, 4>(f0, f1, f2, f3);
var i : f32 = tint_symbol_1[2];
let tint_symbol : array<f32, 4> = array<f32, 4>(f0, f1, f2, f3);
var i : f32 = tint_symbol[2];
}
)";
@ -76,8 +76,8 @@ struct S {
[[stage(vertex)]]
fn main() {
let tint_symbol_1 : S = S(1, 2.0, vec3<f32>());
var x : f32 = tint_symbol_1.b;
let tint_symbol : S = S(1, 2.0, vec3<f32>());
var x : f32 = tint_symbol.b;
}
)";
@ -97,10 +97,10 @@ fn main() {
auto* expect = R"(
[[stage(vertex)]]
fn main() {
let tint_symbol_1 : array<f32, 2> = array<f32, 2>(1.0, 2.0);
let tint_symbol_2 : array<f32, 2> = array<f32, 2>(3.0, 4.0);
let tint_symbol_3 : array<array<f32, 2>, 2> = array<array<f32, 2>, 2>(tint_symbol_1, tint_symbol_2);
var i : f32 = tint_symbol_3[0][1];
let tint_symbol : array<f32, 2> = array<f32, 2>(1.0, 2.0);
let tint_symbol_1 : array<f32, 2> = array<f32, 2>(3.0, 4.0);
let tint_symbol_2 : array<array<f32, 2>, 2> = array<array<f32, 2>, 2>(tint_symbol, tint_symbol_1);
var i : f32 = tint_symbol_2[0][1];
}
)";
@ -148,10 +148,10 @@ struct S3 {
[[stage(vertex)]]
fn main() {
let tint_symbol_1 : S1 = S1(2);
let tint_symbol_4 : S2 = S2(1, tint_symbol_1, 3);
let tint_symbol_8 : S3 = S3(tint_symbol_4);
var x : i32 = tint_symbol_8.a.b.a;
let tint_symbol : S1 = S1(2);
let tint_symbol_1 : S2 = S2(1, tint_symbol, 3);
let tint_symbol_2 : S3 = S3(tint_symbol_1);
var x : i32 = tint_symbol_2.a.b.a;
}
)";
@ -187,12 +187,12 @@ struct S2 {
[[stage(vertex)]]
fn main() {
let tint_symbol_1 : S1 = S1(1);
let tint_symbol_4 : S1 = S1(2);
let tint_symbol_5 : S1 = S1(3);
let tint_symbol_6 : array<S1, 3> = array<S1, 3>(tint_symbol_1, tint_symbol_4, tint_symbol_5);
let tint_symbol_7 : S2 = S2(tint_symbol_6);
var x : i32 = tint_symbol_7.a[1].a;
let tint_symbol : S1 = S1(1);
let tint_symbol_1 : S1 = S1(2);
let tint_symbol_2 : S1 = S1(3);
let tint_symbol_3 : array<S1, 3> = array<S1, 3>(tint_symbol, tint_symbol_1, tint_symbol_2);
let tint_symbol_4 : S2 = S2(tint_symbol_3);
var x : i32 = tint_symbol_4.a[1].a;
}
)";
@ -268,8 +268,8 @@ struct Uniforms {
[[stage(vertex)]]
fn main() {
let transform : mat2x2<f32> = ubo.transform;
let tint_symbol_1 : array<vec2<f32>, 3> = array<vec2<f32>, 3>(vec2<f32>(-1.0, 1.0), vec2<f32>(1.0, 1.0), vec2<f32>(-1.0, -1.0));
var coord : vec2<f32> = tint_symbol_1[vertex_index];
let tint_symbol : array<vec2<f32>, 3> = array<vec2<f32>, 3>(vec2<f32>(-1.0, 1.0), vec2<f32>(1.0, 1.0), vec2<f32>(-1.0, -1.0));
var coord : vec2<f32> = tint_symbol[vertex_index];
position = vec4<f32>((transform * coord), 0.0, 1.0);
}
)";

View File

@ -50,8 +50,8 @@ fn _tint_main() {
var foo : i32;
var _tint_half : f32;
var half1 : f32;
var _tint_half2_0 : f32;
var _tint_half2 : f32;
var _tint_half2_1 : f32;
}
)";

View File

@ -38,22 +38,22 @@ fn compute_main([[builtin(local_invocation_id)]] local_id : vec3<u32>,
)";
auto* expect = R"(
[[builtin(frag_coord)]] var<in> tint_symbol_1 : vec4<f32>;
[[builtin(frag_coord)]] var<in> tint_symbol : vec4<f32>;
[[location(1)]] var<in> tint_symbol_2 : f32;
[[location(1)]] var<in> tint_symbol_1 : f32;
[[stage(fragment)]]
fn frag_main() {
var col : f32 = (tint_symbol_1.x * tint_symbol_2);
var col : f32 = (tint_symbol.x * tint_symbol_1);
}
[[builtin(local_invocation_id)]] var<in> tint_symbol_6 : vec3<u32>;
[[builtin(local_invocation_id)]] var<in> tint_symbol_2 : vec3<u32>;
[[builtin(local_invocation_index)]] var<in> tint_symbol_7 : u32;
[[builtin(local_invocation_index)]] var<in> tint_symbol_3 : u32;
[[stage(compute)]]
fn compute_main() {
var id_x : u32 = tint_symbol_6.x;
var id_x : u32 = tint_symbol_2.x;
}
)";
@ -74,7 +74,7 @@ fn frag_main([[location(1)]] loc1 : myf32) {
auto* expect = R"(
type myf32 = f32;
[[location(1)]] var<in> tint_symbol_2 : myf32;
[[location(1)]] var<in> tint_symbol : myf32;
[[stage(fragment)]]
fn frag_main() {
@ -97,8 +97,8 @@ fn vert_main() -> [[builtin(position)]] vec4<f32> {
auto* expect = R"(
[[builtin(position)]] var<out> tint_symbol_1 : vec4<f32>;
fn tint_symbol_2(tint_symbol_3 : vec4<f32>) {
tint_symbol_1 = tint_symbol_3;
fn tint_symbol_2(tint_symbol : vec4<f32>) {
tint_symbol_1 = tint_symbol;
}
[[stage(vertex)]]
@ -125,17 +125,17 @@ fn frag_main([[location(0)]] loc_in : u32) -> [[location(0)]] f32 {
)";
auto* expect = R"(
[[location(0)]] var<in> tint_symbol_1 : u32;
[[location(0)]] var<in> tint_symbol : u32;
[[location(0)]] var<out> tint_symbol_2 : f32;
fn tint_symbol_3(tint_symbol_4 : f32) {
tint_symbol_2 = tint_symbol_4;
fn tint_symbol_3(tint_symbol_1 : f32) {
tint_symbol_2 = tint_symbol_1;
}
[[stage(fragment)]]
fn frag_main() {
if ((tint_symbol_1 > 10u)) {
if ((tint_symbol > 10u)) {
tint_symbol_3(0.5);
return;
}
@ -165,21 +165,21 @@ fn frag_main([[location(0)]] loc_in : u32) -> [[location(0)]] myf32 {
auto* expect = R"(
type myf32 = f32;
[[location(0)]] var<in> tint_symbol_2 : u32;
[[location(0)]] var<in> tint_symbol : u32;
[[location(0)]] var<out> tint_symbol_3 : myf32;
[[location(0)]] var<out> tint_symbol_2 : myf32;
fn tint_symbol_4(tint_symbol_5 : myf32) {
tint_symbol_3 = tint_symbol_5;
fn tint_symbol_3(tint_symbol_1 : myf32) {
tint_symbol_2 = tint_symbol_1;
}
[[stage(fragment)]]
fn frag_main() {
if ((tint_symbol_2 > 10u)) {
tint_symbol_4(0.5);
if ((tint_symbol > 10u)) {
tint_symbol_3(0.5);
return;
}
tint_symbol_4(1.0);
tint_symbol_3(1.0);
return;
}
)";
@ -208,14 +208,14 @@ struct FragmentInput {
value : f32;
};
[[builtin(frag_coord)]] var<in> tint_symbol_4 : vec4<f32>;
[[builtin(frag_coord)]] var<in> tint_symbol : vec4<f32>;
[[location(1)]] var<in> tint_symbol_5 : f32;
[[location(1)]] var<in> tint_symbol_1 : f32;
[[stage(fragment)]]
fn frag_main() {
let tint_symbol_7 : FragmentInput = FragmentInput(tint_symbol_4, tint_symbol_5);
var col : f32 = (tint_symbol_7.coord.x * tint_symbol_7.value);
let tint_symbol_2 : FragmentInput = FragmentInput(tint_symbol, tint_symbol_1);
var col : f32 = (tint_symbol_2.coord.x * tint_symbol_2.value);
}
)";
@ -240,7 +240,7 @@ struct FragmentInput {
value : f32;
};
[[location(1)]] var<in> tint_symbol_3 : f32;
[[location(1)]] var<in> tint_symbol : f32;
[[stage(fragment)]]
fn frag_main() {
@ -275,23 +275,23 @@ struct VertexOutput {
value : f32;
};
[[builtin(position)]] var<out> tint_symbol_4 : vec4<f32>;
[[builtin(position)]] var<out> tint_symbol_1 : vec4<f32>;
[[location(1)]] var<out> tint_symbol_5 : f32;
[[location(1)]] var<out> tint_symbol_2 : f32;
fn tint_symbol_6(tint_symbol_7 : VertexOutput) {
tint_symbol_4 = tint_symbol_7.pos;
tint_symbol_5 = tint_symbol_7.value;
fn tint_symbol_3(tint_symbol : VertexOutput) {
tint_symbol_1 = tint_symbol.pos;
tint_symbol_2 = tint_symbol.value;
}
[[stage(vertex)]]
fn vert_main() {
if (false) {
tint_symbol_6(VertexOutput());
tint_symbol_3(VertexOutput());
return;
}
var pos : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 0.0);
tint_symbol_6(VertexOutput(pos, 2.0));
tint_symbol_3(VertexOutput(pos, 2.0));
return;
}
)";
@ -318,18 +318,18 @@ struct Interface {
value : f32;
};
[[location(1)]] var<in> tint_symbol_3 : f32;
[[location(1)]] var<in> tint_symbol : f32;
[[location(1)]] var<out> tint_symbol_4 : f32;
[[location(1)]] var<out> tint_symbol_3 : f32;
fn tint_symbol_5(tint_symbol_6 : Interface) {
tint_symbol_4 = tint_symbol_6.value;
fn tint_symbol_4(tint_symbol_2 : Interface) {
tint_symbol_3 = tint_symbol_2.value;
}
[[stage(vertex)]]
fn vert_main() {
let tint_symbol_8 : Interface = Interface(tint_symbol_3);
tint_symbol_5(tint_symbol_8);
let tint_symbol_1 : Interface = Interface(tint_symbol);
tint_symbol_4(tint_symbol_1);
return;
}
)";
@ -361,24 +361,24 @@ struct Interface {
value : f32;
};
[[location(1)]] var<out> tint_symbol_3 : f32;
[[location(1)]] var<out> tint_symbol_1 : f32;
fn tint_symbol_4(tint_symbol_5 : Interface) {
tint_symbol_3 = tint_symbol_5.value;
fn tint_symbol_2(tint_symbol : Interface) {
tint_symbol_1 = tint_symbol.value;
}
[[stage(vertex)]]
fn vert_main() {
tint_symbol_4(Interface(42.0));
tint_symbol_2(Interface(42.0));
return;
}
[[location(1)]] var<in> tint_symbol_7 : f32;
[[location(1)]] var<in> tint_symbol_3 : f32;
[[stage(fragment)]]
fn frag_main() {
let tint_symbol_9 : Interface = Interface(tint_symbol_7);
var x : f32 = tint_symbol_9.value;
let tint_symbol_4 : Interface = Interface(tint_symbol_3);
var x : f32 = tint_symbol_4.value;
}
)";
@ -419,20 +419,20 @@ struct FragmentOutput {
value : f32;
};
[[location(1)]] var<in> tint_symbol_5 : f32;
[[location(1)]] var<in> tint_symbol : f32;
[[builtin(frag_coord)]] var<in> tint_symbol_6 : vec4<f32>;
[[builtin(frag_coord)]] var<in> tint_symbol_1 : vec4<f32>;
[[location(1)]] var<out> tint_symbol_7 : f32;
[[location(1)]] var<out> tint_symbol_4 : f32;
fn tint_symbol_8(tint_symbol_9 : FragmentOutput) {
tint_symbol_7 = tint_symbol_9.value;
fn tint_symbol_5(tint_symbol_3 : FragmentOutput) {
tint_symbol_4 = tint_symbol_3.value;
}
[[stage(fragment)]]
fn frag_main() {
let tint_symbol_11 : FragmentInput = FragmentInput(tint_symbol_5, tint_symbol_6);
tint_symbol_8(FragmentOutput((tint_symbol_11.coord.x * tint_symbol_11.value)));
let tint_symbol_2 : FragmentInput = FragmentInput(tint_symbol, tint_symbol_1);
tint_symbol_5(FragmentOutput((tint_symbol_2.coord.x * tint_symbol_2.value)));
return;
}
)";
@ -465,15 +465,15 @@ struct VertexOutput {
Position : vec4<f32>;
};
[[builtin(position)]] var<out> tint_symbol_4 : vec4<f32>;
[[builtin(position)]] var<out> tint_symbol_1 : vec4<f32>;
fn tint_symbol_5(tint_symbol_6 : VertexOutput) {
tint_symbol_4 = tint_symbol_6.Position;
fn tint_symbol_2(tint_symbol : VertexOutput) {
tint_symbol_1 = tint_symbol.Position;
}
[[stage(vertex)]]
fn main() {
tint_symbol_5(VertexOutput(vec4<f32>()));
tint_symbol_2(VertexOutput(vec4<f32>()));
return;
}
)";
@ -585,14 +585,14 @@ fn main([[builtin(sample_index)]] sample_index : u32,
)";
auto* expect = R"(
[[builtin(sample_index)]] var<in> tint_symbol_3 : u32;
[[builtin(sample_index)]] var<in> tint_symbol : u32;
[[builtin(sample_mask_in)]] var<in> tint_symbol_1 : array<u32, 1>;
[[builtin(sample_mask_out)]] var<out> tint_symbol_2 : array<u32, 1>;
[[builtin(sample_mask_out)]] var<out> tint_symbol_3 : array<u32, 1>;
fn tint_symbol_4(tint_symbol_5 : u32) {
tint_symbol_2[0] = tint_symbol_5;
fn tint_symbol_4(tint_symbol_2 : u32) {
tint_symbol_3[0] = tint_symbol_2;
}
[[stage(fragment)]]

View File

@ -61,20 +61,11 @@ void Transform::RenameReservedKeywords(CloneContext* ctx,
const char* names[],
size_t count) {
ctx->ReplaceAll([=](Symbol in) {
if (!ctx->src->Symbols().HasName(in)) {
return ctx->dst->Symbols().New();
}
auto name_in = ctx->src->Symbols().NameFor(in);
if (!std::binary_search(names, names + count, name_in)) {
return ctx->dst->Symbols().Register(name_in);
if (std::binary_search(names, names + count, name_in)) {
return ctx->dst->Symbols().New("_tint_" + name_in);
}
// Create a new unique name
auto base_name = "_tint_" + name_in;
auto name_out = base_name;
for (int i = 0; ctx->src->Symbols().Get(name_out).IsValid(); i++) {
name_out = base_name + "_" + std::to_string(i);
}
return ctx->dst->Symbols().Register(name_out);
return ctx->dst->Symbols().New(name_in);
});
}

View File

@ -48,7 +48,7 @@ TEST_F(AliasTest, Is) {
TEST_F(AliasTest, TypeName) {
auto* at = ty.alias("Particle", ty.i32());
EXPECT_EQ(at->type_name(), "__alias_tint_symbol_1__i32");
EXPECT_EQ(at->type_name(), "__alias_$1__i32");
}
TEST_F(AliasTest, FriendlyName) {

View File

@ -54,7 +54,7 @@ TEST_F(StructTypeTest, TypeName) {
auto* impl =
create<ast::Struct>(ast::StructMemberList{}, ast::DecorationList{});
auto* s = ty.struct_("my_struct", impl);
EXPECT_EQ(s->type_name(), "__struct_tint_symbol_1");
EXPECT_EQ(s->type_name(), "__struct_$1");
}
TEST_F(StructTypeTest, FriendlyName) {

View File

@ -119,17 +119,17 @@ TEST_F(HlslGeneratorImplTest_Function,
GeneratorImpl& gen = SanitizeAndBuild();
ASSERT_TRUE(gen.Generate(out)) << gen.error();
EXPECT_EQ(result(), R"(struct tint_symbol_5 {
EXPECT_EQ(result(), R"(struct tint_symbol_1 {
float foo : TEXCOORD0;
};
struct tint_symbol_2 {
float value : SV_Target1;
};
tint_symbol_2 frag_main(tint_symbol_5 tint_symbol_7) {
const float foo = tint_symbol_7.foo;
const tint_symbol_2 tint_symbol_1 = {foo};
return tint_symbol_1;
tint_symbol_2 frag_main(tint_symbol_1 tint_symbol_3) {
const float foo = tint_symbol_3.foo;
const tint_symbol_2 tint_symbol = {foo};
return tint_symbol;
}
)");
@ -153,17 +153,17 @@ TEST_F(HlslGeneratorImplTest_Function,
GeneratorImpl& gen = SanitizeAndBuild();
ASSERT_TRUE(gen.Generate(out)) << gen.error();
EXPECT_EQ(result(), R"(struct tint_symbol_6 {
EXPECT_EQ(result(), R"(struct tint_symbol_1 {
float4 coord : SV_Position;
};
struct tint_symbol_2 {
float value : SV_Depth;
};
tint_symbol_2 frag_main(tint_symbol_6 tint_symbol_8) {
const float4 coord = tint_symbol_8.coord;
const tint_symbol_2 tint_symbol_1 = {coord.x};
return tint_symbol_1;
tint_symbol_2 frag_main(tint_symbol_1 tint_symbol_3) {
const float4 coord = tint_symbol_3.coord;
const tint_symbol_2 tint_symbol = {coord.x};
return tint_symbol;
}
)");
@ -210,23 +210,23 @@ TEST_F(HlslGeneratorImplTest_Function,
float col1;
float col2;
};
struct tint_symbol_2 {
struct tint_symbol_1 {
float col1 : TEXCOORD1;
float col2 : TEXCOORD2;
};
struct tint_symbol_8 {
struct tint_symbol_3 {
float col1 : TEXCOORD1;
float col2 : TEXCOORD2;
};
tint_symbol_2 vert_main() {
const Interface tint_symbol_5 = {0.5f, 0.25f};
const tint_symbol_2 tint_symbol_1 = {tint_symbol_5.col1, tint_symbol_5.col2};
return tint_symbol_1;
tint_symbol_1 vert_main() {
const Interface tint_symbol_1_1 = {0.5f, 0.25f};
const tint_symbol_1 tint_symbol = {tint_symbol_1_1.col1, tint_symbol_1_1.col2};
return tint_symbol;
}
void frag_main(tint_symbol_8 tint_symbol_10) {
const Interface colors = {tint_symbol_10.col1, tint_symbol_10.col2};
void frag_main(tint_symbol_3 tint_symbol_2) {
const Interface colors = {tint_symbol_2.col1, tint_symbol_2.col2};
const float r = colors.col1;
const float g = colors.col2;
return;
@ -278,28 +278,28 @@ TEST_F(HlslGeneratorImplTest_Function,
EXPECT_EQ(result(), R"(struct VertexOutput {
float4 pos;
};
struct tint_symbol_6 {
struct tint_symbol_2 {
float4 pos : SV_Position;
};
struct tint_symbol_9 {
struct tint_symbol_2_1 {
float4 pos : SV_Position;
};
VertexOutput foo(float x) {
const VertexOutput tint_symbol_1 = {float4(x, x, x, 1.0f)};
const VertexOutput tint_symbol = {float4(x, x, x, 1.0f)};
return tint_symbol;
}
tint_symbol_2 vert_main1() {
const VertexOutput tint_symbol_1_1 = {foo(0.5f)};
const tint_symbol_2 tint_symbol_1 = {tint_symbol_1_1.pos};
return tint_symbol_1;
}
tint_symbol_6 vert_main1() {
const VertexOutput tint_symbol_7 = {foo(0.5f)};
const tint_symbol_6 tint_symbol_5 = {tint_symbol_7.pos};
return tint_symbol_5;
}
tint_symbol_9 vert_main2() {
const VertexOutput tint_symbol_10 = {foo(0.25f)};
const tint_symbol_9 tint_symbol_8 = {tint_symbol_10.pos};
return tint_symbol_8;
tint_symbol_2_1 vert_main2() {
const VertexOutput tint_symbol_3_1 = {foo(0.25f)};
const tint_symbol_2_1 tint_symbol_3 = {tint_symbol_3_1.pos};
return tint_symbol_3;
}
)");

View File

@ -141,7 +141,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor) {
[numthreads(1, 1, 1)]
void test_function() {
float tint_symbol_5 = str.mem;
float tint_symbol = str.mem;
return;
}
@ -353,13 +353,13 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, StorageBuffer_Store_Matrix_Empty) {
R"(
RWByteAddressBuffer data : register(u0, space1);
void tint_symbol_8(RWByteAddressBuffer buffer, uint offset, float2x3 value) {
void tint_symbol_1(RWByteAddressBuffer buffer, uint offset, float2x3 value) {
buffer.Store3((offset + 0u), asuint(value[0u]));
buffer.Store3((offset + 16u), asuint(value[1u]));
}
void main() {
tint_symbol_8(data, 16u, float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f));
tint_symbol_1(data, 16u, float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f));
return;
}

View File

@ -62,10 +62,10 @@ TEST_F(HlslSanitizerTest, ArrayLength) {
ByteAddressBuffer sb : register(t0, space1);
void main() {
uint tint_symbol_9 = 0u;
sb.GetDimensions(tint_symbol_9);
const uint tint_symbol_10 = ((tint_symbol_9 - 16u) / 16u);
uint len = tint_symbol_10;
uint tint_symbol_1 = 0u;
sb.GetDimensions(tint_symbol_1);
const uint tint_symbol_2 = ((tint_symbol_1 - 16u) / 16u);
uint len = tint_symbol_2;
return;
}
@ -92,8 +92,8 @@ TEST_F(HlslSanitizerTest, PromoteArrayInitializerToConstVar) {
auto got = result();
auto* expect = R"(void main() {
const int tint_symbol_1[4] = {1, 2, 3, 4};
int pos = tint_symbol_1[3];
const int tint_symbol[4] = {1, 2, 3, 4};
int pos = tint_symbol[3];
return;
}
@ -132,8 +132,8 @@ TEST_F(HlslSanitizerTest, PromoteStructInitializerToConstVar) {
};
void main() {
const S tint_symbol_1 = {1, float3(2.0f, 3.0f, 4.0f), 4};
float3 pos = tint_symbol_1.b;
const S tint_symbol = {1, float3(2.0f, 3.0f, 4.0f), 4};
float3 pos = tint_symbol.b;
return;
}

View File

@ -111,12 +111,12 @@ using namespace metal;
struct tint_symbol_1 {
float foo [[user(locn0)]];
};
struct tint_symbol_3 {
struct tint_symbol_2 {
float value [[color(1)]];
};
fragment tint_symbol_3 frag_main(tint_symbol_1 tint_symbol_6 [[stage_in]]) {
const float foo = tint_symbol_6.foo;
fragment tint_symbol_2 frag_main(tint_symbol_1 tint_symbol [[stage_in]]) {
const float foo = tint_symbol.foo;
return {foo};
}
@ -144,12 +144,12 @@ using namespace metal;
struct tint_symbol_1 {
float4 coord [[position]];
};
struct tint_symbol_3 {
struct tint_symbol_2 {
float value [[depth(any)]];
};
fragment tint_symbol_3 frag_main(tint_symbol_1 tint_symbol_6 [[stage_in]]) {
const float4 coord = tint_symbol_6.coord;
fragment tint_symbol_2 frag_main(tint_symbol_1 tint_symbol [[stage_in]]) {
const float4 coord = tint_symbol.coord;
return {coord.x};
}
@ -198,22 +198,22 @@ struct Interface {
float col1;
float col2;
};
struct tint_symbol_4 {
struct tint_symbol {
float col1 [[user(locn1)]];
float col2 [[user(locn2)]];
};
struct tint_symbol_7 {
struct tint_symbol_3 {
float col1 [[user(locn1)]];
float col2 [[user(locn2)]];
};
vertex tint_symbol_4 vert_main() {
const Interface tint_symbol_6 = {0.5f, 0.25f};
return {tint_symbol_6.col1, tint_symbol_6.col2};
vertex tint_symbol vert_main() {
const Interface tint_symbol_1 = {0.5f, 0.25f};
return {tint_symbol_1.col1, tint_symbol_1.col2};
}
fragment void frag_main(tint_symbol_7 tint_symbol_9 [[stage_in]]) {
const Interface colors = {tint_symbol_9.col1, tint_symbol_9.col2};
fragment void frag_main(tint_symbol_3 tint_symbol_2 [[stage_in]]) {
const Interface colors = {tint_symbol_2.col1, tint_symbol_2.col2};
const float r = colors.col1;
const float g = colors.col2;
return;
@ -266,10 +266,10 @@ using namespace metal;
struct VertexOutput {
float4 pos;
};
struct tint_symbol_5 {
struct tint_symbol {
float4 pos [[position]];
};
struct tint_symbol_8 {
struct tint_symbol_2 {
float4 pos [[position]];
};
@ -277,14 +277,14 @@ VertexOutput foo(float x) {
return {float4(x, x, x, 1.0f)};
}
vertex tint_symbol_5 vert_main1() {
const VertexOutput tint_symbol_7 = {foo(0.5f)};
return {tint_symbol_7.pos};
vertex tint_symbol vert_main1() {
const VertexOutput tint_symbol_1 = {foo(0.5f)};
return {tint_symbol_1.pos};
}
vertex tint_symbol_8 vert_main2() {
const VertexOutput tint_symbol_10 = {foo(0.25f)};
return {tint_symbol_10.pos};
vertex tint_symbol_2 vert_main2() {
const VertexOutput tint_symbol_3 = {foo(0.25f)};
return {tint_symbol_3.pos};
}
)");

View File

@ -66,8 +66,8 @@ TEST_F(BuilderTest, EntryPoint_Parameters) {
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %9 "frag_main" %1 %5
OpExecutionMode %9 OriginUpperLeft
OpName %1 "tint_symbol_1"
OpName %5 "tint_symbol_2"
OpName %1 "tint_symbol"
OpName %5 "tint_symbol_1"
OpName %9 "frag_main"
OpName %17 "col"
OpDecorate %1 BuiltIn FragCoord
@ -132,10 +132,10 @@ TEST_F(BuilderTest, EntryPoint_ReturnValue) {
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %14 "frag_main" %1 %4
OpExecutionMode %14 OriginUpperLeft
OpName %1 "tint_symbol_1"
OpName %1 "tint_symbol"
OpName %4 "tint_symbol_2"
OpName %10 "tint_symbol_3"
OpName %11 "tint_symbol_4"
OpName %11 "tint_symbol_1"
OpName %14 "frag_main"
OpDecorate %1 Location 0
OpDecorate %4 Location 0
@ -218,16 +218,16 @@ OpEntryPoint Vertex %16 "vert_main" %1
OpEntryPoint Fragment %25 "frag_main" %5 %7
OpExecutionMode %25 OriginUpperLeft
OpExecutionMode %25 DepthReplacing
OpName %1 "tint_symbol_3"
OpName %5 "tint_symbol_7"
OpName %7 "tint_symbol_8"
OpName %1 "tint_symbol_1"
OpName %5 "tint_symbol_3"
OpName %7 "tint_symbol_6"
OpName %10 "Interface"
OpMemberName %10 0 "value"
OpName %11 "tint_symbol_4"
OpName %12 "tint_symbol_5"
OpName %11 "tint_symbol_2"
OpName %12 "tint_symbol"
OpName %16 "vert_main"
OpName %22 "tint_symbol_9"
OpName %23 "tint_symbol_10"
OpName %22 "tint_symbol_7"
OpName %23 "tint_symbol_5"
OpName %25 "frag_main"
OpDecorate %1 Location 1
OpDecorate %5 Location 1