[shuffle] Remove the `utils::` namespace.
This CL strips the `utils::` namespace declaration and usages.
Bug: tint:1988
Change-Id: I860b9cae052bec9eed0879fdda6ff2a05534af0e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/143421
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
diff --git a/docs/tint/style_guide.md b/docs/tint/style_guide.md
index e5f8fa3..25e9146 100644
--- a/docs/tint/style_guide.md
+++ b/docs/tint/style_guide.md
@@ -14,7 +14,7 @@
* Do not use C++ exceptions
* Do not use C++ RTTI.
- Instead, use `tint::utils::Castable::As<T>()` from
+ Instead, use `tint::Castable::As<T>()` from
[src/castable.h](../src/castable.h)
* Generally, avoid `assert`. Instead, issue a [diagnostic](../src/diagnostic.h)
diff --git a/include/tint/binding_point.h b/include/tint/binding_point.h
index c03ea445..e5d3d14 100644
--- a/include/tint/binding_point.h
+++ b/include/tint/binding_point.h
@@ -65,7 +65,7 @@
/// @param o the stream to write to
/// @param bp the BindingPoint
/// @return the stream so calls can be chained
-inline utils::StringStream& operator<<(utils::StringStream& o, const BindingPoint& bp) {
+inline StringStream& operator<<(StringStream& o, const BindingPoint& bp) {
return o << "[group: " << bp.group << ", binding: " << bp.binding << "]";
}
@@ -81,7 +81,7 @@
/// @param binding_point the binding point to create a hash for
/// @return the hash value
inline std::size_t operator()(const tint::BindingPoint& binding_point) const {
- return tint::utils::Hash(binding_point.group, binding_point.binding);
+ return tint::Hash(binding_point.group, binding_point.binding);
}
};
diff --git a/src/dawn/native/CompilationMessages.cpp b/src/dawn/native/CompilationMessages.cpp
index 88e2570..da78a6e 100644
--- a/src/dawn/native/CompilationMessages.cpp
+++ b/src/dawn/native/CompilationMessages.cpp
@@ -37,14 +37,14 @@
} // anonymous namespace
ResultOrError<uint64_t> CountUTF16CodeUnitsFromUTF8String(const std::string_view& utf8String) {
- if (tint::utils::utf8::IsASCII(utf8String)) {
+ if (tint::utf8::IsASCII(utf8String)) {
return utf8String.size();
}
uint64_t numberOfUTF16CodeUnits = 0;
std::string_view remaining = utf8String;
while (!remaining.empty()) {
- auto [codePoint, utf8CharacterByteLength] = tint::utils::utf8::Decode(remaining);
+ auto [codePoint, utf8CharacterByteLength] = tint::utf8::Decode(remaining);
// Directly return as something wrong has happened during the UTF-8 decoding.
if (utf8CharacterByteLength == 0) {
return DAWN_INTERNAL_ERROR("Fail to decode the unicode string");
diff --git a/src/tint/bench/benchmark.cc b/src/tint/bench/benchmark.cc
index ca90fc1..67740cf 100644
--- a/src/tint/bench/benchmark.cc
+++ b/src/tint/bench/benchmark.cc
@@ -47,7 +47,7 @@
fseek(file, 0, SEEK_END);
const auto file_size = static_cast<size_t>(ftell(file));
if (0 != (file_size % sizeof(T))) {
- utils::StringStream err;
+ StringStream err;
err << "File " << input_file
<< " does not contain an integral number of objects: " << file_size
<< " bytes in the file, require " << sizeof(T) << " bytes per object";
@@ -91,14 +91,14 @@
std::variant<tint::Source::File, Error> LoadInputFile(std::string name) {
auto path = std::filesystem::path(name).is_absolute() ? name : (kInputFileDir / name).string();
- if (utils::HasSuffix(path, ".wgsl")) {
+ if (tint::HasSuffix(path, ".wgsl")) {
auto data = ReadFile<uint8_t>(path);
if (auto* buf = std::get_if<std::vector<uint8_t>>(&data)) {
return tint::Source::File(path, std::string(buf->begin(), buf->end()));
}
return std::get<Error>(data);
}
- if (utils::HasSuffix(path, ".spv")) {
+ if (tint::HasSuffix(path, ".spv")) {
auto spirv = ReadFile<uint32_t>(path);
if (auto* buf = std::get_if<std::vector<uint32_t>>(&spirv)) {
auto program = tint::spirv::reader::Parse(*buf, {});
diff --git a/src/tint/cmd/helper.cc b/src/tint/cmd/helper.cc
index f04077a..29c8ab3 100644
--- a/src/tint/cmd/helper.cc
+++ b/src/tint/cmd/helper.cc
@@ -36,11 +36,11 @@
InputFormat InputFormatFromFilename(const std::string& filename) {
auto input_format = InputFormat::kUnknown;
- if (utils::HasSuffix(filename, ".wgsl")) {
+ if (tint::HasSuffix(filename, ".wgsl")) {
input_format = InputFormat::kWgsl;
- } else if (utils::HasSuffix(filename, ".spv")) {
+ } else if (tint::HasSuffix(filename, ".spv")) {
input_format = InputFormat::kSpirvBin;
- } else if (utils::HasSuffix(filename, ".spvasm")) {
+ } else if (tint::HasSuffix(filename, ".spvasm")) {
input_format = InputFormat::kSpirvAsm;
}
return input_format;
diff --git a/src/tint/cmd/main.cc b/src/tint/cmd/main.cc
index 8f0c3f4..72803b9 100644
--- a/src/tint/cmd/main.cc
+++ b/src/tint/cmd/main.cc
@@ -126,12 +126,12 @@
tint::spirv::reader::Options spirv_reader_options;
#endif
- tint::utils::Vector<std::string, 4> transforms;
+ tint::Vector<std::string, 4> transforms;
std::string fxc_path;
std::string dxc_path;
std::string xcrun_path;
- tint::utils::Hashmap<std::string, double, 8> overrides;
+ tint::Hashmap<std::string, double, 8> overrides;
std::optional<tint::BindingPoint> hlsl_root_constant_binding_point;
#if TINT_BUILD_IR
@@ -150,28 +150,28 @@
(void)filename;
#if TINT_BUILD_SPV_WRITER
- if (tint::utils::HasSuffix(filename, ".spv")) {
+ if (tint::HasSuffix(filename, ".spv")) {
return Format::kSpirv;
}
- if (tint::utils::HasSuffix(filename, ".spvasm")) {
+ if (tint::HasSuffix(filename, ".spvasm")) {
return Format::kSpvAsm;
}
#endif // TINT_BUILD_SPV_WRITER
#if TINT_BUILD_WGSL_WRITER
- if (tint::utils::HasSuffix(filename, ".wgsl")) {
+ if (tint::HasSuffix(filename, ".wgsl")) {
return Format::kWgsl;
}
#endif // TINT_BUILD_WGSL_WRITER
#if TINT_BUILD_MSL_WRITER
- if (tint::utils::HasSuffix(filename, ".metal")) {
+ if (tint::HasSuffix(filename, ".metal")) {
return Format::kMsl;
}
#endif // TINT_BUILD_MSL_WRITER
#if TINT_BUILD_HLSL_WRITER
- if (tint::utils::HasSuffix(filename, ".hlsl")) {
+ if (tint::HasSuffix(filename, ".hlsl")) {
return Format::kHlsl;
}
#endif // TINT_BUILD_HLSL_WRITER
@@ -179,12 +179,12 @@
return Format::kUnknown;
}
-bool ParseArgs(tint::utils::VectorRef<std::string_view> arguments,
+bool ParseArgs(tint::VectorRef<std::string_view> arguments,
std::string transform_names,
Options* opts) {
- using namespace tint::utils::cli; // NOLINT(build/namespaces)
+ using namespace tint::cli; // NOLINT(build/namespaces)
- tint::utils::Vector<EnumName<Format>, 8> format_enum_names{
+ tint::Vector<EnumName<Format>, 8> format_enum_names{
EnumName(Format::kNone, "none"),
};
@@ -308,7 +308,7 @@
ShortName{"t"});
TINT_DEFER({
if (transforms.value.has_value()) {
- for (auto transform : tint::utils::Split(*transforms.value, ",")) {
+ for (auto transform : tint::Split(*transforms.value, ",")) {
opts->transforms.Push(std::string(transform));
}
}
@@ -326,7 +326,7 @@
of the hash codes in the comma separated list of hashes)");
TINT_DEFER({
if (skip_hash.value.has_value()) {
- for (auto hash : tint::utils::Split(*skip_hash.value, ",")) {
+ for (auto hash : tint::Split(*skip_hash.value, ",")) {
uint32_t value = 0;
int base = 10;
if (hash.size() > 2 && hash[0] == '0' && (hash[1] == 'x' || hash[1] == 'X')) {
@@ -364,13 +364,13 @@
}
if (overrides.value.has_value()) {
- for (const auto& o : tint::utils::Split(*overrides.value, ",")) {
- auto parts = tint::utils::Split(o, "=");
+ for (const auto& o : tint::Split(*overrides.value, ",")) {
+ auto parts = tint::Split(o, "=");
if (parts.Length() != 2) {
std::cerr << "override values must be of the form IDENTIFIER=VALUE";
return false;
}
- auto value = tint::utils::ParseNumber<double>(parts[1]);
+ auto value = tint::ParseNumber<double>(parts[1]);
if (!value) {
std::cerr << "invalid override value: " << parts[1];
return false;
@@ -380,19 +380,19 @@
}
if (hlsl_rc_bp.value.has_value()) {
- auto binding_points = tint::utils::Split(*hlsl_rc_bp.value, ",");
+ auto binding_points = tint::Split(*hlsl_rc_bp.value, ",");
if (binding_points.Length() != 2) {
std::cerr << "Invalid binding point for " << hlsl_rc_bp.name << ": "
<< *hlsl_rc_bp.value << std::endl;
return false;
}
- auto group = tint::utils::ParseUint32(binding_points[0]);
+ auto group = tint::ParseUint32(binding_points[0]);
if (!group) {
std::cerr << "Invalid group for " << hlsl_rc_bp.name << ": " << binding_points[0]
<< std::endl;
return false;
}
- auto binding = tint::utils::ParseUint32(binding_points[1]);
+ auto binding = tint::ParseUint32(binding_points[1]);
if (!binding) {
std::cerr << "Invalid binding for " << hlsl_rc_bp.name << ": " << binding_points[1]
<< std::endl;
@@ -404,7 +404,7 @@
auto files = result.Get();
if (files.Length() > 1) {
std::cerr << "More than one input file specified: "
- << tint::utils::Join(Transform(files, tint::utils::Quote), ", ") << std::endl;
+ << tint::Join(Transform(files, tint::Quote), ", ") << std::endl;
return false;
}
if (files.Length() == 1) {
@@ -527,7 +527,7 @@
}
}
- const auto hash = tint::utils::CRC32(result.spirv.data(), result.spirv.size());
+ const auto hash = tint::CRC32(result.spirv.data(), result.spirv.size());
if (options.print_hash) {
PrintHash(hash);
}
@@ -572,7 +572,7 @@
return false;
}
- const auto hash = tint::utils::CRC32(result.wgsl.data(), result.wgsl.size());
+ const auto hash = tint::CRC32(result.wgsl.data(), result.wgsl.size());
if (options.print_hash) {
PrintHash(hash);
}
@@ -637,7 +637,7 @@
return false;
}
- const auto hash = tint::utils::CRC32(result.msl.c_str());
+ const auto hash = tint::CRC32(result.msl.c_str());
if (options.print_hash) {
PrintHash(hash);
}
@@ -652,7 +652,7 @@
#else
const char* default_xcrun_exe = "xcrun";
#endif
- auto xcrun = tint::utils::Command::LookPath(
+ auto xcrun = tint::Command::LookPath(
options.xcrun_path.empty() ? default_xcrun_exe : std::string(options.xcrun_path));
if (xcrun.Found()) {
res = tint::msl::validate::Msl(xcrun.Path(), result.msl);
@@ -700,7 +700,7 @@
return false;
}
- const auto hash = tint::utils::CRC32(result.hlsl.c_str());
+ const auto hash = tint::CRC32(result.hlsl.c_str());
if (options.print_hash) {
PrintHash(hash);
}
@@ -714,7 +714,7 @@
tint::hlsl::validate::Result dxc_res;
bool dxc_found = false;
if (options.validate || must_validate_dxc) {
- auto dxc = tint::utils::Command::LookPath(
+ auto dxc = tint::Command::LookPath(
options.dxc_path.empty() ? "dxc" : std::string(options.dxc_path));
if (dxc.Found()) {
dxc_found = true;
@@ -741,9 +741,9 @@
tint::hlsl::validate::Result fxc_res;
bool fxc_found = false;
if (options.validate || must_validate_fxc) {
- auto fxc = tint::utils::Command::LookPath(options.fxc_path.empty()
- ? tint::hlsl::validate::kFxcDLLName
- : std::string(options.fxc_path));
+ auto fxc =
+ tint::Command::LookPath(options.fxc_path.empty() ? tint::hlsl::validate::kFxcDLLName
+ : std::string(options.fxc_path));
#ifdef _WIN32
if (fxc.Found()) {
@@ -841,7 +841,7 @@
return false;
}
- const auto hash = tint::utils::CRC32(result.glsl.c_str());
+ const auto hash = tint::CRC32(result.glsl.c_str());
if (options.print_hash) {
PrintHash(hash);
}
@@ -891,7 +891,7 @@
} // namespace
int main(int argc, const char** argv) {
- tint::utils::Vector<std::string_view, 8> arguments;
+ tint::Vector<std::string_view, 8> arguments;
for (int i = 1; i < argc; i++) {
std::string_view arg(argv[i]);
if (!arg.empty()) {
@@ -961,7 +961,7 @@
std::cerr << "empty override name" << std::endl;
return false;
}
- if (auto num = tint::utils::ParseNumber<decltype(tint::OverrideId::value)>(name)) {
+ if (auto num = tint::ParseNumber<decltype(tint::OverrideId::value)>(name)) {
tint::OverrideId id{num.Get()};
values.emplace(id, value);
} else {
@@ -983,7 +983,7 @@
}},
};
auto transform_names = [&] {
- tint::utils::StringStream names;
+ tint::StringStream names;
for (auto& t : transforms) {
names << " " << t.name << std::endl;
}
diff --git a/src/tint/fuzzers/random_generator.cc b/src/tint/fuzzers/random_generator.cc
index 257b2f2..7d2e8f2 100644
--- a/src/tint/fuzzers/random_generator.cc
+++ b/src/tint/fuzzers/random_generator.cc
@@ -34,9 +34,9 @@
/// @param size - number of elements in buffer
/// @returns hash of the data in the buffer
size_t HashBuffer(const uint8_t* data, const size_t size) {
- size_t hash = utils::Hash(size);
+ size_t hash = Hash(size);
for (size_t i = 0; i < size; i++) {
- hash = utils::HashCombine(hash, data[i]);
+ hash = HashCombine(hash, data[i]);
}
return hash;
}
diff --git a/src/tint/fuzzers/tint_common_fuzzer.cc b/src/tint/fuzzers/tint_common_fuzzer.cc
index c153c96..4bb3261 100644
--- a/src/tint/fuzzers/tint_common_fuzzer.cc
+++ b/src/tint/fuzzers/tint_common_fuzzer.cc
@@ -147,7 +147,7 @@
#if TINT_BUILD_WGSL_READER || TINT_BUILD_SPV_READER
auto dump_input_data = [&](auto& content, const char* extension) {
- size_t hash = utils::Hash(content);
+ size_t hash = Hash(content);
auto filename = "fuzzer_input_" + std::to_string(hash) + extension; //
std::ofstream fout(filename, std::ios::binary);
fout.write(reinterpret_cast<const char*>(data), static_cast<std::streamsize>(size));
diff --git a/src/tint/lang/core/builtin/access.cc b/src/tint/lang/core/builtin/access.cc
index c62be63..01b1604 100644
--- a/src/tint/lang/core/builtin/access.cc
+++ b/src/tint/lang/core/builtin/access.cc
@@ -40,7 +40,7 @@
return Access::kUndefined;
}
-utils::StringStream& operator<<(utils::StringStream& out, Access value) {
+StringStream& operator<<(StringStream& out, Access value) {
switch (value) {
case Access::kUndefined:
return out << "undefined";
diff --git a/src/tint/lang/core/builtin/access.h b/src/tint/lang/core/builtin/access.h
index 70bec10..1b52fec 100644
--- a/src/tint/lang/core/builtin/access.h
+++ b/src/tint/lang/core/builtin/access.h
@@ -38,7 +38,7 @@
/// @param out the stream to write to
/// @param value the Access
/// @returns `out` so calls can be chained
-utils::StringStream& operator<<(utils::StringStream& out, Access value);
+StringStream& operator<<(StringStream& out, Access value);
/// ParseAccess parses a Access from a string.
/// @param str the string to parse
diff --git a/src/tint/lang/core/builtin/access_test.cc b/src/tint/lang/core/builtin/access_test.cc
index 39a6b82..06f1cb1 100644
--- a/src/tint/lang/core/builtin/access_test.cc
+++ b/src/tint/lang/core/builtin/access_test.cc
@@ -72,7 +72,7 @@
TEST_P(AccessPrintTest, Print) {
Access value = GetParam().value;
const char* expect = GetParam().string;
- EXPECT_EQ(expect, utils::ToString(value));
+ EXPECT_EQ(expect, tint::ToString(value));
}
INSTANTIATE_TEST_SUITE_P(ValidCases, AccessPrintTest, testing::ValuesIn(kValidCases));
diff --git a/src/tint/lang/core/builtin/address_space.cc b/src/tint/lang/core/builtin/address_space.cc
index e344b8c..7081cab 100644
--- a/src/tint/lang/core/builtin/address_space.cc
+++ b/src/tint/lang/core/builtin/address_space.cc
@@ -55,7 +55,7 @@
return AddressSpace::kUndefined;
}
-utils::StringStream& operator<<(utils::StringStream& out, AddressSpace value) {
+StringStream& operator<<(StringStream& out, AddressSpace value) {
switch (value) {
case AddressSpace::kUndefined:
return out << "undefined";
diff --git a/src/tint/lang/core/builtin/address_space.h b/src/tint/lang/core/builtin/address_space.h
index 0614d24..1ac2c21 100644
--- a/src/tint/lang/core/builtin/address_space.h
+++ b/src/tint/lang/core/builtin/address_space.h
@@ -44,7 +44,7 @@
/// @param out the stream to write to
/// @param value the AddressSpace
/// @returns `out` so calls can be chained
-utils::StringStream& operator<<(utils::StringStream& out, AddressSpace value);
+StringStream& operator<<(StringStream& out, AddressSpace value);
/// ParseAddressSpace parses a AddressSpace from a string.
/// @param str the string to parse
diff --git a/src/tint/lang/core/builtin/address_space_test.cc b/src/tint/lang/core/builtin/address_space_test.cc
index a0d3f91..c26d7be 100644
--- a/src/tint/lang/core/builtin/address_space_test.cc
+++ b/src/tint/lang/core/builtin/address_space_test.cc
@@ -84,7 +84,7 @@
TEST_P(AddressSpacePrintTest, Print) {
AddressSpace value = GetParam().value;
const char* expect = GetParam().string;
- EXPECT_EQ(expect, utils::ToString(value));
+ EXPECT_EQ(expect, tint::ToString(value));
}
INSTANTIATE_TEST_SUITE_P(ValidCases, AddressSpacePrintTest, testing::ValuesIn(kValidCases));
diff --git a/src/tint/lang/core/builtin/attribute.cc b/src/tint/lang/core/builtin/attribute.cc
index e4f6908..f7c7596 100644
--- a/src/tint/lang/core/builtin/attribute.cc
+++ b/src/tint/lang/core/builtin/attribute.cc
@@ -79,7 +79,7 @@
return Attribute::kUndefined;
}
-utils::StringStream& operator<<(utils::StringStream& out, Attribute value) {
+StringStream& operator<<(StringStream& out, Attribute value) {
switch (value) {
case Attribute::kUndefined:
return out << "undefined";
diff --git a/src/tint/lang/core/builtin/attribute.h b/src/tint/lang/core/builtin/attribute.h
index b7d8fd6..1914f41 100644
--- a/src/tint/lang/core/builtin/attribute.h
+++ b/src/tint/lang/core/builtin/attribute.h
@@ -54,7 +54,7 @@
/// @param out the stream to write to
/// @param value the Attribute
/// @returns `out` so calls can be chained
-utils::StringStream& operator<<(utils::StringStream& out, Attribute value);
+StringStream& operator<<(StringStream& out, Attribute value);
/// ParseAttribute parses a Attribute from a string.
/// @param str the string to parse
diff --git a/src/tint/lang/core/builtin/attribute_test.cc b/src/tint/lang/core/builtin/attribute_test.cc
index fcb0498..f100e7d 100644
--- a/src/tint/lang/core/builtin/attribute_test.cc
+++ b/src/tint/lang/core/builtin/attribute_test.cc
@@ -120,7 +120,7 @@
TEST_P(AttributePrintTest, Print) {
Attribute value = GetParam().value;
const char* expect = GetParam().string;
- EXPECT_EQ(expect, utils::ToString(value));
+ EXPECT_EQ(expect, tint::ToString(value));
}
INSTANTIATE_TEST_SUITE_P(ValidCases, AttributePrintTest, testing::ValuesIn(kValidCases));
diff --git a/src/tint/lang/core/builtin/builtin.cc b/src/tint/lang/core/builtin/builtin.cc
index 2ca4395..3cd8fb6 100644
--- a/src/tint/lang/core/builtin/builtin.cc
+++ b/src/tint/lang/core/builtin/builtin.cc
@@ -319,7 +319,7 @@
return Builtin::kUndefined;
}
-utils::StringStream& operator<<(utils::StringStream& out, Builtin value) {
+StringStream& operator<<(StringStream& out, Builtin value) {
switch (value) {
case Builtin::kUndefined:
return out << "undefined";
diff --git a/src/tint/lang/core/builtin/builtin.h b/src/tint/lang/core/builtin/builtin.h
index b2177b1..e22855d 100644
--- a/src/tint/lang/core/builtin/builtin.h
+++ b/src/tint/lang/core/builtin/builtin.h
@@ -131,7 +131,7 @@
/// @param out the stream to write to
/// @param value the Builtin
/// @returns `out` so calls can be chained
-utils::StringStream& operator<<(utils::StringStream& out, Builtin value);
+StringStream& operator<<(StringStream& out, Builtin value);
/// ParseBuiltin parses a Builtin from a string.
/// @param str the string to parse
diff --git a/src/tint/lang/core/builtin/builtin_test.cc b/src/tint/lang/core/builtin/builtin_test.cc
index ce5d7ba..99557d0 100644
--- a/src/tint/lang/core/builtin/builtin_test.cc
+++ b/src/tint/lang/core/builtin/builtin_test.cc
@@ -448,7 +448,7 @@
TEST_P(BuiltinPrintTest, Print) {
Builtin value = GetParam().value;
const char* expect = GetParam().string;
- EXPECT_EQ(expect, utils::ToString(value));
+ EXPECT_EQ(expect, tint::ToString(value));
}
INSTANTIATE_TEST_SUITE_P(ValidCases, BuiltinPrintTest, testing::ValuesIn(kValidCases));
diff --git a/src/tint/lang/core/builtin/builtin_value.cc b/src/tint/lang/core/builtin/builtin_value.cc
index 988be77..8107369 100644
--- a/src/tint/lang/core/builtin/builtin_value.cc
+++ b/src/tint/lang/core/builtin/builtin_value.cc
@@ -70,7 +70,7 @@
return BuiltinValue::kUndefined;
}
-utils::StringStream& operator<<(utils::StringStream& out, BuiltinValue value) {
+StringStream& operator<<(StringStream& out, BuiltinValue value) {
switch (value) {
case BuiltinValue::kUndefined:
return out << "undefined";
diff --git a/src/tint/lang/core/builtin/builtin_value.h b/src/tint/lang/core/builtin/builtin_value.h
index 80407e8..5d33d96 100644
--- a/src/tint/lang/core/builtin/builtin_value.h
+++ b/src/tint/lang/core/builtin/builtin_value.h
@@ -48,7 +48,7 @@
/// @param out the stream to write to
/// @param value the BuiltinValue
/// @returns `out` so calls can be chained
-utils::StringStream& operator<<(utils::StringStream& out, BuiltinValue value);
+StringStream& operator<<(StringStream& out, BuiltinValue value);
/// ParseBuiltinValue parses a BuiltinValue from a string.
/// @param str the string to parse
diff --git a/src/tint/lang/core/builtin/builtin_value_test.cc b/src/tint/lang/core/builtin/builtin_value_test.cc
index 7da9eb3..dc2c26f 100644
--- a/src/tint/lang/core/builtin/builtin_value_test.cc
+++ b/src/tint/lang/core/builtin/builtin_value_test.cc
@@ -116,7 +116,7 @@
TEST_P(BuiltinValuePrintTest, Print) {
BuiltinValue value = GetParam().value;
const char* expect = GetParam().string;
- EXPECT_EQ(expect, utils::ToString(value));
+ EXPECT_EQ(expect, tint::ToString(value));
}
INSTANTIATE_TEST_SUITE_P(ValidCases, BuiltinValuePrintTest, testing::ValuesIn(kValidCases));
diff --git a/src/tint/lang/core/builtin/diagnostic_rule.cc b/src/tint/lang/core/builtin/diagnostic_rule.cc
index 5120358..496bf0d 100644
--- a/src/tint/lang/core/builtin/diagnostic_rule.cc
+++ b/src/tint/lang/core/builtin/diagnostic_rule.cc
@@ -38,7 +38,7 @@
return CoreDiagnosticRule::kUndefined;
}
-utils::StringStream& operator<<(utils::StringStream& out, CoreDiagnosticRule value) {
+StringStream& operator<<(StringStream& out, CoreDiagnosticRule value) {
switch (value) {
case CoreDiagnosticRule::kUndefined:
return out << "undefined";
@@ -59,7 +59,7 @@
return ChromiumDiagnosticRule::kUndefined;
}
-utils::StringStream& operator<<(utils::StringStream& out, ChromiumDiagnosticRule value) {
+StringStream& operator<<(StringStream& out, ChromiumDiagnosticRule value) {
switch (value) {
case ChromiumDiagnosticRule::kUndefined:
return out << "undefined";
diff --git a/src/tint/lang/core/builtin/diagnostic_rule.h b/src/tint/lang/core/builtin/diagnostic_rule.h
index 66a6c4d..63d2839 100644
--- a/src/tint/lang/core/builtin/diagnostic_rule.h
+++ b/src/tint/lang/core/builtin/diagnostic_rule.h
@@ -39,7 +39,7 @@
/// @param out the stream to write to
/// @param value the CoreDiagnosticRule
/// @returns `out` so calls can be chained
-utils::StringStream& operator<<(utils::StringStream& out, CoreDiagnosticRule value);
+StringStream& operator<<(StringStream& out, CoreDiagnosticRule value);
/// ParseCoreDiagnosticRule parses a CoreDiagnosticRule from a string.
/// @param str the string to parse
@@ -59,7 +59,7 @@
/// @param out the stream to write to
/// @param value the ChromiumDiagnosticRule
/// @returns `out` so calls can be chained
-utils::StringStream& operator<<(utils::StringStream& out, ChromiumDiagnosticRule value);
+StringStream& operator<<(StringStream& out, ChromiumDiagnosticRule value);
/// ParseChromiumDiagnosticRule parses a ChromiumDiagnosticRule from a string.
/// @param str the string to parse
diff --git a/src/tint/lang/core/builtin/diagnostic_rule_test.cc b/src/tint/lang/core/builtin/diagnostic_rule_test.cc
index 1af325f..92b2889 100644
--- a/src/tint/lang/core/builtin/diagnostic_rule_test.cc
+++ b/src/tint/lang/core/builtin/diagnostic_rule_test.cc
@@ -70,7 +70,7 @@
TEST_P(CoreDiagnosticRulePrintTest, Print) {
CoreDiagnosticRule value = GetParam().value;
const char* expect = GetParam().string;
- EXPECT_EQ(expect, utils::ToString(value));
+ EXPECT_EQ(expect, tint::ToString(value));
}
INSTANTIATE_TEST_SUITE_P(ValidCases, CoreDiagnosticRulePrintTest, testing::ValuesIn(kValidCases));
@@ -122,7 +122,7 @@
TEST_P(ChromiumDiagnosticRulePrintTest, Print) {
ChromiumDiagnosticRule value = GetParam().value;
const char* expect = GetParam().string;
- EXPECT_EQ(expect, utils::ToString(value));
+ EXPECT_EQ(expect, tint::ToString(value));
}
INSTANTIATE_TEST_SUITE_P(ValidCases,
diff --git a/src/tint/lang/core/builtin/diagnostic_severity.cc b/src/tint/lang/core/builtin/diagnostic_severity.cc
index 6bb7a32..543ccc8 100644
--- a/src/tint/lang/core/builtin/diagnostic_severity.cc
+++ b/src/tint/lang/core/builtin/diagnostic_severity.cc
@@ -58,7 +58,7 @@
return DiagnosticSeverity::kUndefined;
}
-utils::StringStream& operator<<(utils::StringStream& out, DiagnosticSeverity value) {
+StringStream& operator<<(StringStream& out, DiagnosticSeverity value) {
switch (value) {
case DiagnosticSeverity::kUndefined:
return out << "undefined";
diff --git a/src/tint/lang/core/builtin/diagnostic_severity.h b/src/tint/lang/core/builtin/diagnostic_severity.h
index c056335..e866a29 100644
--- a/src/tint/lang/core/builtin/diagnostic_severity.h
+++ b/src/tint/lang/core/builtin/diagnostic_severity.h
@@ -44,7 +44,7 @@
/// @param out the stream to write to
/// @param value the DiagnosticSeverity
/// @returns `out` so calls can be chained
-utils::StringStream& operator<<(utils::StringStream& out, DiagnosticSeverity value);
+StringStream& operator<<(StringStream& out, DiagnosticSeverity value);
/// ParseDiagnosticSeverity parses a DiagnosticSeverity from a string.
/// @param str the string to parse
diff --git a/src/tint/lang/core/builtin/diagnostic_severity_test.cc b/src/tint/lang/core/builtin/diagnostic_severity_test.cc
index 661dd10..3194acd 100644
--- a/src/tint/lang/core/builtin/diagnostic_severity_test.cc
+++ b/src/tint/lang/core/builtin/diagnostic_severity_test.cc
@@ -76,7 +76,7 @@
TEST_P(DiagnosticSeverityPrintTest, Print) {
DiagnosticSeverity value = GetParam().value;
const char* expect = GetParam().string;
- EXPECT_EQ(expect, utils::ToString(value));
+ EXPECT_EQ(expect, tint::ToString(value));
}
INSTANTIATE_TEST_SUITE_P(ValidCases, DiagnosticSeverityPrintTest, testing::ValuesIn(kValidCases));
diff --git a/src/tint/lang/core/builtin/extension.cc b/src/tint/lang/core/builtin/extension.cc
index a0fc59f..568743d 100644
--- a/src/tint/lang/core/builtin/extension.cc
+++ b/src/tint/lang/core/builtin/extension.cc
@@ -52,7 +52,7 @@
return Extension::kUndefined;
}
-utils::StringStream& operator<<(utils::StringStream& out, Extension value) {
+StringStream& operator<<(StringStream& out, Extension value) {
switch (value) {
case Extension::kUndefined:
return out << "undefined";
diff --git a/src/tint/lang/core/builtin/extension.h b/src/tint/lang/core/builtin/extension.h
index 67f8b45..cb9f52d 100644
--- a/src/tint/lang/core/builtin/extension.h
+++ b/src/tint/lang/core/builtin/extension.h
@@ -44,7 +44,7 @@
/// @param out the stream to write to
/// @param value the Extension
/// @returns `out` so calls can be chained
-utils::StringStream& operator<<(utils::StringStream& out, Extension value);
+StringStream& operator<<(StringStream& out, Extension value);
/// ParseExtension parses a Extension from a string.
/// @param str the string to parse
@@ -62,7 +62,7 @@
};
// A unique vector of extensions
-using Extensions = utils::UniqueVector<Extension, 4>;
+using Extensions = UniqueVector<Extension, 4>;
} // namespace tint::builtin
diff --git a/src/tint/lang/core/builtin/extension.h.tmpl b/src/tint/lang/core/builtin/extension.h.tmpl
index cd417a0..860acc1 100644
--- a/src/tint/lang/core/builtin/extension.h.tmpl
+++ b/src/tint/lang/core/builtin/extension.h.tmpl
@@ -24,7 +24,7 @@
{{ Eval "DeclareEnum" $enum}}
// A unique vector of extensions
-using Extensions = utils::UniqueVector<Extension, 4>;
+using Extensions = UniqueVector<Extension, 4>;
} // namespace tint::builtin
diff --git a/src/tint/lang/core/builtin/extension_test.cc b/src/tint/lang/core/builtin/extension_test.cc
index f3065c9..5d70f13 100644
--- a/src/tint/lang/core/builtin/extension_test.cc
+++ b/src/tint/lang/core/builtin/extension_test.cc
@@ -93,7 +93,7 @@
TEST_P(ExtensionPrintTest, Print) {
Extension value = GetParam().value;
const char* expect = GetParam().string;
- EXPECT_EQ(expect, utils::ToString(value));
+ EXPECT_EQ(expect, tint::ToString(value));
}
INSTANTIATE_TEST_SUITE_P(ValidCases, ExtensionPrintTest, testing::ValuesIn(kValidCases));
diff --git a/src/tint/lang/core/builtin/function.cc b/src/tint/lang/core/builtin/function.cc
index 0ea63a3..d194a6e 100644
--- a/src/tint/lang/core/builtin/function.cc
+++ b/src/tint/lang/core/builtin/function.cc
@@ -606,7 +606,7 @@
return "<unknown>";
}
-utils::StringStream& operator<<(utils::StringStream& out, Function i) {
+StringStream& operator<<(StringStream& out, Function i) {
out << str(i);
return out;
}
diff --git a/src/tint/lang/core/builtin/function.cc.tmpl b/src/tint/lang/core/builtin/function.cc.tmpl
index 95588ed..c98af1e 100644
--- a/src/tint/lang/core/builtin/function.cc.tmpl
+++ b/src/tint/lang/core/builtin/function.cc.tmpl
@@ -36,7 +36,7 @@
return "<unknown>";
}
-utils::StringStream& operator<<(utils::StringStream& out, Function i) {
+StringStream& operator<<(StringStream& out, Function i) {
out << str(i);
return out;
}
diff --git a/src/tint/lang/core/builtin/function.h b/src/tint/lang/core/builtin/function.h
index 6fb9063..d1f45df 100644
--- a/src/tint/lang/core/builtin/function.h
+++ b/src/tint/lang/core/builtin/function.h
@@ -161,7 +161,7 @@
/// Emits the name of the builtin function type. The spelling, including case,
/// matches the name in the WGSL spec.
-utils::StringStream& operator<<(utils::StringStream& out, Function i);
+StringStream& operator<<(StringStream& out, Function i);
/// All builtin functions
constexpr Function kFunctions[] = {
diff --git a/src/tint/lang/core/builtin/function.h.tmpl b/src/tint/lang/core/builtin/function.h.tmpl
index f40f208..78d82c4 100644
--- a/src/tint/lang/core/builtin/function.h.tmpl
+++ b/src/tint/lang/core/builtin/function.h.tmpl
@@ -41,7 +41,7 @@
/// Emits the name of the builtin function type. The spelling, including case,
/// matches the name in the WGSL spec.
-utils::StringStream& operator<<(utils::StringStream& out, Function i);
+StringStream& operator<<(StringStream& out, Function i);
/// All builtin functions
constexpr Function kFunctions[] = {
diff --git a/src/tint/lang/core/builtin/interpolation_sampling.cc b/src/tint/lang/core/builtin/interpolation_sampling.cc
index 4891de9..e3cf02d 100644
--- a/src/tint/lang/core/builtin/interpolation_sampling.cc
+++ b/src/tint/lang/core/builtin/interpolation_sampling.cc
@@ -43,7 +43,7 @@
return InterpolationSampling::kUndefined;
}
-utils::StringStream& operator<<(utils::StringStream& out, InterpolationSampling value) {
+StringStream& operator<<(StringStream& out, InterpolationSampling value) {
switch (value) {
case InterpolationSampling::kUndefined:
return out << "undefined";
diff --git a/src/tint/lang/core/builtin/interpolation_sampling.h b/src/tint/lang/core/builtin/interpolation_sampling.h
index 00fbd32..15ef048 100644
--- a/src/tint/lang/core/builtin/interpolation_sampling.h
+++ b/src/tint/lang/core/builtin/interpolation_sampling.h
@@ -40,7 +40,7 @@
/// @param out the stream to write to
/// @param value the InterpolationSampling
/// @returns `out` so calls can be chained
-utils::StringStream& operator<<(utils::StringStream& out, InterpolationSampling value);
+StringStream& operator<<(StringStream& out, InterpolationSampling value);
/// ParseInterpolationSampling parses a InterpolationSampling from a string.
/// @param str the string to parse
diff --git a/src/tint/lang/core/builtin/interpolation_sampling_test.cc b/src/tint/lang/core/builtin/interpolation_sampling_test.cc
index 2f7c7ed..5a43a0a 100644
--- a/src/tint/lang/core/builtin/interpolation_sampling_test.cc
+++ b/src/tint/lang/core/builtin/interpolation_sampling_test.cc
@@ -81,7 +81,7 @@
TEST_P(InterpolationSamplingPrintTest, Print) {
InterpolationSampling value = GetParam().value;
const char* expect = GetParam().string;
- EXPECT_EQ(expect, utils::ToString(value));
+ EXPECT_EQ(expect, tint::ToString(value));
}
INSTANTIATE_TEST_SUITE_P(ValidCases,
diff --git a/src/tint/lang/core/builtin/interpolation_type.cc b/src/tint/lang/core/builtin/interpolation_type.cc
index 64f2d45..e236701 100644
--- a/src/tint/lang/core/builtin/interpolation_type.cc
+++ b/src/tint/lang/core/builtin/interpolation_type.cc
@@ -42,7 +42,7 @@
return InterpolationType::kUndefined;
}
-utils::StringStream& operator<<(utils::StringStream& out, InterpolationType value) {
+StringStream& operator<<(StringStream& out, InterpolationType value) {
switch (value) {
case InterpolationType::kUndefined:
return out << "undefined";
diff --git a/src/tint/lang/core/builtin/interpolation_type.h b/src/tint/lang/core/builtin/interpolation_type.h
index 6983d57..9957ec1 100644
--- a/src/tint/lang/core/builtin/interpolation_type.h
+++ b/src/tint/lang/core/builtin/interpolation_type.h
@@ -40,7 +40,7 @@
/// @param out the stream to write to
/// @param value the InterpolationType
/// @returns `out` so calls can be chained
-utils::StringStream& operator<<(utils::StringStream& out, InterpolationType value);
+StringStream& operator<<(StringStream& out, InterpolationType value);
/// ParseInterpolationType parses a InterpolationType from a string.
/// @param str the string to parse
diff --git a/src/tint/lang/core/builtin/interpolation_type_test.cc b/src/tint/lang/core/builtin/interpolation_type_test.cc
index 0ec8607..8e09912 100644
--- a/src/tint/lang/core/builtin/interpolation_type_test.cc
+++ b/src/tint/lang/core/builtin/interpolation_type_test.cc
@@ -75,7 +75,7 @@
TEST_P(InterpolationTypePrintTest, Print) {
InterpolationType value = GetParam().value;
const char* expect = GetParam().string;
- EXPECT_EQ(expect, utils::ToString(value));
+ EXPECT_EQ(expect, tint::ToString(value));
}
INSTANTIATE_TEST_SUITE_P(ValidCases, InterpolationTypePrintTest, testing::ValuesIn(kValidCases));
diff --git a/src/tint/lang/core/builtin/number.cc b/src/tint/lang/core/builtin/number.cc
index af0e7ca..980d934 100644
--- a/src/tint/lang/core/builtin/number.cc
+++ b/src/tint/lang/core/builtin/number.cc
@@ -50,7 +50,7 @@
} // namespace
-utils::StringStream& operator<<(utils::StringStream& out, ConversionFailure failure) {
+StringStream& operator<<(StringStream& out, ConversionFailure failure) {
switch (failure) {
case ConversionFailure::kExceedsPositiveLimit:
return out << "value exceeds positive limit for type";
@@ -72,7 +72,7 @@
// Assert we use binary32 (i.e. float) as underlying type, which has 4 bytes.
static_assert(std::is_same<f16::type, float>());
- uint32_t u32 = utils::Bitcast<uint32_t>(value);
+ uint32_t u32 = tint::Bitcast<uint32_t>(value);
if ((u32 & ~kF32SignMask) == 0) {
return value; // +/- zero
}
@@ -260,7 +260,7 @@
return value > 0 ? 0.0 : -0.0;
}
- return utils::Bitcast<f16::type>(u32);
+ return tint::Bitcast<f16::type>(u32);
}
uint16_t f16::BitsRepresentation() const {
@@ -288,7 +288,7 @@
// | Normal f16 | [-14, 15] | [1, 30] | [113, 142] |
// ---------------------------------------------------------------------------
- uint32_t f32_bit_pattern = utils::Bitcast<uint32_t>(value);
+ uint32_t f32_bit_pattern = tint::Bitcast<uint32_t>(value);
uint32_t f32_biased_exponent = (f32_bit_pattern & kF32ExponentMask) >> kF32MantissaBits;
uint32_t f32_mantissa = f32_bit_pattern & kF32MantissaMask;
@@ -410,7 +410,7 @@
uint32_t val = f32_sign_bit | f32_biased_exponent | f32_mantissa;
// Bitcast to a F32 and then store into the F16 Number
- return f16(utils::Bitcast<f16::type>(val));
+ return f16(tint::Bitcast<f16::type>(val));
}
} // namespace tint
diff --git a/src/tint/lang/core/builtin/number.h b/src/tint/lang/core/builtin/number.h
index cce411e..0ab6532 100644
--- a/src/tint/lang/core/builtin/number.h
+++ b/src/tint/lang/core/builtin/number.h
@@ -179,7 +179,7 @@
/// @param num the Number
/// @return the stream so calls can be chained
template <typename T>
-inline utils::StringStream& operator<<(utils::StringStream& out, Number<T> num) {
+inline StringStream& operator<<(StringStream& out, Number<T> num) {
return out << num.value;
}
@@ -281,7 +281,7 @@
static_assert(std::numeric_limits<double>::has_infinity);
static_assert(std::numeric_limits<double>::has_quiet_NaN);
-template <typename T, utils::traits::EnableIf<IsFloatingPoint<T>>* = nullptr>
+template <typename T, tint::traits::EnableIf<IsFloatingPoint<T>>* = nullptr>
inline const auto kPi = T(UnwrapNumber<T>(3.14159265358979323846));
/// True iff T is an abstract number type
@@ -289,7 +289,7 @@
constexpr bool IsAbstract = std::is_same_v<T, AInt> || std::is_same_v<T, AFloat>;
/// @returns the friendly name of Number type T
-template <typename T, utils::traits::EnableIf<IsNumber<T>>* = nullptr>
+template <typename T, tint::traits::EnableIf<IsNumber<T>>* = nullptr>
const char* FriendlyName() {
if constexpr (std::is_same_v<T, AInt>) {
return "abstract-int";
@@ -309,7 +309,7 @@
}
/// @returns the friendly name of T when T is bool
-template <typename T, utils::traits::EnableIf<std::is_same_v<T, bool>>* = nullptr>
+template <typename T, tint::traits::EnableIf<std::is_same_v<T, bool>>* = nullptr>
const char* FriendlyName() {
return "bool";
}
@@ -324,12 +324,12 @@
/// @param out the stream to write to
/// @param failure the ConversionFailure
/// @return the stream so calls can be chained
-utils::StringStream& operator<<(utils::StringStream& out, ConversionFailure failure);
+StringStream& operator<<(StringStream& out, ConversionFailure failure);
/// Converts a number from one type to another, checking that the value fits in the target type.
/// @returns the resulting value of the conversion, or a failure reason.
template <typename TO, typename FROM>
-utils::Result<TO, ConversionFailure> CheckedConvert(Number<FROM> num) {
+tint::Result<TO, ConversionFailure> CheckedConvert(Number<FROM> num) {
// Use the highest-precision integer or floating-point type to perform the comparisons.
using T = std::conditional_t<IsFloatingPoint<UnwrapNumber<TO>> || IsFloatingPoint<FROM>,
AFloat::type, AInt::type>;
@@ -446,7 +446,7 @@
/// @returns a + b, or an empty optional if the resulting value overflowed the float value
template <typename FloatingPointT,
- typename = utils::traits::EnableIf<IsFloatingPoint<FloatingPointT>>>
+ typename = tint::traits::EnableIf<IsFloatingPoint<FloatingPointT>>>
inline std::optional<FloatingPointT> CheckedAdd(FloatingPointT a, FloatingPointT b) {
auto result = FloatingPointT{a.value + b.value};
if (!std::isfinite(result.value)) {
@@ -479,7 +479,7 @@
/// @returns a + b, or an empty optional if the resulting value overflowed the float value
template <typename FloatingPointT,
- typename = utils::traits::EnableIf<IsFloatingPoint<FloatingPointT>>>
+ typename = tint::traits::EnableIf<IsFloatingPoint<FloatingPointT>>>
inline std::optional<FloatingPointT> CheckedSub(FloatingPointT a, FloatingPointT b) {
auto result = FloatingPointT{a.value - b.value};
if (!std::isfinite(result.value)) {
@@ -524,7 +524,7 @@
/// @returns a * b, or an empty optional if the resulting value overflowed the float value
template <typename FloatingPointT,
- typename = utils::traits::EnableIf<IsFloatingPoint<FloatingPointT>>>
+ typename = tint::traits::EnableIf<IsFloatingPoint<FloatingPointT>>>
inline std::optional<FloatingPointT> CheckedMul(FloatingPointT a, FloatingPointT b) {
auto result = FloatingPointT{a.value * b.value};
if (!std::isfinite(result.value)) {
@@ -548,7 +548,7 @@
/// @returns a / b, or an empty optional if the resulting value overflowed the float value
template <typename FloatingPointT,
- typename = utils::traits::EnableIf<IsFloatingPoint<FloatingPointT>>>
+ typename = tint::traits::EnableIf<IsFloatingPoint<FloatingPointT>>>
inline std::optional<FloatingPointT> CheckedDiv(FloatingPointT a, FloatingPointT b) {
if (b == FloatingPointT{0.0} || b == FloatingPointT{-0.0}) {
return {};
@@ -589,7 +589,7 @@
/// @returns the remainder of a / b, or an empty optional if the resulting value overflowed the
/// float value
template <typename FloatingPointT,
- typename = utils::traits::EnableIf<IsFloatingPoint<FloatingPointT>>>
+ typename = tint::traits::EnableIf<IsFloatingPoint<FloatingPointT>>>
inline std::optional<FloatingPointT> CheckedMod(FloatingPointT a, FloatingPointT b) {
if (b == FloatingPointT{0.0} || b == FloatingPointT{-0.0}) {
return {};
@@ -612,7 +612,7 @@
/// @returns the value of `base` raised to the power `exp`, or an empty optional if the operation
/// cannot be performed.
template <typename FloatingPointT,
- typename = utils::traits::EnableIf<IsFloatingPoint<FloatingPointT>>>
+ typename = tint::traits::EnableIf<IsFloatingPoint<FloatingPointT>>>
inline std::optional<FloatingPointT> CheckedPow(FloatingPointT base, FloatingPointT exp) {
static_assert(IsNumber<FloatingPointT>);
if ((base < 0) || (base == 0 && exp <= 0)) {
diff --git a/src/tint/lang/core/builtin/number_test.cc b/src/tint/lang/core/builtin/number_test.cc
index c6545bc..be5cab5 100644
--- a/src/tint/lang/core/builtin/number_test.cc
+++ b/src/tint/lang/core/builtin/number_test.cc
@@ -255,7 +255,7 @@
float input_value = GetParam().input_value;
float quantized_value = GetParam().quantized_value;
- utils::StringStream ss;
+ StringStream ss;
ss << "input value = " << input_value << ", expected quantized value = " << quantized_value;
SCOPED_TRACE(ss.str());
@@ -270,7 +270,7 @@
float input_value = GetParam().input_value;
uint16_t representation = GetParam().f16_bit_pattern;
- utils::StringStream ss;
+ StringStream ss;
ss << "input value = " << input_value
<< ", expected binary16 bits representation = " << std::hex << std::showbase
<< representation;
@@ -283,7 +283,7 @@
float input_value = GetParam().quantized_value;
uint16_t representation = GetParam().f16_bit_pattern;
- utils::StringStream ss;
+ StringStream ss;
ss << "binary16 bits representation = " << std::hex << std::showbase << representation
<< " expected value = " << input_value;
SCOPED_TRACE(ss.str());
diff --git a/src/tint/lang/core/builtin/texel_format.cc b/src/tint/lang/core/builtin/texel_format.cc
index 84c0bec..b3e3665 100644
--- a/src/tint/lang/core/builtin/texel_format.cc
+++ b/src/tint/lang/core/builtin/texel_format.cc
@@ -82,7 +82,7 @@
return TexelFormat::kUndefined;
}
-utils::StringStream& operator<<(utils::StringStream& out, TexelFormat value) {
+StringStream& operator<<(StringStream& out, TexelFormat value) {
switch (value) {
case TexelFormat::kUndefined:
return out << "undefined";
diff --git a/src/tint/lang/core/builtin/texel_format.h b/src/tint/lang/core/builtin/texel_format.h
index 658e278..63ebeb3 100644
--- a/src/tint/lang/core/builtin/texel_format.h
+++ b/src/tint/lang/core/builtin/texel_format.h
@@ -52,7 +52,7 @@
/// @param out the stream to write to
/// @param value the TexelFormat
/// @returns `out` so calls can be chained
-utils::StringStream& operator<<(utils::StringStream& out, TexelFormat value);
+StringStream& operator<<(StringStream& out, TexelFormat value);
/// ParseTexelFormat parses a TexelFormat from a string.
/// @param str the string to parse
diff --git a/src/tint/lang/core/builtin/texel_format_test.cc b/src/tint/lang/core/builtin/texel_format_test.cc
index 0fd6e55..36d01a6 100644
--- a/src/tint/lang/core/builtin/texel_format_test.cc
+++ b/src/tint/lang/core/builtin/texel_format_test.cc
@@ -99,7 +99,7 @@
TEST_P(TexelFormatPrintTest, Print) {
TexelFormat value = GetParam().value;
const char* expect = GetParam().string;
- EXPECT_EQ(expect, utils::ToString(value));
+ EXPECT_EQ(expect, tint::ToString(value));
}
INSTANTIATE_TEST_SUITE_P(ValidCases, TexelFormatPrintTest, testing::ValuesIn(kValidCases));
diff --git a/src/tint/lang/core/constant/composite.cc b/src/tint/lang/core/constant/composite.cc
index 8413952..c1a4dce 100644
--- a/src/tint/lang/core/constant/composite.cc
+++ b/src/tint/lang/core/constant/composite.cc
@@ -23,7 +23,7 @@
namespace tint::constant {
Composite::Composite(const type::Type* t,
- utils::VectorRef<const constant::Value*> els,
+ VectorRef<const constant::Value*> els,
bool all_0,
bool any_0)
: type(t), elements(std::move(els)), all_zero(all_0), any_zero(any_0), hash(CalcHash()) {
@@ -34,7 +34,7 @@
const Composite* Composite::Clone(CloneContext& ctx) const {
auto* ty = type->Clone(ctx.type_ctx);
- utils::Vector<const constant::Value*, 4> els;
+ Vector<const constant::Value*, 4> els;
for (const auto* el : elements) {
els.Push(el->Clone(ctx));
}
diff --git a/src/tint/lang/core/constant/composite.h b/src/tint/lang/core/constant/composite.h
index 612d256..ccff258 100644
--- a/src/tint/lang/core/constant/composite.h
+++ b/src/tint/lang/core/constant/composite.h
@@ -28,14 +28,14 @@
/// Composite may be of a vector, matrix, array or structure type.
/// If each element is the same type and value, then a Splat would be a more efficient constant
/// implementation. Use CreateComposite() to create the appropriate type.
-class Composite : public utils::Castable<Composite, Value> {
+class Composite : public Castable<Composite, Value> {
public:
/// Constructor
/// @param t the compsite type
/// @param els the composite elements
/// @param all_0 true if all elements are 0
/// @param any_0 true if any element is 0
- Composite(const type::Type* t, utils::VectorRef<const Value*> els, bool all_0, bool any_0);
+ Composite(const type::Type* t, VectorRef<const Value*> els, bool all_0, bool any_0);
~Composite() override;
/// @copydoc Value::Type()
@@ -66,7 +66,7 @@
/// The composite type
type::Type const* const type;
/// The composite elements
- const utils::Vector<const Value*, 4> elements;
+ const Vector<const Value*, 4> elements;
/// True if all elements are zero
const bool all_zero;
/// True if any element is zero
@@ -80,9 +80,9 @@
private:
size_t CalcHash() {
- auto h = utils::Hash(type, all_zero, any_zero);
+ auto h = tint::Hash(type, all_zero, any_zero);
for (auto* el : elements) {
- h = utils::HashCombine(h, el->Hash());
+ h = HashCombine(h, el->Hash());
}
return h;
}
diff --git a/src/tint/lang/core/constant/composite_test.cc b/src/tint/lang/core/constant/composite_test.cc
index 120872d..81ddf51 100644
--- a/src/tint/lang/core/constant/composite_test.cc
+++ b/src/tint/lang/core/constant/composite_test.cc
@@ -31,9 +31,9 @@
auto* fNeg0 = constants.Get(-0_f);
auto* fPos1 = constants.Get(1_f);
- auto* compositeAll = constants.Composite(vec3f, utils::Vector{fPos0, fPos0});
- auto* compositeAny = constants.Composite(vec3f, utils::Vector{fNeg0, fPos1, fPos0});
- auto* compositeNone = constants.Composite(vec3f, utils::Vector{fNeg0, fNeg0});
+ auto* compositeAll = constants.Composite(vec3f, Vector{fPos0, fPos0});
+ auto* compositeAny = constants.Composite(vec3f, Vector{fNeg0, fPos1, fPos0});
+ auto* compositeNone = constants.Composite(vec3f, Vector{fNeg0, fNeg0});
EXPECT_TRUE(compositeAll->AllZero());
EXPECT_FALSE(compositeAny->AllZero());
@@ -47,9 +47,9 @@
auto* fNeg0 = constants.Get(-0_f);
auto* fPos1 = constants.Get(1_f);
- auto* compositeAll = constants.Composite(vec3f, utils::Vector{fPos0, fPos0});
- auto* compositeAny = constants.Composite(vec3f, utils::Vector{fNeg0, fPos1, fPos0});
- auto* compositeNone = constants.Composite(vec3f, utils::Vector{fNeg0, fNeg0});
+ auto* compositeAll = constants.Composite(vec3f, Vector{fPos0, fPos0});
+ auto* compositeAny = constants.Composite(vec3f, Vector{fNeg0, fPos1, fPos0});
+ auto* compositeNone = constants.Composite(vec3f, Vector{fNeg0, fNeg0});
EXPECT_TRUE(compositeAll->AnyZero());
EXPECT_TRUE(compositeAny->AnyZero());
@@ -62,7 +62,7 @@
auto* fPos0 = constants.Get(0_f);
auto* fPos1 = constants.Get(1_f);
- auto* composite = constants.Composite(vec3f, utils::Vector{fPos1, fPos0});
+ auto* composite = constants.Composite(vec3f, Vector{fPos1, fPos0});
ASSERT_NE(composite->Index(0), nullptr);
ASSERT_NE(composite->Index(1), nullptr);
@@ -80,7 +80,7 @@
auto* fPos0 = constants.Get(0_f);
auto* fPos1 = constants.Get(1_f);
- auto* composite = constants.Composite(vec3f, utils::Vector{fPos1, fPos0});
+ auto* composite = constants.Composite(vec3f, Vector{fPos1, fPos0});
constant::Manager mgr;
constant::CloneContext ctx{type::CloneContext{{nullptr}, {nullptr, &mgr.types}}, mgr};
diff --git a/src/tint/lang/core/constant/manager.cc b/src/tint/lang/core/constant/manager.cc
index 4681f79..c39d418 100644
--- a/src/tint/lang/core/constant/manager.cc
+++ b/src/tint/lang/core/constant/manager.cc
@@ -38,7 +38,7 @@
Manager::~Manager() = default;
const constant::Value* Manager::Composite(const type::Type* type,
- utils::VectorRef<const constant::Value*> elements) {
+ VectorRef<const constant::Value*> elements) {
if (elements.IsEmpty()) {
return nullptr;
}
diff --git a/src/tint/lang/core/constant/manager.h b/src/tint/lang/core/constant/manager.h
index 1694bd3..708d266 100644
--- a/src/tint/lang/core/constant/manager.h
+++ b/src/tint/lang/core/constant/manager.h
@@ -36,7 +36,7 @@
class Manager final {
public:
/// Iterator is the type returned by begin() and end()
- using TypeIterator = utils::BlockAllocator<Value>::ConstIterator;
+ using TypeIterator = BlockAllocator<Value>::ConstIterator;
/// Constructor
Manager();
@@ -90,7 +90,7 @@
/// @param elements the composite elements
/// @returns the value pointer
const constant::Value* Composite(const type::Type* type,
- utils::VectorRef<const constant::Value*> elements);
+ VectorRef<const constant::Value*> elements);
/// Constructs a splat constant.
/// @param type the splat type
@@ -131,7 +131,7 @@
type::Manager types;
private:
- /// A specialization of utils::Hasher for constant::Value
+ /// A specialization of Hasher for constant::Value
struct Hasher {
/// @param value the value to hash
/// @returns a hash of the value
@@ -149,7 +149,7 @@
};
/// Unique types owned by the manager
- utils::UniqueAllocator<Value, Hasher, Equal> values_;
+ UniqueAllocator<Value, Hasher, Equal> values_;
};
} // namespace tint::constant
diff --git a/src/tint/lang/core/constant/node.h b/src/tint/lang/core/constant/node.h
index feb9334..d456227 100644
--- a/src/tint/lang/core/constant/node.h
+++ b/src/tint/lang/core/constant/node.h
@@ -20,7 +20,7 @@
namespace tint::constant {
/// Node is the base class for all constant nodes
-class Node : public utils::Castable<Node> {
+class Node : public Castable<Node> {
public:
/// Constructor
Node();
diff --git a/src/tint/lang/core/constant/scalar.h b/src/tint/lang/core/constant/scalar.h
index 4d69bfc..59ca5d0 100644
--- a/src/tint/lang/core/constant/scalar.h
+++ b/src/tint/lang/core/constant/scalar.h
@@ -26,14 +26,14 @@
/// ScalarBase is the base class of all Scalar<T> specializations.
/// Used for querying whether a value is a scalar type.
-class ScalarBase : public utils::Castable<ScalarBase, Value> {
+class ScalarBase : public Castable<ScalarBase, Value> {
public:
~ScalarBase() override;
};
/// Scalar holds a single scalar or abstract-numeric value.
template <typename T>
-class Scalar : public utils::Castable<Scalar<T>, ScalarBase> {
+class Scalar : public Castable<Scalar<T>, ScalarBase> {
public:
static_assert(!std::is_same_v<UnwrapNumber<T>, T> || std::is_same_v<T, bool>,
"T must be a Number or bool");
@@ -64,7 +64,7 @@
bool AnyZero() const override { return IsPositiveZero(); }
/// @copydoc Value::Hash()
- size_t Hash() const override { return utils::Hash(type, ValueOf()); }
+ size_t Hash() const override { return tint::Hash(type, ValueOf()); }
/// Clones the constant into the provided context
/// @param ctx the clone context
diff --git a/src/tint/lang/core/constant/splat.h b/src/tint/lang/core/constant/splat.h
index 9333d90..50b0316 100644
--- a/src/tint/lang/core/constant/splat.h
+++ b/src/tint/lang/core/constant/splat.h
@@ -26,7 +26,7 @@
///
/// Splat is used for zero-initializers, 'splat' initializers, or initializers where each element is
/// identical. Splat may be of a vector, matrix, array or structure type.
-class Splat : public utils::Castable<Splat, Value> {
+class Splat : public Castable<Splat, Value> {
public:
/// Constructor
/// @param t the splat type
@@ -52,7 +52,7 @@
bool AnyZero() const override { return el->AnyZero(); }
/// @returns the hash for the splat
- size_t Hash() const override { return utils::Hash(type, el->Hash(), count); }
+ size_t Hash() const override { return tint::Hash(type, el->Hash(), count); }
/// Clones the constant into the provided context
/// @param ctx the clone context
diff --git a/src/tint/lang/core/constant/value.h b/src/tint/lang/core/constant/value.h
index fa1056c..e8d87c9 100644
--- a/src/tint/lang/core/constant/value.h
+++ b/src/tint/lang/core/constant/value.h
@@ -26,7 +26,7 @@
namespace tint::constant {
/// Value is the interface to a compile-time evaluated expression value.
-class Value : public utils::Castable<Value, Node> {
+class Value : public Castable<Value, Node> {
public:
/// Constructor
Value();
diff --git a/src/tint/lang/core/constant/value_test.cc b/src/tint/lang/core/constant/value_test.cc
index 2da646e..8868685 100644
--- a/src/tint/lang/core/constant/value_test.cc
+++ b/src/tint/lang/core/constant/value_test.cc
@@ -53,9 +53,9 @@
auto* vec3f = create<type::Vector>(create<type::F32>(), 3u);
auto* vec3f_1_1_2 = constants.Composite(
- vec3f, utils::Vector{constants.Get(1_f), constants.Get(1_f), constants.Get(2_f)});
+ vec3f, Vector{constants.Get(1_f), constants.Get(1_f), constants.Get(2_f)});
auto* vec3f_1_2_1 = constants.Composite(
- vec3f, utils::Vector{constants.Get(1_f), constants.Get(2_f), constants.Get(1_f)});
+ vec3f, Vector{constants.Get(1_f), constants.Get(2_f), constants.Get(1_f)});
EXPECT_TRUE(vec3f_1_1_2->Equal(vec3f_1_1_2));
EXPECT_FALSE(vec3f_1_2_1->Equal(vec3f_1_1_2));
@@ -67,7 +67,7 @@
auto* vec3f_1_1_1 = constants.Splat(vec3f, constants.Get(1_f), 3);
auto* vec3f_1_2_1 = constants.Composite(
- vec3f, utils::Vector{constants.Get(1_f), constants.Get(2_f), constants.Get(1_f)});
+ vec3f, Vector{constants.Get(1_f), constants.Get(2_f), constants.Get(1_f)});
EXPECT_TRUE(vec3f_1_1_1->Equal(vec3f_1_1_1));
EXPECT_FALSE(vec3f_1_2_1->Equal(vec3f_1_1_1));
diff --git a/src/tint/lang/core/ir/access.cc b/src/tint/lang/core/ir/access.cc
index ce894c8..9d73b98 100644
--- a/src/tint/lang/core/ir/access.cc
+++ b/src/tint/lang/core/ir/access.cc
@@ -23,7 +23,7 @@
namespace tint::ir {
//! @cond Doxygen_Suppress
-Access::Access(InstructionResult* result, Value* object, utils::VectorRef<Value*> indices) {
+Access::Access(InstructionResult* result, Value* object, VectorRef<Value*> indices) {
AddOperand(Access::kObjectOperandOffset, object);
AddOperands(Access::kIndicesOperandOffset, std::move(indices));
AddResult(result);
diff --git a/src/tint/lang/core/ir/access.h b/src/tint/lang/core/ir/access.h
index c00210d..e8bf796 100644
--- a/src/tint/lang/core/ir/access.h
+++ b/src/tint/lang/core/ir/access.h
@@ -21,7 +21,7 @@
namespace tint::ir {
/// An access instruction in the IR.
-class Access : public utils::Castable<Access, OperandInstruction<3, 1>> {
+class Access : public Castable<Access, OperandInstruction<3, 1>> {
public:
/// The offset in Operands() for the object being accessed
static constexpr size_t kObjectOperandOffset = 0;
@@ -33,7 +33,7 @@
/// @param result the result value
/// @param object the accessor object
/// @param indices the indices to access
- Access(InstructionResult* result, Value* object, utils::VectorRef<Value*> indices);
+ Access(InstructionResult* result, Value* object, VectorRef<Value*> indices);
~Access() override;
/// @returns the object used for the access
@@ -44,7 +44,7 @@
void AddIndex(Value* idx) { AddOperand(operands_.Length(), idx); }
/// @returns the accessor indices
- utils::Slice<Value*> Indices() { return operands_.Slice().Offset(kIndicesOperandOffset); }
+ tint::Slice<Value*> Indices() { return operands_.Slice().Offset(kIndicesOperandOffset); }
/// @returns the friendly name for the instruction
std::string_view FriendlyName() override { return "access"; }
diff --git a/src/tint/lang/core/ir/binary.h b/src/tint/lang/core/ir/binary.h
index 8d469bb..5ee8389 100644
--- a/src/tint/lang/core/ir/binary.h
+++ b/src/tint/lang/core/ir/binary.h
@@ -21,7 +21,7 @@
namespace tint::ir {
/// A binary instruction in the IR.
-class Binary : public utils::Castable<Binary, OperandInstruction<2, 1>> {
+class Binary : public Castable<Binary, OperandInstruction<2, 1>> {
public:
/// The offset in Operands() for the LHS
static constexpr size_t kLhsOperandOffset = 0;
diff --git a/src/tint/lang/core/ir/bitcast.h b/src/tint/lang/core/ir/bitcast.h
index 347e1fa..4f49742 100644
--- a/src/tint/lang/core/ir/bitcast.h
+++ b/src/tint/lang/core/ir/bitcast.h
@@ -21,7 +21,7 @@
namespace tint::ir {
/// A bitcast instruction in the IR.
-class Bitcast : public utils::Castable<Bitcast, Call> {
+class Bitcast : public Castable<Bitcast, Call> {
public:
/// The offset in Operands() for the value
static constexpr size_t kValueOperandOffset = 0;
diff --git a/src/tint/lang/core/ir/block.h b/src/tint/lang/core/ir/block.h
index ff70820..315582c 100644
--- a/src/tint/lang/core/ir/block.h
+++ b/src/tint/lang/core/ir/block.h
@@ -30,7 +30,7 @@
/// A block of statements. The instructions in the block are a linear list of instructions to
/// execute. The block will terminate with a Terminator instruction at the end.
-class Block : public utils::Castable<Block> {
+class Block : public Castable<Block> {
public:
/// Constructor
Block();
diff --git a/src/tint/lang/core/ir/block_param.h b/src/tint/lang/core/ir/block_param.h
index 9483f13..e694540 100644
--- a/src/tint/lang/core/ir/block_param.h
+++ b/src/tint/lang/core/ir/block_param.h
@@ -21,7 +21,7 @@
namespace tint::ir {
/// An instruction in the IR.
-class BlockParam : public utils::Castable<BlockParam, Value> {
+class BlockParam : public Castable<BlockParam, Value> {
public:
/// Constructor
/// @param type the type of the var
diff --git a/src/tint/lang/core/ir/break_if.cc b/src/tint/lang/core/ir/break_if.cc
index 7061396c..15cd0f2 100644
--- a/src/tint/lang/core/ir/break_if.cc
+++ b/src/tint/lang/core/ir/break_if.cc
@@ -24,7 +24,7 @@
namespace tint::ir {
-BreakIf::BreakIf(Value* condition, ir::Loop* loop, utils::VectorRef<Value*> args) : loop_(loop) {
+BreakIf::BreakIf(Value* condition, ir::Loop* loop, VectorRef<Value*> args) : loop_(loop) {
TINT_ASSERT(IR, loop_);
AddOperand(BreakIf::kConditionOperandOffset, condition);
diff --git a/src/tint/lang/core/ir/break_if.h b/src/tint/lang/core/ir/break_if.h
index 791c328..b1de2ca 100644
--- a/src/tint/lang/core/ir/break_if.h
+++ b/src/tint/lang/core/ir/break_if.h
@@ -27,7 +27,7 @@
namespace tint::ir {
/// A break-if iteration instruction.
-class BreakIf : public utils::Castable<BreakIf, Terminator> {
+class BreakIf : public Castable<BreakIf, Terminator> {
public:
/// The offset in Operands() for the condition
static constexpr size_t kConditionOperandOffset = 0;
@@ -39,11 +39,11 @@
/// @param condition the break condition
/// @param loop the loop containing the break-if
/// @param args the MultiInBlock arguments
- BreakIf(Value* condition, ir::Loop* loop, utils::VectorRef<Value*> args = utils::Empty);
+ BreakIf(Value* condition, ir::Loop* loop, VectorRef<Value*> args = tint::Empty);
~BreakIf() override;
/// @returns the MultiInBlock arguments
- utils::Slice<Value* const> Args() override {
+ tint::Slice<Value* const> Args() override {
return operands_.Slice().Offset(kArgsOperandOffset);
}
diff --git a/src/tint/lang/core/ir/builder.cc b/src/tint/lang/core/ir/builder.cc
index 27fda7e..060a732 100644
--- a/src/tint/lang/core/ir/builder.cc
+++ b/src/tint/lang/core/ir/builder.cc
@@ -58,7 +58,7 @@
return Append(ir.instructions.Create<ir::Loop>(Block(), MultiInBlock(), MultiInBlock()));
}
-Block* Builder::Case(ir::Switch* s, utils::VectorRef<Switch::CaseSelector> selectors) {
+Block* Builder::Case(ir::Switch* s, VectorRef<Switch::CaseSelector> selectors) {
auto* block = Block();
s->Cases().Push(Switch::Case{std::move(selectors), block});
block->SetParent(s);
@@ -66,7 +66,7 @@
}
Block* Builder::Case(ir::Switch* s, std::initializer_list<Switch::CaseSelector> selectors) {
- return Case(s, utils::Vector<Switch::CaseSelector, 4>(selectors));
+ return Case(s, Vector<Switch::CaseSelector, 4>(selectors));
}
ir::Discard* Builder::Discard() {
diff --git a/src/tint/lang/core/ir/builder.h b/src/tint/lang/core/ir/builder.h
index 787097f..8f5bfd6 100644
--- a/src/tint/lang/core/ir/builder.h
+++ b/src/tint/lang/core/ir/builder.h
@@ -89,17 +89,17 @@
"Consider hoisting Builder call arguments to separate statements.");
}
- /// A helper used to enable overloads if the first type in `TYPES` is a utils::Vector or
- /// utils::VectorRef.
+ /// A helper used to enable overloads if the first type in `TYPES` is a Vector or
+ /// VectorRef.
template <typename... TYPES>
- using EnableIfVectorLike = utils::traits::EnableIf<
- utils::IsVectorLike<utils::traits::Decay<utils::traits::NthTypeOf<0, TYPES..., void>>>>;
+ using EnableIfVectorLike = tint::traits::EnableIf<
+ tint::IsVectorLike<tint::traits::Decay<tint::traits::NthTypeOf<0, TYPES..., void>>>>;
- /// A helper used to disable overloads if the first type in `TYPES` is a utils::Vector or
- /// utils::VectorRef.
+ /// A helper used to disable overloads if the first type in `TYPES` is a Vector or
+ /// VectorRef.
template <typename... TYPES>
- using DisableIfVectorLike = utils::traits::EnableIf<
- !utils::IsVectorLike<utils::traits::Decay<utils::traits::NthTypeOf<0, TYPES..., void>>>>;
+ using DisableIfVectorLike = tint::traits::EnableIf<
+ !tint::IsVectorLike<tint::traits::Decay<tint::traits::NthTypeOf<0, TYPES..., void>>>>;
/// If set, any created instruction will be auto-appended to the block.
ir::Block* current_block_ = nullptr;
@@ -200,7 +200,7 @@
/// @param s the switch to create the case into
/// @param selectors the case selectors for the case statement
/// @returns the start block for the case instruction
- ir::Block* Case(ir::Switch* s, utils::VectorRef<Switch::CaseSelector> selectors);
+ ir::Block* Case(ir::Switch* s, VectorRef<Switch::CaseSelector> selectors);
/// Creates a case for the switch @p s with the given selectors
/// @param s the switch to create the case into
@@ -277,25 +277,25 @@
/// Pass-through overload for Values() with vector-like argument
/// @param vec the vector of ir::Value*
/// @return @p vec
- template <typename VEC, typename = EnableIfVectorLike<utils::traits::Decay<VEC>>>
+ template <typename VEC, typename = EnableIfVectorLike<tint::traits::Decay<VEC>>>
auto Values(VEC&& vec) {
return std::forward<VEC>(vec);
}
- /// Overload for Values() with utils::Empty argument
- /// @return utils::Empty
- utils::EmptyType Values(utils::EmptyType) { return utils::Empty; }
+ /// Overload for Values() with tint::Empty argument
+ /// @return tint::Empty
+ tint::EmptyType Values(tint::EmptyType) { return tint::Empty; }
/// Overload for Values() with no arguments
- /// @return utils::Empty
- utils::EmptyType Values() { return utils::Empty; }
+ /// @return tint::Empty
+ tint::EmptyType Values() { return tint::Empty; }
/// @param args the arguments to pass to Value()
/// @returns a vector of ir::Value* built from transforming the arguments with Value()
template <typename... ARGS, typename = DisableIfVectorLike<ARGS...>>
auto Values(ARGS&&... args) {
CheckForNonDeterministicEvaluation<ARGS...>();
- return utils::Vector{Value(std::forward<ARGS>(args))...};
+ return Vector{Value(std::forward<ARGS>(args))...};
}
/// Creates an op for `lhs kind rhs`
@@ -805,7 +805,7 @@
/// @param indices the swizzle indices
/// @returns the instruction
template <typename OBJ>
- ir::Swizzle* Swizzle(const type::Type* type, OBJ&& object, utils::VectorRef<uint32_t> indices) {
+ ir::Swizzle* Swizzle(const type::Type* type, OBJ&& object, VectorRef<uint32_t> indices) {
auto* obj_val = Value(std::forward<OBJ>(object));
return Append(ir.instructions.Create<ir::Swizzle>(InstructionResult(type), obj_val,
std::move(indices)));
@@ -822,7 +822,7 @@
std::initializer_list<uint32_t> indices) {
auto* obj_val = Value(std::forward<OBJ>(object));
return Append(ir.instructions.Create<ir::Swizzle>(InstructionResult(type), obj_val,
- utils::Vector<uint32_t, 4>(indices)));
+ Vector<uint32_t, 4>(indices)));
}
/// Creates a terminate invocation instruction
diff --git a/src/tint/lang/core/ir/builtin_call.cc b/src/tint/lang/core/ir/builtin_call.cc
index d3b19f7..d754f5a 100644
--- a/src/tint/lang/core/ir/builtin_call.cc
+++ b/src/tint/lang/core/ir/builtin_call.cc
@@ -22,7 +22,7 @@
namespace tint::ir {
-BuiltinCall::BuiltinCall(InstructionResult* result, utils::VectorRef<Value*> arguments) {
+BuiltinCall::BuiltinCall(InstructionResult* result, VectorRef<Value*> arguments) {
AddOperands(BuiltinCall::kArgsOperandOffset, std::move(arguments));
AddResult(result);
}
diff --git a/src/tint/lang/core/ir/builtin_call.h b/src/tint/lang/core/ir/builtin_call.h
index d29a8ce..1cf0f8e 100644
--- a/src/tint/lang/core/ir/builtin_call.h
+++ b/src/tint/lang/core/ir/builtin_call.h
@@ -21,7 +21,7 @@
namespace tint::ir {
/// A builtin call instruction in the IR.
-class BuiltinCall : public utils::Castable<BuiltinCall, Call> {
+class BuiltinCall : public Castable<BuiltinCall, Call> {
public:
/// The base offset in Operands() for the args
static constexpr size_t kArgsOperandOffset = 0;
@@ -29,7 +29,7 @@
/// Constructor
/// @param result the result value
/// @param args the conversion arguments
- explicit BuiltinCall(InstructionResult* result, utils::VectorRef<Value*> args = utils::Empty);
+ explicit BuiltinCall(InstructionResult* result, VectorRef<Value*> args = tint::Empty);
~BuiltinCall() override;
};
diff --git a/src/tint/lang/core/ir/call.h b/src/tint/lang/core/ir/call.h
index 72f650a..3069c85 100644
--- a/src/tint/lang/core/ir/call.h
+++ b/src/tint/lang/core/ir/call.h
@@ -21,12 +21,12 @@
namespace tint::ir {
/// A Call instruction in the IR.
-class Call : public utils::Castable<Call, OperandInstruction<4, 1>> {
+class Call : public Castable<Call, OperandInstruction<4, 1>> {
public:
~Call() override;
/// @returns the call arguments
- virtual utils::Slice<Value*> Args() { return operands_.Slice(); }
+ virtual tint::Slice<Value*> Args() { return operands_.Slice(); }
/// Append a new argument to the argument list for this call instruction.
/// @param arg the argument value to append
diff --git a/src/tint/lang/core/ir/constant.h b/src/tint/lang/core/ir/constant.h
index c358013..82a4a27 100644
--- a/src/tint/lang/core/ir/constant.h
+++ b/src/tint/lang/core/ir/constant.h
@@ -21,7 +21,7 @@
namespace tint::ir {
/// Constant in the IR.
-class Constant : public utils::Castable<Constant, Value> {
+class Constant : public Castable<Constant, Value> {
public:
/// Constructor
/// @param val the value stored in the constant
diff --git a/src/tint/lang/core/ir/constant_test.cc b/src/tint/lang/core/ir/constant_test.cc
index df59cc0..14407a0 100644
--- a/src/tint/lang/core/ir/constant_test.cc
+++ b/src/tint/lang/core/ir/constant_test.cc
@@ -25,7 +25,7 @@
using IR_ConstantTest = IRTestHelper;
TEST_F(IR_ConstantTest, f32) {
- utils::StringStream str;
+ StringStream str;
auto* c = b.Constant(1.2_f);
EXPECT_EQ(1.2_f, c->Value()->As<constant::Scalar<f32>>()->ValueAs<f32>());
@@ -38,7 +38,7 @@
}
TEST_F(IR_ConstantTest, f16) {
- utils::StringStream str;
+ StringStream str;
auto* c = b.Constant(1.1_h);
EXPECT_EQ(1.1_h, c->Value()->As<constant::Scalar<f16>>()->ValueAs<f16>());
@@ -51,7 +51,7 @@
}
TEST_F(IR_ConstantTest, i32) {
- utils::StringStream str;
+ StringStream str;
auto* c = b.Constant(1_i);
EXPECT_EQ(1_i, c->Value()->As<constant::Scalar<i32>>()->ValueAs<i32>());
@@ -64,7 +64,7 @@
}
TEST_F(IR_ConstantTest, u32) {
- utils::StringStream str;
+ StringStream str;
auto* c = b.Constant(2_u);
EXPECT_EQ(2_u, c->Value()->As<constant::Scalar<u32>>()->ValueAs<u32>());
@@ -78,14 +78,14 @@
TEST_F(IR_ConstantTest, bool) {
{
- utils::StringStream str;
+ StringStream str;
auto* c = b.Constant(false);
EXPECT_FALSE(c->Value()->As<constant::Scalar<bool>>()->ValueAs<bool>());
}
{
- utils::StringStream str;
+ StringStream str;
auto c = b.Constant(true);
EXPECT_TRUE(c->Value()->As<constant::Scalar<bool>>()->ValueAs<bool>());
diff --git a/src/tint/lang/core/ir/construct.cc b/src/tint/lang/core/ir/construct.cc
index 990b625..8912359 100644
--- a/src/tint/lang/core/ir/construct.cc
+++ b/src/tint/lang/core/ir/construct.cc
@@ -22,7 +22,7 @@
namespace tint::ir {
-Construct::Construct(InstructionResult* result, utils::VectorRef<Value*> arguments) {
+Construct::Construct(InstructionResult* result, VectorRef<Value*> arguments) {
AddOperands(Construct::kArgsOperandOffset, std::move(arguments));
AddResult(result);
}
diff --git a/src/tint/lang/core/ir/construct.h b/src/tint/lang/core/ir/construct.h
index d125826..ce7268f 100644
--- a/src/tint/lang/core/ir/construct.h
+++ b/src/tint/lang/core/ir/construct.h
@@ -21,7 +21,7 @@
namespace tint::ir {
/// A constructor instruction in the IR.
-class Construct : public utils::Castable<Construct, Call> {
+class Construct : public Castable<Construct, Call> {
public:
/// The base offset in Operands() for the args
static constexpr size_t kArgsOperandOffset = 0;
@@ -29,7 +29,7 @@
/// Constructor
/// @param result the result value
/// @param args the constructor arguments
- explicit Construct(InstructionResult* result, utils::VectorRef<Value*> args = utils::Empty);
+ explicit Construct(InstructionResult* result, VectorRef<Value*> args = tint::Empty);
~Construct() override;
/// @returns the friendly name for the instruction
diff --git a/src/tint/lang/core/ir/continue.cc b/src/tint/lang/core/ir/continue.cc
index 06b3517..ce2c9d0 100644
--- a/src/tint/lang/core/ir/continue.cc
+++ b/src/tint/lang/core/ir/continue.cc
@@ -24,7 +24,7 @@
namespace tint::ir {
-Continue::Continue(ir::Loop* loop, utils::VectorRef<Value*> args) : loop_(loop) {
+Continue::Continue(ir::Loop* loop, VectorRef<Value*> args) : loop_(loop) {
TINT_ASSERT(IR, loop_);
AddOperands(Continue::kArgsOperandOffset, std::move(args));
diff --git a/src/tint/lang/core/ir/continue.h b/src/tint/lang/core/ir/continue.h
index 12e067b..fe7a466 100644
--- a/src/tint/lang/core/ir/continue.h
+++ b/src/tint/lang/core/ir/continue.h
@@ -26,7 +26,7 @@
namespace tint::ir {
/// A continue instruction.
-class Continue : public utils::Castable<Continue, Terminator> {
+class Continue : public Castable<Continue, Terminator> {
public:
/// The base offset in Operands() for the args
static constexpr size_t kArgsOperandOffset = 0;
@@ -34,7 +34,7 @@
/// Constructor
/// @param loop the loop owning the continue block
/// @param args the arguments for the MultiInBlock
- explicit Continue(ir::Loop* loop, utils::VectorRef<Value*> args = utils::Empty);
+ explicit Continue(ir::Loop* loop, VectorRef<Value*> args = tint::Empty);
~Continue() override;
/// @returns the loop owning the continue block
diff --git a/src/tint/lang/core/ir/control_instruction.h b/src/tint/lang/core/ir/control_instruction.h
index 143704f..6f989c4 100644
--- a/src/tint/lang/core/ir/control_instruction.h
+++ b/src/tint/lang/core/ir/control_instruction.h
@@ -29,7 +29,7 @@
/// Base class of instructions that perform control flow to two or more blocks, owned by the
/// ControlInstruction.
-class ControlInstruction : public utils::Castable<ControlInstruction, OperandInstruction<1, 1>> {
+class ControlInstruction : public Castable<ControlInstruction, OperandInstruction<1, 1>> {
public:
/// Constructor
ControlInstruction();
@@ -43,7 +43,7 @@
/// Sets the results of the control instruction
/// @param values the new result values
- void SetResults(utils::VectorRef<InstructionResult*> values) {
+ void SetResults(VectorRef<InstructionResult*> values) {
for (auto* value : results_) {
if (value) {
value->SetSource(nullptr);
@@ -60,14 +60,14 @@
/// Sets the results of the control instruction
/// @param values the new result values
template <typename... ARGS,
- typename = std::enable_if_t<!utils::IsVectorLike<
- utils::traits::Decay<utils::traits::NthTypeOf<0, ARGS..., void>>>>>
+ typename = std::enable_if_t<!tint::IsVectorLike<
+ tint::traits::Decay<tint::traits::NthTypeOf<0, ARGS..., void>>>>>
void SetResults(ARGS&&... values) {
- SetResults(utils::Vector{std::forward<ARGS>(values)...});
+ SetResults(Vector{std::forward<ARGS>(values)...});
}
/// @return All the exits for the flow control instruction
- const utils::Hashset<Exit*, 2>& Exits() const { return exits_; }
+ const Hashset<Exit*, 2>& Exits() const { return exits_; }
/// Adds the exit to the flow control instruction
/// @param exit the exit instruction
@@ -79,7 +79,7 @@
protected:
/// The flow control exits
- utils::Hashset<Exit*, 2> exits_;
+ Hashset<Exit*, 2> exits_;
};
} // namespace tint::ir
diff --git a/src/tint/lang/core/ir/convert.h b/src/tint/lang/core/ir/convert.h
index ccd5eab..aaf5849 100644
--- a/src/tint/lang/core/ir/convert.h
+++ b/src/tint/lang/core/ir/convert.h
@@ -22,7 +22,7 @@
namespace tint::ir {
/// A value conversion instruction in the IR.
-class Convert : public utils::Castable<Convert, Call> {
+class Convert : public Castable<Convert, Call> {
public:
/// The offset in Operands() for the value
static constexpr size_t kValueOperandOffset = 0;
diff --git a/src/tint/lang/core/ir/core_builtin_call.cc b/src/tint/lang/core/ir/core_builtin_call.cc
index 94f26bb..a75c5bc 100644
--- a/src/tint/lang/core/ir/core_builtin_call.cc
+++ b/src/tint/lang/core/ir/core_builtin_call.cc
@@ -24,7 +24,7 @@
CoreBuiltinCall::CoreBuiltinCall(InstructionResult* result,
builtin::Function func,
- utils::VectorRef<Value*> arguments)
+ VectorRef<Value*> arguments)
: Base(result, arguments), func_(func) {
TINT_ASSERT(IR, func != builtin::Function::kNone);
TINT_ASSERT(IR, func != builtin::Function::kTintMaterialize);
diff --git a/src/tint/lang/core/ir/core_builtin_call.h b/src/tint/lang/core/ir/core_builtin_call.h
index aab5ffe..bdaf991 100644
--- a/src/tint/lang/core/ir/core_builtin_call.h
+++ b/src/tint/lang/core/ir/core_builtin_call.h
@@ -22,7 +22,7 @@
namespace tint::ir {
/// A core builtin call instruction in the IR.
-class CoreBuiltinCall : public utils::Castable<CoreBuiltinCall, BuiltinCall> {
+class CoreBuiltinCall : public Castable<CoreBuiltinCall, BuiltinCall> {
public:
/// Constructor
/// @param result the result value
@@ -30,7 +30,7 @@
/// @param args the conversion arguments
CoreBuiltinCall(InstructionResult* result,
builtin::Function func,
- utils::VectorRef<Value*> args = utils::Empty);
+ VectorRef<Value*> args = tint::Empty);
~CoreBuiltinCall() override;
/// @returns the builtin function
diff --git a/src/tint/lang/core/ir/disassembler.cc b/src/tint/lang/core/ir/disassembler.cc
index c3670ea..2c06f15 100644
--- a/src/tint/lang/core/ir/disassembler.cc
+++ b/src/tint/lang/core/ir/disassembler.cc
@@ -75,7 +75,7 @@
Disassembler::~Disassembler() = default;
-utils::StringStream& Disassembler::Indent() {
+StringStream& Disassembler::Indent() {
for (uint32_t i = 0; i < indent_size_; i++) {
out_ << " ";
}
@@ -309,7 +309,7 @@
out_ << " -> %b" << IdOf(func->Block()) << " {";
{ // Add a comment if the function IDs or parameter IDs doesn't match their name
- utils::Vector<std::string, 4> names;
+ Vector<std::string, 4> names;
if (auto name = mod_.NameOf(func); name.IsValid()) {
if (name.NameView() != fn_id) {
names.Push("%" + std::string(fn_id) + ": '" + name.Name() + "'");
@@ -324,7 +324,7 @@
}
}
if (!names.IsEmpty()) {
- out_ << " # " << utils::Join(names, ", ");
+ out_ << " # " << tint::Join(names, ", ");
}
}
@@ -427,7 +427,7 @@
if (!inst->Alive()) {
SourceMarker sm(this);
- out_ << "<destroyed " << inst->TypeInfo().name << " " << utils::ToString(inst) << ">";
+ out_ << "<destroyed " << inst->TypeInfo().name << " " << tint::ToString(inst) << ">";
sm.Store(inst);
return;
}
@@ -472,7 +472,7 @@
[&](IntrinsicCall* i) {
EmitValueWithType(i);
out_ << " = ";
- EmitInstructionName(utils::ToString(i->Kind()), i);
+ EmitInstructionName(tint::ToString(i->Kind()), i);
out_ << " ";
EmitOperandList(i);
},
@@ -567,7 +567,7 @@
[&](Default) { out_ << "Unknown instruction: " << inst->TypeInfo().name; });
{ // Add a comment if the result IDs don't match their names
- utils::Vector<std::string, 4> names;
+ Vector<std::string, 4> names;
for (auto* result : inst->Results()) {
if (result) {
if (auto name = mod_.NameOf(result); name.IsValid()) {
@@ -579,7 +579,7 @@
}
}
if (!names.IsEmpty()) {
- out_ << " # " << utils::Join(names, ", ");
+ out_ << " # " << tint::Join(names, ", ");
}
}
}
@@ -652,7 +652,7 @@
}
void Disassembler::EmitLoop(Loop* l) {
- utils::Vector<std::string, 3> parts;
+ Vector<std::string, 3> parts;
if (!l->Initializer()->IsEmpty()) {
parts.Push("i: %b" + std::to_string(IdOf(l->Initializer())));
}
@@ -674,7 +674,7 @@
}
out_ << " = ";
}
- out_ << "loop [" << utils::Join(parts, ", ") << "]";
+ out_ << "loop [" << tint::Join(parts, ", ") << "]";
sm.Store(l);
out_ << " { # " << NameOf(l);
@@ -803,7 +803,7 @@
);
}
-void Disassembler::EmitValueList(utils::Slice<Value* const> values) {
+void Disassembler::EmitValueList(tint::Slice<Value* const> values) {
for (size_t i = 0, n = values.Length(); i < n; i++) {
if (i > 0) {
out_ << ", ";
diff --git a/src/tint/lang/core/ir/disassembler.h b/src/tint/lang/core/ir/disassembler.h
index 9b26d02..27c8518 100644
--- a/src/tint/lang/core/ir/disassembler.h
+++ b/src/tint/lang/core/ir/disassembler.h
@@ -115,7 +115,7 @@
Source::Location begin_;
};
- utils::StringStream& Indent();
+ StringStream& Indent();
size_t IdOf(Block* blk);
std::string IdOf(Value* node);
@@ -133,7 +133,7 @@
void EmitValueWithType(Instruction* val);
void EmitValueWithType(Value* val);
void EmitValue(Value* val);
- void EmitValueList(utils::Slice<ir::Value* const> values);
+ void EmitValueList(tint::Slice<ir::Value* const> values);
void EmitBinary(Binary* b);
void EmitUnary(Unary* b);
void EmitTerminator(Terminator* b);
@@ -147,23 +147,23 @@
void EmitInstructionName(std::string_view name, Instruction* inst);
Module& mod_;
- utils::StringStream out_;
- utils::Hashmap<Block*, size_t, 32> block_ids_;
- utils::Hashmap<Value*, std::string, 32> value_ids_;
- utils::Hashset<std::string, 32> ids_;
+ StringStream out_;
+ Hashmap<Block*, size_t, 32> block_ids_;
+ Hashmap<Value*, std::string, 32> value_ids_;
+ Hashset<std::string, 32> ids_;
uint32_t indent_size_ = 0;
bool in_function_ = false;
uint32_t current_output_line_ = 1;
uint32_t current_output_start_pos_ = 0;
- utils::Hashmap<Block*, Source, 8> block_to_src_;
- utils::Hashmap<Instruction*, Source, 8> instruction_to_src_;
- utils::Hashmap<Usage, Source, 8, Usage::Hasher> operand_to_src_;
- utils::Hashmap<Usage, Source, 8, Usage::Hasher> result_to_src_;
- utils::Hashmap<If*, std::string, 8> if_names_;
- utils::Hashmap<Loop*, std::string, 8> loop_names_;
- utils::Hashmap<Switch*, std::string, 8> switch_names_;
+ Hashmap<Block*, Source, 8> block_to_src_;
+ Hashmap<Instruction*, Source, 8> instruction_to_src_;
+ Hashmap<Usage, Source, 8, Usage::Hasher> operand_to_src_;
+ Hashmap<Usage, Source, 8, Usage::Hasher> result_to_src_;
+ Hashmap<If*, std::string, 8> if_names_;
+ Hashmap<Loop*, std::string, 8> loop_names_;
+ Hashmap<Switch*, std::string, 8> switch_names_;
};
} // namespace tint::ir
diff --git a/src/tint/lang/core/ir/discard.h b/src/tint/lang/core/ir/discard.h
index c304a82..5d9b4e8 100644
--- a/src/tint/lang/core/ir/discard.h
+++ b/src/tint/lang/core/ir/discard.h
@@ -22,7 +22,7 @@
namespace tint::ir {
/// A discard instruction in the IR.
-class Discard : public utils::Castable<Discard, Call> {
+class Discard : public Castable<Discard, Call> {
public:
/// Constructor
Discard();
diff --git a/src/tint/lang/core/ir/exit.h b/src/tint/lang/core/ir/exit.h
index 22e9e2b..5511a38 100644
--- a/src/tint/lang/core/ir/exit.h
+++ b/src/tint/lang/core/ir/exit.h
@@ -25,7 +25,7 @@
namespace tint::ir {
/// The base class for all exit terminators.
-class Exit : public utils::Castable<Exit, Terminator> {
+class Exit : public Castable<Exit, Terminator> {
public:
~Exit() override;
diff --git a/src/tint/lang/core/ir/exit_if.cc b/src/tint/lang/core/ir/exit_if.cc
index b7c46d0..a2c6415 100644
--- a/src/tint/lang/core/ir/exit_if.cc
+++ b/src/tint/lang/core/ir/exit_if.cc
@@ -23,7 +23,7 @@
namespace tint::ir {
-ExitIf::ExitIf(ir::If* i, utils::VectorRef<Value*> args) {
+ExitIf::ExitIf(ir::If* i, VectorRef<Value*> args) {
SetIf(i);
AddOperands(ExitIf::kArgsOperandOffset, std::move(args));
}
diff --git a/src/tint/lang/core/ir/exit_if.h b/src/tint/lang/core/ir/exit_if.h
index fe9127d..f1f0346 100644
--- a/src/tint/lang/core/ir/exit_if.h
+++ b/src/tint/lang/core/ir/exit_if.h
@@ -26,7 +26,7 @@
namespace tint::ir {
/// A exit if instruction.
-class ExitIf : public utils::Castable<ExitIf, Exit> {
+class ExitIf : public Castable<ExitIf, Exit> {
public:
/// The base offset in Operands() for the args
static constexpr size_t kArgsOperandOffset = 0;
@@ -34,7 +34,7 @@
/// Constructor
/// @param i the if being exited
/// @param args the target MultiInBlock arguments
- explicit ExitIf(ir::If* i, utils::VectorRef<Value*> args = utils::Empty);
+ explicit ExitIf(ir::If* i, VectorRef<Value*> args = tint::Empty);
~ExitIf() override;
/// Re-associates the exit with the given if instruction
diff --git a/src/tint/lang/core/ir/exit_loop.cc b/src/tint/lang/core/ir/exit_loop.cc
index b7b49b9..3c19c05f 100644
--- a/src/tint/lang/core/ir/exit_loop.cc
+++ b/src/tint/lang/core/ir/exit_loop.cc
@@ -24,7 +24,7 @@
namespace tint::ir {
-ExitLoop::ExitLoop(ir::Loop* loop, utils::VectorRef<Value*> args /* = utils::Empty */) {
+ExitLoop::ExitLoop(ir::Loop* loop, VectorRef<Value*> args /* = tint::Empty */) {
SetLoop(loop);
AddOperands(ExitLoop::kArgsOperandOffset, std::move(args));
}
diff --git a/src/tint/lang/core/ir/exit_loop.h b/src/tint/lang/core/ir/exit_loop.h
index 8e6f6d4..d01b8cc 100644
--- a/src/tint/lang/core/ir/exit_loop.h
+++ b/src/tint/lang/core/ir/exit_loop.h
@@ -26,7 +26,7 @@
namespace tint::ir {
/// A exit loop instruction.
-class ExitLoop : public utils::Castable<ExitLoop, Exit> {
+class ExitLoop : public Castable<ExitLoop, Exit> {
public:
/// The base offset in Operands() for the args
static constexpr size_t kArgsOperandOffset = 0;
@@ -34,7 +34,7 @@
/// Constructor
/// @param loop the loop being exited
/// @param args the target MultiInBlock arguments
- explicit ExitLoop(ir::Loop* loop, utils::VectorRef<Value*> args = utils::Empty);
+ explicit ExitLoop(ir::Loop* loop, VectorRef<Value*> args = tint::Empty);
~ExitLoop() override;
/// Re-associates the exit with the given loop instruction
diff --git a/src/tint/lang/core/ir/exit_switch.cc b/src/tint/lang/core/ir/exit_switch.cc
index 96192c5..6f7040f 100644
--- a/src/tint/lang/core/ir/exit_switch.cc
+++ b/src/tint/lang/core/ir/exit_switch.cc
@@ -23,7 +23,7 @@
namespace tint::ir {
-ExitSwitch::ExitSwitch(ir::Switch* sw, utils::VectorRef<Value*> args /* = utils::Empty */) {
+ExitSwitch::ExitSwitch(ir::Switch* sw, VectorRef<Value*> args /* = tint::Empty */) {
SetSwitch(sw);
AddOperands(ExitSwitch::kArgsOperandOffset, std::move(args));
}
diff --git a/src/tint/lang/core/ir/exit_switch.h b/src/tint/lang/core/ir/exit_switch.h
index f13d8d4..df1861b 100644
--- a/src/tint/lang/core/ir/exit_switch.h
+++ b/src/tint/lang/core/ir/exit_switch.h
@@ -26,7 +26,7 @@
namespace tint::ir {
/// A exit switch instruction.
-class ExitSwitch : public utils::Castable<ExitSwitch, Exit> {
+class ExitSwitch : public Castable<ExitSwitch, Exit> {
public:
/// The base offset in Operands() for the args
static constexpr size_t kArgsOperandOffset = 0;
@@ -34,7 +34,7 @@
/// Constructor
/// @param sw the switch being exited
/// @param args the target MultiInBlock arguments
- explicit ExitSwitch(ir::Switch* sw, utils::VectorRef<Value*> args = utils::Empty);
+ explicit ExitSwitch(ir::Switch* sw, VectorRef<Value*> args = tint::Empty);
~ExitSwitch() override;
/// Re-associates the exit with the given switch instruction
diff --git a/src/tint/lang/core/ir/function.cc b/src/tint/lang/core/ir/function.cc
index 00117cb..98754b8 100644
--- a/src/tint/lang/core/ir/function.cc
+++ b/src/tint/lang/core/ir/function.cc
@@ -31,17 +31,17 @@
Function::~Function() = default;
-void Function::SetParams(utils::VectorRef<FunctionParam*> params) {
+void Function::SetParams(VectorRef<FunctionParam*> params) {
params_ = std::move(params);
- TINT_ASSERT(IR, !params_.Any(utils::IsNull));
+ TINT_ASSERT(IR, !params_.Any(tint::IsNull));
}
void Function::SetParams(std::initializer_list<FunctionParam*> params) {
params_ = params;
- TINT_ASSERT(IR, !params_.Any(utils::IsNull));
+ TINT_ASSERT(IR, !params_.Any(tint::IsNull));
}
-utils::StringStream& operator<<(utils::StringStream& out, Function::PipelineStage value) {
+StringStream& operator<<(StringStream& out, Function::PipelineStage value) {
switch (value) {
case Function::PipelineStage::kVertex:
return out << "vertex";
@@ -55,7 +55,7 @@
return out << "<unknown>";
}
-utils::StringStream& operator<<(utils::StringStream& out, enum Function::ReturnBuiltin value) {
+StringStream& operator<<(StringStream& out, enum Function::ReturnBuiltin value) {
switch (value) {
case Function::ReturnBuiltin::kFragDepth:
return out << "frag_depth";
diff --git a/src/tint/lang/core/ir/function.h b/src/tint/lang/core/ir/function.h
index 141cda1..143efe0 100644
--- a/src/tint/lang/core/ir/function.h
+++ b/src/tint/lang/core/ir/function.h
@@ -33,7 +33,7 @@
namespace tint::ir {
/// An IR representation of a function
-class Function : public utils::Castable<Function, Value> {
+class Function : public Castable<Function, Value> {
public:
/// The pipeline stage for an entry point
enum class PipelineStage {
@@ -118,14 +118,14 @@
/// Sets the function parameters
/// @param params the function parameters
- void SetParams(utils::VectorRef<FunctionParam*> params);
+ void SetParams(VectorRef<FunctionParam*> params);
/// Sets the function parameters
/// @param params the function parameters
void SetParams(std::initializer_list<FunctionParam*> params);
/// @returns the function parameters
- const utils::VectorRef<FunctionParam*> Params() { return params_; }
+ const VectorRef<FunctionParam*> Params() { return params_; }
/// Sets the root block for the function
/// @param target the root block
@@ -147,12 +147,12 @@
bool invariant = false;
} return_;
- utils::Vector<FunctionParam*, 1> params_;
+ Vector<FunctionParam*, 1> params_;
ir::Block* block_ = nullptr;
};
-utils::StringStream& operator<<(utils::StringStream& out, Function::PipelineStage value);
-utils::StringStream& operator<<(utils::StringStream& out, enum Function::ReturnBuiltin value);
+StringStream& operator<<(StringStream& out, Function::PipelineStage value);
+StringStream& operator<<(StringStream& out, enum Function::ReturnBuiltin value);
} // namespace tint::ir
diff --git a/src/tint/lang/core/ir/function_param.cc b/src/tint/lang/core/ir/function_param.cc
index 898d22c..492522e 100644
--- a/src/tint/lang/core/ir/function_param.cc
+++ b/src/tint/lang/core/ir/function_param.cc
@@ -24,7 +24,7 @@
FunctionParam::~FunctionParam() = default;
-utils::StringStream& operator<<(utils::StringStream& out, enum FunctionParam::Builtin value) {
+StringStream& operator<<(StringStream& out, enum FunctionParam::Builtin value) {
switch (value) {
case FunctionParam::Builtin::kVertexIndex:
out << "vertex_index";
diff --git a/src/tint/lang/core/ir/function_param.h b/src/tint/lang/core/ir/function_param.h
index 4612e30..e4edabc 100644
--- a/src/tint/lang/core/ir/function_param.h
+++ b/src/tint/lang/core/ir/function_param.h
@@ -26,7 +26,7 @@
namespace tint::ir {
/// A function parameter in the IR.
-class FunctionParam : public utils::Castable<FunctionParam, Value> {
+class FunctionParam : public Castable<FunctionParam, Value> {
public:
/// Builtin attribute
enum class Builtin {
@@ -105,7 +105,7 @@
bool invariant_ = false;
};
-utils::StringStream& operator<<(utils::StringStream& out, enum FunctionParam::Builtin value);
+StringStream& operator<<(StringStream& out, enum FunctionParam::Builtin value);
} // namespace tint::ir
diff --git a/src/tint/lang/core/ir/if.h b/src/tint/lang/core/ir/if.h
index 54a7191..6b93df9 100644
--- a/src/tint/lang/core/ir/if.h
+++ b/src/tint/lang/core/ir/if.h
@@ -40,7 +40,7 @@
/// â–¼
/// out
/// ```
-class If : public utils::Castable<If, ControlInstruction> {
+class If : public Castable<If, ControlInstruction> {
public:
/// The index of the condition operand
static constexpr size_t kConditionOperandOffset = 0;
diff --git a/src/tint/lang/core/ir/instruction.h b/src/tint/lang/core/ir/instruction.h
index df0f825..5e1cf71 100644
--- a/src/tint/lang/core/ir/instruction.h
+++ b/src/tint/lang/core/ir/instruction.h
@@ -28,7 +28,7 @@
namespace tint::ir {
/// An instruction in the IR.
-class Instruction : public utils::Castable<Instruction> {
+class Instruction : public Castable<Instruction> {
public:
/// Destructor
~Instruction() override;
@@ -39,7 +39,7 @@
virtual void SetOperand(size_t index, ir::Value* value) = 0;
/// @returns the operands of the instruction
- virtual utils::VectorRef<ir::Value*> Operands() = 0;
+ virtual VectorRef<ir::Value*> Operands() = 0;
/// @returns true if the instruction has result values
virtual bool HasResults() { return false; }
@@ -51,7 +51,7 @@
virtual InstructionResult* Result() { return nullptr; }
/// @returns the result values for this instruction
- virtual utils::VectorRef<InstructionResult*> Results() { return utils::Empty; }
+ virtual VectorRef<InstructionResult*> Results() { return tint::Empty; }
/// Removes the instruction from the block, and destroys all the result values.
/// The result values must not be in use.
@@ -115,7 +115,7 @@
ir::Block* block_ = nullptr;
/// Bitset of instruction flags
- utils::EnumSet<Flag> flags_;
+ tint::EnumSet<Flag> flags_;
};
} // namespace tint::ir
diff --git a/src/tint/lang/core/ir/instruction_result.h b/src/tint/lang/core/ir/instruction_result.h
index 20b6cd1..f2bdd9c 100644
--- a/src/tint/lang/core/ir/instruction_result.h
+++ b/src/tint/lang/core/ir/instruction_result.h
@@ -21,7 +21,7 @@
namespace tint::ir {
/// An instruction result in the IR.
-class InstructionResult : public utils::Castable<InstructionResult, Value> {
+class InstructionResult : public Castable<InstructionResult, Value> {
public:
/// Constructor
/// @param type the type of the value
diff --git a/src/tint/lang/core/ir/intrinsic_call.cc b/src/tint/lang/core/ir/intrinsic_call.cc
index b8f8d5e..ee52c23 100644
--- a/src/tint/lang/core/ir/intrinsic_call.cc
+++ b/src/tint/lang/core/ir/intrinsic_call.cc
@@ -22,9 +22,7 @@
namespace tint::ir {
-IntrinsicCall::IntrinsicCall(InstructionResult* result,
- enum Kind kind,
- utils::VectorRef<Value*> arguments)
+IntrinsicCall::IntrinsicCall(InstructionResult* result, enum Kind kind, VectorRef<Value*> arguments)
: kind_(kind) {
AddOperands(IntrinsicCall::kArgsOperandOffset, std::move(arguments));
AddResult(result);
@@ -32,7 +30,7 @@
IntrinsicCall::~IntrinsicCall() = default;
-utils::StringStream& operator<<(utils::StringStream& out, enum IntrinsicCall::Kind kind) {
+StringStream& operator<<(StringStream& out, enum IntrinsicCall::Kind kind) {
switch (kind) {
case IntrinsicCall::Kind::kSpirvArrayLength:
out << "spirv.array_length";
diff --git a/src/tint/lang/core/ir/intrinsic_call.h b/src/tint/lang/core/ir/intrinsic_call.h
index 038049a..9a01acf 100644
--- a/src/tint/lang/core/ir/intrinsic_call.h
+++ b/src/tint/lang/core/ir/intrinsic_call.h
@@ -21,7 +21,7 @@
namespace tint::ir {
/// A backend intrinsic call instruction in the IR.
-class IntrinsicCall : public utils::Castable<IntrinsicCall, Call> {
+class IntrinsicCall : public Castable<IntrinsicCall, Call> {
public:
/// The base offset in Operands() for the args
static constexpr size_t kArgsOperandOffset = 0;
@@ -67,9 +67,7 @@
/// @param result the result value
/// @param kind the intrinsic kind
/// @param args the intrinsic call arguments
- IntrinsicCall(InstructionResult* result,
- enum Kind kind,
- utils::VectorRef<Value*> args = utils::Empty);
+ IntrinsicCall(InstructionResult* result, enum Kind kind, VectorRef<Value*> args = tint::Empty);
~IntrinsicCall() override;
/// @returns the builtin function
@@ -83,7 +81,7 @@
};
/// Emits the name of the intrinsic type.
-utils::StringStream& operator<<(utils::StringStream& out, enum IntrinsicCall::Kind kind);
+StringStream& operator<<(StringStream& out, enum IntrinsicCall::Kind kind);
} // namespace tint::ir
diff --git a/src/tint/lang/core/ir/let.h b/src/tint/lang/core/ir/let.h
index 52f8c8f..2aca260 100644
--- a/src/tint/lang/core/ir/let.h
+++ b/src/tint/lang/core/ir/let.h
@@ -20,7 +20,7 @@
namespace tint::ir {
/// A no-op instruction in the IR, used to position and name a value
-class Let : public utils::Castable<Let, OperandInstruction<1, 1>> {
+class Let : public Castable<Let, OperandInstruction<1, 1>> {
public:
/// The offset in Operands() for the value
static constexpr size_t kValueOperandOffset = 0;
diff --git a/src/tint/lang/core/ir/load.h b/src/tint/lang/core/ir/load.h
index 958cf57..cdfa295 100644
--- a/src/tint/lang/core/ir/load.h
+++ b/src/tint/lang/core/ir/load.h
@@ -21,7 +21,7 @@
namespace tint::ir {
/// A load instruction in the IR.
-class Load : public utils::Castable<Load, OperandInstruction<1, 1>> {
+class Load : public Castable<Load, OperandInstruction<1, 1>> {
public:
/// The offset in Operands() for the from value
static constexpr size_t kFromOperandOffset = 0;
diff --git a/src/tint/lang/core/ir/load_vector_element.h b/src/tint/lang/core/ir/load_vector_element.h
index db42278..021ae6f 100644
--- a/src/tint/lang/core/ir/load_vector_element.h
+++ b/src/tint/lang/core/ir/load_vector_element.h
@@ -21,7 +21,7 @@
namespace tint::ir {
/// A load instruction for a single vector element in the IR.
-class LoadVectorElement : public utils::Castable<LoadVectorElement, OperandInstruction<3, 0>> {
+class LoadVectorElement : public Castable<LoadVectorElement, OperandInstruction<3, 0>> {
public:
/// The offset in Operands() for the `from` value
static constexpr size_t kFromOperandOffset = 0;
diff --git a/src/tint/lang/core/ir/loop.h b/src/tint/lang/core/ir/loop.h
index 99e08f7..b2ede16 100644
--- a/src/tint/lang/core/ir/loop.h
+++ b/src/tint/lang/core/ir/loop.h
@@ -54,7 +54,7 @@
/// out
///
/// ```
-class Loop : public utils::Castable<Loop, ControlInstruction> {
+class Loop : public Castable<Loop, ControlInstruction> {
public:
/// Constructor
/// @param i the initializer block
diff --git a/src/tint/lang/core/ir/module.h b/src/tint/lang/core/ir/module.h
index 9f4a197..df39ff9 100644
--- a/src/tint/lang/core/ir/module.h
+++ b/src/tint/lang/core/ir/module.h
@@ -39,7 +39,7 @@
GenerationID prog_id_;
/// Map of value to name
- utils::Hashmap<Value*, Symbol, 32> value_to_name_;
+ Hashmap<Value*, Symbol, 32> value_to_name_;
public:
/// Constructor
@@ -81,19 +81,19 @@
type::Manager& Types() { return constant_values.types; }
/// The block allocator
- utils::BlockAllocator<Block> blocks;
+ BlockAllocator<Block> blocks;
/// The constant value manager
constant::Manager constant_values;
/// The instruction allocator
- utils::BlockAllocator<Instruction> instructions;
+ BlockAllocator<Instruction> instructions;
/// The value allocator
- utils::BlockAllocator<Value> values;
+ BlockAllocator<Value> values;
/// List of functions in the program
- utils::Vector<Function*, 8> functions;
+ Vector<Function*, 8> functions;
/// The block containing module level declarations, if any exist.
Block* root_block = nullptr;
@@ -102,7 +102,7 @@
SymbolTable symbols{prog_id_};
/// The map of constant::Value to their ir::Constant.
- utils::Hashmap<const constant::Value*, ir::Constant*, 16> constants;
+ Hashmap<const constant::Value*, ir::Constant*, 16> constants;
/// If the module generated a validation error, will store the file for the disassembly text.
std::unique_ptr<Source::File> disassembly_file;
diff --git a/src/tint/lang/core/ir/multi_in_block.cc b/src/tint/lang/core/ir/multi_in_block.cc
index 84b5e0c..615876c 100644
--- a/src/tint/lang/core/ir/multi_in_block.cc
+++ b/src/tint/lang/core/ir/multi_in_block.cc
@@ -24,7 +24,7 @@
MultiInBlock::~MultiInBlock() = default;
-void MultiInBlock::SetParams(utils::VectorRef<BlockParam*> params) {
+void MultiInBlock::SetParams(VectorRef<BlockParam*> params) {
params_ = std::move(params);
}
diff --git a/src/tint/lang/core/ir/multi_in_block.h b/src/tint/lang/core/ir/multi_in_block.h
index 1dd8e07..d25cc26 100644
--- a/src/tint/lang/core/ir/multi_in_block.h
+++ b/src/tint/lang/core/ir/multi_in_block.h
@@ -29,7 +29,7 @@
/// A block that can be the target of multiple branches.
/// MultiInBlocks maintain a list of inbound branches and a number of BlockParam parameters, used to
/// pass values from the branch source to this target.
-class MultiInBlock : public utils::Castable<MultiInBlock, Block> {
+class MultiInBlock : public Castable<MultiInBlock, Block> {
public:
/// Constructor
MultiInBlock();
@@ -37,27 +37,25 @@
/// Sets the params to the block
/// @param params the params for the block
- void SetParams(utils::VectorRef<BlockParam*> params);
+ void SetParams(VectorRef<BlockParam*> params);
/// Sets the params to the block
/// @param params the params for the block
void SetParams(std::initializer_list<BlockParam*> params);
/// @returns the params to the block
- const utils::Vector<BlockParam*, 2>& Params() { return params_; }
+ const Vector<BlockParam*, 2>& Params() { return params_; }
/// @returns branches made to this block by sibling blocks
- const utils::VectorRef<ir::Terminator*> InboundSiblingBranches() {
- return inbound_sibling_branches_;
- }
+ const VectorRef<ir::Terminator*> InboundSiblingBranches() { return inbound_sibling_branches_; }
/// Adds the given branch to the list of branches made to this block by sibling blocks
/// @param branch the branch to add
void AddInboundSiblingBranch(ir::Terminator* branch);
private:
- utils::Vector<BlockParam*, 2> params_;
- utils::Vector<ir::Terminator*, 2> inbound_sibling_branches_;
+ Vector<BlockParam*, 2> params_;
+ Vector<ir::Terminator*, 2> inbound_sibling_branches_;
};
} // namespace tint::ir
diff --git a/src/tint/lang/core/ir/next_iteration.cc b/src/tint/lang/core/ir/next_iteration.cc
index 1d06530..797cd0c 100644
--- a/src/tint/lang/core/ir/next_iteration.cc
+++ b/src/tint/lang/core/ir/next_iteration.cc
@@ -23,7 +23,7 @@
namespace tint::ir {
-NextIteration::NextIteration(ir::Loop* loop, utils::VectorRef<Value*> args /* = utils::Empty */)
+NextIteration::NextIteration(ir::Loop* loop, VectorRef<Value*> args /* = tint::Empty */)
: loop_(loop) {
TINT_ASSERT(IR, loop_);
diff --git a/src/tint/lang/core/ir/next_iteration.h b/src/tint/lang/core/ir/next_iteration.h
index ae76ff4..b1c8bf2 100644
--- a/src/tint/lang/core/ir/next_iteration.h
+++ b/src/tint/lang/core/ir/next_iteration.h
@@ -26,7 +26,7 @@
namespace tint::ir {
/// A next iteration instruction.
-class NextIteration : public utils::Castable<NextIteration, Terminator> {
+class NextIteration : public Castable<NextIteration, Terminator> {
public:
/// The base offset in Operands() for the args
static constexpr size_t kArgsOperandOffset = 0;
@@ -34,7 +34,7 @@
/// Constructor
/// @param loop the loop being iterated
/// @param args the arguments for the MultiInBlock
- explicit NextIteration(ir::Loop* loop, utils::VectorRef<Value*> args = utils::Empty);
+ explicit NextIteration(ir::Loop* loop, VectorRef<Value*> args = tint::Empty);
~NextIteration() override;
/// @returns the loop being iterated
diff --git a/src/tint/lang/core/ir/operand_instruction.h b/src/tint/lang/core/ir/operand_instruction.h
index 7f9a5c1..d6fd4bb 100644
--- a/src/tint/lang/core/ir/operand_instruction.h
+++ b/src/tint/lang/core/ir/operand_instruction.h
@@ -26,7 +26,7 @@
/// @tparam N the number of operands before spilling to the heap
/// @tparam R the number of result values before spilling to the heap
template <unsigned N, unsigned R>
-class OperandInstruction : public utils::Castable<OperandInstruction<N, R>, Instruction> {
+class OperandInstruction : public Castable<OperandInstruction<N, R>, Instruction> {
public:
/// Destructor
~OperandInstruction() override = default;
@@ -53,7 +53,7 @@
/// Sets the operands to @p operands
/// @param operands the new operands for the instruction
- void SetOperands(utils::VectorRef<ir::Value*> operands) {
+ void SetOperands(VectorRef<ir::Value*> operands) {
ClearOperands();
operands_ = std::move(operands);
for (size_t i = 0; i < operands_.Length(); i++) {
@@ -75,7 +75,7 @@
}
/// @returns the operands of the instruction
- utils::VectorRef<ir::Value*> Operands() override { return operands_; }
+ VectorRef<ir::Value*> Operands() override { return operands_; }
/// @returns true if the instruction has result values
bool HasResults() override { return !results_.IsEmpty(); }
@@ -94,7 +94,7 @@
using Instruction::Result;
/// @returns the result values for this instruction
- utils::VectorRef<InstructionResult*> Results() override { return results_; }
+ VectorRef<InstructionResult*> Results() override { return results_; }
protected:
/// Append a new operand to the operand list for this instruction.
@@ -112,7 +112,7 @@
/// Append a list of operands to the operand list for this instruction.
/// @param start_idx the index from which the values should start
/// @param values the operand values to append
- void AddOperands(size_t start_idx, utils::VectorRef<ir::Value*> values) {
+ void AddOperands(size_t start_idx, VectorRef<ir::Value*> values) {
size_t idx = start_idx;
for (auto* val : values) {
AddOperand(idx, val);
@@ -130,9 +130,9 @@
}
/// The operands to this instruction.
- utils::Vector<ir::Value*, N> operands_;
+ Vector<ir::Value*, N> operands_;
/// The results of this instruction.
- utils::Vector<ir::InstructionResult*, R> results_;
+ Vector<ir::InstructionResult*, R> results_;
};
} // namespace tint::ir
diff --git a/src/tint/lang/core/ir/operand_instruction_test.cc b/src/tint/lang/core/ir/operand_instruction_test.cc
index 9b5a600..fe7c0d2 100644
--- a/src/tint/lang/core/ir/operand_instruction_test.cc
+++ b/src/tint/lang/core/ir/operand_instruction_test.cc
@@ -55,7 +55,7 @@
TEST_F(IR_OperandInstructionTest, SetOperands_WithNullOperand) {
auto* inst = b.Var(ty.ptr<private_, f32>());
- utils::Vector<Value*, 1> ops;
+ Vector<Value*, 1> ops;
ops.Push(nullptr);
inst->SetOperands(ops);
diff --git a/src/tint/lang/core/ir/return.h b/src/tint/lang/core/ir/return.h
index d918220..d7d7b75 100644
--- a/src/tint/lang/core/ir/return.h
+++ b/src/tint/lang/core/ir/return.h
@@ -26,7 +26,7 @@
namespace tint::ir {
/// A return instruction.
-class Return : public utils::Castable<Return, Terminator> {
+class Return : public Castable<Return, Terminator> {
public:
/// The offset in Operands() for the function being returned
static constexpr size_t kFunctionOperandOffset = 0;
@@ -58,7 +58,7 @@
void SetValue(ir::Value* val) { SetOperand(kArgOperandOffset, val); }
/// @returns the return arguments
- utils::Slice<ir::Value* const> Args() override {
+ tint::Slice<ir::Value* const> Args() override {
return operands_.Slice().Offset(kArgOperandOffset);
}
diff --git a/src/tint/lang/core/ir/store.h b/src/tint/lang/core/ir/store.h
index a9f6319..d47a1ed 100644
--- a/src/tint/lang/core/ir/store.h
+++ b/src/tint/lang/core/ir/store.h
@@ -21,7 +21,7 @@
namespace tint::ir {
/// A store instruction in the IR.
-class Store : public utils::Castable<Store, OperandInstruction<2, 0>> {
+class Store : public Castable<Store, OperandInstruction<2, 0>> {
public:
/// The offset in Operands() for the `to` value
static constexpr size_t kToOperandOffset = 0;
diff --git a/src/tint/lang/core/ir/store_vector_element.h b/src/tint/lang/core/ir/store_vector_element.h
index d718da8..0e081e8 100644
--- a/src/tint/lang/core/ir/store_vector_element.h
+++ b/src/tint/lang/core/ir/store_vector_element.h
@@ -21,7 +21,7 @@
namespace tint::ir {
/// A store instruction for a single vector element in the IR.
-class StoreVectorElement : public utils::Castable<StoreVectorElement, OperandInstruction<3, 0>> {
+class StoreVectorElement : public Castable<StoreVectorElement, OperandInstruction<3, 0>> {
public:
/// The offset in Operands() for the `to` value
static constexpr size_t kToOperandOffset = 0;
diff --git a/src/tint/lang/core/ir/switch.h b/src/tint/lang/core/ir/switch.h
index 70d8170..500281f 100644
--- a/src/tint/lang/core/ir/switch.h
+++ b/src/tint/lang/core/ir/switch.h
@@ -41,7 +41,7 @@
/// â–¼
/// out
/// ```
-class Switch : public utils::Castable<Switch, ControlInstruction> {
+class Switch : public Castable<Switch, ControlInstruction> {
public:
/// The offset in Operands() for the condition
static constexpr size_t kConditionOperandOffset = 0;
@@ -58,7 +58,7 @@
/// A case label in the struct
struct Case {
/// The case selector for this node
- utils::Vector<CaseSelector, 4> selectors;
+ Vector<CaseSelector, 4> selectors;
/// The case block.
ir::Block* block = nullptr;
@@ -75,7 +75,7 @@
void ForeachBlock(const std::function<void(ir::Block*)>& cb) override;
/// @returns the switch cases
- utils::Vector<Case, 4>& Cases() { return cases_; }
+ Vector<Case, 4>& Cases() { return cases_; }
/// @returns the condition
Value* Condition() { return operands_[kConditionOperandOffset]; }
@@ -84,7 +84,7 @@
std::string_view FriendlyName() override { return "switch"; }
private:
- utils::Vector<Case, 4> cases_;
+ Vector<Case, 4> cases_;
};
} // namespace tint::ir
diff --git a/src/tint/lang/core/ir/swizzle.cc b/src/tint/lang/core/ir/swizzle.cc
index 2b64364..b81fab8 100644
--- a/src/tint/lang/core/ir/swizzle.cc
+++ b/src/tint/lang/core/ir/swizzle.cc
@@ -22,7 +22,7 @@
namespace tint::ir {
-Swizzle::Swizzle(InstructionResult* result, Value* object, utils::VectorRef<uint32_t> indices)
+Swizzle::Swizzle(InstructionResult* result, Value* object, VectorRef<uint32_t> indices)
: indices_(std::move(indices)) {
TINT_ASSERT(IR, !indices.IsEmpty());
TINT_ASSERT(IR, indices.Length() <= 4);
diff --git a/src/tint/lang/core/ir/swizzle.h b/src/tint/lang/core/ir/swizzle.h
index b099032..927ab8e 100644
--- a/src/tint/lang/core/ir/swizzle.h
+++ b/src/tint/lang/core/ir/swizzle.h
@@ -21,7 +21,7 @@
namespace tint::ir {
/// A swizzle instruction in the IR.
-class Swizzle : public utils::Castable<Swizzle, OperandInstruction<1, 1>> {
+class Swizzle : public Castable<Swizzle, OperandInstruction<1, 1>> {
public:
/// The offset in Operands() for the object being swizzled
static constexpr size_t kObjectOperandOffset = 0;
@@ -30,20 +30,20 @@
/// @param result the result value
/// @param object the object being swizzled
/// @param indices the indices to swizzle
- Swizzle(InstructionResult* result, Value* object, utils::VectorRef<uint32_t> indices);
+ Swizzle(InstructionResult* result, Value* object, VectorRef<uint32_t> indices);
~Swizzle() override;
/// @returns the object used for the access
Value* Object() { return operands_[kObjectOperandOffset]; }
/// @returns the swizzle indices
- utils::VectorRef<uint32_t> Indices() { return indices_; }
+ VectorRef<uint32_t> Indices() { return indices_; }
/// @returns the friendly name for the instruction
std::string_view FriendlyName() override { return "swizzle"; }
private:
- utils::Vector<uint32_t, 4> indices_;
+ Vector<uint32_t, 4> indices_;
};
} // namespace tint::ir
diff --git a/src/tint/lang/core/ir/swizzle_test.cc b/src/tint/lang/core/ir/swizzle_test.cc
index c1471bb..63954a2 100644
--- a/src/tint/lang/core/ir/swizzle_test.cc
+++ b/src/tint/lang/core/ir/swizzle_test.cc
@@ -59,7 +59,7 @@
Module mod;
Builder b{mod};
auto* var = b.Var(mod.Types().ptr<function, i32>());
- b.Swizzle(mod.Types().i32(), var, utils::Empty);
+ b.Swizzle(mod.Types().i32(), var, tint::Empty);
},
"");
}
diff --git a/src/tint/lang/core/ir/terminate_invocation.h b/src/tint/lang/core/ir/terminate_invocation.h
index ddb9ee7..6e98eb3 100644
--- a/src/tint/lang/core/ir/terminate_invocation.h
+++ b/src/tint/lang/core/ir/terminate_invocation.h
@@ -20,7 +20,7 @@
namespace tint::ir {
/// An terminate invocation instruction in the IR.
-class TerminateInvocation : public utils::Castable<TerminateInvocation, Terminator> {
+class TerminateInvocation : public Castable<TerminateInvocation, Terminator> {
public:
~TerminateInvocation() override;
diff --git a/src/tint/lang/core/ir/terminator.h b/src/tint/lang/core/ir/terminator.h
index 9169db4..13ec744 100644
--- a/src/tint/lang/core/ir/terminator.h
+++ b/src/tint/lang/core/ir/terminator.h
@@ -27,12 +27,12 @@
namespace tint::ir {
/// The base class of all instructions that terminate a block.
-class Terminator : public utils::Castable<Terminator, OperandInstruction<1, 0>> {
+class Terminator : public Castable<Terminator, OperandInstruction<1, 0>> {
public:
~Terminator() override;
/// @returns the terminator arguments
- virtual utils::Slice<Value* const> Args() { return operands_.Slice(); }
+ virtual tint::Slice<Value* const> Args() { return operands_.Slice(); }
};
} // namespace tint::ir
diff --git a/src/tint/lang/core/ir/transform/add_empty_entry_point.h b/src/tint/lang/core/ir/transform/add_empty_entry_point.h
index b931b37..dad8ace 100644
--- a/src/tint/lang/core/ir/transform/add_empty_entry_point.h
+++ b/src/tint/lang/core/ir/transform/add_empty_entry_point.h
@@ -20,7 +20,7 @@
namespace tint::ir::transform {
/// Add an empty entry point to the module, if no other entry points exist.
-class AddEmptyEntryPoint final : public utils::Castable<AddEmptyEntryPoint, Transform> {
+class AddEmptyEntryPoint final : public Castable<AddEmptyEntryPoint, Transform> {
public:
/// Constructor
AddEmptyEntryPoint();
diff --git a/src/tint/lang/core/ir/transform/block_decorated_structs.cc b/src/tint/lang/core/ir/transform/block_decorated_structs.cc
index a1990d9..9861231 100644
--- a/src/tint/lang/core/ir/transform/block_decorated_structs.cc
+++ b/src/tint/lang/core/ir/transform/block_decorated_structs.cc
@@ -39,7 +39,7 @@
}
// Loop over module-scope declarations, looking for storage or uniform buffers.
- utils::Vector<Var*, 8> buffer_variables;
+ Vector<Var*, 8> buffer_variables;
for (auto inst : *ir->root_block) {
auto* var = inst->As<Var>();
if (!var) {
@@ -58,7 +58,7 @@
auto* store_ty = ptr->StoreType();
bool wrapped = false;
- utils::Vector<const type::StructMember*, 4> members;
+ Vector<const type::StructMember*, 4> members;
// Build the member list for the block-decorated structure.
if (auto* str = store_ty->As<type::Struct>(); str && !str->HasFixedFootprint()) {
@@ -86,7 +86,7 @@
/* name */ ir->symbols.New(),
/* members */ members,
/* align */ store_ty->Align(),
- /* size */ utils::RoundUp(store_ty->Align(), store_ty->Size()),
+ /* size */ tint::RoundUp(store_ty->Align(), store_ty->Size()),
/* size_no_padding */ store_ty->Size());
block_struct->SetStructFlag(type::StructFlag::kBlock);
diff --git a/src/tint/lang/core/ir/transform/block_decorated_structs.h b/src/tint/lang/core/ir/transform/block_decorated_structs.h
index 776df0a..529db18 100644
--- a/src/tint/lang/core/ir/transform/block_decorated_structs.h
+++ b/src/tint/lang/core/ir/transform/block_decorated_structs.h
@@ -24,7 +24,7 @@
/// BlockDecoratedStructs is a transform that changes the store type of a buffer to be a special
/// structure that is recognized as needing a block decoration in SPIR-V, potentially wrapping the
/// existing store type in a new structure if necessary.
-class BlockDecoratedStructs final : public utils::Castable<BlockDecoratedStructs, Transform> {
+class BlockDecoratedStructs final : public Castable<BlockDecoratedStructs, Transform> {
public:
/// Constructor
BlockDecoratedStructs();
diff --git a/src/tint/lang/core/ir/transform/builtin_polyfill_spirv.cc b/src/tint/lang/core/ir/transform/builtin_polyfill_spirv.cc
index b02f62e..99079b9 100644
--- a/src/tint/lang/core/ir/transform/builtin_polyfill_spirv.cc
+++ b/src/tint/lang/core/ir/transform/builtin_polyfill_spirv.cc
@@ -53,7 +53,7 @@
/// Process the module.
void Process() {
// Find the builtins that need replacing.
- utils::Vector<CoreBuiltinCall*, 4> worklist;
+ Vector<CoreBuiltinCall*, 4> worklist;
for (auto* inst : ir->instructions.Objects()) {
if (!inst->Alive()) {
continue;
@@ -184,9 +184,9 @@
auto* const_idx = access->Indices()[0]->As<Constant>();
// Replace the builtin call with a call to the spirv.array_length intrinsic.
- auto* call = b.Call(
- builtin->Result()->Type(), IntrinsicCall::Kind::kSpirvArrayLength,
- utils::Vector{access->Object(), Literal(u32(const_idx->Value()->ValueAs<uint32_t>()))});
+ auto* call =
+ b.Call(builtin->Result()->Type(), IntrinsicCall::Kind::kSpirvArrayLength,
+ Vector{access->Object(), Literal(u32(const_idx->Value()->ValueAs<uint32_t>()))});
call->InsertBefore(builtin);
return call->Result();
}
@@ -244,7 +244,7 @@
// Construct the atomicCompareExchange result structure.
call = b.Construct(type::CreateAtomicCompareExchangeResult(ty, ir->symbols, int_ty),
- utils::Vector{original, compare->Result()});
+ Vector{original, compare->Result()});
break;
}
case builtin::Function::kAtomicExchange:
@@ -323,7 +323,7 @@
}
// Replace the builtin call with a call to the spirv.dot intrinsic.
- auto args = utils::Vector<Value*, 4>(builtin->Args());
+ auto args = Vector<Value*, 4>(builtin->Args());
auto* call =
b.Call(builtin->Result()->Type(), IntrinsicCall::Kind::kSpirvDot, std::move(args));
call->InsertBefore(builtin);
@@ -335,7 +335,7 @@
/// @returns the replacement value
Value* Select(CoreBuiltinCall* builtin) {
// Argument order is different in SPIR-V: (condition, true_operand, false_operand).
- utils::Vector<Value*, 4> args = {
+ Vector<Value*, 4> args = {
builtin->Args()[2],
builtin->Args()[1],
builtin->Args()[0],
@@ -346,7 +346,7 @@
// TODO(jrprice): We don't need to do this if we're targeting SPIR-V 1.4 or newer.
auto* vec = builtin->Result()->Type()->As<type::Vector>();
if (vec && args[0]->Type()->Is<type::Scalar>()) {
- utils::Vector<Value*, 4> elements;
+ Vector<Value*, 4> elements;
elements.Resize(vec->Width(), args[0]);
auto* construct = b.Construct(ty.vec(ty.bool_(), vec->Width()), std::move(elements));
@@ -383,7 +383,7 @@
/// @param insertion_point the insertion point for new instructions
/// @param requires_float_lod true if the lod needs to be a floating point value
void AppendImageOperands(ImageOperands& operands,
- utils::Vector<Value*, 8>& args,
+ Vector<Value*, 8>& args,
Instruction* insertion_point,
bool requires_float_lod) {
// Add a placeholder argument for the image operand mask, which we will fill in when we have
@@ -443,7 +443,7 @@
// Construct a new coordinate vector.
auto num_coords = vec->Width();
auto* coord_ty = ty.vec(element_ty, num_coords + 1);
- auto* construct = b.Construct(coord_ty, utils::Vector{coords, array_idx});
+ auto* construct = b.Construct(coord_ty, Vector{coords, array_idx});
construct->InsertBefore(insertion_point);
return construct->Result();
}
@@ -466,7 +466,7 @@
// Use OpSampledImage to create an OpTypeSampledImage object.
auto* sampled_image =
b.Call(ty.Get<SampledImage>(texture_ty), IntrinsicCall::Kind::kSpirvSampledImage,
- utils::Vector{texture, sampler});
+ Vector{texture, sampler});
sampled_image->InsertBefore(builtin);
// Append the array index to the coordinates if provided.
@@ -518,7 +518,7 @@
// Start building the argument list for the intrinsic.
// The first two operands are always the sampled image and then the coordinates, followed by
// the depth reference if used.
- utils::Vector<Value*, 8> intrinsic_args;
+ Vector<Value*, 8> intrinsic_args;
intrinsic_args.Push(sampled_image->Result());
intrinsic_args.Push(coords);
if (depth) {
@@ -572,7 +572,7 @@
// Use OpSampledImage to create an OpTypeSampledImage object.
auto* sampled_image =
b.Call(ty.Get<SampledImage>(texture_ty), IntrinsicCall::Kind::kSpirvSampledImage,
- utils::Vector{texture, sampler});
+ Vector{texture, sampler});
sampled_image->InsertBefore(builtin);
// Append the array index to the coordinates if provided.
@@ -602,7 +602,7 @@
// Start building the argument list for the intrinsic.
// The first two operands are always the sampled image and then the coordinates, followed by
// either the depth reference or the component.
- utils::Vector<Value*, 8> intrinsic_args;
+ Vector<Value*, 8> intrinsic_args;
intrinsic_args.Push(sampled_image->Result());
intrinsic_args.Push(coords);
if (depth) {
@@ -643,7 +643,7 @@
// Start building the argument list for the intrinsic.
// The first two operands are always the texture and then the coordinates.
- utils::Vector<Value*, 8> intrinsic_args;
+ Vector<Value*, 8> intrinsic_args;
intrinsic_args.Push(texture);
intrinsic_args.Push(coords);
@@ -702,7 +702,7 @@
// Start building the argument list for the intrinsic.
// The first two operands are always the texture and then the coordinates.
- utils::Vector<Value*, 8> intrinsic_args;
+ Vector<Value*, 8> intrinsic_args;
intrinsic_args.Push(texture);
intrinsic_args.Push(coords);
intrinsic_args.Push(texel);
@@ -730,7 +730,7 @@
auto* texture = next_arg();
auto* texture_ty = texture->Type()->As<type::Texture>();
- utils::Vector<Value*, 8> intrinsic_args;
+ Vector<Value*, 8> intrinsic_args;
intrinsic_args.Push(texture);
// Determine which SPIR-V intrinsic to use, and add the Lod argument if needed.
@@ -778,7 +778,7 @@
auto* texture = builtin->Args()[0];
auto* texture_ty = texture->Type()->As<type::Texture>();
- utils::Vector<Value*, 2> intrinsic_args;
+ Vector<Value*, 2> intrinsic_args;
intrinsic_args.Push(texture);
// Determine which SPIR-V intrinsic to use, and add the Lod argument if needed.
@@ -812,8 +812,7 @@
BuiltinPolyfillSpirv::SampledImage::SampledImage(const type::Type* image)
: Base(static_cast<size_t>(
- utils::Hash(utils::TypeInfo::Of<BuiltinPolyfillSpirv::SampledImage>().full_hashcode,
- image)),
+ Hash(tint::TypeInfo::Of<BuiltinPolyfillSpirv::SampledImage>().full_hashcode, image)),
type::Flags{}),
image_(image) {}
diff --git a/src/tint/lang/core/ir/transform/builtin_polyfill_spirv.h b/src/tint/lang/core/ir/transform/builtin_polyfill_spirv.h
index a0db45d..3433f23 100644
--- a/src/tint/lang/core/ir/transform/builtin_polyfill_spirv.h
+++ b/src/tint/lang/core/ir/transform/builtin_polyfill_spirv.h
@@ -30,7 +30,7 @@
/// BuiltinPolyfillSpirv is a transform that replaces calls to builtins with polyfills and calls to
/// SPIR-V backend intrinsic functions.
-class BuiltinPolyfillSpirv final : public utils::Castable<BuiltinPolyfillSpirv, Transform> {
+class BuiltinPolyfillSpirv final : public Castable<BuiltinPolyfillSpirv, Transform> {
public:
/// Constructor
BuiltinPolyfillSpirv();
@@ -42,7 +42,7 @@
/// LiteralOperand is a type of constant value that is intended to be emitted as a literal in
/// the SPIR-V instruction stream.
- class LiteralOperand final : public utils::Castable<LiteralOperand, ir::Constant> {
+ class LiteralOperand final : public Castable<LiteralOperand, ir::Constant> {
public:
/// Constructor
/// @param value the operand value
@@ -52,7 +52,7 @@
};
/// SampledImage represents an OpTypeSampledImage in SPIR-V.
- class SampledImage final : public utils::Castable<SampledImage, type::Type> {
+ class SampledImage final : public Castable<SampledImage, type::Type> {
public:
/// Constructor
/// @param image the image type
diff --git a/src/tint/lang/core/ir/transform/demote_to_helper.cc b/src/tint/lang/core/ir/transform/demote_to_helper.cc
index 6428c8d..ce8aec4b 100644
--- a/src/tint/lang/core/ir/transform/demote_to_helper.cc
+++ b/src/tint/lang/core/ir/transform/demote_to_helper.cc
@@ -45,10 +45,10 @@
Var* continue_execution = nullptr;
/// Map from function to a flag that indicates whether it (transitively) contains a discard.
- utils::Hashmap<Function*, bool, 4> function_discard_status;
+ Hashmap<Function*, bool, 4> function_discard_status;
/// Set of functions that have been processed.
- utils::Hashset<Function*, 4> processed_functions;
+ Hashset<Function*, 4> processed_functions;
/// Constructor
/// @param mod the module
@@ -58,7 +58,7 @@
void Process() {
// Check each fragment shader entry point for discard instruction, potentially inside
// functions called (transitively) by the entry point.
- utils::Vector<Function*, 4> to_process;
+ Vector<Function*, 4> to_process;
for (auto* func : ir->functions) {
// If the function is a fragment shader that contains a discard, we need to process it.
if (func->Stage() == Function::PipelineStage::kFragment) {
@@ -143,7 +143,7 @@
TINT_ASSERT(Transform, !inst->HasMultiResults());
if (inst->HasResults() && !inst->Result()->Type()->Is<type::Void>()) {
// The original instruction had a result, so return it from the if instruction.
- ifelse->SetResults(utils::Vector{b.InstructionResult(inst->Result()->Type())});
+ ifelse->SetResults(Vector{b.InstructionResult(inst->Result()->Type())});
inst->Result()->ReplaceAllUsesWith(ifelse->Result());
ifelse->True()->Append(b.ExitIf(ifelse, result));
} else {
diff --git a/src/tint/lang/core/ir/transform/demote_to_helper.h b/src/tint/lang/core/ir/transform/demote_to_helper.h
index be753b1..b3c0079 100644
--- a/src/tint/lang/core/ir/transform/demote_to_helper.h
+++ b/src/tint/lang/core/ir/transform/demote_to_helper.h
@@ -25,7 +25,7 @@
/// program to ensure that discarding the fragment does not affect uniformity with respect to
/// derivative operations. We do this by setting a global flag and masking all writes to storage
/// buffers and textures.
-class DemoteToHelper final : public utils::Castable<DemoteToHelper, Transform> {
+class DemoteToHelper final : public Castable<DemoteToHelper, Transform> {
public:
/// Constructor
DemoteToHelper();
diff --git a/src/tint/lang/core/ir/transform/expand_implicit_splats.cc b/src/tint/lang/core/ir/transform/expand_implicit_splats.cc
index 1252f8b..b8faedf 100644
--- a/src/tint/lang/core/ir/transform/expand_implicit_splats.cc
+++ b/src/tint/lang/core/ir/transform/expand_implicit_splats.cc
@@ -34,8 +34,8 @@
// Find the instructions that use implicit splats and either modify them in place or record them
// to be replaced in a second pass.
- utils::Vector<Binary*, 4> binary_worklist;
- utils::Vector<CoreBuiltinCall*, 4> builtin_worklist;
+ Vector<Binary*, 4> binary_worklist;
+ Vector<CoreBuiltinCall*, 4> builtin_worklist;
for (auto* inst : ir->instructions.Objects()) {
if (!inst->Alive()) {
continue;
@@ -78,7 +78,7 @@
auto expand_operand = [&](Instruction* inst, size_t operand_idx) {
auto* vec = inst->Result()->Type()->As<type::Vector>();
- utils::Vector<Value*, 4> args;
+ Vector<Value*, 4> args;
args.Resize(vec->Width(), inst->Operands()[operand_idx]);
auto* construct = b.Construct(vec, std::move(args));
diff --git a/src/tint/lang/core/ir/transform/expand_implicit_splats.h b/src/tint/lang/core/ir/transform/expand_implicit_splats.h
index 6cfe51b..37fb887 100644
--- a/src/tint/lang/core/ir/transform/expand_implicit_splats.h
+++ b/src/tint/lang/core/ir/transform/expand_implicit_splats.h
@@ -21,7 +21,7 @@
/// ExpandImplicitSplats is a transform that expands implicit vector splat operands in construct
/// instructions and binary instructions where not supported by SPIR-V.
-class ExpandImplicitSplats final : public utils::Castable<ExpandImplicitSplats, Transform> {
+class ExpandImplicitSplats final : public Castable<ExpandImplicitSplats, Transform> {
public:
/// Constructor
ExpandImplicitSplats();
diff --git a/src/tint/lang/core/ir/transform/handle_matrix_arithmetic.cc b/src/tint/lang/core/ir/transform/handle_matrix_arithmetic.cc
index 0ea3227..423d660 100644
--- a/src/tint/lang/core/ir/transform/handle_matrix_arithmetic.cc
+++ b/src/tint/lang/core/ir/transform/handle_matrix_arithmetic.cc
@@ -34,8 +34,8 @@
ir::Builder b(*ir);
// Find the instructions that need to be modified.
- utils::Vector<Binary*, 4> binary_worklist;
- utils::Vector<Convert*, 4> convert_worklist;
+ Vector<Binary*, 4> binary_worklist;
+ Vector<Convert*, 4> convert_worklist;
for (auto* inst : ir->instructions.Objects()) {
if (!inst->Alive()) {
continue;
@@ -74,7 +74,7 @@
// Helper to replace the instruction with a column-wise operation.
auto column_wise = [&](enum Binary::Kind op) {
auto* mat = ty->As<type::Matrix>();
- utils::Vector<Value*, 4> args;
+ Vector<Value*, 4> args;
for (uint32_t col = 0; col < mat->columns(); col++) {
b.InsertBefore(binary, [&] {
auto* lhs_col = b.Access(mat->ColumnType(), lhs, u32(col));
@@ -125,7 +125,7 @@
auto* out_mat = convert->Result()->Type()->As<type::Matrix>();
// Extract and convert each column separately.
- utils::Vector<Value*, 4> args;
+ Vector<Value*, 4> args;
for (uint32_t c = 0; c < out_mat->columns(); c++) {
b.InsertBefore(convert, [&] {
auto* col = b.Access(in_mat->ColumnType(), arg, u32(c));
diff --git a/src/tint/lang/core/ir/transform/handle_matrix_arithmetic.h b/src/tint/lang/core/ir/transform/handle_matrix_arithmetic.h
index bcdd6f0..f55e919 100644
--- a/src/tint/lang/core/ir/transform/handle_matrix_arithmetic.h
+++ b/src/tint/lang/core/ir/transform/handle_matrix_arithmetic.h
@@ -21,7 +21,7 @@
/// HandleMatrixArithmetic is a transform that converts arithmetic instruction that use matrix into
/// SPIR-V intrinsics or polyfills.
-class HandleMatrixArithmetic final : public utils::Castable<HandleMatrixArithmetic, Transform> {
+class HandleMatrixArithmetic final : public Castable<HandleMatrixArithmetic, Transform> {
public:
/// Constructor
HandleMatrixArithmetic();
diff --git a/src/tint/lang/core/ir/transform/merge_return.cc b/src/tint/lang/core/ir/transform/merge_return.cc
index 5eaa976..4ba6bf6 100644
--- a/src/tint/lang/core/ir/transform/merge_return.cc
+++ b/src/tint/lang/core/ir/transform/merge_return.cc
@@ -56,7 +56,7 @@
Return* fn_return = nullptr;
/// A set of control instructions that transitively hold a return instruction
- utils::Hashset<ControlInstruction*, 8> holds_return_;
+ Hashset<ControlInstruction*, 8> holds_return_;
/// Constructor
/// @param mod the module
@@ -157,7 +157,7 @@
if (holds_return_.Contains(ctrl)) {
// Control instruction transitively holds a return.
ctrl->ForeachBlock([&](Block* ctrl_block) { ProcessBlock(ctrl_block); });
- if (next && next != fn_return && !utils::IsAnyOf<Exit, Unreachable>(next)) {
+ if (next && next != fn_return && !tint::IsAnyOf<Exit, Unreachable>(next)) {
inner_if = CreateIfContinueExecution(ctrl);
}
}
@@ -177,7 +177,7 @@
// Inner-most 'if' has a 'exit_if' that returns values.
// These need propagating through the if stack.
inner_if->SetResults(
- utils::Transform<8>(exit_if->Args(), new_value_with_type));
+ tint::Transform<8>(exit_if->Args(), new_value_with_type));
}
}
} else {
@@ -190,9 +190,9 @@
for (auto* i = inner_if; i; i = tint::As<If>(i->Block()->Parent())) {
if (!i->Block()->HasTerminator()) {
// Append the exit instruction to the block holding the 'if'.
- utils::Vector<InstructionResult*, 8> exit_args = i->Results();
+ Vector<InstructionResult*, 8> exit_args = i->Results();
if (!i->HasResults()) {
- i->SetResults(utils::Transform(exit_args, new_value_with_type));
+ i->SetResults(tint::Transform(exit_args, new_value_with_type));
}
auto* exit = b.Exit(i->Block()->Parent(), std::move(exit_args));
i->Block()->Append(exit);
@@ -255,7 +255,7 @@
// If the outermost control instruction is expecting exit values, then return them as
// 'undef' values.
auto* ctrl = block->Parent();
- utils::Vector<Value*, 8> exit_args;
+ Vector<Value*, 8> exit_args;
exit_args.Resize(ctrl->Results().Length());
// Replace the return instruction with an exit instruction.
diff --git a/src/tint/lang/core/ir/transform/merge_return.h b/src/tint/lang/core/ir/transform/merge_return.h
index c42c71b..c86f116 100644
--- a/src/tint/lang/core/ir/transform/merge_return.h
+++ b/src/tint/lang/core/ir/transform/merge_return.h
@@ -21,7 +21,7 @@
/// MergeReturn is a transform merges multiple return statements in a function into a single return
/// at the end of the function.
-class MergeReturn final : public utils::Castable<MergeReturn, Transform> {
+class MergeReturn final : public Castable<MergeReturn, Transform> {
public:
/// Constructor
MergeReturn();
diff --git a/src/tint/lang/core/ir/transform/shader_io.cc b/src/tint/lang/core/ir/transform/shader_io.cc
index a324b93..6380c3d 100644
--- a/src/tint/lang/core/ir/transform/shader_io.cc
+++ b/src/tint/lang/core/ir/transform/shader_io.cc
@@ -85,7 +85,7 @@
/// The type manager.
type::Manager& ty{ir->Types()};
/// The set of struct members that need to have their IO attributes stripped.
- utils::Hashset<const type::StructMember*, 8> members_to_strip;
+ Hashset<const type::StructMember*, 8> members_to_strip;
/// The entry point currently being processed.
Function* func = nullptr;
@@ -202,12 +202,12 @@
/// Build the argument list to call the original entry point function.
/// @param builder the IR builder for new instructions
/// @returns the argument list
- utils::Vector<Value*, 4> BuildInnerCallArgs(Builder& builder) {
+ Vector<Value*, 4> BuildInnerCallArgs(Builder& builder) {
uint32_t input_idx = 0;
- utils::Vector<Value*, 4> args;
+ Vector<Value*, 4> args;
for (auto* param : func->Params()) {
if (auto* str = param->Type()->As<type::Struct>()) {
- utils::Vector<Value*, 4> construct_args;
+ Vector<Value*, 4> construct_args;
for (uint32_t i = 0; i < str->Members().Length(); i++) {
construct_args.Push(backend->GetInput(builder, input_idx++));
}
diff --git a/src/tint/lang/core/ir/transform/shader_io.h b/src/tint/lang/core/ir/transform/shader_io.h
index 00f6322..46e9018 100644
--- a/src/tint/lang/core/ir/transform/shader_io.h
+++ b/src/tint/lang/core/ir/transform/shader_io.h
@@ -26,7 +26,7 @@
/// ShaderIO is a transform that modifies an entry point function's parameters and return value to
/// prepare them for backend codegen.
-class ShaderIO : public utils::Castable<ShaderIO, Transform> {
+class ShaderIO : public Castable<ShaderIO, Transform> {
public:
/// Constructor
ShaderIO();
@@ -68,7 +68,7 @@
/// Finalize the shader inputs and create any state needed for the new entry point function.
/// @returns the list of function parameters for the new entry point
- virtual utils::Vector<FunctionParam*, 4> FinalizeInputs() = 0;
+ virtual Vector<FunctionParam*, 4> FinalizeInputs() = 0;
/// Finalize the shader outputs and create state needed for the new entry point function.
/// @returns the return value for the new entry point
@@ -100,10 +100,10 @@
Function* func = nullptr;
/// The list of shader inputs.
- utils::Vector<type::Manager::StructMemberDesc, 4> inputs;
+ Vector<type::Manager::StructMemberDesc, 4> inputs;
/// The list of shader outputs.
- utils::Vector<type::Manager::StructMemberDesc, 4> outputs;
+ Vector<type::Manager::StructMemberDesc, 4> outputs;
};
protected:
diff --git a/src/tint/lang/core/ir/transform/shader_io_spirv.cc b/src/tint/lang/core/ir/transform/shader_io_spirv.cc
index d22722c..e4fbc97 100644
--- a/src/tint/lang/core/ir/transform/shader_io_spirv.cc
+++ b/src/tint/lang/core/ir/transform/shader_io_spirv.cc
@@ -50,9 +50,9 @@
/// The global variable for output locations.
Var* location_output_var = nullptr;
/// The member indices for inputs.
- utils::Vector<uint32_t, 4> input_indices;
+ Vector<uint32_t, 4> input_indices;
/// The member indices for outputs.
- utils::Vector<uint32_t, 4> output_indices;
+ Vector<uint32_t, 4> output_indices;
/// Constructor
/// @copydoc ShaderIO::BackendState::BackendState
@@ -71,16 +71,16 @@
/// @param name_suffix the suffix to add to struct and variable names
void MakeStructs(Var*& builtin_var,
Var*& location_var,
- utils::Vector<uint32_t, 4>* indices,
- utils::Vector<type::Manager::StructMemberDesc, 4>& entries,
+ Vector<uint32_t, 4>* indices,
+ Vector<type::Manager::StructMemberDesc, 4>& entries,
builtin::AddressSpace addrspace,
builtin::Access access,
const char* name_suffix) {
// Build separate lists of builtin and location entries and record their new indices.
uint32_t next_builtin_idx = 0;
uint32_t next_location_idx = 0;
- utils::Vector<type::Manager::StructMemberDesc, 4> builtin_members;
- utils::Vector<type::Manager::StructMemberDesc, 4> location_members;
+ Vector<type::Manager::StructMemberDesc, 4> builtin_members;
+ Vector<type::Manager::StructMemberDesc, 4> location_members;
for (auto io : entries) {
if (io.attributes.builtin) {
// SampleMask must be an array for Vulkan.
@@ -113,10 +113,10 @@
}
/// @copydoc ShaderIO::BackendState::FinalizeInputs
- utils::Vector<FunctionParam*, 4> FinalizeInputs() override {
+ Vector<FunctionParam*, 4> FinalizeInputs() override {
MakeStructs(builtin_input_var, location_input_var, &input_indices, inputs,
builtin::AddressSpace::kIn, builtin::Access::kRead, "Inputs");
- return utils::Empty;
+ return tint::Empty;
}
/// @copydoc ShaderIO::BackendState::FinalizeOutputs
diff --git a/src/tint/lang/core/ir/transform/shader_io_spirv.h b/src/tint/lang/core/ir/transform/shader_io_spirv.h
index 8b3eea6..017b09c 100644
--- a/src/tint/lang/core/ir/transform/shader_io_spirv.h
+++ b/src/tint/lang/core/ir/transform/shader_io_spirv.h
@@ -22,7 +22,7 @@
namespace tint::ir::transform {
/// ShaderIOSpirv is the subclass of the ShaderIO transform used for the SPIR-V backend.
-class ShaderIOSpirv final : public utils::Castable<ShaderIOSpirv, ShaderIO> {
+class ShaderIOSpirv final : public Castable<ShaderIOSpirv, ShaderIO> {
public:
/// Constructor
ShaderIOSpirv();
diff --git a/src/tint/lang/core/ir/transform/transform.h b/src/tint/lang/core/ir/transform/transform.h
index 3bebd63..a88cec2 100644
--- a/src/tint/lang/core/ir/transform/transform.h
+++ b/src/tint/lang/core/ir/transform/transform.h
@@ -28,7 +28,7 @@
namespace tint::ir::transform {
/// Interface for IR Module transforms.
-class Transform : public utils::Castable<Transform> {
+class Transform : public Castable<Transform> {
public:
/// Constructor
Transform();
diff --git a/src/tint/lang/core/ir/transform/var_for_dynamic_index.cc b/src/tint/lang/core/ir/transform/var_for_dynamic_index.cc
index 18ab18f..f8390dd 100644
--- a/src/tint/lang/core/ir/transform/var_for_dynamic_index.cc
+++ b/src/tint/lang/core/ir/transform/var_for_dynamic_index.cc
@@ -49,12 +49,12 @@
// The base object.
Value* base = nullptr;
// The list of constant indices to get from the base to the source object.
- utils::Vector<Value*, 4> indices;
+ Vector<Value*, 4> indices;
- // A specialization of utils::Hasher for PartialAccess.
+ // A specialization of Hasher for PartialAccess.
struct Hasher {
inline std::size_t operator()(const PartialAccess& src) const {
- return utils::Hash(src.base, src.indices);
+ return Hash(src.base, src.indices);
}
};
@@ -120,7 +120,7 @@
ir::Builder builder(*ir);
// Find the access instructions that need replacing.
- utils::Vector<AccessToReplace, 4> worklist;
+ Vector<AccessToReplace, 4> worklist;
for (auto* inst : ir->instructions.Objects()) {
if (auto* access = inst->As<Access>()) {
if (auto to_replace = ShouldReplace(access)) {
@@ -130,8 +130,8 @@
}
// Replace each access instruction that we recorded.
- utils::Hashmap<Value*, Value*, 4> object_to_local;
- utils::Hashmap<PartialAccess, Value*, 4, PartialAccess::Hasher> source_object_to_value;
+ Hashmap<Value*, Value*, 4> object_to_local;
+ Hashmap<PartialAccess, Value*, 4, PartialAccess::Hasher> source_object_to_value;
for (const auto& to_replace : worklist) {
auto* access = to_replace.access;
auto* source_object = access->Object();
@@ -160,7 +160,7 @@
});
// Create a new access instruction using the local variable as the source.
- utils::Vector<Value*, 4> indices{access->Indices().Offset(to_replace.first_dynamic_index)};
+ Vector<Value*, 4> indices{access->Indices().Offset(to_replace.first_dynamic_index)};
const type::Type* access_type = access->Result()->Type();
Value* vector_index = nullptr;
if (to_replace.vector_access_type) {
diff --git a/src/tint/lang/core/ir/transform/var_for_dynamic_index.h b/src/tint/lang/core/ir/transform/var_for_dynamic_index.h
index f70d540..03837e3 100644
--- a/src/tint/lang/core/ir/transform/var_for_dynamic_index.h
+++ b/src/tint/lang/core/ir/transform/var_for_dynamic_index.h
@@ -23,7 +23,7 @@
/// indexed to a temporary local `var` before performing the index. This transform is used by the
/// SPIR-V writer as there is no SPIR-V instruction that can dynamically index a non-pointer
/// composite.
-class VarForDynamicIndex final : public utils::Castable<VarForDynamicIndex, Transform> {
+class VarForDynamicIndex final : public Castable<VarForDynamicIndex, Transform> {
public:
/// Constructor
VarForDynamicIndex();
diff --git a/src/tint/lang/core/ir/unary.h b/src/tint/lang/core/ir/unary.h
index 0489f7e..14dfd72 100644
--- a/src/tint/lang/core/ir/unary.h
+++ b/src/tint/lang/core/ir/unary.h
@@ -21,7 +21,7 @@
namespace tint::ir {
/// A unary instruction in the IR.
-class Unary : public utils::Castable<Unary, OperandInstruction<1, 1>> {
+class Unary : public Castable<Unary, OperandInstruction<1, 1>> {
public:
/// The offset in Operands() for the value
static constexpr size_t kValueOperandOffset = 0;
diff --git a/src/tint/lang/core/ir/unreachable.h b/src/tint/lang/core/ir/unreachable.h
index 81c9020..2d417ae 100644
--- a/src/tint/lang/core/ir/unreachable.h
+++ b/src/tint/lang/core/ir/unreachable.h
@@ -20,7 +20,7 @@
namespace tint::ir {
/// An unreachable instruction in the IR.
-class Unreachable : public utils::Castable<Unreachable, Terminator> {
+class Unreachable : public Castable<Unreachable, Terminator> {
public:
~Unreachable() override;
diff --git a/src/tint/lang/core/ir/user_call.cc b/src/tint/lang/core/ir/user_call.cc
index 4bd8d83..01e7f91 100644
--- a/src/tint/lang/core/ir/user_call.cc
+++ b/src/tint/lang/core/ir/user_call.cc
@@ -22,7 +22,7 @@
namespace tint::ir {
-UserCall::UserCall(InstructionResult* result, Function* func, utils::VectorRef<Value*> arguments) {
+UserCall::UserCall(InstructionResult* result, Function* func, VectorRef<Value*> arguments) {
AddOperand(UserCall::kFunctionOperandOffset, func);
AddOperands(UserCall::kArgsOperandOffset, std::move(arguments));
AddResult(result);
diff --git a/src/tint/lang/core/ir/user_call.h b/src/tint/lang/core/ir/user_call.h
index 9638bb7..eb0c4f3 100644
--- a/src/tint/lang/core/ir/user_call.h
+++ b/src/tint/lang/core/ir/user_call.h
@@ -22,7 +22,7 @@
namespace tint::ir {
/// A user call instruction in the IR.
-class UserCall : public utils::Castable<UserCall, Call> {
+class UserCall : public Castable<UserCall, Call> {
public:
/// The offset in Operands() for the function being called
static constexpr size_t kFunctionOperandOffset = 0;
@@ -34,11 +34,11 @@
/// @param result the result value
/// @param func the function being called
/// @param args the function arguments
- UserCall(InstructionResult* result, Function* func, utils::VectorRef<Value*> args);
+ UserCall(InstructionResult* result, Function* func, VectorRef<Value*> args);
~UserCall() override;
/// @returns the call arguments
- utils::Slice<Value*> Args() override { return operands_.Slice().Offset(kArgsOperandOffset); }
+ tint::Slice<Value*> Args() override { return operands_.Slice().Offset(kArgsOperandOffset); }
/// @returns the called function name
Function* Func() { return operands_[kFunctionOperandOffset]->As<ir::Function>(); }
diff --git a/src/tint/lang/core/ir/user_call_test.cc b/src/tint/lang/core/ir/user_call_test.cc
index 4f41efa..b216390 100644
--- a/src/tint/lang/core/ir/user_call_test.cc
+++ b/src/tint/lang/core/ir/user_call_test.cc
@@ -28,7 +28,7 @@
auto* func = b.Function("myfunc", mod.Types().void_());
auto* arg1 = b.Constant(1_u);
auto* arg2 = b.Constant(2_u);
- auto* e = b.Call(mod.Types().void_(), func, utils::Vector{arg1, arg2});
+ auto* e = b.Call(mod.Types().void_(), func, Vector{arg1, arg2});
EXPECT_THAT(func->Usages(), testing::UnorderedElementsAre(Usage{e, 0u}));
EXPECT_THAT(arg1->Usages(), testing::UnorderedElementsAre(Usage{e, 1u}));
EXPECT_THAT(arg2->Usages(), testing::UnorderedElementsAre(Usage{e, 2u}));
@@ -38,7 +38,7 @@
auto* func = b.Function("myfunc", mod.Types().void_());
auto* arg1 = b.Constant(1_u);
auto* arg2 = b.Constant(2_u);
- auto* e = b.Call(mod.Types().void_(), func, utils::Vector{arg1, arg2});
+ auto* e = b.Call(mod.Types().void_(), func, Vector{arg1, arg2});
EXPECT_TRUE(e->HasResults());
EXPECT_FALSE(e->HasMultiResults());
diff --git a/src/tint/lang/core/ir/validator.cc b/src/tint/lang/core/ir/validator.cc
index ddda53f..af87a08 100644
--- a/src/tint/lang/core/ir/validator.cc
+++ b/src/tint/lang/core/ir/validator.cc
@@ -71,7 +71,7 @@
mod_.disassembly_file = std::make_unique<Source::File>("", dis_.Disassemble());
}
-utils::Result<utils::SuccessType, diag::List> Validator::IsValid() {
+Result<SuccessType, diag::List> Validator::IsValid() {
CheckRootBlock(mod_.root_block);
for (auto* func : mod_.functions) {
@@ -84,7 +84,7 @@
"# Disassembly\n" + mod_.disassembly_file->content.data, {});
return std::move(diagnostics_);
}
- return utils::Success;
+ return Success;
}
std::string Validator::InstError(Instruction* inst, std::string err) {
@@ -521,7 +521,7 @@
void Validator::CheckControlsAllowingIf(Exit* exit, Instruction* control) {
bool found = false;
- for (auto ctrl : utils::Reverse(control_stack_)) {
+ for (auto ctrl : tint::Reverse(control_stack_)) {
if (ctrl == control) {
found = true;
break;
@@ -621,7 +621,7 @@
return nullptr;
}
-utils::Result<utils::SuccessType, diag::List> Validate(Module& mod) {
+Result<SuccessType, diag::List> Validate(Module& mod) {
Validator v(mod);
return v.IsValid();
}
diff --git a/src/tint/lang/core/ir/validator.h b/src/tint/lang/core/ir/validator.h
index d0698c5..80af5e9 100644
--- a/src/tint/lang/core/ir/validator.h
+++ b/src/tint/lang/core/ir/validator.h
@@ -40,7 +40,7 @@
/// Validates that a given IR module is correctly formed
/// @param mod the module to validate
/// @returns true on success, an error result otherwise
-utils::Result<utils::SuccessType, diag::List> Validate(Module& mod);
+Result<SuccessType, diag::List> Validate(Module& mod);
/// The core IR validator.
class Validator {
@@ -55,7 +55,7 @@
/// Runs the validator over the module provided during construction
/// @returns the results of validation, either a success result object or the diagnostics of
/// validation failures.
- utils::Result<utils::SuccessType, diag::List> IsValid();
+ Result<SuccessType, diag::List> IsValid();
protected:
/// @param inst the instruction
@@ -230,8 +230,8 @@
Disassembler dis_{mod_};
Block* current_block_ = nullptr;
- utils::Hashset<Function*, 4> seen_functions_;
- utils::Vector<ControlInstruction*, 8> control_stack_;
+ Hashset<Function*, 4> seen_functions_;
+ Vector<ControlInstruction*, 8> control_stack_;
void DisassembleIfNeeded();
};
diff --git a/src/tint/lang/core/ir/validator_test.cc b/src/tint/lang/core/ir/validator_test.cc
index 6701b74..69f526d 100644
--- a/src/tint/lang/core/ir/validator_test.cc
+++ b/src/tint/lang/core/ir/validator_test.cc
@@ -703,7 +703,7 @@
if_->True()->Append(b.Return(f));
if_->False()->Append(b.Return(f));
- if_->SetResults(utils::Vector<InstructionResult*, 1>{nullptr});
+ if_->SetResults(Vector<InstructionResult*, 1>{nullptr});
f->Block()->Append(if_);
f->Block()->Append(b.Return(f));
@@ -953,7 +953,7 @@
v->Destroy();
v->InsertBefore(ret);
- auto addr = utils::ToString(v);
+ auto addr = tint::ToString(v);
auto arrows = std::string(addr.length(), '^');
std::string expected = R"(:3:5 error: var: destroyed instruction found in instruction list
@@ -973,8 +973,8 @@
}
)";
- expected = utils::ReplaceAll(expected, "$ADDRESS", addr);
- expected = utils::ReplaceAll(expected, "$ARROWS", arrows);
+ expected = tint::ReplaceAll(expected, "$ADDRESS", addr);
+ expected = tint::ReplaceAll(expected, "$ARROWS", arrows);
auto res = ir::Validate(mod);
ASSERT_FALSE(res);
@@ -1294,7 +1294,7 @@
auto* r1 = b.InstructionResult(ty.i32());
auto* r2 = b.InstructionResult(ty.f32());
- if_->SetResults(utils::Vector{r1, r2});
+ if_->SetResults(Vector{r1, r2});
auto* f = b.Function("my_func", ty.void_());
auto sb = b.Append(f->Block());
@@ -1338,7 +1338,7 @@
auto* r1 = b.InstructionResult(ty.i32());
auto* r2 = b.InstructionResult(ty.f32());
- if_->SetResults(utils::Vector{r1, r2});
+ if_->SetResults(Vector{r1, r2});
auto* f = b.Function("my_func", ty.void_());
auto sb = b.Append(f->Block());
@@ -1382,7 +1382,7 @@
auto* r1 = b.InstructionResult(ty.i32());
auto* r2 = b.InstructionResult(ty.f32());
- if_->SetResults(utils::Vector{r1, r2});
+ if_->SetResults(Vector{r1, r2});
auto* f = b.Function("my_func", ty.void_());
auto sb = b.Append(f->Block());
@@ -1399,7 +1399,7 @@
auto* r1 = b.InstructionResult(ty.i32());
auto* r2 = b.InstructionResult(ty.f32());
- if_->SetResults(utils::Vector{r1, r2});
+ if_->SetResults(Vector{r1, r2});
auto* f = b.Function("my_func", ty.void_());
auto sb = b.Append(f->Block());
@@ -1684,7 +1684,7 @@
auto* r1 = b.InstructionResult(ty.i32());
auto* r2 = b.InstructionResult(ty.f32());
- switch_->SetResults(utils::Vector{r1, r2});
+ switch_->SetResults(Vector{r1, r2});
auto* def = b.Case(switch_, {Switch::CaseSelector{}});
def->Append(b.ExitSwitch(switch_, 1_i));
@@ -1728,7 +1728,7 @@
auto* switch_ = b.Switch(true);
auto* r1 = b.InstructionResult(ty.i32());
auto* r2 = b.InstructionResult(ty.f32());
- switch_->SetResults(utils::Vector{r1, r2});
+ switch_->SetResults(Vector{r1, r2});
auto* def = b.Case(switch_, {Switch::CaseSelector{}});
def->Append(b.ExitSwitch(switch_, 1_i, 2_f, 3_i));
@@ -1772,7 +1772,7 @@
auto* switch_ = b.Switch(true);
auto* r1 = b.InstructionResult(ty.i32());
auto* r2 = b.InstructionResult(ty.f32());
- switch_->SetResults(utils::Vector{r1, r2});
+ switch_->SetResults(Vector{r1, r2});
auto* def = b.Case(switch_, {Switch::CaseSelector{}});
def->Append(b.ExitSwitch(switch_, 1_i, 2_f));
@@ -1790,7 +1790,7 @@
auto* switch_ = b.Switch(true);
auto* r1 = b.InstructionResult(ty.i32());
auto* r2 = b.InstructionResult(ty.f32());
- switch_->SetResults(utils::Vector{r1, r2});
+ switch_->SetResults(Vector{r1, r2});
auto* def = b.Case(switch_, {Switch::CaseSelector{}});
def->Append(b.ExitSwitch(switch_, 1_i, 2_i));
@@ -2067,7 +2067,7 @@
auto* loop = b.Loop();
auto* r1 = b.InstructionResult(ty.i32());
auto* r2 = b.InstructionResult(ty.f32());
- loop->SetResults(utils::Vector{r1, r2});
+ loop->SetResults(Vector{r1, r2});
loop->Continuing()->Append(b.NextIteration(loop));
loop->Body()->Append(b.ExitLoop(loop, 1_i));
@@ -2114,7 +2114,7 @@
auto* loop = b.Loop();
auto* r1 = b.InstructionResult(ty.i32());
auto* r2 = b.InstructionResult(ty.f32());
- loop->SetResults(utils::Vector{r1, r2});
+ loop->SetResults(Vector{r1, r2});
loop->Continuing()->Append(b.NextIteration(loop));
loop->Body()->Append(b.ExitLoop(loop, 1_i, 2_f, 3_i));
@@ -2161,7 +2161,7 @@
auto* loop = b.Loop();
auto* r1 = b.InstructionResult(ty.i32());
auto* r2 = b.InstructionResult(ty.f32());
- loop->SetResults(utils::Vector{r1, r2});
+ loop->SetResults(Vector{r1, r2});
loop->Continuing()->Append(b.NextIteration(loop));
loop->Body()->Append(b.ExitLoop(loop, 1_i, 2_f));
@@ -2179,7 +2179,7 @@
auto* loop = b.Loop();
auto* r1 = b.InstructionResult(ty.i32());
auto* r2 = b.InstructionResult(ty.f32());
- loop->SetResults(utils::Vector{r1, r2});
+ loop->SetResults(Vector{r1, r2});
loop->Continuing()->Append(b.NextIteration(loop));
loop->Body()->Append(b.ExitLoop(loop, 1_i, 2_i));
diff --git a/src/tint/lang/core/ir/value.h b/src/tint/lang/core/ir/value.h
index bc4c79d..2c7516a 100644
--- a/src/tint/lang/core/ir/value.h
+++ b/src/tint/lang/core/ir/value.h
@@ -33,12 +33,12 @@
/// The index of the operand that is the value being used.
size_t operand_index = 0u;
- /// A specialization of utils::Hasher for Usage.
+ /// A specialization of Hasher for Usage.
struct Hasher {
/// @param u the usage to hash
/// @returns a hash of the usage
inline std::size_t operator()(const Usage& u) const {
- return utils::Hash(u.instruction, u.operand_index);
+ return Hash(u.instruction, u.operand_index);
}
};
@@ -51,7 +51,7 @@
};
/// Value in the IR.
-class Value : public utils::Castable<Value> {
+class Value : public Castable<Value> {
public:
/// Destructor
~Value() override;
@@ -76,7 +76,7 @@
/// @returns the set of usages of this value. An instruction may appear multiple times if it
/// uses the value for multiple different operands.
- const utils::Hashset<Usage, 4, Usage::Hasher>& Usages() { return uses_; }
+ const Hashset<Usage, 4, Usage::Hasher>& Usages() { return uses_; }
/// Replace all uses of the value.
/// @param replacer a function which returns a replacement for a given use
@@ -97,10 +97,10 @@
kDead,
};
- utils::Hashset<Usage, 4, Usage::Hasher> uses_;
+ Hashset<Usage, 4, Usage::Hasher> uses_;
/// Bitset of value flags
- utils::EnumSet<Flag> flags_;
+ tint::EnumSet<Flag> flags_;
};
} // namespace tint::ir
diff --git a/src/tint/lang/core/ir/var.h b/src/tint/lang/core/ir/var.h
index efe3b69..215c206 100644
--- a/src/tint/lang/core/ir/var.h
+++ b/src/tint/lang/core/ir/var.h
@@ -26,7 +26,7 @@
namespace tint::ir {
/// A var instruction in the IR.
-class Var : public utils::Castable<Var, OperandInstruction<1, 1>> {
+class Var : public Castable<Var, OperandInstruction<1, 1>> {
public:
/// The offset in Operands() for the initializer
static constexpr size_t kInitializerOperandOffset = 0;
diff --git a/src/tint/lang/core/type/abstract_float.cc b/src/tint/lang/core/type/abstract_float.cc
index a6c08e7..89791c4 100644
--- a/src/tint/lang/core/type/abstract_float.cc
+++ b/src/tint/lang/core/type/abstract_float.cc
@@ -21,8 +21,7 @@
namespace tint::type {
-AbstractFloat::AbstractFloat()
- : Base(utils::Hash(utils::TypeInfo::Of<AbstractFloat>().full_hashcode)) {}
+AbstractFloat::AbstractFloat() : Base(Hash(tint::TypeInfo::Of<AbstractFloat>().full_hashcode)) {}
AbstractFloat::~AbstractFloat() = default;
diff --git a/src/tint/lang/core/type/abstract_float.h b/src/tint/lang/core/type/abstract_float.h
index ef5a25e..857cf5e 100644
--- a/src/tint/lang/core/type/abstract_float.h
+++ b/src/tint/lang/core/type/abstract_float.h
@@ -23,7 +23,7 @@
/// An abstract-float type.
/// @see https://www.w3.org/TR/WGSL/#abstractFloat
-class AbstractFloat final : public utils::Castable<AbstractFloat, AbstractNumeric> {
+class AbstractFloat final : public Castable<AbstractFloat, AbstractNumeric> {
public:
/// Constructor
AbstractFloat();
diff --git a/src/tint/lang/core/type/abstract_int.cc b/src/tint/lang/core/type/abstract_int.cc
index d7023cf..ed2abe1 100644
--- a/src/tint/lang/core/type/abstract_int.cc
+++ b/src/tint/lang/core/type/abstract_int.cc
@@ -21,7 +21,7 @@
namespace tint::type {
-AbstractInt::AbstractInt() : Base(utils::Hash(utils::TypeInfo::Of<AbstractInt>().full_hashcode)) {}
+AbstractInt::AbstractInt() : Base(Hash(tint::TypeInfo::Of<AbstractInt>().full_hashcode)) {}
AbstractInt::~AbstractInt() = default;
diff --git a/src/tint/lang/core/type/abstract_int.h b/src/tint/lang/core/type/abstract_int.h
index de1ef44..71da42c 100644
--- a/src/tint/lang/core/type/abstract_int.h
+++ b/src/tint/lang/core/type/abstract_int.h
@@ -23,7 +23,7 @@
/// An abstract-int type.
/// @see https://www.w3.org/TR/WGSL/#abstractint
-class AbstractInt final : public utils::Castable<AbstractInt, AbstractNumeric> {
+class AbstractInt final : public Castable<AbstractInt, AbstractNumeric> {
public:
/// Constructor
AbstractInt();
diff --git a/src/tint/lang/core/type/abstract_numeric.h b/src/tint/lang/core/type/abstract_numeric.h
index 6a1ee93..7a7670a 100644
--- a/src/tint/lang/core/type/abstract_numeric.h
+++ b/src/tint/lang/core/type/abstract_numeric.h
@@ -23,7 +23,7 @@
/// The base class for abstract-int and abstract-float types.
/// @see https://www.w3.org/TR/WGSL/#types-for-creation-time-constants
-class AbstractNumeric : public utils::Castable<AbstractNumeric, NumericScalar> {
+class AbstractNumeric : public Castable<AbstractNumeric, NumericScalar> {
public:
/// Constructor
/// @param hash the unique hash of the node
diff --git a/src/tint/lang/core/type/array.cc b/src/tint/lang/core/type/array.cc
index e0bcfee..4d2d81c 100644
--- a/src/tint/lang/core/type/array.cc
+++ b/src/tint/lang/core/type/array.cc
@@ -60,7 +60,7 @@
uint32_t size,
uint32_t stride,
uint32_t implicit_stride)
- : Base(utils::Hash(utils::TypeInfo::Of<Array>().full_hashcode, count, align, size, stride),
+ : Base(Hash(tint::TypeInfo::Of<Array>().full_hashcode, count, align, size, stride),
FlagsFrom(element, count)),
element_(element),
count_(count),
@@ -82,7 +82,7 @@
}
std::string Array::FriendlyName() const {
- utils::StringStream out;
+ StringStream out;
if (!IsStrideImplicit()) {
out << "@stride(" << stride_ << ") ";
}
diff --git a/src/tint/lang/core/type/array.h b/src/tint/lang/core/type/array.h
index 7fb972a..1eb09c9 100644
--- a/src/tint/lang/core/type/array.h
+++ b/src/tint/lang/core/type/array.h
@@ -28,7 +28,7 @@
namespace tint::type {
/// Array holds the type information for Array nodes.
-class Array final : public utils::Castable<Array, Type> {
+class Array final : public Castable<Array, Type> {
public:
/// An error message string stating that the array count was expected to be a constant
/// expression. Used by multiple writers and transforms.
diff --git a/src/tint/lang/core/type/array_count.cc b/src/tint/lang/core/type/array_count.cc
index c39d2e5..3d6dc76 100644
--- a/src/tint/lang/core/type/array_count.cc
+++ b/src/tint/lang/core/type/array_count.cc
@@ -26,7 +26,7 @@
ArrayCount::~ArrayCount() = default;
ConstantArrayCount::ConstantArrayCount(uint32_t val)
- : Base(static_cast<size_t>(utils::TypeInfo::Of<ConstantArrayCount>().full_hashcode)),
+ : Base(static_cast<size_t>(tint::TypeInfo::Of<ConstantArrayCount>().full_hashcode)),
value(val) {}
ConstantArrayCount::~ConstantArrayCount() = default;
@@ -46,7 +46,7 @@
}
RuntimeArrayCount::RuntimeArrayCount()
- : Base(static_cast<size_t>(utils::TypeInfo::Of<RuntimeArrayCount>().full_hashcode)) {}
+ : Base(static_cast<size_t>(tint::TypeInfo::Of<RuntimeArrayCount>().full_hashcode)) {}
RuntimeArrayCount::~RuntimeArrayCount() = default;
bool RuntimeArrayCount::Equals(const UniqueNode& other) const {
diff --git a/src/tint/lang/core/type/array_count.h b/src/tint/lang/core/type/array_count.h
index 85875b1..17cd5c4 100644
--- a/src/tint/lang/core/type/array_count.h
+++ b/src/tint/lang/core/type/array_count.h
@@ -25,7 +25,7 @@
namespace tint::type {
/// An array count
-class ArrayCount : public utils::Castable<ArrayCount, UniqueNode> {
+class ArrayCount : public Castable<ArrayCount, UniqueNode> {
public:
~ArrayCount() override;
@@ -48,7 +48,7 @@
/// const N = 123;
/// type arr = array<i32, N>
/// ```
-class ConstantArrayCount final : public utils::Castable<ConstantArrayCount, ArrayCount> {
+class ConstantArrayCount final : public Castable<ConstantArrayCount, ArrayCount> {
public:
/// Constructor
/// @param val the constant-expression value
@@ -75,7 +75,7 @@
/// ```
/// type arr = array<i32>
/// ```
-class RuntimeArrayCount final : public utils::Castable<RuntimeArrayCount, ArrayCount> {
+class RuntimeArrayCount final : public Castable<RuntimeArrayCount, ArrayCount> {
public:
/// Constructor
RuntimeArrayCount();
diff --git a/src/tint/lang/core/type/atomic.cc b/src/tint/lang/core/type/atomic.cc
index 10017aa..1ab17f4 100644
--- a/src/tint/lang/core/type/atomic.cc
+++ b/src/tint/lang/core/type/atomic.cc
@@ -26,7 +26,7 @@
namespace tint::type {
Atomic::Atomic(const type::Type* subtype)
- : Base(utils::Hash(utils::TypeInfo::Of<Atomic>().full_hashcode, subtype),
+ : Base(Hash(tint::TypeInfo::Of<Atomic>().full_hashcode, subtype),
type::Flags{
Flag::kCreationFixedFootprint,
Flag::kFixedFootprint,
@@ -43,7 +43,7 @@
}
std::string Atomic::FriendlyName() const {
- utils::StringStream out;
+ StringStream out;
out << "atomic<" << subtype_->FriendlyName() << ">";
return out.str();
}
diff --git a/src/tint/lang/core/type/atomic.h b/src/tint/lang/core/type/atomic.h
index 3f026da..4680b45 100644
--- a/src/tint/lang/core/type/atomic.h
+++ b/src/tint/lang/core/type/atomic.h
@@ -22,7 +22,7 @@
namespace tint::type {
/// A atomic type.
-class Atomic final : public utils::Castable<Atomic, Type> {
+class Atomic final : public Castable<Atomic, Type> {
public:
/// Constructor
/// @param subtype the atomic type
diff --git a/src/tint/lang/core/type/bool.cc b/src/tint/lang/core/type/bool.cc
index d9df31d..0c937a4 100644
--- a/src/tint/lang/core/type/bool.cc
+++ b/src/tint/lang/core/type/bool.cc
@@ -21,7 +21,7 @@
namespace tint::type {
Bool::Bool()
- : Base(static_cast<size_t>(utils::TypeInfo::Of<Bool>().full_hashcode),
+ : Base(static_cast<size_t>(tint::TypeInfo::Of<Bool>().full_hashcode),
type::Flags{
Flag::kConstructable,
Flag::kCreationFixedFootprint,
diff --git a/src/tint/lang/core/type/bool.h b/src/tint/lang/core/type/bool.h
index d1cbea5..2a96db1 100644
--- a/src/tint/lang/core/type/bool.h
+++ b/src/tint/lang/core/type/bool.h
@@ -28,7 +28,7 @@
namespace tint::type {
/// A boolean type
-class Bool final : public utils::Castable<Bool, Scalar> {
+class Bool final : public Castable<Bool, Scalar> {
public:
/// Constructor
Bool();
diff --git a/src/tint/lang/core/type/builtin_structs.cc b/src/tint/lang/core/type/builtin_structs.cc
index fde6d11..c3d381e 100644
--- a/src/tint/lang/core/type/builtin_structs.cc
+++ b/src/tint/lang/core/type/builtin_structs.cc
@@ -51,7 +51,7 @@
};
Struct* CreateModfResult(Manager& types, SymbolTable& symbols, const Type* ty) {
auto build = [&](builtin::Builtin name, const Type* t) {
- return types.Struct(symbols.Register(utils::ToString(name)),
+ return types.Struct(symbols.Register(tint::ToString(name)),
{{symbols.Register("fract"), t}, {symbols.Register("whole"), t}});
};
return Switch(
@@ -60,7 +60,7 @@
[&](const F16*) { return build(builtin::Builtin::kModfResultF16, ty); },
[&](const AbstractFloat*) {
auto* abstract = build(builtin::Builtin::kModfResultAbstract, ty);
- abstract->SetConcreteTypes(utils::Vector{
+ abstract->SetConcreteTypes(tint::Vector{
build(builtin::Builtin::kModfResultF32, types.f32()),
build(builtin::Builtin::kModfResultF16, types.f16()),
});
@@ -74,7 +74,7 @@
[&](const F16*) { return build(kModfVecF16Names[width - 2], vec); },
[&](const AbstractFloat*) {
auto* abstract = build(kModfVecAbstractNames[width - 2], vec);
- abstract->SetConcreteTypes(utils::Vector{
+ abstract->SetConcreteTypes(tint::Vector{
build(kModfVecF32Names[width - 2], types.vec(types.f32(), width)),
build(kModfVecF16Names[width - 2], types.vec(types.f16(), width)),
});
@@ -109,7 +109,7 @@
Struct* CreateFrexpResult(Manager& types, SymbolTable& symbols, const Type* ty) {
auto build = [&](builtin::Builtin name, const Type* fract_ty, const Type* exp_ty) {
return types.Struct(
- symbols.Register(utils::ToString(name)),
+ symbols.Register(tint::ToString(name)),
{{symbols.Register("fract"), fract_ty}, {symbols.Register("exp"), exp_ty}});
};
return Switch(
@@ -118,7 +118,7 @@
[&](const F16*) { return build(builtin::Builtin::kFrexpResultF16, ty, types.i32()); },
[&](const AbstractFloat*) {
auto* abstract = build(builtin::Builtin::kFrexpResultAbstract, ty, types.AInt());
- abstract->SetConcreteTypes(utils::Vector{
+ abstract->SetConcreteTypes(tint::Vector{
build(builtin::Builtin::kFrexpResultF32, types.f32(), types.i32()),
build(builtin::Builtin::kFrexpResultF16, types.f16(), types.i32()),
});
@@ -140,7 +140,7 @@
auto* vec_i32 = types.vec(types.i32(), width);
auto* vec_ai = types.vec(types.AInt(), width);
auto* abstract = build(kFrexpVecAbstractNames[width - 2], ty, vec_ai);
- abstract->SetConcreteTypes(utils::Vector{
+ abstract->SetConcreteTypes(tint::Vector{
build(kFrexpVecF32Names[width - 2], vec_f32, vec_i32),
build(kFrexpVecF16Names[width - 2], vec_f16, vec_i32),
});
@@ -159,7 +159,7 @@
Struct* CreateAtomicCompareExchangeResult(Manager& types, SymbolTable& symbols, const Type* ty) {
auto build = [&](builtin::Builtin name) {
- return types.Struct(symbols.Register(utils::ToString(name)),
+ return types.Struct(symbols.Register(tint::ToString(name)),
{
{symbols.Register("old_value"), ty},
{symbols.Register("exchanged"), types.bool_()},
diff --git a/src/tint/lang/core/type/depth_multisampled_texture.cc b/src/tint/lang/core/type/depth_multisampled_texture.cc
index 527c82e..386ff3d 100644
--- a/src/tint/lang/core/type/depth_multisampled_texture.cc
+++ b/src/tint/lang/core/type/depth_multisampled_texture.cc
@@ -33,7 +33,7 @@
} // namespace
DepthMultisampledTexture::DepthMultisampledTexture(TextureDimension dim)
- : Base(utils::Hash(utils::TypeInfo::Of<DepthMultisampledTexture>().full_hashcode, dim), dim) {
+ : Base(Hash(tint::TypeInfo::Of<DepthMultisampledTexture>().full_hashcode, dim), dim) {
TINT_ASSERT(Type, IsValidDepthDimension(dim));
}
@@ -47,7 +47,7 @@
}
std::string DepthMultisampledTexture::FriendlyName() const {
- utils::StringStream out;
+ StringStream out;
out << "texture_depth_multisampled_" << dim();
return out.str();
}
diff --git a/src/tint/lang/core/type/depth_multisampled_texture.h b/src/tint/lang/core/type/depth_multisampled_texture.h
index 2451e24..f5e1e35 100644
--- a/src/tint/lang/core/type/depth_multisampled_texture.h
+++ b/src/tint/lang/core/type/depth_multisampled_texture.h
@@ -23,7 +23,7 @@
namespace tint::type {
/// A multisampled depth texture type.
-class DepthMultisampledTexture final : public utils::Castable<DepthMultisampledTexture, Texture> {
+class DepthMultisampledTexture final : public Castable<DepthMultisampledTexture, Texture> {
public:
/// Constructor
/// @param dim the dimensionality of the texture
diff --git a/src/tint/lang/core/type/depth_texture.cc b/src/tint/lang/core/type/depth_texture.cc
index f19c2cc..f4f989a 100644
--- a/src/tint/lang/core/type/depth_texture.cc
+++ b/src/tint/lang/core/type/depth_texture.cc
@@ -34,7 +34,7 @@
} // namespace
DepthTexture::DepthTexture(TextureDimension dim)
- : Base(utils::Hash(utils::TypeInfo::Of<DepthTexture>().full_hashcode, dim), dim) {
+ : Base(Hash(tint::TypeInfo::Of<DepthTexture>().full_hashcode, dim), dim) {
TINT_ASSERT(Type, IsValidDepthDimension(dim));
}
@@ -48,7 +48,7 @@
}
std::string DepthTexture::FriendlyName() const {
- utils::StringStream out;
+ StringStream out;
out << "texture_depth_" << dim();
return out.str();
}
diff --git a/src/tint/lang/core/type/depth_texture.h b/src/tint/lang/core/type/depth_texture.h
index 4657b9d..92692ed 100644
--- a/src/tint/lang/core/type/depth_texture.h
+++ b/src/tint/lang/core/type/depth_texture.h
@@ -23,7 +23,7 @@
namespace tint::type {
/// A depth texture type.
-class DepthTexture final : public utils::Castable<DepthTexture, Texture> {
+class DepthTexture final : public Castable<DepthTexture, Texture> {
public:
/// Constructor
/// @param dim the dimensionality of the texture
diff --git a/src/tint/lang/core/type/external_texture.cc b/src/tint/lang/core/type/external_texture.cc
index bf39ec8..13e5d44 100644
--- a/src/tint/lang/core/type/external_texture.cc
+++ b/src/tint/lang/core/type/external_texture.cc
@@ -22,7 +22,7 @@
namespace tint::type {
ExternalTexture::ExternalTexture()
- : Base(static_cast<size_t>(utils::TypeInfo::Of<ExternalTexture>().full_hashcode),
+ : Base(static_cast<size_t>(tint::TypeInfo::Of<ExternalTexture>().full_hashcode),
TextureDimension::k2d) {}
ExternalTexture::~ExternalTexture() = default;
diff --git a/src/tint/lang/core/type/external_texture.h b/src/tint/lang/core/type/external_texture.h
index 62732fb..7f35697 100644
--- a/src/tint/lang/core/type/external_texture.h
+++ b/src/tint/lang/core/type/external_texture.h
@@ -22,7 +22,7 @@
namespace tint::type {
/// An external texture type
-class ExternalTexture final : public utils::Castable<ExternalTexture, Texture> {
+class ExternalTexture final : public Castable<ExternalTexture, Texture> {
public:
/// Constructor
ExternalTexture();
diff --git a/src/tint/lang/core/type/f16.cc b/src/tint/lang/core/type/f16.cc
index 3a46ad0..f14db5a 100644
--- a/src/tint/lang/core/type/f16.cc
+++ b/src/tint/lang/core/type/f16.cc
@@ -21,7 +21,7 @@
namespace tint::type {
F16::F16()
- : Base(static_cast<size_t>(utils::TypeInfo::Of<F16>().full_hashcode),
+ : Base(static_cast<size_t>(tint::TypeInfo::Of<F16>().full_hashcode),
type::Flags{
Flag::kConstructable,
Flag::kCreationFixedFootprint,
diff --git a/src/tint/lang/core/type/f16.h b/src/tint/lang/core/type/f16.h
index 9c575f3..4d310d8 100644
--- a/src/tint/lang/core/type/f16.h
+++ b/src/tint/lang/core/type/f16.h
@@ -22,7 +22,7 @@
namespace tint::type {
/// A float 16 type
-class F16 final : public utils::Castable<F16, NumericScalar> {
+class F16 final : public Castable<F16, NumericScalar> {
public:
/// Constructor
F16();
diff --git a/src/tint/lang/core/type/f32.cc b/src/tint/lang/core/type/f32.cc
index ad1ca68..2fb2693 100644
--- a/src/tint/lang/core/type/f32.cc
+++ b/src/tint/lang/core/type/f32.cc
@@ -21,7 +21,7 @@
namespace tint::type {
F32::F32()
- : Base(static_cast<size_t>(utils::TypeInfo::Of<F32>().full_hashcode),
+ : Base(static_cast<size_t>(tint::TypeInfo::Of<F32>().full_hashcode),
type::Flags{
Flag::kConstructable,
Flag::kCreationFixedFootprint,
diff --git a/src/tint/lang/core/type/f32.h b/src/tint/lang/core/type/f32.h
index 28e476f..3c7f730 100644
--- a/src/tint/lang/core/type/f32.h
+++ b/src/tint/lang/core/type/f32.h
@@ -22,7 +22,7 @@
namespace tint::type {
/// A float 32 type
-class F32 final : public utils::Castable<F32, NumericScalar> {
+class F32 final : public Castable<F32, NumericScalar> {
public:
/// Constructor
F32();
diff --git a/src/tint/lang/core/type/i32.cc b/src/tint/lang/core/type/i32.cc
index 1d3a545..ceb53de 100644
--- a/src/tint/lang/core/type/i32.cc
+++ b/src/tint/lang/core/type/i32.cc
@@ -21,7 +21,7 @@
namespace tint::type {
I32::I32()
- : Base(static_cast<size_t>(utils::TypeInfo::Of<I32>().full_hashcode),
+ : Base(static_cast<size_t>(tint::TypeInfo::Of<I32>().full_hashcode),
type::Flags{
Flag::kConstructable,
Flag::kCreationFixedFootprint,
diff --git a/src/tint/lang/core/type/i32.h b/src/tint/lang/core/type/i32.h
index 59a8783..fae89d5 100644
--- a/src/tint/lang/core/type/i32.h
+++ b/src/tint/lang/core/type/i32.h
@@ -22,7 +22,7 @@
namespace tint::type {
/// A signed int 32 type.
-class I32 final : public utils::Castable<I32, NumericScalar> {
+class I32 final : public Castable<I32, NumericScalar> {
public:
/// Constructor
I32();
diff --git a/src/tint/lang/core/type/manager.cc b/src/tint/lang/core/type/manager.cc
index 3d8a051..e624a3c 100644
--- a/src/tint/lang/core/type/manager.cc
+++ b/src/tint/lang/core/type/manager.cc
@@ -139,7 +139,7 @@
const type::Array* Manager::array(const type::Type* elem_ty,
uint32_t count,
uint32_t stride /* = 0*/) {
- uint32_t implicit_stride = utils::RoundUp(elem_ty->Align(), elem_ty->Size());
+ uint32_t implicit_stride = tint::RoundUp(elem_ty->Align(), elem_ty->Size());
if (stride == 0) {
stride = implicit_stride;
}
@@ -172,20 +172,20 @@
return Get<type::Pointer>(address_space, subtype, access);
}
-type::Struct* Manager::Struct(Symbol name, utils::VectorRef<StructMemberDesc> md) {
- utils::Vector<const type::StructMember*, 4> members;
+type::Struct* Manager::Struct(Symbol name, VectorRef<StructMemberDesc> md) {
+ tint::Vector<const type::StructMember*, 4> members;
uint32_t current_size = 0u;
uint32_t max_align = 0u;
for (const auto& m : md) {
uint32_t index = static_cast<uint32_t>(members.Length());
uint32_t align = std::max<uint32_t>(m.type->Align(), 1u);
- uint32_t offset = utils::RoundUp(align, current_size);
+ uint32_t offset = tint::RoundUp(align, current_size);
members.Push(Get<type::StructMember>(m.name, m.type, index, offset, align, m.type->Size(),
std::move(m.attributes)));
current_size = offset + m.type->Size();
max_align = std::max(max_align, align);
}
- return Get<type::Struct>(name, members, max_align, utils::RoundUp(max_align, current_size),
+ return Get<type::Struct>(name, members, max_align, tint::RoundUp(max_align, current_size),
current_size);
}
diff --git a/src/tint/lang/core/type/manager.h b/src/tint/lang/core/type/manager.h
index 961222d..602b3b2 100644
--- a/src/tint/lang/core/type/manager.h
+++ b/src/tint/lang/core/type/manager.h
@@ -52,7 +52,7 @@
class Manager final {
public:
/// Iterator is the type returned by begin() and end()
- using TypeIterator = utils::BlockAllocator<Type>::ConstIterator;
+ using TypeIterator = BlockAllocator<Type>::ConstIterator;
/// Constructor
Manager();
@@ -116,9 +116,9 @@
return ptr<T::address, typename T::type, T::access>(std::forward<ARGS>(args)...);
} else if constexpr (builtin::fluent_types::IsArray<T>) {
return array<typename T::type, T::length>(std::forward<ARGS>(args)...);
- } else if constexpr (utils::traits::IsTypeOrDerived<T, Type>) {
+ } else if constexpr (tint::traits::IsTypeOrDerived<T, Type>) {
return types_.Get<T>(std::forward<ARGS>(args)...);
- } else if constexpr (utils::traits::IsTypeOrDerived<T, UniqueNode>) {
+ } else if constexpr (tint::traits::IsTypeOrDerived<T, UniqueNode>) {
return unique_nodes_.Get<T>(std::forward<ARGS>(args)...);
} else {
return nodes_.Create<T>(std::forward<ARGS>(args)...);
@@ -129,7 +129,7 @@
/// @return a pointer to an instance of `T` with the provided arguments, or nullptr if the item
/// was not found.
template <typename TYPE,
- typename _ = std::enable_if<utils::traits::IsTypeOrDerived<TYPE, Type>>,
+ typename _ = std::enable_if<tint::traits::IsTypeOrDerived<TYPE, Type>>,
typename... ARGS>
auto* Find(ARGS&&... args) const {
return types_.Find<ToType<TYPE>>(std::forward<ARGS>(args)...);
@@ -429,14 +429,14 @@
/// @param name the name of the structure
/// @param members the list of structure member descriptors
/// @returns the structure type
- type::Struct* Struct(Symbol name, utils::VectorRef<StructMemberDesc> members);
+ type::Struct* Struct(Symbol name, VectorRef<StructMemberDesc> members);
/// Create a new structure declaration.
/// @param name the name of the structure
/// @param members the list of structure member descriptors
/// @returns the structure type
type::Struct* Struct(Symbol name, std::initializer_list<StructMemberDesc> members) {
- return Struct(name, utils::Vector<StructMemberDesc, 4>(members));
+ return Struct(name, tint::Vector<StructMemberDesc, 4>(members));
}
/// @returns an iterator to the beginning of the types
@@ -456,11 +456,11 @@
using ToType = typename ToTypeImpl<T>::type;
/// Unique types owned by the manager
- utils::UniqueAllocator<Type> types_;
+ UniqueAllocator<Type> types_;
/// Unique nodes (excluding types) owned by the manager
- utils::UniqueAllocator<UniqueNode> unique_nodes_;
+ UniqueAllocator<UniqueNode> unique_nodes_;
/// Non-unique nodes owned by the manager
- utils::BlockAllocator<Node> nodes_;
+ BlockAllocator<Node> nodes_;
};
} // namespace tint::type
diff --git a/src/tint/lang/core/type/matrix.cc b/src/tint/lang/core/type/matrix.cc
index 1694c47..50787a4 100644
--- a/src/tint/lang/core/type/matrix.cc
+++ b/src/tint/lang/core/type/matrix.cc
@@ -26,7 +26,7 @@
namespace tint::type {
Matrix::Matrix(const Vector* column_type, uint32_t columns)
- : Base(utils::Hash(utils::TypeInfo::Of<Vector>().full_hashcode, columns, column_type),
+ : Base(Hash(tint::TypeInfo::Of<Vector>().full_hashcode, columns, column_type),
type::Flags{
Flag::kConstructable,
Flag::kCreationFixedFootprint,
@@ -52,7 +52,7 @@
}
std::string Matrix::FriendlyName() const {
- utils::StringStream out;
+ StringStream out;
out << "mat" << columns_ << "x" << rows_ << "<" << subtype_->FriendlyName() << ">";
return out.str();
}
diff --git a/src/tint/lang/core/type/matrix.h b/src/tint/lang/core/type/matrix.h
index 83e1c2e..2a9cda5 100644
--- a/src/tint/lang/core/type/matrix.h
+++ b/src/tint/lang/core/type/matrix.h
@@ -27,7 +27,7 @@
namespace tint::type {
/// A matrix type
-class Matrix final : public utils::Castable<Matrix, Type> {
+class Matrix final : public Castable<Matrix, Type> {
public:
/// Constructor
/// @param column_type the type of a column of the matrix
diff --git a/src/tint/lang/core/type/multisampled_texture.cc b/src/tint/lang/core/type/multisampled_texture.cc
index 0630ec4b..e49706e 100644
--- a/src/tint/lang/core/type/multisampled_texture.cc
+++ b/src/tint/lang/core/type/multisampled_texture.cc
@@ -26,7 +26,7 @@
namespace tint::type {
MultisampledTexture::MultisampledTexture(TextureDimension dim, const Type* type)
- : Base(utils::Hash(utils::TypeInfo::Of<MultisampledTexture>().full_hashcode, dim, type), dim),
+ : Base(Hash(tint::TypeInfo::Of<MultisampledTexture>().full_hashcode, dim, type), dim),
type_(type) {
TINT_ASSERT(Type, type_);
}
@@ -41,7 +41,7 @@
}
std::string MultisampledTexture::FriendlyName() const {
- utils::StringStream out;
+ StringStream out;
out << "texture_multisampled_" << dim() << "<" << type_->FriendlyName() << ">";
return out.str();
}
diff --git a/src/tint/lang/core/type/multisampled_texture.h b/src/tint/lang/core/type/multisampled_texture.h
index da37f73..0a37556 100644
--- a/src/tint/lang/core/type/multisampled_texture.h
+++ b/src/tint/lang/core/type/multisampled_texture.h
@@ -23,7 +23,7 @@
namespace tint::type {
/// A multisampled texture type.
-class MultisampledTexture final : public utils::Castable<MultisampledTexture, Texture> {
+class MultisampledTexture final : public Castable<MultisampledTexture, Texture> {
public:
/// Constructor
/// @param dim the dimensionality of the texture
diff --git a/src/tint/lang/core/type/node.h b/src/tint/lang/core/type/node.h
index 529f474..d4addf4 100644
--- a/src/tint/lang/core/type/node.h
+++ b/src/tint/lang/core/type/node.h
@@ -20,7 +20,7 @@
namespace tint::type {
/// Node is the base class for all type nodes
-class Node : public utils::Castable<Node> {
+class Node : public Castable<Node> {
public:
/// Constructor
Node();
diff --git a/src/tint/lang/core/type/numeric_scalar.h b/src/tint/lang/core/type/numeric_scalar.h
index 6cef2db..987921a 100644
--- a/src/tint/lang/core/type/numeric_scalar.h
+++ b/src/tint/lang/core/type/numeric_scalar.h
@@ -21,7 +21,7 @@
/// Base class for all numeric-scalar types
/// @see https://www.w3.org/TR/WGSL/#scalar-types
-class NumericScalar : public utils::Castable<NumericScalar, Scalar> {
+class NumericScalar : public Castable<NumericScalar, Scalar> {
public:
/// Destructor
~NumericScalar() override;
diff --git a/src/tint/lang/core/type/pointer.cc b/src/tint/lang/core/type/pointer.cc
index 23d045e..1104d1f 100644
--- a/src/tint/lang/core/type/pointer.cc
+++ b/src/tint/lang/core/type/pointer.cc
@@ -26,9 +26,8 @@
namespace tint::type {
Pointer::Pointer(builtin::AddressSpace address_space, const Type* subtype, builtin::Access access)
- : Base(
- utils::Hash(utils::TypeInfo::Of<Pointer>().full_hashcode, address_space, subtype, access),
- type::Flags{}),
+ : Base(Hash(tint::TypeInfo::Of<Pointer>().full_hashcode, address_space, subtype, access),
+ type::Flags{}),
subtype_(subtype),
address_space_(address_space),
access_(access) {
@@ -45,7 +44,7 @@
}
std::string Pointer::FriendlyName() const {
- utils::StringStream out;
+ StringStream out;
out << "ptr<";
if (address_space_ != builtin::AddressSpace::kUndefined) {
out << address_space_ << ", ";
diff --git a/src/tint/lang/core/type/pointer.h b/src/tint/lang/core/type/pointer.h
index 73b3886..fa1f785 100644
--- a/src/tint/lang/core/type/pointer.h
+++ b/src/tint/lang/core/type/pointer.h
@@ -24,7 +24,7 @@
namespace tint::type {
/// A pointer type.
-class Pointer final : public utils::Castable<Pointer, Type> {
+class Pointer final : public Castable<Pointer, Type> {
public:
/// Constructor
/// @param address_space the address space of the pointer
diff --git a/src/tint/lang/core/type/reference.cc b/src/tint/lang/core/type/reference.cc
index 959dc11..63dc855 100644
--- a/src/tint/lang/core/type/reference.cc
+++ b/src/tint/lang/core/type/reference.cc
@@ -27,10 +27,7 @@
Reference::Reference(builtin::AddressSpace address_space,
const Type* subtype,
builtin::Access access)
- : Base(utils::Hash(utils::TypeInfo::Of<Reference>().full_hashcode,
- address_space,
- subtype,
- access),
+ : Base(Hash(tint::TypeInfo::Of<Reference>().full_hashcode, address_space, subtype, access),
type::Flags{}),
subtype_(subtype),
address_space_(address_space),
@@ -48,7 +45,7 @@
}
std::string Reference::FriendlyName() const {
- utils::StringStream out;
+ StringStream out;
out << "ref<";
if (address_space_ != builtin::AddressSpace::kUndefined) {
out << address_space_ << ", ";
diff --git a/src/tint/lang/core/type/reference.h b/src/tint/lang/core/type/reference.h
index 8fcf839..9424eb0 100644
--- a/src/tint/lang/core/type/reference.h
+++ b/src/tint/lang/core/type/reference.h
@@ -24,7 +24,7 @@
namespace tint::type {
/// A reference type.
-class Reference final : public utils::Castable<Reference, Type> {
+class Reference final : public Castable<Reference, Type> {
public:
/// Constructor
/// @param address_space the address space of the reference
diff --git a/src/tint/lang/core/type/sampled_texture.cc b/src/tint/lang/core/type/sampled_texture.cc
index a34a73c..6290476 100644
--- a/src/tint/lang/core/type/sampled_texture.cc
+++ b/src/tint/lang/core/type/sampled_texture.cc
@@ -26,8 +26,7 @@
namespace tint::type {
SampledTexture::SampledTexture(TextureDimension dim, const Type* type)
- : Base(utils::Hash(utils::TypeInfo::Of<SampledTexture>().full_hashcode, dim, type), dim),
- type_(type) {
+ : Base(Hash(tint::TypeInfo::Of<SampledTexture>().full_hashcode, dim, type), dim), type_(type) {
TINT_ASSERT(Type, type_);
}
@@ -41,7 +40,7 @@
}
std::string SampledTexture::FriendlyName() const {
- utils::StringStream out;
+ StringStream out;
out << "texture_" << dim() << "<" << type_->FriendlyName() << ">";
return out.str();
}
diff --git a/src/tint/lang/core/type/sampled_texture.h b/src/tint/lang/core/type/sampled_texture.h
index bef8fba..d22c81f 100644
--- a/src/tint/lang/core/type/sampled_texture.h
+++ b/src/tint/lang/core/type/sampled_texture.h
@@ -23,7 +23,7 @@
namespace tint::type {
/// A sampled texture type.
-class SampledTexture final : public utils::Castable<SampledTexture, Texture> {
+class SampledTexture final : public Castable<SampledTexture, Texture> {
public:
/// Constructor
/// @param dim the dimensionality of the texture
diff --git a/src/tint/lang/core/type/sampler.cc b/src/tint/lang/core/type/sampler.cc
index 7b180cd..ffdaaa2 100644
--- a/src/tint/lang/core/type/sampler.cc
+++ b/src/tint/lang/core/type/sampler.cc
@@ -22,8 +22,7 @@
namespace tint::type {
Sampler::Sampler(SamplerKind kind)
- : Base(utils::Hash(utils::TypeInfo::Of<Sampler>().full_hashcode, kind), type::Flags{}),
- kind_(kind) {}
+ : Base(Hash(tint::TypeInfo::Of<Sampler>().full_hashcode, kind), type::Flags{}), kind_(kind) {}
Sampler::~Sampler() = default;
diff --git a/src/tint/lang/core/type/sampler.h b/src/tint/lang/core/type/sampler.h
index ec36537..9946731 100644
--- a/src/tint/lang/core/type/sampler.h
+++ b/src/tint/lang/core/type/sampler.h
@@ -23,7 +23,7 @@
namespace tint::type {
/// A sampler type.
-class Sampler final : public utils::Castable<Sampler, Type> {
+class Sampler final : public Castable<Sampler, Type> {
public:
/// Constructor
/// @param kind the kind of sampler
diff --git a/src/tint/lang/core/type/sampler_kind.cc b/src/tint/lang/core/type/sampler_kind.cc
index 6d810a4..0780929 100644
--- a/src/tint/lang/core/type/sampler_kind.cc
+++ b/src/tint/lang/core/type/sampler_kind.cc
@@ -16,7 +16,7 @@
namespace tint::type {
-utils::StringStream& operator<<(utils::StringStream& out, SamplerKind kind) {
+StringStream& operator<<(StringStream& out, SamplerKind kind) {
switch (kind) {
case SamplerKind::kSampler:
out << "sampler";
diff --git a/src/tint/lang/core/type/sampler_kind.h b/src/tint/lang/core/type/sampler_kind.h
index 99e80a3..33d766e 100644
--- a/src/tint/lang/core/type/sampler_kind.h
+++ b/src/tint/lang/core/type/sampler_kind.h
@@ -30,7 +30,7 @@
/// @param out the stream to write to
/// @param kind the SamplerKind
/// @return the stream so calls can be chained
-utils::StringStream& operator<<(utils::StringStream& out, SamplerKind kind);
+StringStream& operator<<(StringStream& out, SamplerKind kind);
} // namespace tint::type
diff --git a/src/tint/lang/core/type/scalar.h b/src/tint/lang/core/type/scalar.h
index a0ac40c..bbcd046 100644
--- a/src/tint/lang/core/type/scalar.h
+++ b/src/tint/lang/core/type/scalar.h
@@ -21,7 +21,7 @@
/// Base class for all scalar types
/// @see https://www.w3.org/TR/WGSL/#scalar-types
-class Scalar : public utils::Castable<Scalar, Type> {
+class Scalar : public Castable<Scalar, Type> {
public:
/// Destructor
~Scalar() override;
diff --git a/src/tint/lang/core/type/storage_texture.cc b/src/tint/lang/core/type/storage_texture.cc
index f51fa0e..ebe1024 100644
--- a/src/tint/lang/core/type/storage_texture.cc
+++ b/src/tint/lang/core/type/storage_texture.cc
@@ -29,8 +29,7 @@
builtin::TexelFormat format,
builtin::Access access,
Type* subtype)
- : Base(utils::Hash(utils::TypeInfo::Of<StorageTexture>().full_hashcode, dim, format, access),
- dim),
+ : Base(Hash(tint::TypeInfo::Of<StorageTexture>().full_hashcode, dim, format, access), dim),
texel_format_(format),
access_(access),
subtype_(subtype) {}
@@ -45,7 +44,7 @@
}
std::string StorageTexture::FriendlyName() const {
- utils::StringStream out;
+ StringStream out;
out << "texture_storage_" << dim() << "<" << texel_format_ << ", " << access_ << ">";
return out.str();
}
diff --git a/src/tint/lang/core/type/storage_texture.h b/src/tint/lang/core/type/storage_texture.h
index c3365c6..1b45c43 100644
--- a/src/tint/lang/core/type/storage_texture.h
+++ b/src/tint/lang/core/type/storage_texture.h
@@ -30,7 +30,7 @@
namespace tint::type {
/// A storage texture type.
-class StorageTexture final : public utils::Castable<StorageTexture, Texture> {
+class StorageTexture final : public Castable<StorageTexture, Texture> {
public:
/// Constructor
/// @param dim the dimensionality of the texture
diff --git a/src/tint/lang/core/type/struct.cc b/src/tint/lang/core/type/struct.cc
index 90f23b4..e816e8b 100644
--- a/src/tint/lang/core/type/struct.cc
+++ b/src/tint/lang/core/type/struct.cc
@@ -30,7 +30,7 @@
namespace tint::type {
namespace {
-type::Flags FlagsFrom(utils::VectorRef<const StructMember*> members) {
+type::Flags FlagsFrom(VectorRef<const StructMember*> members) {
type::Flags flags{
Flag::kConstructable,
Flag::kCreationFixedFootprint,
@@ -53,11 +53,11 @@
} // namespace
Struct::Struct(Symbol name,
- utils::VectorRef<const StructMember*> members,
+ VectorRef<const StructMember*> members,
uint32_t align,
uint32_t size,
uint32_t size_no_padding)
- : Base(utils::Hash(utils::TypeInfo::Of<Struct>().full_hashcode, name), FlagsFrom(members)),
+ : Base(Hash(tint::TypeInfo::Of<Struct>().full_hashcode, name), FlagsFrom(members)),
name_(name),
members_(std::move(members)),
align_(align),
@@ -95,7 +95,7 @@
}
std::string Struct::Layout() const {
- utils::StringStream ss;
+ StringStream ss;
auto member_name_of = [&](const StructMember* sm) { return sm->Name().Name(); };
@@ -172,7 +172,7 @@
Struct* Struct::Clone(CloneContext& ctx) const {
auto sym = ctx.dst.st->Register(name_.Name());
- utils::Vector<const StructMember*, 4> members;
+ tint::Vector<const StructMember*, 4> members;
for (const auto& mem : members_) {
members.Push(mem->Clone(ctx));
}
diff --git a/src/tint/lang/core/type/struct.h b/src/tint/lang/core/type/struct.h
index 92cef7a..e110f81 100644
--- a/src/tint/lang/core/type/struct.h
+++ b/src/tint/lang/core/type/struct.h
@@ -51,11 +51,11 @@
kBlock,
};
-/// An alias to utils::EnumSet<StructFlag>
-using StructFlags = utils::EnumSet<StructFlag>;
+/// An alias to tint::EnumSet<StructFlag>
+using StructFlags = tint::EnumSet<StructFlag>;
/// Struct holds the Type information for structures.
-class Struct : public utils::Castable<Struct, Type> {
+class Struct : public Castable<Struct, Type> {
public:
/// Constructor
/// @param name the name of the structure
@@ -65,7 +65,7 @@
/// @param size_no_padding size of the members without the end of structure
/// alignment padding
Struct(Symbol name,
- utils::VectorRef<const StructMember*> members,
+ VectorRef<const StructMember*> members,
uint32_t align,
uint32_t size,
uint32_t size_no_padding);
@@ -85,7 +85,7 @@
void SetName(Symbol name) { name_ = name; }
/// @returns the members of the structure
- utils::VectorRef<const StructMember*> Members() const { return members_; }
+ VectorRef<const StructMember*> Members() const { return members_; }
/// @param name the member name to look for
/// @returns the member with the given name, or nullptr if it was not found.
@@ -156,12 +156,12 @@
std::string Layout() const;
/// @param concrete the conversion-rank ordered concrete versions of this abstract structure.
- void SetConcreteTypes(utils::VectorRef<const Struct*> concrete) { concrete_types_ = concrete; }
+ void SetConcreteTypes(VectorRef<const Struct*> concrete) { concrete_types_ = concrete; }
/// @returns the conversion-rank ordered concrete versions of this abstract structure, or an
/// empty vector if this structure is not abstract.
/// @note only structures returned by builtins may be abstract (e.g. modf, frexp)
- utils::VectorRef<const Struct*> ConcreteTypes() const { return concrete_types_; }
+ VectorRef<const Struct*> ConcreteTypes() const { return concrete_types_; }
/// @copydoc Type::Elements
TypeAndCount Elements(const Type* type_if_invalid = nullptr,
@@ -176,14 +176,14 @@
private:
Symbol name_;
- const utils::Vector<const StructMember*, 4> members_;
+ const tint::Vector<const StructMember*, 4> members_;
const uint32_t align_;
const uint32_t size_;
const uint32_t size_no_padding_;
type::StructFlags struct_flags_;
std::unordered_set<builtin::AddressSpace> address_space_usage_;
std::unordered_set<PipelineStageUsage> pipeline_stage_uses_;
- utils::Vector<const Struct*, 2> concrete_types_;
+ tint::Vector<const Struct*, 2> concrete_types_;
};
/// Attributes that can be applied to the StructMember
@@ -201,7 +201,7 @@
};
/// StructMember holds the type information for structure members.
-class StructMember : public utils::Castable<StructMember, Node> {
+class StructMember : public Castable<StructMember, Node> {
public:
/// Constructor
/// @param name the name of the structure member
diff --git a/src/tint/lang/core/type/struct_test.cc b/src/tint/lang/core/type/struct_test.cc
index 82cbc4a..658463e 100644
--- a/src/tint/lang/core/type/struct_test.cc
+++ b/src/tint/lang/core/type/struct_test.cc
@@ -24,17 +24,17 @@
TEST_F(TypeStructTest, Creation) {
auto name = Sym("S");
- auto* s = create<Struct>(name, utils::Empty, 4u /* align */, 8u /* size */,
- 16u /* size_no_padding */);
+ auto* s =
+ create<Struct>(name, tint::Empty, 4u /* align */, 8u /* size */, 16u /* size_no_padding */);
EXPECT_EQ(s->Align(), 4u);
EXPECT_EQ(s->Size(), 8u);
EXPECT_EQ(s->SizeNoPadding(), 16u);
}
TEST_F(TypeStructTest, Equals) {
- auto* a = create<Struct>(Sym("a"), utils::Empty, 4u /* align */, 4u /* size */,
+ auto* a = create<Struct>(Sym("a"), tint::Empty, 4u /* align */, 4u /* size */,
4u /* size_no_padding */);
- auto* b = create<Struct>(Sym("b"), utils::Empty, 4u /* align */, 4u /* size */,
+ auto* b = create<Struct>(Sym("b"), tint::Empty, 4u /* align */, 4u /* size */,
4u /* size_no_padding */);
EXPECT_TRUE(a->Equals(*a));
@@ -45,13 +45,13 @@
TEST_F(TypeStructTest, FriendlyName) {
auto name = Sym("my_struct");
auto* s =
- create<Struct>(name, utils::Empty, 4u /* align */, 4u /* size */, 4u /* size_no_padding */);
+ create<Struct>(name, tint::Empty, 4u /* align */, 4u /* size */, 4u /* size_no_padding */);
EXPECT_EQ(s->FriendlyName(), "my_struct");
}
TEST_F(TypeStructTest, Layout) {
auto* inner_st = //
- Structure("Inner", utils::Vector{
+ Structure("Inner", tint::Vector{
Member("a", ty.i32()),
Member("b", ty.u32()),
Member("c", ty.f32()),
@@ -59,7 +59,7 @@
Member("e", ty.mat4x2<f32>()),
});
- auto* outer_st = Structure("Outer", utils::Vector{
+ auto* outer_st = Structure("Outer", tint::Vector{
Member("inner", ty("Inner")),
Member("a", ty.i32()),
});
@@ -90,8 +90,8 @@
}
TEST_F(TypeStructTest, Location) {
- auto* st = Structure("st", utils::Vector{
- Member("a", ty.i32(), utils::Vector{Location(1_u)}),
+ auto* st = Structure("st", tint::Vector{
+ Member("a", ty.i32(), tint::Vector{Location(1_u)}),
Member("b", ty.u32()),
});
@@ -107,7 +107,7 @@
TEST_F(TypeStructTest, IsConstructable) {
auto* inner = //
- Structure("Inner", utils::Vector{
+ Structure("Inner", tint::Vector{
Member("a", ty.i32()),
Member("b", ty.u32()),
Member("c", ty.f32()),
@@ -115,13 +115,13 @@
Member("e", ty.mat4x2<f32>()),
});
- auto* outer = Structure("Outer", utils::Vector{
+ auto* outer = Structure("Outer", tint::Vector{
Member("inner", ty("Inner")),
Member("a", ty.i32()),
});
auto* outer_runtime_sized_array =
- Structure("OuterRuntimeSizedArray", utils::Vector{
+ Structure("OuterRuntimeSizedArray", tint::Vector{
Member("inner", ty("Inner")),
Member("a", ty.i32()),
Member("runtime_sized_array", ty.array<i32>()),
@@ -140,7 +140,7 @@
TEST_F(TypeStructTest, HasCreationFixedFootprint) {
auto* inner = //
- Structure("Inner", utils::Vector{
+ Structure("Inner", tint::Vector{
Member("a", ty.i32()),
Member("b", ty.u32()),
Member("c", ty.f32()),
@@ -149,12 +149,12 @@
Member("f", ty.array<f32, 32>()),
});
- auto* outer = Structure("Outer", utils::Vector{
+ auto* outer = Structure("Outer", tint::Vector{
Member("inner", ty("Inner")),
});
auto* outer_with_runtime_sized_array =
- Structure("OuterRuntimeSizedArray", utils::Vector{
+ Structure("OuterRuntimeSizedArray", tint::Vector{
Member("inner", ty("Inner")),
Member("runtime_sized_array", ty.array<i32>()),
});
@@ -173,7 +173,7 @@
TEST_F(TypeStructTest, HasFixedFootprint) {
auto* inner = //
- Structure("Inner", utils::Vector{
+ Structure("Inner", tint::Vector{
Member("a", ty.i32()),
Member("b", ty.u32()),
Member("c", ty.f32()),
@@ -182,12 +182,12 @@
Member("f", ty.array<f32, 32>()),
});
- auto* outer = Structure("Outer", utils::Vector{
+ auto* outer = Structure("Outer", tint::Vector{
Member("inner", ty("Inner")),
});
auto* outer_with_runtime_sized_array =
- Structure("OuterRuntimeSizedArray", utils::Vector{
+ Structure("OuterRuntimeSizedArray", tint::Vector{
Member("inner", ty("Inner")),
Member("runtime_sized_array", ty.array<i32>()),
});
@@ -210,10 +210,10 @@
auto* s = create<Struct>(
Sym("my_struct"),
- utils::Vector{create<StructMember>(Sym("b"), create<Vector>(create<F32>(), 3u), 0u, 0u, 16u,
- 12u, attrs_location_2),
- create<StructMember>(Sym("a"), create<I32>(), 1u, 16u, 4u, 4u,
- type::StructMemberAttributes{})},
+ tint::Vector{create<StructMember>(Sym("b"), create<Vector>(create<F32>(), 3u), 0u, 0u, 16u,
+ 12u, attrs_location_2),
+ create<StructMember>(Sym("a"), create<I32>(), 1u, 16u, 4u, 4u,
+ type::StructMemberAttributes{})},
4u /* align */, 8u /* size */, 16u /* size_no_padding */);
GenerationID id;
diff --git a/src/tint/lang/core/type/texture.h b/src/tint/lang/core/type/texture.h
index 3cb4ceb..792f9be 100644
--- a/src/tint/lang/core/type/texture.h
+++ b/src/tint/lang/core/type/texture.h
@@ -21,7 +21,7 @@
namespace tint::type {
/// A texture type.
-class Texture : public utils::Castable<Texture, Type> {
+class Texture : public Castable<Texture, Type> {
public:
/// Constructor
/// @param hash the unique hash of the node
diff --git a/src/tint/lang/core/type/texture_dimension.cc b/src/tint/lang/core/type/texture_dimension.cc
index 78a0ace..ecabdb2 100644
--- a/src/tint/lang/core/type/texture_dimension.cc
+++ b/src/tint/lang/core/type/texture_dimension.cc
@@ -16,7 +16,7 @@
namespace tint::type {
-utils::StringStream& operator<<(utils::StringStream& out, type::TextureDimension dim) {
+StringStream& operator<<(StringStream& out, type::TextureDimension dim) {
switch (dim) {
case type::TextureDimension::kNone:
out << "None";
diff --git a/src/tint/lang/core/type/texture_dimension.h b/src/tint/lang/core/type/texture_dimension.h
index 163b7f3..9bcd724 100644
--- a/src/tint/lang/core/type/texture_dimension.h
+++ b/src/tint/lang/core/type/texture_dimension.h
@@ -40,7 +40,7 @@
/// @param out the stream to write to
/// @param dim the type::TextureDimension
/// @return the stream so calls can be chained
-utils::StringStream& operator<<(utils::StringStream& out, type::TextureDimension dim);
+StringStream& operator<<(StringStream& out, type::TextureDimension dim);
} // namespace tint::type
diff --git a/src/tint/lang/core/type/type.cc b/src/tint/lang/core/type/type.cc
index 1dad201..93adb19 100644
--- a/src/tint/lang/core/type/type.cc
+++ b/src/tint/lang/core/type/type.cc
@@ -261,7 +261,7 @@
}
}
-const Type* Type::Common(utils::VectorRef<const Type*> types) {
+const Type* Type::Common(VectorRef<const Type*> types) {
const auto count = types.Length();
if (count == 0) {
return nullptr;
diff --git a/src/tint/lang/core/type/type.h b/src/tint/lang/core/type/type.h
index c550269..0e45496 100644
--- a/src/tint/lang/core/type/type.h
+++ b/src/tint/lang/core/type/type.h
@@ -46,8 +46,8 @@
kFixedFootprint,
};
-/// An alias to utils::EnumSet<Flag>
-using Flags = utils::EnumSet<Flag>;
+/// An alias to tint::EnumSet<Flag>
+using Flags = tint::EnumSet<Flag>;
/// TypeAndCount holds a type and count
struct TypeAndCount {
@@ -66,7 +66,7 @@
}
/// Base class for a type in the system
-class Type : public utils::Castable<Type, UniqueNode> {
+class Type : public Castable<Type, UniqueNode> {
public:
/// Destructor
~Type() override;
@@ -221,7 +221,7 @@
/// @returns the lowest-ranking type that all types in `types` can be implicitly converted to,
/// or nullptr if there is no consistent common type across all types in `types`.
/// @see https://www.w3.org/TR/WGSL/#conversion-rank
- static const Type* Common(utils::VectorRef<const Type*> types);
+ static const Type* Common(VectorRef<const Type*> types);
protected:
/// Constructor
diff --git a/src/tint/lang/core/type/type_test.cc b/src/tint/lang/core/type/type_test.cc
index 1336bd1..293965c 100644
--- a/src/tint/lang/core/type/type_test.cc
+++ b/src/tint/lang/core/type/type_test.cc
@@ -46,7 +46,7 @@
const Reference* ref_u32 =
create<Reference>(builtin::AddressSpace::kPrivate, u32, builtin::Access::kReadWrite);
const Struct* str_f32 = create<Struct>(Sym("str_f32"),
- utils::Vector{
+ tint::Vector{
create<StructMember>(
/* name */ Sym("x"),
/* type */ f32,
@@ -60,7 +60,7 @@
/* size*/ 4u,
/* size_no_padding*/ 4u);
const Struct* str_f16 = create<Struct>(Sym("str_f16"),
- utils::Vector{
+ tint::Vector{
create<StructMember>(
/* name */ Sym("x"),
/* type */ f16,
@@ -74,7 +74,7 @@
/* size*/ 4u,
/* size_no_padding*/ 4u);
Struct* str_af = create<Struct>(Sym("str_af"),
- utils::Vector{
+ tint::Vector{
create<StructMember>(
/* name */ Sym("x"),
/* type */ af,
@@ -151,7 +151,7 @@
/* stride */ 5u * 4u,
/* implicit_stride */ 5u * 4u);
- TypeTest() { str_af->SetConcreteTypes(utils::Vector{str_f32, str_f16}); }
+ TypeTest() { str_af->SetConcreteTypes(tint::Vector{str_f32, str_f16}); }
};
TEST_F(TypeTest, ConversionRank) {
@@ -321,193 +321,193 @@
}
TEST_F(TypeTest, Common2) {
- EXPECT_TYPE(Type::Common(utils::Vector{ai, ai}), ai);
- EXPECT_TYPE(Type::Common(utils::Vector{af, af}), af);
- EXPECT_TYPE(Type::Common(utils::Vector{f32, f32}), f32);
- EXPECT_TYPE(Type::Common(utils::Vector{f16, f16}), f16);
- EXPECT_TYPE(Type::Common(utils::Vector{i32, i32}), i32);
- EXPECT_TYPE(Type::Common(utils::Vector{u32, u32}), u32);
+ EXPECT_TYPE(Type::Common(tint::Vector{ai, ai}), ai);
+ EXPECT_TYPE(Type::Common(tint::Vector{af, af}), af);
+ EXPECT_TYPE(Type::Common(tint::Vector{f32, f32}), f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{f16, f16}), f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{i32, i32}), i32);
+ EXPECT_TYPE(Type::Common(tint::Vector{u32, u32}), u32);
- EXPECT_TYPE(Type::Common(utils::Vector{i32, u32}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{u32, f32}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{f32, f16}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{f16, i32}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{i32, u32}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{u32, f32}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{f32, f16}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{f16, i32}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{ai, af}), af);
- EXPECT_TYPE(Type::Common(utils::Vector{ai, f32}), f32);
- EXPECT_TYPE(Type::Common(utils::Vector{ai, f16}), f16);
- EXPECT_TYPE(Type::Common(utils::Vector{ai, i32}), i32);
- EXPECT_TYPE(Type::Common(utils::Vector{ai, u32}), u32);
+ EXPECT_TYPE(Type::Common(tint::Vector{ai, af}), af);
+ EXPECT_TYPE(Type::Common(tint::Vector{ai, f32}), f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{ai, f16}), f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{ai, i32}), i32);
+ EXPECT_TYPE(Type::Common(tint::Vector{ai, u32}), u32);
- EXPECT_TYPE(Type::Common(utils::Vector{af, ai}), af);
- EXPECT_TYPE(Type::Common(utils::Vector{f32, ai}), f32);
- EXPECT_TYPE(Type::Common(utils::Vector{f16, ai}), f16);
- EXPECT_TYPE(Type::Common(utils::Vector{i32, ai}), i32);
- EXPECT_TYPE(Type::Common(utils::Vector{u32, ai}), u32);
+ EXPECT_TYPE(Type::Common(tint::Vector{af, ai}), af);
+ EXPECT_TYPE(Type::Common(tint::Vector{f32, ai}), f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{f16, ai}), f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{i32, ai}), i32);
+ EXPECT_TYPE(Type::Common(tint::Vector{u32, ai}), u32);
- EXPECT_TYPE(Type::Common(utils::Vector{ai, af}), af);
- EXPECT_TYPE(Type::Common(utils::Vector{f32, af}), f32);
- EXPECT_TYPE(Type::Common(utils::Vector{f16, af}), f16);
- EXPECT_TYPE(Type::Common(utils::Vector{i32, af}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{u32, af}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{ai, af}), af);
+ EXPECT_TYPE(Type::Common(tint::Vector{f32, af}), f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{f16, af}), f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{i32, af}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{u32, af}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{af, ai}), af);
- EXPECT_TYPE(Type::Common(utils::Vector{af, f32}), f32);
- EXPECT_TYPE(Type::Common(utils::Vector{af, f16}), f16);
- EXPECT_TYPE(Type::Common(utils::Vector{af, i32}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{af, u32}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{af, ai}), af);
+ EXPECT_TYPE(Type::Common(tint::Vector{af, f32}), f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{af, f16}), f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{af, i32}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{af, u32}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_ai}), vec3_ai);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_af, vec3_af}), vec3_af);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_f32, vec3_f32}), vec3_f32);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_f16, vec3_f16}), vec3_f16);
- EXPECT_TYPE(Type::Common(utils::Vector{vec4_f32, vec4_f32}), vec4_f32);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_u32, vec3_u32}), vec3_u32);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_i32, vec3_i32}), vec3_i32);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_ai, vec3_ai}), vec3_ai);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_af, vec3_af}), vec3_af);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_f32, vec3_f32}), vec3_f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_f16, vec3_f16}), vec3_f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec4_f32, vec4_f32}), vec4_f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_u32, vec3_u32}), vec3_u32);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_i32, vec3_i32}), vec3_i32);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_f32}), vec3_f32);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_f16}), vec3_f16);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec4_f32}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_u32}), vec3_u32);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_i32}), vec3_i32);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_ai, vec3_f32}), vec3_f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_ai, vec3_f16}), vec3_f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_ai, vec4_f32}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_ai, vec3_u32}), vec3_u32);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_ai, vec3_i32}), vec3_i32);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_f32, vec3_ai}), vec3_f32);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_f16, vec3_ai}), vec3_f16);
- EXPECT_TYPE(Type::Common(utils::Vector{vec4_f32, vec3_ai}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_u32, vec3_ai}), vec3_u32);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_i32, vec3_ai}), vec3_i32);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_f32, vec3_ai}), vec3_f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_f16, vec3_ai}), vec3_f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec4_f32, vec3_ai}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_u32, vec3_ai}), vec3_u32);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_i32, vec3_ai}), vec3_i32);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_af, vec3_f32}), vec3_f32);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_af, vec3_f16}), vec3_f16);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_af, vec4_f32}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_af, vec3_u32}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_af, vec3_i32}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_af, vec3_f32}), vec3_f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_af, vec3_f16}), vec3_f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_af, vec4_f32}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_af, vec3_u32}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_af, vec3_i32}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_f32, vec3_af}), vec3_f32);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_f16, vec3_af}), vec3_f16);
- EXPECT_TYPE(Type::Common(utils::Vector{vec4_f32, vec3_af}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_u32, vec3_af}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_i32, vec3_af}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_f32, vec3_af}), vec3_f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_f16, vec3_af}), vec3_f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec4_f32, vec3_af}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_u32, vec3_af}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_i32, vec3_af}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_af, mat4x3_af}), mat4x3_af);
- EXPECT_TYPE(Type::Common(utils::Vector{mat3x4_f32, mat3x4_f32}), mat3x4_f32);
- EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_f32, mat4x3_f32}), mat4x3_f32);
- EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_f16, mat4x3_f16}), mat4x3_f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{mat4x3_af, mat4x3_af}), mat4x3_af);
+ EXPECT_TYPE(Type::Common(tint::Vector{mat3x4_f32, mat3x4_f32}), mat3x4_f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{mat4x3_f32, mat4x3_f32}), mat4x3_f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{mat4x3_f16, mat4x3_f16}), mat4x3_f16);
- EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_af, mat3x4_f32}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_af, mat4x3_f32}), mat4x3_f32);
- EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_af, mat4x3_f16}), mat4x3_f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{mat4x3_af, mat3x4_f32}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{mat4x3_af, mat4x3_f32}), mat4x3_f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{mat4x3_af, mat4x3_f16}), mat4x3_f16);
- EXPECT_TYPE(Type::Common(utils::Vector{mat3x4_f32, mat4x3_af}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_f32, mat4x3_af}), mat4x3_f32);
- EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_f16, mat4x3_af}), mat4x3_f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{mat3x4_f32, mat4x3_af}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{mat4x3_f32, mat4x3_af}), mat4x3_f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{mat4x3_f16, mat4x3_af}), mat4x3_f16);
- EXPECT_TYPE(Type::Common(utils::Vector{arr_mat4x3_f32, arr_mat4x3_f16}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{arr_mat4x3_f32, arr_mat4x3_af}), arr_mat4x3_f32);
- EXPECT_TYPE(Type::Common(utils::Vector{arr_mat4x3_f16, arr_mat4x3_af}), arr_mat4x3_f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{arr_mat4x3_f32, arr_mat4x3_f16}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{arr_mat4x3_f32, arr_mat4x3_af}), arr_mat4x3_f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{arr_mat4x3_f16, arr_mat4x3_af}), arr_mat4x3_f16);
}
TEST_F(TypeTest, Common3) {
- EXPECT_TYPE(Type::Common(utils::Vector{ai, ai, ai}), ai);
- EXPECT_TYPE(Type::Common(utils::Vector{af, af, af}), af);
- EXPECT_TYPE(Type::Common(utils::Vector{f32, f32, f32}), f32);
- EXPECT_TYPE(Type::Common(utils::Vector{f16, f16, f16}), f16);
- EXPECT_TYPE(Type::Common(utils::Vector{i32, i32, i32}), i32);
- EXPECT_TYPE(Type::Common(utils::Vector{u32, u32, u32}), u32);
+ EXPECT_TYPE(Type::Common(tint::Vector{ai, ai, ai}), ai);
+ EXPECT_TYPE(Type::Common(tint::Vector{af, af, af}), af);
+ EXPECT_TYPE(Type::Common(tint::Vector{f32, f32, f32}), f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{f16, f16, f16}), f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{i32, i32, i32}), i32);
+ EXPECT_TYPE(Type::Common(tint::Vector{u32, u32, u32}), u32);
- EXPECT_TYPE(Type::Common(utils::Vector{ai, af, ai}), af);
- EXPECT_TYPE(Type::Common(utils::Vector{ai, f32, ai}), f32);
- EXPECT_TYPE(Type::Common(utils::Vector{ai, f16, ai}), f16);
- EXPECT_TYPE(Type::Common(utils::Vector{ai, i32, ai}), i32);
- EXPECT_TYPE(Type::Common(utils::Vector{ai, u32, ai}), u32);
+ EXPECT_TYPE(Type::Common(tint::Vector{ai, af, ai}), af);
+ EXPECT_TYPE(Type::Common(tint::Vector{ai, f32, ai}), f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{ai, f16, ai}), f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{ai, i32, ai}), i32);
+ EXPECT_TYPE(Type::Common(tint::Vector{ai, u32, ai}), u32);
- EXPECT_TYPE(Type::Common(utils::Vector{af, ai, af}), af);
- EXPECT_TYPE(Type::Common(utils::Vector{f32, ai, f32}), f32);
- EXPECT_TYPE(Type::Common(utils::Vector{f16, ai, f16}), f16);
- EXPECT_TYPE(Type::Common(utils::Vector{i32, ai, i32}), i32);
- EXPECT_TYPE(Type::Common(utils::Vector{u32, ai, u32}), u32);
+ EXPECT_TYPE(Type::Common(tint::Vector{af, ai, af}), af);
+ EXPECT_TYPE(Type::Common(tint::Vector{f32, ai, f32}), f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{f16, ai, f16}), f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{i32, ai, i32}), i32);
+ EXPECT_TYPE(Type::Common(tint::Vector{u32, ai, u32}), u32);
- EXPECT_TYPE(Type::Common(utils::Vector{ai, f32, ai}), f32);
- EXPECT_TYPE(Type::Common(utils::Vector{ai, f16, ai}), f16);
- EXPECT_TYPE(Type::Common(utils::Vector{ai, i32, ai}), i32);
- EXPECT_TYPE(Type::Common(utils::Vector{ai, u32, ai}), u32);
+ EXPECT_TYPE(Type::Common(tint::Vector{ai, f32, ai}), f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{ai, f16, ai}), f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{ai, i32, ai}), i32);
+ EXPECT_TYPE(Type::Common(tint::Vector{ai, u32, ai}), u32);
- EXPECT_TYPE(Type::Common(utils::Vector{f32, ai, f32}), f32);
- EXPECT_TYPE(Type::Common(utils::Vector{f16, ai, f16}), f16);
- EXPECT_TYPE(Type::Common(utils::Vector{i32, ai, i32}), i32);
- EXPECT_TYPE(Type::Common(utils::Vector{u32, ai, u32}), u32);
+ EXPECT_TYPE(Type::Common(tint::Vector{f32, ai, f32}), f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{f16, ai, f16}), f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{i32, ai, i32}), i32);
+ EXPECT_TYPE(Type::Common(tint::Vector{u32, ai, u32}), u32);
- EXPECT_TYPE(Type::Common(utils::Vector{af, f32, af}), f32);
- EXPECT_TYPE(Type::Common(utils::Vector{af, f16, af}), f16);
- EXPECT_TYPE(Type::Common(utils::Vector{af, i32, af}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{af, u32, af}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{af, f32, af}), f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{af, f16, af}), f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{af, i32, af}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{af, u32, af}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{f32, af, f32}), f32);
- EXPECT_TYPE(Type::Common(utils::Vector{f16, af, f16}), f16);
- EXPECT_TYPE(Type::Common(utils::Vector{i32, af, i32}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{u32, af, u32}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{f32, af, f32}), f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{f16, af, f16}), f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{i32, af, i32}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{u32, af, u32}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{ai, af, f32}), f32);
- EXPECT_TYPE(Type::Common(utils::Vector{ai, af, f16}), f16);
- EXPECT_TYPE(Type::Common(utils::Vector{ai, af, i32}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{ai, af, u32}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{ai, af, f32}), f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{ai, af, f16}), f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{ai, af, i32}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{ai, af, u32}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_ai, vec3_ai}), vec3_ai);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_af, vec3_af, vec3_af}), vec3_af);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_f32, vec3_f32, vec3_f32}), vec3_f32);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_f16, vec3_f16, vec3_f16}), vec3_f16);
- EXPECT_TYPE(Type::Common(utils::Vector{vec4_f32, vec4_f32, vec4_f32}), vec4_f32);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_u32, vec3_u32, vec3_u32}), vec3_u32);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_i32, vec3_i32, vec3_i32}), vec3_i32);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_ai, vec3_ai, vec3_ai}), vec3_ai);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_af, vec3_af, vec3_af}), vec3_af);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_f32, vec3_f32, vec3_f32}), vec3_f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_f16, vec3_f16, vec3_f16}), vec3_f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec4_f32, vec4_f32, vec4_f32}), vec4_f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_u32, vec3_u32, vec3_u32}), vec3_u32);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_i32, vec3_i32, vec3_i32}), vec3_i32);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_f32, vec3_ai, vec3_f32}), vec3_f32);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_f16, vec3_ai, vec3_f16}), vec3_f16);
- EXPECT_TYPE(Type::Common(utils::Vector{vec4_f32, vec3_ai, vec4_f32}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_u32, vec3_ai, vec3_u32}), vec3_u32);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_i32, vec3_ai, vec3_i32}), vec3_i32);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_f32, vec3_ai, vec3_f32}), vec3_f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_f16, vec3_ai, vec3_f16}), vec3_f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec4_f32, vec3_ai, vec4_f32}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_u32, vec3_ai, vec3_u32}), vec3_u32);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_i32, vec3_ai, vec3_i32}), vec3_i32);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_f32, vec3_ai}), vec3_f32);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_f16, vec3_ai}), vec3_f16);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec4_f32, vec3_ai}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_u32, vec3_ai}), vec3_u32);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_i32, vec3_ai}), vec3_i32);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_ai, vec3_f32, vec3_ai}), vec3_f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_ai, vec3_f16, vec3_ai}), vec3_f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_ai, vec4_f32, vec3_ai}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_ai, vec3_u32, vec3_ai}), vec3_u32);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_ai, vec3_i32, vec3_ai}), vec3_i32);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_f32, vec3_af, vec3_f32}), vec3_f32);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_f16, vec3_af, vec3_f16}), vec3_f16);
- EXPECT_TYPE(Type::Common(utils::Vector{vec4_f32, vec3_af, vec4_f32}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_u32, vec3_af, vec3_u32}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_i32, vec3_af, vec3_i32}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_f32, vec3_af, vec3_f32}), vec3_f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_f16, vec3_af, vec3_f16}), vec3_f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec4_f32, vec3_af, vec4_f32}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_u32, vec3_af, vec3_u32}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_i32, vec3_af, vec3_i32}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_af, vec3_f32, vec3_af}), vec3_f32);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_af, vec3_f16, vec3_af}), vec3_f16);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_af, vec4_f32, vec3_af}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_af, vec3_u32, vec3_af}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_af, vec3_i32, vec3_af}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_af, vec3_f32, vec3_af}), vec3_f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_af, vec3_f16, vec3_af}), vec3_f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_af, vec4_f32, vec3_af}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_af, vec3_u32, vec3_af}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_af, vec3_i32, vec3_af}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_af, vec3_f32}), vec3_f32);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_af, vec3_f16}), vec3_f16);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_af, vec4_f32}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_af, vec3_u32}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{vec3_ai, vec3_af, vec3_i32}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_ai, vec3_af, vec3_f32}), vec3_f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_ai, vec3_af, vec3_f16}), vec3_f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_ai, vec3_af, vec4_f32}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_ai, vec3_af, vec3_u32}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{vec3_ai, vec3_af, vec3_i32}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_af, mat4x3_af, mat4x3_af}), mat4x3_af);
- EXPECT_TYPE(Type::Common(utils::Vector{mat3x4_f32, mat3x4_f32, mat3x4_f32}), mat3x4_f32);
- EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_f32, mat4x3_f32, mat4x3_f32}), mat4x3_f32);
- EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_f16, mat4x3_f16, mat4x3_f16}), mat4x3_f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{mat4x3_af, mat4x3_af, mat4x3_af}), mat4x3_af);
+ EXPECT_TYPE(Type::Common(tint::Vector{mat3x4_f32, mat3x4_f32, mat3x4_f32}), mat3x4_f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{mat4x3_f32, mat4x3_f32, mat4x3_f32}), mat4x3_f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{mat4x3_f16, mat4x3_f16, mat4x3_f16}), mat4x3_f16);
- EXPECT_TYPE(Type::Common(utils::Vector{mat3x4_f32, mat4x3_af, mat3x4_f32}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_f32, mat4x3_af, mat4x3_f32}), mat4x3_f32);
- EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_f16, mat4x3_af, mat4x3_f16}), mat4x3_f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{mat3x4_f32, mat4x3_af, mat3x4_f32}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{mat4x3_f32, mat4x3_af, mat4x3_f32}), mat4x3_f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{mat4x3_f16, mat4x3_af, mat4x3_f16}), mat4x3_f16);
- EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_af, mat3x4_f32, mat4x3_af}), nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_af, mat4x3_f32, mat4x3_af}), mat4x3_f32);
- EXPECT_TYPE(Type::Common(utils::Vector{mat4x3_af, mat4x3_f16, mat4x3_af}), mat4x3_f16);
+ EXPECT_TYPE(Type::Common(tint::Vector{mat4x3_af, mat3x4_f32, mat4x3_af}), nullptr);
+ EXPECT_TYPE(Type::Common(tint::Vector{mat4x3_af, mat4x3_f32, mat4x3_af}), mat4x3_f32);
+ EXPECT_TYPE(Type::Common(tint::Vector{mat4x3_af, mat4x3_f16, mat4x3_af}), mat4x3_f16);
- EXPECT_TYPE(Type::Common(utils::Vector{arr_mat4x3_f16, arr_mat4x3_f32, arr_mat4x3_f16}),
+ EXPECT_TYPE(Type::Common(tint::Vector{arr_mat4x3_f16, arr_mat4x3_f32, arr_mat4x3_f16}),
nullptr);
- EXPECT_TYPE(Type::Common(utils::Vector{arr_mat4x3_af, arr_mat4x3_f32, arr_mat4x3_af}),
+ EXPECT_TYPE(Type::Common(tint::Vector{arr_mat4x3_af, arr_mat4x3_f32, arr_mat4x3_af}),
arr_mat4x3_f32);
- EXPECT_TYPE(Type::Common(utils::Vector{arr_mat4x3_af, arr_mat4x3_f16, arr_mat4x3_af}),
+ EXPECT_TYPE(Type::Common(tint::Vector{arr_mat4x3_af, arr_mat4x3_f16, arr_mat4x3_af}),
arr_mat4x3_f16);
}
diff --git a/src/tint/lang/core/type/u32.cc b/src/tint/lang/core/type/u32.cc
index 783bf3e..37cf91d 100644
--- a/src/tint/lang/core/type/u32.cc
+++ b/src/tint/lang/core/type/u32.cc
@@ -21,7 +21,7 @@
namespace tint::type {
U32::U32()
- : Base(static_cast<size_t>(utils::TypeInfo::Of<U32>().full_hashcode),
+ : Base(static_cast<size_t>(tint::TypeInfo::Of<U32>().full_hashcode),
type::Flags{
Flag::kConstructable,
Flag::kCreationFixedFootprint,
diff --git a/src/tint/lang/core/type/u32.h b/src/tint/lang/core/type/u32.h
index 4eb74dd..5498228 100644
--- a/src/tint/lang/core/type/u32.h
+++ b/src/tint/lang/core/type/u32.h
@@ -22,7 +22,7 @@
namespace tint::type {
/// A unsigned int 32 type.
-class U32 final : public utils::Castable<U32, NumericScalar> {
+class U32 final : public Castable<U32, NumericScalar> {
public:
/// Constructor
U32();
diff --git a/src/tint/lang/core/type/unique_node.h b/src/tint/lang/core/type/unique_node.h
index b71e56d..c0042a5 100644
--- a/src/tint/lang/core/type/unique_node.h
+++ b/src/tint/lang/core/type/unique_node.h
@@ -25,7 +25,7 @@
/// Deduplication is achieved by comparing a temporary object to the set of existing objects, using
/// Hash() and Equals(). If an existing object is found, then the pointer to that object is
/// returned, otherwise a new object is constructed, added to the Manager's set and returned.
-class UniqueNode : public utils::Castable<UniqueNode, Node> {
+class UniqueNode : public Castable<UniqueNode, Node> {
public:
/// Constructor
/// @param hash the immutable hash for the node
diff --git a/src/tint/lang/core/type/vector.cc b/src/tint/lang/core/type/vector.cc
index f3af737..dd50a5d 100644
--- a/src/tint/lang/core/type/vector.cc
+++ b/src/tint/lang/core/type/vector.cc
@@ -25,7 +25,7 @@
namespace tint::type {
Vector::Vector(Type const* subtype, uint32_t width, bool packed /* = false */)
- : Base(utils::Hash(utils::TypeInfo::Of<Vector>().full_hashcode, width, subtype, packed),
+ : Base(Hash(tint::TypeInfo::Of<Vector>().full_hashcode, width, subtype, packed),
type::Flags{
Flag::kConstructable,
Flag::kCreationFixedFootprint,
@@ -48,7 +48,7 @@
}
std::string Vector::FriendlyName() const {
- utils::StringStream out;
+ StringStream out;
if (packed_) {
out << "__packed_";
}
diff --git a/src/tint/lang/core/type/vector.h b/src/tint/lang/core/type/vector.h
index e358454..ce92cef 100644
--- a/src/tint/lang/core/type/vector.h
+++ b/src/tint/lang/core/type/vector.h
@@ -22,7 +22,7 @@
namespace tint::type {
/// A vector type.
-class Vector : public utils::Castable<Vector, Type> {
+class Vector : public Castable<Vector, Type> {
public:
/// Constructor
/// @param subtype the vector element type
diff --git a/src/tint/lang/core/type/void.cc b/src/tint/lang/core/type/void.cc
index fb0c672..69c9a44 100644
--- a/src/tint/lang/core/type/void.cc
+++ b/src/tint/lang/core/type/void.cc
@@ -20,8 +20,7 @@
namespace tint::type {
-Void::Void()
- : Base(static_cast<size_t>(utils::TypeInfo::Of<Void>().full_hashcode), type::Flags{}) {}
+Void::Void() : Base(static_cast<size_t>(tint::TypeInfo::Of<Void>().full_hashcode), type::Flags{}) {}
Void::~Void() = default;
diff --git a/src/tint/lang/core/type/void.h b/src/tint/lang/core/type/void.h
index c916ed1..5ee7146 100644
--- a/src/tint/lang/core/type/void.h
+++ b/src/tint/lang/core/type/void.h
@@ -22,7 +22,7 @@
namespace tint::type {
/// A void type
-class Void final : public utils::Castable<Void, Type> {
+class Void final : public Castable<Void, Type> {
public:
/// Constructor
Void();
diff --git a/src/tint/lang/glsl/writer/ast_printer/array_accessor_test.cc b/src/tint/lang/glsl/writer/ast_printer/array_accessor_test.cc
index 06be52a..0f74331 100644
--- a/src/tint/lang/glsl/writer/ast_printer/array_accessor_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/array_accessor_test.cc
@@ -32,7 +32,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "ary[5]");
diff --git a/src/tint/lang/glsl/writer/ast_printer/ast_printer.cc b/src/tint/lang/glsl/writer/ast_printer/ast_printer.cc
index 5eaf72b..8d82da4 100644
--- a/src/tint/lang/glsl/writer/ast_printer/ast_printer.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/ast_printer.cc
@@ -94,7 +94,7 @@
const char kTempNamePrefix[] = "tint_tmp";
bool last_is_break(const ast::BlockStatement* stmts) {
- return utils::IsAnyOf<ast::BreakStatement>(stmts->Last());
+ return tint::IsAnyOf<ast::BreakStatement>(stmts->Last());
}
bool IsRelational(tint::ast::BinaryOp op) {
@@ -114,7 +114,7 @@
}
}
-void PrintI32(utils::StringStream& out, int32_t value) {
+void PrintI32(StringStream& out, int32_t value) {
// GLSL parses `-2147483648` as a unary minus and `2147483648` as separate tokens, and the
// latter doesn't fit into an (32-bit) `int`. Emit `(-2147483647 - 1)` instead, which ensures
// the expression type is `int`.
@@ -125,7 +125,7 @@
}
}
-void PrintF32(utils::StringStream& out, float value) {
+void PrintF32(StringStream& out, float value) {
if (std::isinf(value)) {
out << "0.0f " << (value >= 0 ? "/* inf */" : "/* -inf */");
} else if (std::isnan(value)) {
@@ -135,7 +135,7 @@
}
}
-void PrintF16(utils::StringStream& out, float value) {
+void PrintF16(StringStream& out, float value) {
if (std::isinf(value)) {
out << "0.0hf " << (value >= 0 ? "/* inf */" : "/* -inf */");
} else if (std::isnan(value)) {
@@ -348,15 +348,14 @@
}
}
-void ASTPrinter::EmitIndexAccessor(utils::StringStream& out,
- const ast::IndexAccessorExpression* expr) {
+void ASTPrinter::EmitIndexAccessor(StringStream& out, const ast::IndexAccessorExpression* expr) {
EmitExpression(out, expr->object);
out << "[";
EmitExpression(out, expr->index);
out << "]";
}
-void ASTPrinter::EmitBitcast(utils::StringStream& out, const ast::BitcastExpression* expr) {
+void ASTPrinter::EmitBitcast(StringStream& out, const ast::BitcastExpression* expr) {
auto* src_type = TypeOf(expr->expr)->UnwrapRef();
auto* dst_type = TypeOf(expr)->UnwrapRef();
@@ -378,7 +377,7 @@
auto* src_vec = src_type->As<type::Vector>();
TINT_ASSERT(Writer, src_vec);
TINT_ASSERT(Writer, ((src_vec->Width() == 2u) || (src_vec->Width() == 4u)));
- std::string fn = utils::GetOrCreate(
+ std::string fn = tint::GetOrCreate(
bitcast_funcs_, BinaryOperandType{{src_type, dst_type}}, [&]() -> std::string {
TextBuffer b;
TINT_DEFER(helpers_.Append(b));
@@ -432,7 +431,7 @@
auto* dst_vec = dst_type->As<type::Vector>();
TINT_ASSERT(Writer, dst_vec);
TINT_ASSERT(Writer, ((dst_vec->Width() == 2u) || (dst_vec->Width() == 4u)));
- std::string fn = utils::GetOrCreate(
+ std::string fn = tint::GetOrCreate(
bitcast_funcs_, BinaryOperandType{{src_type, dst_type}}, [&]() -> std::string {
TextBuffer b;
TINT_DEFER(helpers_.Append(b));
@@ -524,7 +523,7 @@
out << ";";
}
-void ASTPrinter::EmitVectorRelational(utils::StringStream& out, const ast::BinaryExpression* expr) {
+void ASTPrinter::EmitVectorRelational(StringStream& out, const ast::BinaryExpression* expr) {
switch (expr->op) {
case ast::BinaryOp::kEqual:
out << "equal";
@@ -553,7 +552,7 @@
EmitExpression(out, expr->rhs);
}
-void ASTPrinter::EmitBitwiseBoolOp(utils::StringStream& out, const ast::BinaryExpression* expr) {
+void ASTPrinter::EmitBitwiseBoolOp(StringStream& out, const ast::BinaryExpression* expr) {
auto* bool_type = TypeOf(expr->lhs)->UnwrapRef();
auto* uint_type = BoolTypeToUint(bool_type);
@@ -586,42 +585,42 @@
}
}
-void ASTPrinter::EmitFloatModulo(utils::StringStream& out, const ast::BinaryExpression* expr) {
+void ASTPrinter::EmitFloatModulo(StringStream& out, const ast::BinaryExpression* expr) {
std::string fn;
auto* ret_ty = TypeOf(expr)->UnwrapRef();
auto* lhs_ty = TypeOf(expr->lhs)->UnwrapRef();
auto* rhs_ty = TypeOf(expr->rhs)->UnwrapRef();
- fn = utils::GetOrCreate(float_modulo_funcs_, BinaryOperandType{{lhs_ty, rhs_ty}},
- [&]() -> std::string {
- TextBuffer b;
- TINT_DEFER(helpers_.Append(b));
+ fn = tint::GetOrCreate(float_modulo_funcs_, BinaryOperandType{{lhs_ty, rhs_ty}},
+ [&]() -> std::string {
+ TextBuffer b;
+ TINT_DEFER(helpers_.Append(b));
- auto fn_name = UniqueIdentifier("tint_float_modulo");
- std::vector<std::string> parameter_names;
- {
- auto decl = Line(&b);
- EmitTypeAndName(decl, ret_ty, builtin::AddressSpace::kUndefined,
- builtin::Access::kUndefined, fn_name);
- {
- ScopedParen sp(decl);
- const auto* ty = TypeOf(expr->lhs)->UnwrapRef();
- EmitTypeAndName(decl, ty, builtin::AddressSpace::kUndefined,
- builtin::Access::kUndefined, "lhs");
- decl << ", ";
- ty = TypeOf(expr->rhs)->UnwrapRef();
- EmitTypeAndName(decl, ty, builtin::AddressSpace::kUndefined,
- builtin::Access::kUndefined, "rhs");
- }
- decl << " {";
- }
- {
- ScopedIndent si(&b);
- Line(&b) << "return (lhs - rhs * trunc(lhs / rhs));";
- }
- Line(&b) << "}";
- Line(&b);
- return fn_name;
- });
+ auto fn_name = UniqueIdentifier("tint_float_modulo");
+ std::vector<std::string> parameter_names;
+ {
+ auto decl = Line(&b);
+ EmitTypeAndName(decl, ret_ty, builtin::AddressSpace::kUndefined,
+ builtin::Access::kUndefined, fn_name);
+ {
+ ScopedParen sp(decl);
+ const auto* ty = TypeOf(expr->lhs)->UnwrapRef();
+ EmitTypeAndName(decl, ty, builtin::AddressSpace::kUndefined,
+ builtin::Access::kUndefined, "lhs");
+ decl << ", ";
+ ty = TypeOf(expr->rhs)->UnwrapRef();
+ EmitTypeAndName(decl, ty, builtin::AddressSpace::kUndefined,
+ builtin::Access::kUndefined, "rhs");
+ }
+ decl << " {";
+ }
+ {
+ ScopedIndent si(&b);
+ Line(&b) << "return (lhs - rhs * trunc(lhs / rhs));";
+ }
+ Line(&b) << "}";
+ Line(&b);
+ return fn_name;
+ });
// Call the helper
out << fn;
@@ -633,7 +632,7 @@
}
}
-void ASTPrinter::EmitBinary(utils::StringStream& out, const ast::BinaryExpression* expr) {
+void ASTPrinter::EmitBinary(StringStream& out, const ast::BinaryExpression* expr) {
if (IsRelational(expr->op) && !TypeOf(expr->lhs)->UnwrapRef()->Is<type::Scalar>()) {
EmitVectorRelational(out, expr);
return;
@@ -750,13 +749,13 @@
EmitExpression(out, expr->rhs);
}
-void ASTPrinter::EmitStatements(utils::VectorRef<const ast::Statement*> stmts) {
+void ASTPrinter::EmitStatements(VectorRef<const ast::Statement*> stmts) {
for (auto* s : stmts) {
EmitStatement(s);
}
}
-void ASTPrinter::EmitStatementsWithIndent(utils::VectorRef<const ast::Statement*> stmts) {
+void ASTPrinter::EmitStatementsWithIndent(VectorRef<const ast::Statement*> stmts) {
ScopedIndent si(this);
EmitStatements(stmts);
}
@@ -778,7 +777,7 @@
out << ") { break; }";
}
-void ASTPrinter::EmitCall(utils::StringStream& out, const ast::CallExpression* expr) {
+void ASTPrinter::EmitCall(StringStream& out, const ast::CallExpression* expr) {
auto* call = builder_.Sem().Get<sem::Call>(expr);
Switch(
call->Target(), //
@@ -792,7 +791,7 @@
});
}
-void ASTPrinter::EmitFunctionCall(utils::StringStream& out,
+void ASTPrinter::EmitFunctionCall(StringStream& out,
const sem::Call* call,
const sem::Function* fn) {
const auto& args = call->Arguments();
@@ -812,7 +811,7 @@
}
}
-void ASTPrinter::EmitBuiltinCall(utils::StringStream& out,
+void ASTPrinter::EmitBuiltinCall(StringStream& out,
const sem::Call* call,
const sem::Builtin* builtin) {
auto* expr = call->Declaration();
@@ -876,7 +875,7 @@
}
}
-void ASTPrinter::EmitValueConversion(utils::StringStream& out,
+void ASTPrinter::EmitValueConversion(StringStream& out,
const sem::Call* call,
const sem::ValueConversion* conv) {
EmitType(out, conv->Target(), builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite,
@@ -885,7 +884,7 @@
EmitExpression(out, call->Arguments()[0]->Declaration());
}
-void ASTPrinter::EmitValueConstructor(utils::StringStream& out,
+void ASTPrinter::EmitValueConstructor(StringStream& out,
const sem::Call* call,
const sem::ValueConstructor* ctor) {
auto* type = ctor->ReturnType();
@@ -911,7 +910,7 @@
}
}
-void ASTPrinter::EmitWorkgroupAtomicCall(utils::StringStream& out,
+void ASTPrinter::EmitWorkgroupAtomicCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin) {
auto call = [&](const char* name) {
@@ -1022,13 +1021,13 @@
TINT_UNREACHABLE(Writer, diagnostics_) << "unsupported atomic builtin: " << builtin->Type();
}
-void ASTPrinter::EmitArrayLength(utils::StringStream& out, const ast::CallExpression* expr) {
+void ASTPrinter::EmitArrayLength(StringStream& out, const ast::CallExpression* expr) {
out << "uint(";
EmitExpression(out, expr->args[0]);
out << ".length())";
}
-void ASTPrinter::EmitExtractBits(utils::StringStream& out, const ast::CallExpression* expr) {
+void ASTPrinter::EmitExtractBits(StringStream& out, const ast::CallExpression* expr) {
out << "bitfieldExtract(";
EmitExpression(out, expr->args[0]);
out << ", int(";
@@ -1038,7 +1037,7 @@
out << "))";
}
-void ASTPrinter::EmitInsertBits(utils::StringStream& out, const ast::CallExpression* expr) {
+void ASTPrinter::EmitInsertBits(StringStream& out, const ast::CallExpression* expr) {
out << "bitfieldInsert(";
EmitExpression(out, expr->args[0]);
out << ", ";
@@ -1050,7 +1049,7 @@
out << "))";
}
-void ASTPrinter::EmitEmulatedFMA(utils::StringStream& out, const ast::CallExpression* expr) {
+void ASTPrinter::EmitEmulatedFMA(StringStream& out, const ast::CallExpression* expr) {
out << "((";
EmitExpression(out, expr->args[0]);
out << ") * (";
@@ -1060,7 +1059,7 @@
out << "))";
}
-void ASTPrinter::EmitCountOneBitsCall(utils::StringStream& out, const ast::CallExpression* expr) {
+void ASTPrinter::EmitCountOneBitsCall(StringStream& out, const ast::CallExpression* expr) {
// GLSL's bitCount returns an integer type, so cast it to the appropriate
// unsigned type.
EmitType(out, TypeOf(expr)->UnwrapRef(), builtin::AddressSpace::kUndefined,
@@ -1070,7 +1069,7 @@
out << "))";
}
-void ASTPrinter::EmitSelectCall(utils::StringStream& out,
+void ASTPrinter::EmitSelectCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin) {
// GLSL does not support ternary expressions with a bool vector conditional,
@@ -1110,7 +1109,7 @@
EmitExpression(out, expr_false);
}
-void ASTPrinter::EmitDotCall(utils::StringStream& out,
+void ASTPrinter::EmitDotCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin) {
auto* vec_ty = builtin->Parameters()[0]->Type()->As<type::Vector>();
@@ -1118,7 +1117,7 @@
if (vec_ty->type()->is_integer_scalar()) {
// GLSL does not have a builtin for dot() with integer vector types.
// Generate the helper function if it hasn't been created already
- fn = utils::GetOrCreate(int_dot_funcs_, vec_ty, [&]() -> std::string {
+ fn = tint::GetOrCreate(int_dot_funcs_, vec_ty, [&]() -> std::string {
TextBuffer b;
TINT_DEFER(helpers_.Append(b));
@@ -1126,7 +1125,7 @@
std::string v;
{
- utils::StringStream s;
+ StringStream s;
EmitType(s, vec_ty->type(), builtin::AddressSpace::kUndefined,
builtin::Access::kRead, "");
v = s.str();
@@ -1165,7 +1164,7 @@
EmitExpression(out, expr->args[1]);
}
-void ASTPrinter::EmitModfCall(utils::StringStream& out,
+void ASTPrinter::EmitModfCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin) {
TINT_ASSERT(Writer, expr->args.Length() == 1);
@@ -1186,7 +1185,7 @@
});
}
-void ASTPrinter::EmitFrexpCall(utils::StringStream& out,
+void ASTPrinter::EmitFrexpCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin) {
TINT_ASSERT(Writer, expr->args.Length() == 1);
@@ -1207,7 +1206,7 @@
});
}
-void ASTPrinter::EmitDegreesCall(utils::StringStream& out,
+void ASTPrinter::EmitDegreesCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin) {
auto* return_elem_type = builtin->ReturnType()->DeepestElement();
@@ -1219,7 +1218,7 @@
});
}
-void ASTPrinter::EmitRadiansCall(utils::StringStream& out,
+void ASTPrinter::EmitRadiansCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin) {
auto* return_elem_type = builtin->ReturnType()->DeepestElement();
@@ -1231,7 +1230,7 @@
});
}
-void ASTPrinter::EmitQuantizeToF16Call(utils::StringStream& out,
+void ASTPrinter::EmitQuantizeToF16Call(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin) {
// Emulate by casting to f16 and back again.
@@ -1262,7 +1261,7 @@
});
}
-void ASTPrinter::EmitBarrierCall(utils::StringStream& out, const sem::Builtin* builtin) {
+void ASTPrinter::EmitBarrierCall(StringStream& out, const sem::Builtin* builtin) {
// TODO(crbug.com/tint/661): Combine sequential barriers to a single
// instruction.
if (builtin->Type() == builtin::Function::kWorkgroupBarrier) {
@@ -1285,7 +1284,7 @@
return zero;
}
-void ASTPrinter::EmitTextureCall(utils::StringStream& out,
+void ASTPrinter::EmitTextureCall(StringStream& out,
const sem::Call* call,
const sem::Builtin* builtin) {
using Usage = sem::ParameterUsage;
@@ -1745,7 +1744,7 @@
Line() << "discard;";
}
-void ASTPrinter::EmitExpression(utils::StringStream& out, const ast::Expression* expr) {
+void ASTPrinter::EmitExpression(StringStream& out, const ast::Expression* expr) {
if (auto* sem = builder_.Sem().GetVal(expr)) {
if (auto* constant = sem->ConstantValue()) {
EmitConstant(out, constant);
@@ -1768,7 +1767,7 @@
});
}
-void ASTPrinter::EmitIdentifier(utils::StringStream& out, const ast::IdentifierExpression* expr) {
+void ASTPrinter::EmitIdentifier(StringStream& out, const ast::IdentifierExpression* expr) {
out << expr->identifier->symbol.Name();
}
@@ -1786,7 +1785,7 @@
if (auto* block = stmt->else_statement->As<ast::BlockStatement>()) {
EmitStatementsWithIndent(block->statements);
} else {
- EmitStatementsWithIndent(utils::Vector{stmt->else_statement});
+ EmitStatementsWithIndent(Vector{stmt->else_statement});
}
}
Line() << "}";
@@ -1871,7 +1870,7 @@
case builtin::AddressSpace::kPushConstant:
diagnostics_.add_error(
diag::System::Writer,
- "unhandled address space " + utils::ToString(sem->AddressSpace()));
+ "unhandled address space " + tint::ToString(sem->AddressSpace()));
return;
default: {
TINT_ICE(Writer, diagnostics_)
@@ -2069,8 +2068,8 @@
out << ";";
}
-void ASTPrinter::EmitInterpolationQualifiers(utils::StringStream& out,
- utils::VectorRef<const ast::Attribute*> attributes) {
+void ASTPrinter::EmitInterpolationQualifiers(StringStream& out,
+ VectorRef<const ast::Attribute*> attributes) {
for (auto* attr : attributes) {
if (auto* interpolate = attr->As<ast::InterpolateAttribute>()) {
auto& sem = builder_.Sem();
@@ -2105,9 +2104,9 @@
}
}
-void ASTPrinter::EmitAttributes(utils::StringStream& out,
+void ASTPrinter::EmitAttributes(StringStream& out,
const sem::GlobalVariable* var,
- utils::VectorRef<const ast::Attribute*> attributes) {
+ VectorRef<const ast::Attribute*> attributes) {
if (attributes.IsEmpty()) {
return;
}
@@ -2207,7 +2206,7 @@
Line() << "}";
}
-void ASTPrinter::EmitConstant(utils::StringStream& out, const constant::Value* constant) {
+void ASTPrinter::EmitConstant(StringStream& out, const constant::Value* constant) {
Switch(
constant->Type(), //
[&](const type::Bool*) { out << (constant->ValueAs<AInt>() ? "true" : "false"); },
@@ -2283,7 +2282,7 @@
});
}
-void ASTPrinter::EmitLiteral(utils::StringStream& out, const ast::LiteralExpression* lit) {
+void ASTPrinter::EmitLiteral(StringStream& out, const ast::LiteralExpression* lit) {
Switch(
lit, //
[&](const ast::BoolLiteralExpression* l) { out << (l->value ? "true" : "false"); },
@@ -2311,7 +2310,7 @@
[&](Default) { diagnostics_.add_error(diag::System::Writer, "unknown literal type"); });
}
-void ASTPrinter::EmitZeroValue(utils::StringStream& out, const type::Type* type) {
+void ASTPrinter::EmitZeroValue(StringStream& out, const type::Type* type) {
if (type->Is<type::Bool>()) {
out << "false";
} else if (type->Is<type::F32>()) {
@@ -2408,7 +2407,7 @@
}
TextBuffer cond_pre;
- utils::StringStream cond_buf;
+ StringStream cond_buf;
if (auto* cond = stmt->condition) {
TINT_SCOPED_ASSIGNMENT(current_buffer_, &cond_pre);
EmitExpression(cond_buf, cond);
@@ -2468,7 +2467,7 @@
out << cond_buf.str() << "; ";
if (!cont_buf.lines.empty()) {
- out << utils::TrimSuffix(cont_buf.lines[0].content, ";");
+ out << tint::TrimSuffix(cont_buf.lines[0].content, ";");
}
}
out << " {";
@@ -2484,7 +2483,7 @@
void ASTPrinter::EmitWhile(const ast::WhileStatement* stmt) {
TextBuffer cond_pre;
- utils::StringStream cond_buf;
+ StringStream cond_buf;
{
auto* cond = stmt->condition;
TINT_SCOPED_ASSIGNMENT(current_buffer_, &cond_pre);
@@ -2525,8 +2524,7 @@
}
}
-void ASTPrinter::EmitMemberAccessor(utils::StringStream& out,
- const ast::MemberAccessorExpression* expr) {
+void ASTPrinter::EmitMemberAccessor(StringStream& out, const ast::MemberAccessorExpression* expr) {
EmitExpression(out, expr->object);
out << ".";
@@ -2618,7 +2616,7 @@
Line() << "}";
}
-void ASTPrinter::EmitType(utils::StringStream& out,
+void ASTPrinter::EmitType(StringStream& out,
const type::Type* type,
builtin::AddressSpace address_space,
builtin::Access access,
@@ -2787,7 +2785,7 @@
}
}
-void ASTPrinter::EmitTypeAndName(utils::StringStream& out,
+void ASTPrinter::EmitTypeAndName(StringStream& out,
const type::Type* type,
builtin::AddressSpace address_space,
builtin::Access access,
@@ -2825,7 +2823,7 @@
}
}
-void ASTPrinter::EmitUnaryOp(utils::StringStream& out, const ast::UnaryOpExpression* expr) {
+void ASTPrinter::EmitUnaryOp(StringStream& out, const ast::UnaryOpExpression* expr) {
switch (expr->op) {
case ast::UnaryOp::kIndirection:
case ast::UnaryOp::kAddressOf:
@@ -2895,12 +2893,12 @@
}
template <typename F>
-void ASTPrinter::CallBuiltinHelper(utils::StringStream& out,
+void ASTPrinter::CallBuiltinHelper(StringStream& out,
const ast::CallExpression* call,
const sem::Builtin* builtin,
F&& build) {
// Generate the helper function if it hasn't been created already
- auto fn = utils::GetOrCreate(builtins_, builtin, [&]() -> std::string {
+ auto fn = tint::GetOrCreate(builtins_, builtin, [&]() -> std::string {
TextBuffer b;
TINT_DEFER(helpers_.Append(b));
diff --git a/src/tint/lang/glsl/writer/ast_printer/ast_printer.h b/src/tint/lang/glsl/writer/ast_printer/ast_printer.h
index 54d7228..6db2fcd 100644
--- a/src/tint/lang/glsl/writer/ast_printer/ast_printer.h
+++ b/src/tint/lang/glsl/writer/ast_printer/ast_printer.h
@@ -65,7 +65,7 @@
const std::string& entry_point);
/// Implementation class for GLSL generator
-class ASTPrinter : public utils::TextGenerator {
+class ASTPrinter : public tint::TextGenerator {
public:
/// Constructor
/// @param program the program to generate
@@ -82,36 +82,36 @@
/// Handles an index accessor expression
/// @param out the output of the expression stream
/// @param expr the expression to emit
- void EmitIndexAccessor(utils::StringStream& out, const ast::IndexAccessorExpression* expr);
+ void EmitIndexAccessor(StringStream& out, const ast::IndexAccessorExpression* expr);
/// Handles an assignment statement
/// @param stmt the statement to emit
void EmitAssign(const ast::AssignmentStatement* stmt);
/// Handles emission of bitwise operators (&|) on bool scalars and vectors
/// @param out the output of the expression stream
/// @param expr the binary expression
- void EmitBitwiseBoolOp(utils::StringStream& out, const ast::BinaryExpression* expr);
+ void EmitBitwiseBoolOp(StringStream& out, const ast::BinaryExpression* expr);
/// Handles generating a binary expression
/// @param out the output of the expression stream
/// @param expr the binary expression
- void EmitFloatModulo(utils::StringStream& out, const ast::BinaryExpression* expr);
+ void EmitFloatModulo(StringStream& out, const ast::BinaryExpression* expr);
/// Handles generating the modulo operator on float vector operands
/// @param out the output of the expression stream
/// @param expr the binary expression
- void EmitBinary(utils::StringStream& out, const ast::BinaryExpression* expr);
+ void EmitBinary(StringStream& out, const ast::BinaryExpression* expr);
/// Handles generating a bitcast expression
/// @param out the output of the expression stream
/// @param expr the expression
- void EmitVectorRelational(utils::StringStream& out, const ast::BinaryExpression* expr);
+ void EmitVectorRelational(StringStream& out, const ast::BinaryExpression* expr);
/// Handles generating a vector relational expression
/// @param out the output of the expression stream
/// @param expr the expression
- void EmitBitcast(utils::StringStream& out, const ast::BitcastExpression* expr);
+ void EmitBitcast(StringStream& out, const ast::BitcastExpression* expr);
/// Emits a list of statements
/// @param stmts the statement list
- void EmitStatements(utils::VectorRef<const ast::Statement*> stmts);
+ void EmitStatements(VectorRef<const ast::Statement*> stmts);
/// Emits a list of statements with an indentation
/// @param stmts the statement list
- void EmitStatementsWithIndent(utils::VectorRef<const ast::Statement*> stmts);
+ void EmitStatementsWithIndent(VectorRef<const ast::Statement*> stmts);
/// Handles a block statement
/// @param stmt the statement to emit
void EmitBlock(const ast::BlockStatement* stmt);
@@ -124,60 +124,58 @@
/// Handles generating a call expression
/// @param out the output of the expression stream
/// @param expr the call expression
- void EmitCall(utils::StringStream& out, const ast::CallExpression* expr);
+ void EmitCall(StringStream& out, const ast::CallExpression* expr);
/// Handles generating a function call expression
/// @param out the output of the expression stream
/// @param call the call expression
/// @param fn the function being called
- void EmitFunctionCall(utils::StringStream& out, const sem::Call* call, const sem::Function* fn);
+ void EmitFunctionCall(StringStream& out, const sem::Call* call, const sem::Function* fn);
/// Handles generating a builtin call expression
/// @param out the output of the expression stream
/// @param call the call expression
/// @param builtin the builtin being called
- void EmitBuiltinCall(utils::StringStream& out,
- const sem::Call* call,
- const sem::Builtin* builtin);
+ void EmitBuiltinCall(StringStream& out, const sem::Call* call, const sem::Builtin* builtin);
/// Handles generating a value conversion expression
/// @param out the output of the expression stream
/// @param call the call expression
/// @param conv the value conversion
- void EmitValueConversion(utils::StringStream& out,
+ void EmitValueConversion(StringStream& out,
const sem::Call* call,
const sem::ValueConversion* conv);
/// Handles generating a value constructor expression
/// @param out the output of the expression stream
/// @param call the call expression
/// @param ctor the value constructor
- void EmitValueConstructor(utils::StringStream& out,
+ void EmitValueConstructor(StringStream& out,
const sem::Call* call,
const sem::ValueConstructor* ctor);
/// Handles generating a barrier builtin call
/// @param out the output of the expression stream
/// @param builtin the semantic information for the barrier builtin
- void EmitBarrierCall(utils::StringStream& out, const sem::Builtin* builtin);
+ void EmitBarrierCall(StringStream& out, const sem::Builtin* builtin);
/// Handles generating an atomic builtin call for a workgroup variable
/// @param out the output of the expression stream
/// @param expr the call expression
/// @param builtin the semantic information for the atomic builtin
- void EmitWorkgroupAtomicCall(utils::StringStream& out,
+ void EmitWorkgroupAtomicCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin);
/// Handles generating an array.length() call
/// @param out the output of the expression stream
/// @param expr the call expression
- void EmitArrayLength(utils::StringStream& out, const ast::CallExpression* expr);
+ void EmitArrayLength(StringStream& out, const ast::CallExpression* expr);
/// Handles generating a call to `bitfieldExtract`
/// @param out the output of the expression stream
/// @param expr the call expression
- void EmitExtractBits(utils::StringStream& out, const ast::CallExpression* expr);
+ void EmitExtractBits(StringStream& out, const ast::CallExpression* expr);
/// Handles generating a call to `bitfieldInsert`
/// @param out the output of the expression stream
/// @param expr the call expression
- void EmitInsertBits(utils::StringStream& out, const ast::CallExpression* expr);
+ void EmitInsertBits(StringStream& out, const ast::CallExpression* expr);
/// Emulates 'fma' on GLSL ES, where it is unsupported.
/// @param out the output of the expression stream
/// @param expr the fma() expression
- void EmitEmulatedFMA(utils::StringStream& out, const ast::CallExpression* expr);
+ void EmitEmulatedFMA(StringStream& out, const ast::CallExpression* expr);
/// Create a float literal zero AST node, and associated semantic nodes.
/// @param stmt the statement which will own the semantic expression node
/// @returns an AST expression representing 0.0f
@@ -188,60 +186,58 @@
/// @param out the output of the expression stream
/// @param call the call expression
/// @param builtin the semantic information for the texture builtin
- void EmitTextureCall(utils::StringStream& out,
- const sem::Call* call,
- const sem::Builtin* builtin);
+ void EmitTextureCall(StringStream& out, const sem::Call* call, const sem::Builtin* builtin);
/// Handles generating a call to the `select()` builtin
/// @param out the output of the expression stream
/// @param expr the call expression
- void EmitCountOneBitsCall(utils::StringStream& out, const ast::CallExpression* expr);
+ void EmitCountOneBitsCall(StringStream& out, const ast::CallExpression* expr);
/// Handles generating a call to the `countOneBits()` builtin
/// @param out the output of the expression stream
/// @param expr the call expression
/// @param builtin the semantic information for the builtin
- void EmitSelectCall(utils::StringStream& out,
+ void EmitSelectCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin);
/// Handles generating a call to the `dot()` builtin
/// @param out the output of the expression stream
/// @param expr the call expression
/// @param builtin the semantic information for the builtin
- void EmitDotCall(utils::StringStream& out,
+ void EmitDotCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin);
/// Handles generating a call to the `modf()` builtin
/// @param out the output of the expression stream
/// @param expr the call expression
/// @param builtin the semantic information for the builtin
- void EmitModfCall(utils::StringStream& out,
+ void EmitModfCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin);
/// Handles generating a call to the `frexp()` builtin
/// @param out the output of the expression stream
/// @param expr the call expression
/// @param builtin the semantic information for the builtin
- void EmitFrexpCall(utils::StringStream& out,
+ void EmitFrexpCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin);
/// Handles generating a call to the `degrees()` builtin
/// @param out the output of the expression stream
/// @param expr the call expression
/// @param builtin the semantic information for the builtin
- void EmitDegreesCall(utils::StringStream& out,
+ void EmitDegreesCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin);
/// Handles generating a call to the `radians()` builtin
/// @param out the output of the expression stream
/// @param expr the call expression
/// @param builtin the semantic information for the builtin
- void EmitRadiansCall(utils::StringStream& out,
+ void EmitRadiansCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin);
/// Handles generating a call to the `quantizeToF16()` intrinsic
/// @param out the output of the expression stream
/// @param expr the call expression
/// @param builtin the semantic information for the builtin
- void EmitQuantizeToF16Call(utils::StringStream& out,
+ void EmitQuantizeToF16Call(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin);
/// Handles a case statement
@@ -256,7 +252,7 @@
/// Handles generate an Expression
/// @param out the output of the expression stream
/// @param expr the expression
- void EmitExpression(utils::StringStream& out, const ast::Expression* expr);
+ void EmitExpression(StringStream& out, const ast::Expression* expr);
/// Handles generating a function
/// @param func the function to generate
void EmitFunction(const ast::Function* func);
@@ -295,15 +291,14 @@
/// Handles emitting interpolation qualifiers
/// @param out the output of the expression stream
/// @param attrs the attributes
- void EmitInterpolationQualifiers(utils::StringStream& out,
- utils::VectorRef<const ast::Attribute*> attrs);
+ void EmitInterpolationQualifiers(StringStream& out, VectorRef<const ast::Attribute*> attrs);
/// Handles emitting attributes
/// @param out the output of the expression stream
/// @param var the global variable semantics
/// @param attrs the attributes
- void EmitAttributes(utils::StringStream& out,
+ void EmitAttributes(StringStream& out,
const sem::GlobalVariable* var,
- utils::VectorRef<const ast::Attribute*> attrs);
+ VectorRef<const ast::Attribute*> attrs);
/// Handles emitting the entry point function
/// @param func the entry point
void EmitEntryPointFunction(const ast::Function* func);
@@ -313,11 +308,11 @@
/// Handles a constant value
/// @param out the output stream
/// @param constant the constant value to emit
- void EmitConstant(utils::StringStream& out, const constant::Value* constant);
+ void EmitConstant(StringStream& out, const constant::Value* constant);
/// Handles a literal
/// @param out the output stream
/// @param lit the literal to emit
- void EmitLiteral(utils::StringStream& out, const ast::LiteralExpression* lit);
+ void EmitLiteral(StringStream& out, const ast::LiteralExpression* lit);
/// Handles a loop statement
/// @param stmt the statement to emit
void EmitLoop(const ast::LoopStatement* stmt);
@@ -330,11 +325,11 @@
/// Handles generating an identifier expression
/// @param out the output of the expression stream
/// @param expr the identifier expression
- void EmitIdentifier(utils::StringStream& out, const ast::IdentifierExpression* expr);
+ void EmitIdentifier(StringStream& out, const ast::IdentifierExpression* expr);
/// Handles a member accessor expression
/// @param out the output of the expression stream
/// @param expr the member accessor expression
- void EmitMemberAccessor(utils::StringStream& out, const ast::MemberAccessorExpression* expr);
+ void EmitMemberAccessor(StringStream& out, const ast::MemberAccessorExpression* expr);
/// Handles return statements
/// @param stmt the statement to emit
void EmitReturn(const ast::ReturnStatement* stmt);
@@ -352,7 +347,7 @@
/// @param name the name of the variable, used for array emission.
/// @param name_printed (optional) if not nullptr and an array was printed
/// then the boolean is set to true.
- void EmitType(utils::StringStream& out,
+ void EmitType(StringStream& out,
const type::Type* type,
builtin::AddressSpace address_space,
builtin::Access access,
@@ -364,7 +359,7 @@
/// @param address_space the address space of the variable
/// @param access the access control type of the variable
/// @param name the name to emit
- void EmitTypeAndName(utils::StringStream& out,
+ void EmitTypeAndName(StringStream& out,
const type::Type* type,
builtin::AddressSpace address_space,
builtin::Access access,
@@ -381,11 +376,11 @@
/// Handles a unary op expression
/// @param out the output of the expression stream
/// @param expr the expression to emit
- void EmitUnaryOp(utils::StringStream& out, const ast::UnaryOpExpression* expr);
+ void EmitUnaryOp(StringStream& out, const ast::UnaryOpExpression* expr);
/// Emits the zero value for the given type
/// @param out the output stream
/// @param type the type to emit the value for
- void EmitZeroValue(utils::StringStream& out, const type::Type* type);
+ void EmitZeroValue(StringStream& out, const type::Type* type);
/// Handles generating a 'var' declaration
/// @param var the variable to generate
void EmitVar(const ast::Var* var);
@@ -419,7 +414,7 @@
/// The map key for two semantic types.
using BinaryOperandType =
- utils::UnorderedKeyWrapper<std::tuple<const type::Type*, const type::Type*>>;
+ tint::UnorderedKeyWrapper<std::tuple<const type::Type*, const type::Type*>>;
/// CallBuiltinHelper will call the builtin helper function, creating it
/// if it hasn't been built already. If the builtin needs to be built then
@@ -434,7 +429,7 @@
/// `buffer` is the body of the generated function
/// `params` is the name of all the generated function parameters
template <typename F>
- void CallBuiltinHelper(utils::StringStream& out,
+ void CallBuiltinHelper(StringStream& out,
const ast::CallExpression* call,
const sem::Builtin* builtin,
F&& build);
@@ -444,7 +439,7 @@
/// @returns the corresponding uint type
type::Type* BoolTypeToUint(const type::Type* type);
- /// @copydoc utils::TextWrtiter::UniqueIdentifier
+ /// @copydoc tint::TextWrtiter::UniqueIdentifier
std::string UniqueIdentifier(const std::string& prefix = "") override;
/// Alias for builder_.TypeOf(ptr)
diff --git a/src/tint/lang/glsl/writer/ast_printer/ast_printer_test.cc b/src/tint/lang/glsl/writer/ast_printer/ast_printer_test.cc
index d3fed8d..f56faae 100644
--- a/src/tint/lang/glsl/writer/ast_printer/ast_printer_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/ast_printer_test.cc
@@ -31,7 +31,7 @@
}
TEST_F(GlslASTPrinterTest, Generate) {
- Func("my_func", utils::Empty, ty.void_(), utils::Empty);
+ Func("my_func", tint::Empty, ty.void_(), tint::Empty);
ASTPrinter& gen = Build();
gen.Generate();
@@ -45,7 +45,7 @@
}
TEST_F(GlslASTPrinterTest, GenerateDesktop) {
- Func("my_func", utils::Empty, ty.void_(), utils::Empty);
+ Func("my_func", tint::Empty, ty.void_(), tint::Empty);
ASTPrinter& gen = Build(Version(Version::Standard::kDesktop, 4, 4));
gen.Generate();
@@ -60,13 +60,13 @@
TEST_F(GlslASTPrinterTest, GenerateSampleIndexES) {
GlobalVar("gl_SampleID", ty.i32(),
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kSampleIndex),
Disable(ast::DisabledValidation::kIgnoreAddressSpace),
},
builtin::AddressSpace::kIn);
- Func("my_func", utils::Empty, ty.i32(),
- utils::Vector{
+ Func("my_func", tint::Empty, ty.i32(),
+ Vector{
Return(Expr("gl_SampleID")),
});
@@ -85,13 +85,13 @@
TEST_F(GlslASTPrinterTest, GenerateSampleIndexDesktop) {
GlobalVar("gl_SampleID", ty.i32(),
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kSampleIndex),
Disable(ast::DisabledValidation::kIgnoreAddressSpace),
},
builtin::AddressSpace::kIn);
- Func("my_func", utils::Empty, ty.i32(),
- utils::Vector{
+ Func("my_func", tint::Empty, ty.i32(),
+ Vector{
Return(Expr("gl_SampleID")),
});
diff --git a/src/tint/lang/glsl/writer/ast_printer/binary_test.cc b/src/tint/lang/glsl/writer/ast_printer/binary_test.cc
index 0a793b4..d0e862d 100644
--- a/src/tint/lang/glsl/writer/ast_printer/binary_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/binary_test.cc
@@ -32,7 +32,7 @@
ast::BinaryOp op;
};
inline std::ostream& operator<<(std::ostream& out, BinaryData data) {
- utils::StringStream str;
+ StringStream str;
str << data.op;
out << str.str();
return out;
@@ -61,7 +61,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), params.result);
@@ -90,7 +90,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), params.result);
@@ -110,7 +110,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), params.result);
@@ -135,7 +135,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), params.result);
@@ -171,7 +171,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "(a * 1.0f)");
@@ -190,7 +190,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "(a * 1.0hf)");
@@ -207,7 +207,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "(1.0f * a)");
@@ -226,7 +226,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "(1.0hf * a)");
@@ -242,7 +242,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "(mat * 1.0f)");
@@ -260,7 +260,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "(mat * 1.0hf)");
@@ -276,7 +276,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "(1.0f * mat)");
@@ -294,7 +294,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "(1.0hf * mat)");
@@ -310,7 +310,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "(mat * vec3(1.0f))");
@@ -328,7 +328,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "(mat * f16vec3(1.0hf))");
@@ -344,7 +344,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "(vec3(1.0f) * mat)");
@@ -362,7 +362,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "(f16vec3(1.0hf) * mat)");
@@ -377,7 +377,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "(lhs * rhs)");
@@ -394,7 +394,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "(lhs * rhs)");
@@ -409,7 +409,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "tint_float_modulo(a, b)");
@@ -426,7 +426,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "tint_float_modulo(a, b)");
@@ -441,7 +441,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "tint_float_modulo(a, b)");
@@ -458,7 +458,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "tint_float_modulo(a, b)");
@@ -473,7 +473,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "tint_float_modulo(a, b)");
@@ -490,7 +490,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "tint_float_modulo(a, b)");
@@ -505,7 +505,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "tint_float_modulo(a, b)");
@@ -522,7 +522,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "tint_float_modulo(a, b)");
@@ -626,7 +626,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "(tint_tmp)");
@@ -652,7 +652,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "(tint_tmp)");
@@ -680,7 +680,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "(tint_tmp)");
@@ -709,7 +709,7 @@
Block(Return(1_i)),
Else(If(create<ast::BinaryExpression>(ast::BinaryOp::kLogicalOr, Expr("b"), Expr("c")),
Block(Return(2_i)), Else(Block(Return(3_i))))));
- Func("func", utils::Empty, ty.i32(), utils::Vector{WrapInStatement(expr)});
+ Func("func", tint::Empty, ty.i32(), Vector{WrapInStatement(expr)});
ASTPrinter& gen = Build();
@@ -746,7 +746,7 @@
ast::BinaryOp::kLogicalOr,
create<ast::BinaryExpression>(ast::BinaryOp::kLogicalAnd, Expr("a"), Expr("b")),
Expr("c")));
- Func("func", utils::Empty, ty.bool_(), utils::Vector{WrapInStatement(expr)});
+ Func("func", tint::Empty, ty.bool_(), Vector{WrapInStatement(expr)});
ASTPrinter& gen = Build();
@@ -833,18 +833,18 @@
// foo(a && b, c || d, (a || c) && (b || d))
Func("foo",
- utils::Vector{
+ Vector{
Param(Sym(), ty.bool_()),
Param(Sym(), ty.bool_()),
Param(Sym(), ty.bool_()),
},
- ty.void_(), utils::Empty, utils::Empty);
+ ty.void_(), tint::Empty, tint::Empty);
GlobalVar("a", ty.bool_(), builtin::AddressSpace::kPrivate);
GlobalVar("b", ty.bool_(), builtin::AddressSpace::kPrivate);
GlobalVar("c", ty.bool_(), builtin::AddressSpace::kPrivate);
GlobalVar("d", ty.bool_(), builtin::AddressSpace::kPrivate);
- utils::Vector params{
+ Vector params{
create<ast::BinaryExpression>(ast::BinaryOp::kLogicalAnd, Expr("a"), Expr("b")),
create<ast::BinaryExpression>(ast::BinaryOp::kLogicalOr, Expr("c"), Expr("d")),
create<ast::BinaryExpression>(
diff --git a/src/tint/lang/glsl/writer/ast_printer/bitcast_test.cc b/src/tint/lang/glsl/writer/ast_printer/bitcast_test.cc
index e8b4c9d..8cdd8aa 100644
--- a/src/tint/lang/glsl/writer/ast_printer/bitcast_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/bitcast_test.cc
@@ -33,7 +33,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, bitcast);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "intBitsToFloat(a)");
@@ -46,7 +46,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, bitcast);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "int(a)");
@@ -59,7 +59,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, bitcast);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "uint(a)");
diff --git a/src/tint/lang/glsl/writer/ast_printer/builtin_test.cc b/src/tint/lang/glsl/writer/ast_printer/builtin_test.cc
index a5b0083..779328a 100644
--- a/src/tint/lang/glsl/writer/ast_printer/builtin_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/builtin_test.cc
@@ -64,7 +64,7 @@
CallParamType type,
ProgramBuilder* builder) {
std::string name;
- utils::StringStream str;
+ StringStream str;
str << name << builtin;
switch (builtin) {
case builtin::Function::kAcos:
@@ -213,11 +213,11 @@
auto* call = GenerateCall(param.builtin, param.type, this);
ASSERT_NE(nullptr, call) << "Unhandled builtin";
- Func("func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("func", tint::Empty, ty.void_(),
+ Vector{
Assign(Phony(), call),
},
- utils::Vector{create<ast::StageAttribute>(ast::PipelineStage::kFragment)});
+ Vector{create<ast::StageAttribute>(ast::PipelineStage::kFragment)});
ASTPrinter& gen = Build();
@@ -350,7 +350,7 @@
ASTPrinter& gen = Build();
gen.IncrementIndent();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, call);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "dot(param1, param2)");
@@ -364,7 +364,7 @@
ASTPrinter& gen = Build();
gen.IncrementIndent();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, call);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "(true ? b : a)");
@@ -378,7 +378,7 @@
ASTPrinter& gen = Build();
gen.IncrementIndent();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, call);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "tint_select(a, b, bvec2(true, false))");
@@ -396,7 +396,7 @@
ASTPrinter& gen = Build();
gen.IncrementIndent();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, call);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "((a) * (b) + (c))");
@@ -415,7 +415,7 @@
ASTPrinter& gen = Build();
gen.IncrementIndent();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, call);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "((a) * (b) + (c))");
@@ -1446,11 +1446,11 @@
}
TEST_F(GlslASTPrinterTest_Builtin, StorageBarrier) {
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
CallStmt(Call("storageBarrier")),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -1470,11 +1470,11 @@
}
TEST_F(GlslASTPrinterTest_Builtin, WorkgroupBarrier) {
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
CallStmt(Call("workgroupBarrier")),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
diff --git a/src/tint/lang/glsl/writer/ast_printer/builtin_texture_test.cc b/src/tint/lang/glsl/writer/ast_printer/builtin_texture_test.cc
index 320b45c..3bccd82 100644
--- a/src/tint/lang/glsl/writer/ast_printer/builtin_texture_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/builtin_texture_test.cc
@@ -283,8 +283,8 @@
auto* stmt = param.returns_value ? static_cast<const ast::Statement*>(Decl(Var("v", call)))
: static_cast<const ast::Statement*>(CallStmt(call));
- Func("main", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("main", tint::Empty, ty.void_(), Vector{stmt},
+ Vector{Stage(ast::PipelineStage::kFragment)});
ASTPrinter& gen = SanitizeAndBuild();
diff --git a/src/tint/lang/glsl/writer/ast_printer/call_test.cc b/src/tint/lang/glsl/writer/ast_printer/call_test.cc
index fb1cfbf..58345e7 100644
--- a/src/tint/lang/glsl/writer/ast_printer/call_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/call_test.cc
@@ -26,14 +26,14 @@
using GlslASTPrinterTest_Call = TestHelper;
TEST_F(GlslASTPrinterTest_Call, EmitExpression_Call_WithoutParams) {
- Func("my_func", utils::Empty, ty.f32(), utils::Vector{Return(1.23_f)});
+ Func("my_func", tint::Empty, ty.f32(), Vector{Return(1.23_f)});
auto* call = Call("my_func");
WrapInFunction(call);
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, call);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "my_func()");
@@ -41,11 +41,11 @@
TEST_F(GlslASTPrinterTest_Call, EmitExpression_Call_WithParams) {
Func("my_func",
- utils::Vector{
+ Vector{
Param(Sym(), ty.f32()),
Param(Sym(), ty.f32()),
},
- ty.f32(), utils::Vector{Return(1.23_f)});
+ ty.f32(), Vector{Return(1.23_f)});
GlobalVar("param1", ty.f32(), builtin::AddressSpace::kPrivate);
GlobalVar("param2", ty.f32(), builtin::AddressSpace::kPrivate);
@@ -54,7 +54,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, call);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "my_func(param1, param2)");
@@ -62,11 +62,11 @@
TEST_F(GlslASTPrinterTest_Call, EmitStatement_Call) {
Func("my_func",
- utils::Vector{
+ Vector{
Param(Sym(), ty.f32()),
Param(Sym(), ty.f32()),
},
- ty.void_(), utils::Empty, utils::Empty);
+ ty.void_(), tint::Empty, tint::Empty);
GlobalVar("param1", ty.f32(), builtin::AddressSpace::kPrivate);
GlobalVar("param2", ty.f32(), builtin::AddressSpace::kPrivate);
diff --git a/src/tint/lang/glsl/writer/ast_printer/case_test.cc b/src/tint/lang/glsl/writer/ast_printer/case_test.cc
index cee46db..81511bc 100644
--- a/src/tint/lang/glsl/writer/ast_printer/case_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/case_test.cc
@@ -56,7 +56,7 @@
TEST_F(GlslASTPrinterTest_Case, Emit_Case_MultipleSelectors) {
auto* s = Switch(1_i,
Case(
- utils::Vector{
+ Vector{
CaseSelector(5_i),
CaseSelector(6_i),
},
diff --git a/src/tint/lang/glsl/writer/ast_printer/cast_test.cc b/src/tint/lang/glsl/writer/ast_printer/cast_test.cc
index 3393b65..42aca9d 100644
--- a/src/tint/lang/glsl/writer/ast_printer/cast_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/cast_test.cc
@@ -31,7 +31,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, cast);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "1.0f");
@@ -43,7 +43,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, cast);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "vec3(1.0f, 2.0f, 3.0f)");
diff --git a/src/tint/lang/glsl/writer/ast_printer/constructor_test.cc b/src/tint/lang/glsl/writer/ast_printer/constructor_test.cc
index a717356..1c1b32c 100644
--- a/src/tint/lang/glsl/writer/ast_printer/constructor_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/constructor_test.cc
@@ -391,7 +391,7 @@
}
TEST_F(GlslASTPrinterTest_Constructor, Type_Struct) {
- auto* str = Structure("S", utils::Vector{
+ auto* str = Structure("S", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
Member("c", ty.vec3<i32>()),
@@ -406,7 +406,7 @@
}
TEST_F(GlslASTPrinterTest_Constructor, Type_Struct_Empty) {
- auto* str = Structure("S", utils::Vector{
+ auto* str = Structure("S", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
Member("c", ty.vec3<i32>()),
diff --git a/src/tint/lang/glsl/writer/ast_printer/discard_test.cc b/src/tint/lang/glsl/writer/ast_printer/discard_test.cc
index 34c543a..67c8b6e 100644
--- a/src/tint/lang/glsl/writer/ast_printer/discard_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/discard_test.cc
@@ -24,8 +24,7 @@
TEST_F(GlslASTPrinterTest_Discard, Emit_Discard) {
auto* stmt = Discard();
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASTPrinter& gen = Build();
diff --git a/src/tint/lang/glsl/writer/ast_printer/function_test.cc b/src/tint/lang/glsl/writer/ast_printer/function_test.cc
index 672ba84..701eb6f 100644
--- a/src/tint/lang/glsl/writer/ast_printer/function_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/function_test.cc
@@ -29,8 +29,8 @@
using GlslASTPrinterTest_Function = TestHelper;
TEST_F(GlslASTPrinterTest_Function, Emit_Function) {
- Func("my_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("my_func", tint::Empty, ty.void_(),
+ Vector{
Return(),
});
@@ -49,8 +49,8 @@
}
TEST_F(GlslASTPrinterTest_Function, Emit_Function_Name_Collision) {
- Func("centroid", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("centroid", tint::Empty, ty.void_(),
+ Vector{
Return(),
});
@@ -66,12 +66,12 @@
TEST_F(GlslASTPrinterTest_Function, Emit_Function_WithParams) {
Func("my_func",
- utils::Vector{
+ Vector{
Param("a", ty.f32()),
Param("b", ty.i32()),
},
ty.void_(),
- utils::Vector{
+ Vector{
Return(),
});
@@ -90,8 +90,8 @@
}
TEST_F(GlslASTPrinterTest_Function, Emit_Attribute_EntryPoint_NoReturn_Void) {
- Func("func", utils::Empty, ty.void_(), utils::Empty /* no explicit return */,
- utils::Vector{
+ Func("func", tint::Empty, ty.void_(), tint::Empty /* no explicit return */,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -111,8 +111,8 @@
// fn f(foo : ptr<function, f32>) -> f32 {
// return *foo;
// }
- Func("f", utils::Vector{Param("foo", ty.ptr<function, f32>())}, ty.f32(),
- utils::Vector{Return(Deref("foo"))});
+ Func("f", Vector{Param("foo", ty.ptr<function, f32>())}, ty.f32(),
+ Vector{Return(Deref("foo"))});
ASTPrinter& gen = SanitizeAndBuild();
gen.Generate();
@@ -128,17 +128,17 @@
// return foo;
// }
Func("frag_main",
- utils::Vector{
- Param("foo", ty.f32(), utils::Vector{Location(0_a)}),
+ Vector{
+ Param("foo", ty.f32(), Vector{Location(0_a)}),
},
ty.f32(),
- utils::Vector{
+ Vector{
Return("foo"),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(1_a),
});
@@ -167,19 +167,19 @@
// return coord.x;
// }
auto* coord_in =
- Param("coord", ty.vec4<f32>(), utils::Vector{Builtin(builtin::BuiltinValue::kPosition)});
+ Param("coord", ty.vec4<f32>(), Vector{Builtin(builtin::BuiltinValue::kPosition)});
Func("frag_main",
- utils::Vector{
+ Vector{
coord_in,
},
ty.f32(),
- utils::Vector{
+ Vector{
Return(MemberAccessor("coord", "x")),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kFragDepth),
});
@@ -217,23 +217,23 @@
// }
auto* interface_struct = Structure(
"Interface",
- utils::Vector{
- Member("pos", ty.vec4<f32>(), utils::Vector{Builtin(builtin::BuiltinValue::kPosition)}),
- Member("col1", ty.f32(), utils::Vector{Location(1_a)}),
- Member("col2", ty.f32(), utils::Vector{Location(2_a)}),
+ Vector{
+ Member("pos", ty.vec4<f32>(), Vector{Builtin(builtin::BuiltinValue::kPosition)}),
+ Member("col1", ty.f32(), Vector{Location(1_a)}),
+ Member("col2", ty.f32(), Vector{Location(2_a)}),
});
- Func("vert_main", utils::Empty, ty.Of(interface_struct),
- utils::Vector{Return(Call(ty.Of(interface_struct), Call<vec4<f32>>(), 0.5_f, 0.25_f))},
- utils::Vector{Stage(ast::PipelineStage::kVertex)});
+ Func("vert_main", tint::Empty, ty.Of(interface_struct),
+ Vector{Return(Call(ty.Of(interface_struct), Call<vec4<f32>>(), 0.5_f, 0.25_f))},
+ Vector{Stage(ast::PipelineStage::kVertex)});
- Func("frag_main", utils::Vector{Param("inputs", ty.Of(interface_struct))}, ty.void_(),
- utils::Vector{
+ Func("frag_main", Vector{Param("inputs", ty.Of(interface_struct))}, ty.void_(),
+ Vector{
Decl(Let("r", ty.f32(), MemberAccessor("inputs", "col1"))),
Decl(Let("g", ty.f32(), MemberAccessor("inputs", "col2"))),
Decl(Let("p", ty.vec4<f32>(), MemberAccessor("inputs", "pos"))),
},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Vector{Stage(ast::PipelineStage::kFragment)});
ASTPrinter& gen = SanitizeAndBuild();
gen.Generate();
@@ -299,17 +299,17 @@
"VertexOutput",
{Member("pos", ty.vec4<f32>(), {Builtin(builtin::BuiltinValue::kPosition)})});
- Func("foo", utils::Vector{Param("x", ty.f32())}, ty.Of(vertex_output_struct),
+ Func("foo", Vector{Param("x", ty.f32())}, ty.Of(vertex_output_struct),
{Return(Call(ty.Of(vertex_output_struct),
Call<vec4<f32>>( "x", "x", "x", 1_f)))},
{});
- Func("vert_main1", utils::Empty, ty.Of(vertex_output_struct),
+ Func("vert_main1", tint::Empty, ty.Of(vertex_output_struct),
{Return(Call(ty.Of(vertex_output_struct),
Expr(Call("foo", Expr(0.5_f)))))},
{Stage(ast::PipelineStage::kVertex)});
- Func("vert_main2", utils::Empty, ty.Of(vertex_output_struct),
+ Func("vert_main2", tint::Empty, ty.Of(vertex_output_struct),
{Return(Call(ty.Of(vertex_output_struct),
Expr(Call("foo", Expr(0.25_f)))))},
{Stage(ast::PipelineStage::kVertex)});
@@ -350,27 +350,27 @@
#endif
TEST_F(GlslASTPrinterTest_Function, Emit_Attribute_EntryPoint_With_Uniform) {
- auto* ubo_ty = Structure("UBO", utils::Vector{Member("coord", ty.vec4<f32>())});
+ auto* ubo_ty = Structure("UBO", Vector{Member("coord", ty.vec4<f32>())});
auto* ubo =
GlobalVar("ubo", ty.Of(ubo_ty), builtin::AddressSpace::kUniform, Binding(0_a), Group(1_a));
Func("sub_func",
- utils::Vector{
+ Vector{
Param("param", ty.f32()),
},
ty.f32(),
- utils::Vector{
+ Vector{
Return(MemberAccessor(MemberAccessor(ubo, "coord"), "x")),
});
auto* var = Var("v", ty.f32(), Call("sub_func", 1_f));
- Func("frag_main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("frag_main", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -400,18 +400,18 @@
}
TEST_F(GlslASTPrinterTest_Function, Emit_Attribute_EntryPoint_With_UniformStruct) {
- auto* s = Structure("Uniforms", utils::Vector{Member("coord", ty.vec4<f32>())});
+ auto* s = Structure("Uniforms", Vector{Member("coord", ty.vec4<f32>())});
GlobalVar("uniforms", ty.Of(s), builtin::AddressSpace::kUniform, Binding(0_a), Group(1_a));
auto* var = Var("v", ty.f32(), MemberAccessor(MemberAccessor("uniforms", "coord"), "x"));
- Func("frag_main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("frag_main", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -437,7 +437,7 @@
}
TEST_F(GlslASTPrinterTest_Function, Emit_Attribute_EntryPoint_With_RW_StorageBuffer_Read) {
- auto* s = Structure("Data", utils::Vector{
+ auto* s = Structure("Data", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
});
@@ -447,12 +447,12 @@
auto* var = Var("v", ty.f32(), MemberAccessor("coord", "b"));
- Func("frag_main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("frag_main", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -484,7 +484,7 @@
}
TEST_F(GlslASTPrinterTest_Function, Emit_Attribute_EntryPoint_With_RO_StorageBuffer_Read) {
- auto* s = Structure("Data", utils::Vector{
+ auto* s = Structure("Data", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
});
@@ -494,12 +494,12 @@
auto* var = Var("v", ty.f32(), MemberAccessor("coord", "b"));
- Func("frag_main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("frag_main", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -532,7 +532,7 @@
}
TEST_F(GlslASTPrinterTest_Function, Emit_Attribute_EntryPoint_With_WO_StorageBuffer_Store) {
- auto* s = Structure("Data", utils::Vector{
+ auto* s = Structure("Data", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
});
@@ -540,12 +540,12 @@
GlobalVar("coord", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(0_a), Group(1_a));
- Func("frag_main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("frag_main", tint::Empty, ty.void_(),
+ Vector{
Assign(MemberAccessor("coord", "b"), Expr(2_f)),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -577,7 +577,7 @@
}
TEST_F(GlslASTPrinterTest_Function, Emit_Attribute_EntryPoint_With_StorageBuffer_Store) {
- auto* s = Structure("Data", utils::Vector{
+ auto* s = Structure("Data", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
});
@@ -585,12 +585,12 @@
GlobalVar("coord", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(0_a), Group(1_a));
- Func("frag_main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("frag_main", tint::Empty, ty.void_(),
+ Vector{
Assign(MemberAccessor("coord", "b"), Expr(2_f)),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -622,22 +622,22 @@
}
TEST_F(GlslASTPrinterTest_Function, Emit_Attribute_Called_By_EntryPoint_With_Uniform) {
- auto* s = Structure("S", utils::Vector{Member("x", ty.f32())});
+ auto* s = Structure("S", Vector{Member("x", ty.f32())});
GlobalVar("coord", ty.Of(s), builtin::AddressSpace::kUniform, Binding(0_a), Group(1_a));
- Func("sub_func", utils::Vector{Param("param", ty.f32())}, ty.f32(),
- utils::Vector{
+ Func("sub_func", Vector{Param("param", ty.f32())}, ty.f32(),
+ Vector{
Return(MemberAccessor("coord", "x")),
});
auto* var = Var("v", ty.f32(), Call("sub_func", 1_f));
- Func("frag_main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("frag_main", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -667,23 +667,23 @@
}
TEST_F(GlslASTPrinterTest_Function, Emit_Attribute_Called_By_EntryPoint_With_StorageBuffer) {
- auto* s = Structure("S", utils::Vector{Member("x", ty.f32())});
+ auto* s = Structure("S", Vector{Member("x", ty.f32())});
GlobalVar("coord", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(0_a), Group(1_a));
- Func("sub_func", utils::Vector{Param("param", ty.f32())}, ty.f32(),
- utils::Vector{
+ Func("sub_func", Vector{Param("param", ty.f32())}, ty.f32(),
+ Vector{
Return(MemberAccessor("coord", "x")),
});
auto* var = Var("v", ty.f32(), Call("sub_func", 1_f));
- Func("frag_main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("frag_main", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -719,8 +719,8 @@
}
TEST_F(GlslASTPrinterTest_Function, Emit_Attribute_EntryPoint_WithNameCollision) {
- Func("centroid", utils::Empty, ty.void_(), {},
- utils::Vector{
+ Func("centroid", tint::Empty, ty.void_(), {},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -741,11 +741,11 @@
}
TEST_F(GlslASTPrinterTest_Function, Emit_Attribute_EntryPoint_Compute) {
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -763,8 +763,8 @@
}
TEST_F(GlslASTPrinterTest_Function, Emit_Attribute_EntryPoint_Compute_WithWorkgroup_Literal) {
- Func("main", utils::Empty, ty.void_(), {},
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), {},
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(2_i, 4_i, 6_i),
});
@@ -785,8 +785,8 @@
GlobalConst("width", ty.i32(), Call<i32>(2_i));
GlobalConst("height", ty.i32(), Call<i32>(3_i));
GlobalConst("depth", ty.i32(), Call<i32>(4_i));
- Func("main", utils::Empty, ty.void_(), {},
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), {},
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize("width", "height", "depth"),
});
@@ -808,8 +808,8 @@
Override("width", ty.i32(), Call<i32>(2_i), Id(7_u));
Override("height", ty.i32(), Call<i32>(3_i), Id(8_u));
Override("depth", ty.i32(), Call<i32>(4_i), Id(9_u));
- Func("main", utils::Empty, ty.void_(), {},
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), {},
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize("width", "height", "depth"),
});
@@ -825,8 +825,8 @@
}
TEST_F(GlslASTPrinterTest_Function, Emit_Function_WithArrayParams) {
- Func("my_func", utils::Vector{Param("a", ty.array<f32, 5>())}, ty.void_(),
- utils::Vector{
+ Func("my_func", Vector{Param("a", ty.array<f32, 5>())}, ty.void_(),
+ Vector{
Return(),
});
@@ -843,8 +843,8 @@
}
TEST_F(GlslASTPrinterTest_Function, Emit_Function_WithArrayReturn) {
- Func("my_func", utils::Empty, ty.array<f32, 5>(),
- utils::Vector{
+ Func("my_func", tint::Empty, ty.array<f32, 5>(),
+ Vector{
Return(Call<array<f32, 5>>()),
});
@@ -879,7 +879,7 @@
// return;
// }
- auto* s = Structure("Data", utils::Vector{Member("d", ty.f32())});
+ auto* s = Structure("Data", Vector{Member("d", ty.f32())});
GlobalVar("data", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(0_a), Group(0_a));
@@ -887,12 +887,12 @@
{
auto* var = Var("v", ty.f32(), MemberAccessor("data", "d"));
- Func("a", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -901,12 +901,12 @@
{
auto* var = Var("v", ty.f32(), MemberAccessor("data", "d"));
- Func("b", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("b", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
diff --git a/src/tint/lang/glsl/writer/ast_printer/identifier_test.cc b/src/tint/lang/glsl/writer/ast_printer/identifier_test.cc
index f10aaba..00aeab1 100644
--- a/src/tint/lang/glsl/writer/ast_printer/identifier_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/identifier_test.cc
@@ -30,7 +30,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, i);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "foo");
diff --git a/src/tint/lang/glsl/writer/ast_printer/import_test.cc b/src/tint/lang/glsl/writer/ast_printer/import_test.cc
index 146d67d..ff2a76e 100644
--- a/src/tint/lang/glsl/writer/ast_printer/import_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/import_test.cc
@@ -43,7 +43,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitCall(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), std::string(param.glsl_name) + "(1.0f)");
@@ -83,7 +83,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitCall(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), std::string(param.glsl_name) + "(1)");
@@ -101,7 +101,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitCall(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(
@@ -145,7 +145,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitCall(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), std::string(param.glsl_name) + "(1.0f, 2.0f)");
@@ -168,7 +168,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitCall(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(),
@@ -194,7 +194,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitCall(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), std::string(param.glsl_name) + "(1, 2)");
@@ -213,7 +213,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitCall(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), std::string(param.glsl_name) + "(1.0f, 2.0f, 3.0f)");
@@ -234,7 +234,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitCall(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(),
@@ -256,7 +256,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitCall(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), std::string(param.glsl_name) + "(1, 2, 3)");
@@ -273,7 +273,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitCall(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), std::string("determinant(var)"));
diff --git a/src/tint/lang/glsl/writer/ast_printer/loop_test.cc b/src/tint/lang/glsl/writer/ast_printer/loop_test.cc
index 9642a09..0d09b5a 100644
--- a/src/tint/lang/glsl/writer/ast_printer/loop_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/loop_test.cc
@@ -29,8 +29,7 @@
auto* continuing = Block();
auto* l = Loop(body, continuing);
- Func("F", utils::Empty, ty.void_(), utils::Vector{l},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{l}, Vector{Stage(ast::PipelineStage::kFragment)});
ASTPrinter& gen = Build();
@@ -50,8 +49,7 @@
auto* continuing = Block(CallStmt(Call("a_statement")));
auto* l = Loop(body, continuing);
- Func("F", utils::Empty, ty.void_(), utils::Vector{l},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{l}, Vector{Stage(ast::PipelineStage::kFragment)});
ASTPrinter& gen = Build();
@@ -74,8 +72,7 @@
auto* continuing = Block(CallStmt(Call("a_statement")), BreakIf(true));
auto* l = Loop(body, continuing);
- Func("F", utils::Empty, ty.void_(), utils::Vector{l},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{l}, Vector{Stage(ast::PipelineStage::kFragment)});
ASTPrinter& gen = Build();
@@ -111,8 +108,7 @@
auto* outer = Loop(body, continuing);
- Func("F", utils::Empty, ty.void_(), utils::Vector{outer},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{outer}, Vector{Stage(ast::PipelineStage::kFragment)});
ASTPrinter& gen = Build();
diff --git a/src/tint/lang/glsl/writer/ast_printer/member_accessor_test.cc b/src/tint/lang/glsl/writer/ast_printer/member_accessor_test.cc
index 6d794d2..7c9aaac 100644
--- a/src/tint/lang/glsl/writer/ast_printer/member_accessor_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/member_accessor_test.cc
@@ -87,7 +87,7 @@
template <typename BASE>
class GlslASTPrinterTest_MemberAccessorBase : public BASE {
public:
- void SetupStorageBuffer(utils::VectorRef<const ast::StructMember*> members) {
+ void SetupStorageBuffer(VectorRef<const ast::StructMember*> members) {
ProgramBuilder& b = *this;
auto* s = b.Structure("Data", members);
@@ -96,10 +96,10 @@
builtin::Access::kReadWrite, b.Group(1_a), b.Binding(0_a));
}
- void SetupFunction(utils::VectorRef<const ast::Statement*> statements) {
+ void SetupFunction(VectorRef<const ast::Statement*> statements) {
ProgramBuilder& b = *this;
- b.Func("main", utils::Empty, b.ty.void_(), statements,
- utils::Vector<const ast::Attribute*, 1>{
+ b.Func("main", tint::Empty, b.ty.void_(), statements,
+ Vector<const ast::Attribute*, 1>{
b.Stage(ast::PipelineStage::kFragment),
});
}
@@ -112,7 +112,7 @@
GlslASTPrinterTest_MemberAccessorBase<TestParamHelper<T>>;
TEST_F(GlslASTPrinterTest_MemberAccessor, EmitExpression_MemberAccessor) {
- auto* s = Structure("Data", utils::Vector{Member("mem", ty.f32())});
+ auto* s = Structure("Data", Vector{Member("mem", ty.f32())});
GlobalVar("str", ty.Of(s), builtin::AddressSpace::kPrivate);
auto* expr = MemberAccessor("str", "mem");
@@ -160,12 +160,12 @@
auto p = GetParam();
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("a", ty.i32()),
Member("b", p.member_type(ty)),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("x", MemberAccessor("data", "b"))),
});
@@ -211,12 +211,12 @@
auto p = GetParam();
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("a", ty.i32()),
Member("b", p.member_type(ty)),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("value", p.member_type(ty), Call(p.member_type(ty)))),
Assign(MemberAccessor("data", "b"), Expr("value")),
});
@@ -269,12 +269,12 @@
// var<storage> data : Data;
// data.a = mat2x3<f32>();
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("a", ty.i32()),
Member("b", ty.mat2x3<f32>()),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Assign(MemberAccessor("data", "b"), Call<mat2x3<f32>>()),
});
@@ -323,12 +323,12 @@
// var<storage> data : Data;
// data.a[2i][1i];
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("z", ty.f32()),
Member("a", ty.mat4x3<f32>()),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("x", IndexAccessor(IndexAccessor(MemberAccessor("data", "a"), 2_i), 1_i))),
});
@@ -371,12 +371,12 @@
// var<storage> data : Data;
// data.a[2];
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("z", ty.f32()),
Member("a", ty.array<i32, 5>()),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("x", IndexAccessor(MemberAccessor("data", "a"), 2_i))),
});
@@ -416,12 +416,12 @@
// var<storage> data : Data;
// data.a[(2i + 4i) - 3i];
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("z", ty.f32()),
Member("a", ty.array<i32, 5>()),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("a", Expr(2_i))),
Decl(Var("b", Expr(4_i))),
Decl(Var("c", Expr(3_i))),
@@ -466,12 +466,12 @@
// var<storage> data : Data;
// data.a[2i] = 2i;
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("z", ty.f32()),
Member("a", ty.array<i32, 5>()),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Assign(IndexAccessor(MemberAccessor("data", "a"), 2_i), 2_i),
});
@@ -515,16 +515,16 @@
// var<storage> data : Pre;
// data.c[2i].b
- auto* inner = Structure("Inner", utils::Vector{
+ auto* inner = Structure("Inner", Vector{
Member("a", ty.vec3<f32>()),
Member("b", ty.vec3<f32>()),
});
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("c", ty.array(ty.Of(inner), 4_u)),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("x", MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"))),
});
@@ -574,16 +574,16 @@
// var<storage> data : Pre;
// data.c[2i].b.xy
- auto* inner = Structure("Inner", utils::Vector{
+ auto* inner = Structure("Inner", Vector{
Member("a", ty.vec3<f32>()),
Member("b", ty.vec3<f32>()),
});
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("c", ty.array(ty.Of(inner), 4_u)),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("x",
MemberAccessor(
MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"), "xy"))),
@@ -636,16 +636,16 @@
// var<storage> data : Pre;
// data.c[2i].b.g
- auto* inner = Structure("Inner", utils::Vector{
+ auto* inner = Structure("Inner", Vector{
Member("a", ty.vec3<f32>()),
Member("b", ty.vec3<f32>()),
});
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("c", ty.array(ty.Of(inner), 4_u)),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("x",
MemberAccessor(
MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"), "g"))),
@@ -697,16 +697,16 @@
// var<storage> data : Pre;
// data.c[2i].b[1i]
- auto* inner = Structure("Inner", utils::Vector{
+ auto* inner = Structure("Inner", Vector{
Member("a", ty.vec3<f32>()),
Member("b", ty.vec3<f32>()),
});
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("c", ty.array(ty.Of(inner), 4_u)),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("x",
IndexAccessor(MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"),
1_i))),
@@ -758,16 +758,16 @@
// var<storage> data : Pre;
// data.c[2i].b = vec3<f32>(1.f, 2.f, 3.f);
- auto* inner = Structure("Inner", utils::Vector{
+ auto* inner = Structure("Inner", Vector{
Member("a", ty.vec3<f32>()),
Member("b", ty.vec3<f32>()),
});
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("c", ty.array(ty.Of(inner), 4_u)),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Assign(MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"),
Call<vec3<f32>>(1_f, 2_f, 3_f)),
});
@@ -818,16 +818,16 @@
// var<storage> data : Pre;
// data.c[2i].b.y = 1.f;
- auto* inner = Structure("Inner", utils::Vector{
+ auto* inner = Structure("Inner", Vector{
Member("a", ty.vec3<i32>()),
Member("b", ty.vec3<f32>()),
});
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("c", ty.array(ty.Of(inner), 4_u)),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Assign(MemberAccessor(MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"),
"y"),
Expr(1_f)),
diff --git a/src/tint/lang/glsl/writer/ast_printer/module_constant_test.cc b/src/tint/lang/glsl/writer/ast_printer/module_constant_test.cc
index d5b531e..ca037c8 100644
--- a/src/tint/lang/glsl/writer/ast_printer/module_constant_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/module_constant_test.cc
@@ -37,8 +37,8 @@
TEST_F(GlslASTPrinterTest_ModuleConstant, Emit_GlobalConst_AInt) {
auto* var = GlobalConst("G", Expr(1_a));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", Expr(var))),
});
@@ -56,8 +56,8 @@
TEST_F(GlslASTPrinterTest_ModuleConstant, Emit_GlobalConst_AFloat) {
auto* var = GlobalConst("G", Expr(1._a));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", Expr(var))),
});
@@ -75,8 +75,8 @@
TEST_F(GlslASTPrinterTest_ModuleConstant, Emit_GlobalConst_i32) {
auto* var = GlobalConst("G", Expr(1_i));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", Expr(var))),
});
@@ -94,8 +94,8 @@
TEST_F(GlslASTPrinterTest_ModuleConstant, Emit_GlobalConst_u32) {
auto* var = GlobalConst("G", Expr(1_u));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", Expr(var))),
});
@@ -113,8 +113,8 @@
TEST_F(GlslASTPrinterTest_ModuleConstant, Emit_GlobalConst_f32) {
auto* var = GlobalConst("G", Expr(1_f));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", Expr(var))),
});
@@ -134,8 +134,8 @@
Enable(builtin::Extension::kF16);
auto* var = GlobalConst("G", Expr(1_h));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", Expr(var))),
});
@@ -154,8 +154,8 @@
TEST_F(GlslASTPrinterTest_ModuleConstant, Emit_GlobalConst_vec3_AInt) {
auto* var = GlobalConst("G", Call<vec3<Infer>>(1_a, 2_a, 3_a));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", Expr(var))),
});
@@ -173,8 +173,8 @@
TEST_F(GlslASTPrinterTest_ModuleConstant, Emit_GlobalConst_vec3_AFloat) {
auto* var = GlobalConst("G", Call<vec3<Infer>>(1._a, 2._a, 3._a));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", Expr(var))),
});
@@ -192,8 +192,8 @@
TEST_F(GlslASTPrinterTest_ModuleConstant, Emit_GlobalConst_vec3_f32) {
auto* var = GlobalConst("G", Call<vec3<f32>>(1_f, 2_f, 3_f));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", Expr(var))),
});
@@ -213,8 +213,8 @@
Enable(builtin::Extension::kF16);
auto* var = GlobalConst("G", Call<vec3<f16>>(1_h, 2_h, 3_h));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", Expr(var))),
});
@@ -233,8 +233,8 @@
TEST_F(GlslASTPrinterTest_ModuleConstant, Emit_GlobalConst_mat2x3_AFloat) {
auto* var = GlobalConst("G", Call<mat2x3<Infer>>(1._a, 2._a, 3._a, 4._a, 5._a, 6._a));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", Expr(var))),
});
@@ -252,8 +252,8 @@
TEST_F(GlslASTPrinterTest_ModuleConstant, Emit_GlobalConst_mat2x3_f32) {
auto* var = GlobalConst("G", Call<mat2x3<f32>>(1_f, 2_f, 3_f, 4_f, 5_f, 6_f));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", Expr(var))),
});
@@ -273,8 +273,8 @@
Enable(builtin::Extension::kF16);
auto* var = GlobalConst("G", Call<mat2x3<f16>>(1_h, 2_h, 3_h, 4_h, 5_h, 6_h));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", Expr(var))),
});
@@ -293,8 +293,8 @@
TEST_F(GlslASTPrinterTest_ModuleConstant, Emit_GlobalConst_arr_f32) {
auto* var = GlobalConst("G", Call<array<f32, 3>>(1_f, 2_f, 3_f));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", Expr(var))),
});
@@ -315,8 +315,8 @@
Call<vec2<bool>>(true, false), //
Call<vec2<bool>>(false, true), //
Call<vec2<bool>>(true, true)));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", Expr(var))),
});
diff --git a/src/tint/lang/glsl/writer/ast_printer/return_test.cc b/src/tint/lang/glsl/writer/ast_printer/return_test.cc
index 82599a3..771c875 100644
--- a/src/tint/lang/glsl/writer/ast_printer/return_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/return_test.cc
@@ -36,7 +36,7 @@
TEST_F(GlslASTPrinterTest_Return, Emit_ReturnWithValue) {
auto* r = Return(123_i);
- Func("f", utils::Empty, ty.i32(), utils::Vector{r});
+ Func("f", tint::Empty, ty.i32(), Vector{r});
ASTPrinter& gen = Build();
gen.IncrementIndent();
diff --git a/src/tint/lang/glsl/writer/ast_printer/sanitizer_test.cc b/src/tint/lang/glsl/writer/ast_printer/sanitizer_test.cc
index e6aac15..516e593 100644
--- a/src/tint/lang/glsl/writer/ast_printer/sanitizer_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/sanitizer_test.cc
@@ -28,15 +28,15 @@
using GlslSanitizerTest = TestHelper;
TEST_F(GlslSanitizerTest, Call_ArrayLength) {
- auto* s = Structure("my_struct", utils::Vector{Member(0, "a", ty.array<f32>())});
+ auto* s = Structure("my_struct", Vector{Member(0, "a", ty.array<f32>())});
GlobalVar("b", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(2_a));
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("len", ty.u32(), Call("arrayLength", AddressOf(MemberAccessor("b", "a"))))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -65,18 +65,18 @@
}
TEST_F(GlslSanitizerTest, Call_ArrayLength_OtherMembersInStruct) {
- auto* s = Structure("my_struct", utils::Vector{
+ auto* s = Structure("my_struct", Vector{
Member(0, "z", ty.f32()),
Member(4, "a", ty.array<f32>()),
});
GlobalVar("b", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(2_a));
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("len", ty.u32(), Call("arrayLength", AddressOf(MemberAccessor("b", "a"))))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -107,20 +107,20 @@
}
TEST_F(GlslSanitizerTest, Call_ArrayLength_ViaLets) {
- auto* s = Structure("my_struct", utils::Vector{Member(0, "a", ty.array<f32>())});
+ auto* s = Structure("my_struct", Vector{Member(0, "a", ty.array<f32>())});
GlobalVar("b", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(2_a));
auto* p = Let("p", AddressOf("b"));
auto* p2 = Let("p2", AddressOf(MemberAccessor(Deref(p), "a")));
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(p),
Decl(p2),
Decl(Var("len", ty.u32(), Call("arrayLength", p2))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -152,12 +152,12 @@
TEST_F(GlslSanitizerTest, PromoteArrayInitializerToConstVar) {
auto* array_init = Call<array<i32, 4>>(1_i, 2_i, 3_i, 4_i);
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("idx", Expr(3_i))),
Decl(Var("pos", ty.i32(), IndexAccessor(array_init, "idx"))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -184,7 +184,7 @@
}
TEST_F(GlslSanitizerTest, PromoteStructInitializerToConstVar) {
- auto* str = Structure("S", utils::Vector{
+ auto* str = Structure("S", Vector{
Member("a", ty.i32()),
Member("b", ty.vec3<f32>()),
Member("c", ty.i32()),
@@ -194,12 +194,12 @@
auto* struct_access = MemberAccessor(struct_init, "b");
auto* pos = Var("pos", ty.vec3<f32>(), struct_access);
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(runtime_value),
Decl(pos),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -239,13 +239,13 @@
auto* p = Let("p", ty.ptr<function, i32>(), AddressOf(v));
auto* x = Var("x", ty.i32(), Deref(p));
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(v),
Decl(p),
Decl(x),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -282,15 +282,15 @@
auto* vp = Let("vp", ty.ptr<function, vec4<f32>>(), AddressOf(IndexAccessor(Deref(mp), 2_i)));
auto* v = Var("v", ty.vec4<f32>(), Deref(vp));
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(a),
Decl(ap),
Decl(mp),
Decl(vp),
Decl(v),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
diff --git a/src/tint/lang/glsl/writer/ast_printer/storage_buffer_test.cc b/src/tint/lang/glsl/writer/ast_printer/storage_buffer_test.cc
index 1f0a420..bbf188c 100644
--- a/src/tint/lang/glsl/writer/ast_printer/storage_buffer_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/storage_buffer_test.cc
@@ -33,10 +33,10 @@
// };
// @group(0) @binding(0) var<storage, read_write> nephews : Nephews;
auto* nephews = ctx->Structure(
- "Nephews", utils::Vector{
- ctx->Member("huey", ctx->ty.f32(), utils::Vector{ctx->MemberAlign(256_i)}),
- ctx->Member("dewey", ctx->ty.f32(), utils::Vector{ctx->MemberAlign(256_i)}),
- ctx->Member("louie", ctx->ty.f32(), utils::Vector{ctx->MemberAlign(256_i)}),
+ "Nephews", Vector{
+ ctx->Member("huey", ctx->ty.f32(), Vector{ctx->MemberAlign(256_i)}),
+ ctx->Member("dewey", ctx->ty.f32(), Vector{ctx->MemberAlign(256_i)}),
+ ctx->Member("louie", ctx->ty.f32(), Vector{ctx->MemberAlign(256_i)}),
});
ctx->GlobalVar("nephews", ctx->ty.Of(nephews), builtin::AddressSpace::kStorage,
ctx->Binding(0_a), ctx->Group(0_a));
diff --git a/src/tint/lang/glsl/writer/ast_printer/switch_test.cc b/src/tint/lang/glsl/writer/ast_printer/switch_test.cc
index 2e48773..06b4ec0 100644
--- a/src/tint/lang/glsl/writer/ast_printer/switch_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/switch_test.cc
@@ -27,13 +27,13 @@
GlobalVar("cond", ty.i32(), builtin::AddressSpace::kPrivate);
auto* def_body = Block(create<ast::BreakStatement>());
- auto* def = create<ast::CaseStatement>(utils::Vector{DefaultCaseSelector()}, def_body);
+ auto* def = create<ast::CaseStatement>(Vector{DefaultCaseSelector()}, def_body);
auto* case_body = Block(create<ast::BreakStatement>());
- auto* case_stmt = create<ast::CaseStatement>(utils::Vector{CaseSelector(5_i)}, case_body);
+ auto* case_stmt = create<ast::CaseStatement>(Vector{CaseSelector(5_i)}, case_body);
auto* cond = Expr("cond");
- auto* s = Switch(cond, utils::Vector{case_stmt, def});
+ auto* s = Switch(cond, Vector{case_stmt, def});
WrapInFunction(s);
ASTPrinter& gen = Build();
@@ -55,11 +55,11 @@
GlobalVar("cond", ty.i32(), builtin::AddressSpace::kPrivate);
auto* def_body = Block(create<ast::BreakStatement>());
- auto* def = create<ast::CaseStatement>(utils::Vector{CaseSelector(5_i), DefaultCaseSelector()},
- def_body);
+ auto* def =
+ create<ast::CaseStatement>(Vector{CaseSelector(5_i), DefaultCaseSelector()}, def_body);
auto* cond = Expr("cond");
- auto* s = Switch(cond, utils::Vector{def});
+ auto* s = Switch(cond, Vector{def});
WrapInFunction(s);
ASTPrinter& gen = Build();
diff --git a/src/tint/lang/glsl/writer/ast_printer/type_test.cc b/src/tint/lang/glsl/writer/ast_printer/type_test.cc
index ba488ae..952a2c1 100644
--- a/src/tint/lang/glsl/writer/ast_printer/type_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/type_test.cc
@@ -40,7 +40,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitType(out, program->TypeOf(ty), builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, "ary");
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
@@ -53,7 +53,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitType(out, program->TypeOf(ty), builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, "ary");
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
@@ -66,7 +66,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitType(out, program->TypeOf(ty), builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, "ary");
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
@@ -79,7 +79,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitType(out, program->TypeOf(ty), builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, "");
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
@@ -91,7 +91,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitType(out, bool_, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, "");
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "bool");
@@ -102,7 +102,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitType(out, f32, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, "");
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "float");
@@ -115,7 +115,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitType(out, f16, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, "");
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "float16_t");
@@ -126,7 +126,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitType(out, i32, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, "");
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "int");
@@ -139,7 +139,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitType(out, mat2x3, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, "");
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "mat2x3");
@@ -154,14 +154,14 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitType(out, mat2x3, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, "");
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "f16mat2x3");
}
TEST_F(GlslASTPrinterTest_Type, EmitType_StructDecl) {
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
});
@@ -169,7 +169,7 @@
ASTPrinter& gen = Build();
- utils::TextGenerator::TextBuffer buf;
+ tint::TextGenerator::TextBuffer buf;
auto* str = program->TypeOf(s)->As<type::Struct>();
gen.EmitStructType(&buf, str);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
@@ -182,7 +182,7 @@
}
TEST_F(GlslASTPrinterTest_Type, EmitType_Struct) {
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
});
@@ -191,14 +191,14 @@
ASTPrinter& gen = Build();
auto* str = program->TypeOf(s)->As<type::Struct>();
- utils::StringStream out;
+ StringStream out;
gen.EmitType(out, str, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, "");
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "S");
}
TEST_F(GlslASTPrinterTest_Type, EmitType_Struct_NameCollision) {
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("double", ty.i32()),
Member("float", ty.f32()),
});
@@ -215,15 +215,15 @@
}
TEST_F(GlslASTPrinterTest_Type, EmitType_Struct_WithOffsetAttributes) {
- auto* s = Structure("S", utils::Vector{
- Member("a", ty.i32(), utils::Vector{MemberOffset(0_a)}),
- Member("b", ty.f32(), utils::Vector{MemberOffset(8_a)}),
+ auto* s = Structure("S", Vector{
+ Member("a", ty.i32(), Vector{MemberOffset(0_a)}),
+ Member("b", ty.f32(), Vector{MemberOffset(8_a)}),
});
GlobalVar("g", ty.Of(s), builtin::AddressSpace::kPrivate);
ASTPrinter& gen = Build();
- utils::TextGenerator::TextBuffer buf;
+ tint::TextGenerator::TextBuffer buf;
auto* str = program->TypeOf(s)->As<type::Struct>();
gen.EmitStructType(&buf, str);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
@@ -240,7 +240,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitType(out, u32, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, "");
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "uint");
@@ -252,7 +252,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitType(out, vec3, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, "");
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "vec3");
@@ -266,7 +266,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitType(out, vec3, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, "");
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "f16vec3");
@@ -277,7 +277,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitType(out, void_, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, "");
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "void");
@@ -288,7 +288,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitType(out, sampler, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, "");
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
}
@@ -298,7 +298,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitType(out, sampler, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, "");
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
}
@@ -308,7 +308,7 @@
std::string result;
};
inline std::ostream& operator<<(std::ostream& out, GlslDepthTextureData data) {
- utils::StringStream s;
+ StringStream s;
s << data.dim;
out << s.str();
return out;
@@ -321,11 +321,11 @@
GlobalVar("tex", t, Binding(1_a), Group(2_a));
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v", Call("textureDimensions", "tex"))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -350,11 +350,11 @@
GlobalVar("tex", t, Binding(1_a), Group(2_a));
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v", Call("textureDimensions", "tex"))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -371,7 +371,7 @@
std::string result;
};
inline std::ostream& operator<<(std::ostream& out, GlslSampledTextureData data) {
- utils::StringStream str;
+ StringStream str;
str << data.dim;
out << str.str();
return out;
@@ -396,11 +396,11 @@
GlobalVar("tex", t, Binding(1_a), Group(2_a));
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v", Call("textureDimensions", "tex"))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -509,7 +509,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitType(out, s, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, "");
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "highp sampler2DMS");
@@ -521,7 +521,7 @@
std::string result;
};
inline std::ostream& operator<<(std::ostream& out, GlslStorageTextureData data) {
- utils::StringStream str;
+ StringStream str;
str << data.dim;
return out << str.str();
}
@@ -533,11 +533,11 @@
GlobalVar("tex", t, Binding(1_a), Group(2_a));
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v", Call("textureDimensions", "tex"))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
diff --git a/src/tint/lang/glsl/writer/ast_printer/unary_op_test.cc b/src/tint/lang/glsl/writer/ast_printer/unary_op_test.cc
index f4507fc..0dcb634 100644
--- a/src/tint/lang/glsl/writer/ast_printer/unary_op_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/unary_op_test.cc
@@ -29,7 +29,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, op);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "expr");
@@ -42,7 +42,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, op);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "~(expr)");
@@ -56,7 +56,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, op);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "expr");
@@ -69,7 +69,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, op);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "!(expr)");
@@ -82,7 +82,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, op);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "-(expr)");
@@ -94,7 +94,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, op);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "(-2147483647 - 1)");
diff --git a/src/tint/lang/glsl/writer/ast_printer/uniform_buffer_test.cc b/src/tint/lang/glsl/writer/ast_printer/uniform_buffer_test.cc
index dd08b8c..feeaa35 100644
--- a/src/tint/lang/glsl/writer/ast_printer/uniform_buffer_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/uniform_buffer_test.cc
@@ -26,7 +26,7 @@
using GlslASTPrinterTest_UniformBuffer = TestHelper;
TEST_F(GlslASTPrinterTest_UniformBuffer, Simple) {
- auto* simple = Structure("Simple", utils::Vector{Member("member", ty.f32())});
+ auto* simple = Structure("Simple", Vector{Member("member", ty.f32())});
GlobalVar("simple", ty.Of(simple), builtin::AddressSpace::kUniform, Group(0_a), Binding(0_a));
ASTPrinter& gen = Build();
@@ -46,7 +46,7 @@
}
TEST_F(GlslASTPrinterTest_UniformBuffer, Simple_Desktop) {
- auto* simple = Structure("Simple", utils::Vector{Member("member", ty.f32())});
+ auto* simple = Structure("Simple", Vector{Member("member", ty.f32())});
GlobalVar("simple", ty.Of(simple), builtin::AddressSpace::kUniform, Group(0_a), Binding(0_a));
ASTPrinter& gen = Build(Version(Version::Standard::kDesktop, 4, 4));
diff --git a/src/tint/lang/glsl/writer/ast_printer/variable_decl_statement_test.cc b/src/tint/lang/glsl/writer/ast_printer/variable_decl_statement_test.cc
index 3245378..6cfcacd 100644
--- a/src/tint/lang/glsl/writer/ast_printer/variable_decl_statement_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/variable_decl_statement_test.cc
@@ -64,8 +64,8 @@
TEST_F(GlslASTPrinterTest_VariableDecl, Emit_VariableDeclStatement_Const_AInt) {
auto* C = Const("C", Expr(1_a));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -84,8 +84,8 @@
TEST_F(GlslASTPrinterTest_VariableDecl, Emit_VariableDeclStatement_Const_AFloat) {
auto* C = Const("C", Expr(1._a));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -104,8 +104,8 @@
TEST_F(GlslASTPrinterTest_VariableDecl, Emit_VariableDeclStatement_Const_i32) {
auto* C = Const("C", Expr(1_i));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -124,8 +124,8 @@
TEST_F(GlslASTPrinterTest_VariableDecl, Emit_VariableDeclStatement_Const_u32) {
auto* C = Const("C", Expr(1_u));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -144,8 +144,8 @@
TEST_F(GlslASTPrinterTest_VariableDecl, Emit_VariableDeclStatement_Const_f32) {
auto* C = Const("C", Expr(1_f));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -166,8 +166,8 @@
Enable(builtin::Extension::kF16);
auto* C = Const("C", Expr(1_h));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -187,8 +187,8 @@
TEST_F(GlslASTPrinterTest_VariableDecl, Emit_VariableDeclStatement_Const_vec3_AInt) {
auto* C = Const("C", Call<vec3<Infer>>(1_a, 2_a, 3_a));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -207,8 +207,8 @@
TEST_F(GlslASTPrinterTest_VariableDecl, Emit_VariableDeclStatement_Const_vec3_AFloat) {
auto* C = Const("C", Call<vec3<Infer>>(1._a, 2._a, 3._a));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -227,8 +227,8 @@
TEST_F(GlslASTPrinterTest_VariableDecl, Emit_VariableDeclStatement_Const_vec3_f32) {
auto* C = Const("C", Call<vec3<f32>>(1_f, 2_f, 3_f));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -249,8 +249,8 @@
Enable(builtin::Extension::kF16);
auto* C = Const("C", Call<vec3<f16>>(1_h, 2_h, 3_h));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -270,8 +270,8 @@
TEST_F(GlslASTPrinterTest_VariableDecl, Emit_VariableDeclStatement_Const_mat2x3_AFloat) {
auto* C = Const("C", Call<mat2x3<Infer>>(1._a, 2._a, 3._a, 4._a, 5._a, 6._a));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -290,8 +290,8 @@
TEST_F(GlslASTPrinterTest_VariableDecl, Emit_VariableDeclStatement_Const_mat2x3_f32) {
auto* C = Const("C", Call<mat2x3<f32>>(1_f, 2_f, 3_f, 4_f, 5_f, 6_f));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -312,8 +312,8 @@
Enable(builtin::Extension::kF16);
auto* C = Const("C", Call<mat2x3<f16>>(1_h, 2_h, 3_h, 4_h, 5_h, 6_h));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -333,8 +333,8 @@
TEST_F(GlslASTPrinterTest_VariableDecl, Emit_VariableDeclStatement_Const_arr_f32) {
auto* C = Const("C", Call<array<f32, 3>>(1_f, 2_f, 3_f));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -353,8 +353,8 @@
TEST_F(GlslASTPrinterTest_VariableDecl, Emit_VariableDeclStatement_Const_arr_f32_zero) {
auto* C = Const("C", Call<array<f32, 2>>());
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -373,8 +373,8 @@
TEST_F(GlslASTPrinterTest_VariableDecl, Emit_VariableDeclStatement_Const_arr_arr_f32_zero) {
auto* C = Const("C", Call<array<array<f32, 2>, 3>>());
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -392,10 +392,10 @@
}
TEST_F(GlslASTPrinterTest_VariableDecl, Emit_VariableDeclStatement_Const_arr_struct_zero) {
- Structure("S", utils::Vector{Member("a", ty.i32()), Member("b", ty.f32())});
+ Structure("S", Vector{Member("a", ty.i32()), Member("b", ty.f32())});
auto* C = Const("C", Call(ty.array(ty("S"), 2_i)));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -422,8 +422,8 @@
Call<vec2<bool>>(true, false), //
Call<vec2<bool>>(false, true), //
Call<vec2<bool>>(true, true)));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
diff --git a/src/tint/lang/glsl/writer/ast_printer/workgroup_var_test.cc b/src/tint/lang/glsl/writer/ast_printer/workgroup_var_test.cc
index 7fb1c04..2c2f2b3 100644
--- a/src/tint/lang/glsl/writer/ast_printer/workgroup_var_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/workgroup_var_test.cc
@@ -30,8 +30,8 @@
TEST_F(GlslASTPrinterTest_WorkgroupVar, Basic) {
GlobalVar("wg", ty.f32(), builtin::AddressSpace::kWorkgroup);
- Func("main", utils::Empty, ty.void_(), utils::Vector{Assign("wg", 1.2_f)},
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), Vector{Assign("wg", 1.2_f)},
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -46,8 +46,8 @@
GlobalVar("wg", ty.Of(alias), builtin::AddressSpace::kWorkgroup);
- Func("main", utils::Empty, ty.void_(), utils::Vector{Assign("wg", 1.2_f)},
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), Vector{Assign("wg", 1.2_f)},
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
diff --git a/src/tint/lang/hlsl/validate/hlsl.cc b/src/tint/lang/hlsl/validate/hlsl.cc
index b6c3232..323885d 100644
--- a/src/tint/lang/hlsl/validate/hlsl.cc
+++ b/src/tint/lang/hlsl/validate/hlsl.cc
@@ -37,7 +37,7 @@
bool require_16bit_types) {
Result result;
- auto dxc = utils::Command(dxc_path);
+ auto dxc = tint::Command(dxc_path);
if (!dxc.Found()) {
result.output = "DXC not found at '" + std::string(dxc_path) + "'";
result.failed = true;
@@ -47,7 +47,7 @@
// Native 16-bit types, e.g. float16_t, require SM6.2. Otherwise we use SM6.0.
const char* shader_model_version = require_16bit_types ? "6_2" : "6_0";
- utils::TmpFile file;
+ tint::TmpFile file;
file << source;
for (auto ep : entry_points) {
@@ -94,7 +94,7 @@
result.failed = (res.error_code != 0);
// Remove the temporary file name from the output to keep output deterministic
- result.output = utils::ReplaceAll(result.output, file.Path(), "shader.hlsl");
+ result.output = tint::ReplaceAll(result.output, file.Path(), "shader.hlsl");
}
if (entry_points.empty()) {
diff --git a/src/tint/lang/hlsl/writer/ast_printer/array_accessor_test.cc b/src/tint/lang/hlsl/writer/ast_printer/array_accessor_test.cc
index e70b970..af8a9d8 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/array_accessor_test.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/array_accessor_test.cc
@@ -29,7 +29,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "ary[5]");
}
diff --git a/src/tint/lang/hlsl/writer/ast_printer/assign_test.cc b/src/tint/lang/hlsl/writer/ast_printer/assign_test.cc
index f8d3365..cf0b503 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/assign_test.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/assign_test.cc
@@ -22,8 +22,8 @@
using HlslASTPrinterTest_Assign = TestHelper;
TEST_F(HlslASTPrinterTest_Assign, Emit_Assign) {
- Func("fn", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("fn", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("lhs", ty.i32())),
Decl(Var("rhs", ty.i32())),
Assign("lhs", "rhs"),
@@ -42,8 +42,8 @@
}
TEST_F(HlslASTPrinterTest_Assign, Emit_Vector_Assign_LetIndex) {
- Func("fn", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("fn", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("lhs", ty.vec3<f32>())),
Decl(Var("rhs", ty.f32())),
Decl(Let("index", ty.u32(), Expr(0_u))),
@@ -68,8 +68,8 @@
}
TEST_F(HlslASTPrinterTest_Assign, Emit_Vector_Assign_ConstIndex) {
- Func("fn", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("fn", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("lhs", ty.vec3<f32>())),
Decl(Var("rhs", ty.f32())),
Decl(Const("index", ty.u32(), Expr(0_u))),
@@ -89,8 +89,8 @@
}
TEST_F(HlslASTPrinterTest_Assign, Emit_Vector_Assign_DynamicIndex) {
- Func("fn", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("fn", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("lhs", ty.vec3<f32>())),
Decl(Var("rhs", ty.f32())),
Decl(Var("index", ty.u32())),
@@ -115,8 +115,8 @@
}
TEST_F(HlslASTPrinterTest_Assign, Emit_Matrix_Assign_Vector_LetIndex) {
- Func("fn", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("fn", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("lhs", ty.mat4x2<f32>())),
Decl(Var("rhs", ty.vec2<f32>())),
Decl(Let("index", ty.u32(), Expr(0_u))),
@@ -146,8 +146,8 @@
}
TEST_F(HlslASTPrinterTest_Assign, Emit_Matrix_Assign_Vector_ConstIndex) {
- Func("fn", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("fn", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("lhs", ty.mat4x2<f32>())),
Decl(Var("rhs", ty.vec2<f32>())),
Decl(Const("index", ty.u32(), Expr(0_u))),
@@ -167,8 +167,8 @@
}
TEST_F(HlslASTPrinterTest_Assign, Emit_Matrix_Assign_Vector_DynamicIndex) {
- Func("fn", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("fn", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("lhs", ty.mat4x2<f32>())),
Decl(Var("rhs", ty.vec2<f32>())),
Decl(Var("index", ty.u32())),
@@ -200,8 +200,8 @@
TEST_F(HlslASTPrinterTest_Assign, Emit_Matrix_Assign_Scalar_LetIndices) {
auto* col = IndexAccessor("lhs", "col");
auto* el = IndexAccessor(col, "row");
- Func("fn", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("fn", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("lhs", ty.mat4x2<f32>())),
Decl(Var("rhs", ty.f32())),
Decl(Let("col", ty.u32(), Expr(0_u))),
@@ -243,8 +243,8 @@
TEST_F(HlslASTPrinterTest_Assign, Emit_Matrix_Assign_Scalar_ConstIndices) {
auto* col = IndexAccessor("lhs", "col");
auto* el = IndexAccessor(col, "row");
- Func("fn", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("fn", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("lhs", ty.mat4x2<f32>())),
Decl(Var("rhs", ty.f32())),
Decl(Const("col", ty.u32(), Expr(0_u))),
@@ -267,8 +267,8 @@
TEST_F(HlslASTPrinterTest_Assign, Emit_Matrix_Assign_Scalar_DynamicIndices) {
auto* col = IndexAccessor("lhs", "col");
auto* el = IndexAccessor(col, "row");
- Func("fn", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("fn", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("lhs", ty.mat4x2<f32>())),
Decl(Var("rhs", ty.f32())),
Decl(Var("col", ty.u32())),
diff --git a/src/tint/lang/hlsl/writer/ast_printer/ast_printer.cc b/src/tint/lang/hlsl/writer/ast_printer/ast_printer.cc
index 44306c2..94a6307 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/ast_printer.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/ast_printer.cc
@@ -119,7 +119,7 @@
}
}
-void PrintF32(utils::StringStream& out, float value) {
+void PrintF32(StringStream& out, float value) {
if (std::isinf(value)) {
out << "0.0f " << (value >= 0 ? "/* inf */" : "/* -inf */");
} else if (std::isnan(value)) {
@@ -129,7 +129,7 @@
}
}
-void PrintF16(utils::StringStream& out, float value) {
+void PrintF16(StringStream& out, float value) {
if (std::isinf(value)) {
out << "0.0h " << (value >= 0 ? "/* inf */" : "/* -inf */");
} else if (std::isnan(value)) {
@@ -148,7 +148,7 @@
BindingPoint const binding_point;
};
-utils::StringStream& operator<<(utils::StringStream& s, const RegisterAndSpace& rs) {
+StringStream& operator<<(StringStream& s, const RegisterAndSpace& rs) {
s << " : register(" << rs.reg << rs.binding_point.binding;
// Omit the space if it's 0, as it's the default.
// SM 5.0 doesn't support spaces, so we don't emit them if group is 0 for better compatibility.
@@ -335,7 +335,7 @@
bool ASTPrinter::Generate() {
if (!tint::writer::CheckSupportedExtensions(
"HLSL", builder_.AST(), diagnostics_,
- utils::Vector{
+ Vector{
builtin::Extension::kChromiumDisableUniformityAnalysis,
builtin::Extension::kChromiumExperimentalDp4A,
builtin::Extension::kChromiumExperimentalFullPtrParameters,
@@ -346,7 +346,7 @@
return false;
}
- const utils::TypeInfo* last_kind = nullptr;
+ const tint::TypeInfo* last_kind = nullptr;
size_t last_padding_line = 0;
auto* mod = builder_.Sem().Module();
@@ -413,10 +413,10 @@
bool ASTPrinter::EmitDynamicVectorAssignment(const ast::AssignmentStatement* stmt,
const type::Vector* vec) {
- auto name = utils::GetOrCreate(dynamic_vector_write_, vec, [&]() -> std::string {
+ auto name = tint::GetOrCreate(dynamic_vector_write_, vec, [&]() -> std::string {
std::string fn;
{
- utils::StringStream ss;
+ StringStream ss;
if (!EmitType(ss, vec, tint::builtin::AddressSpace::kUndefined,
builtin::Access::kUndefined, "")) {
return "";
@@ -487,10 +487,10 @@
bool ASTPrinter::EmitDynamicMatrixVectorAssignment(const ast::AssignmentStatement* stmt,
const type::Matrix* mat) {
- auto name = utils::GetOrCreate(dynamic_matrix_vector_write_, mat, [&]() -> std::string {
+ auto name = tint::GetOrCreate(dynamic_matrix_vector_write_, mat, [&]() -> std::string {
std::string fn;
{
- utils::StringStream ss;
+ StringStream ss;
if (!EmitType(ss, mat, tint::builtin::AddressSpace::kUndefined,
builtin::Access::kUndefined, "")) {
return "";
@@ -556,10 +556,10 @@
auto* lhs_row_access = stmt->lhs->As<ast::IndexAccessorExpression>();
auto* lhs_col_access = lhs_row_access->object->As<ast::IndexAccessorExpression>();
- auto name = utils::GetOrCreate(dynamic_matrix_scalar_write_, mat, [&]() -> std::string {
+ auto name = tint::GetOrCreate(dynamic_matrix_scalar_write_, mat, [&]() -> std::string {
std::string fn;
{
- utils::StringStream ss;
+ StringStream ss;
if (!EmitType(ss, mat, tint::builtin::AddressSpace::kUndefined,
builtin::Access::kUndefined, "")) {
return "";
@@ -655,8 +655,7 @@
return true;
}
-bool ASTPrinter::EmitIndexAccessor(utils::StringStream& out,
- const ast::IndexAccessorExpression* expr) {
+bool ASTPrinter::EmitIndexAccessor(StringStream& out, const ast::IndexAccessorExpression* expr) {
if (!EmitExpression(out, expr->object)) {
return false;
}
@@ -670,7 +669,7 @@
return true;
}
-bool ASTPrinter::EmitBitcast(utils::StringStream& out, const ast::BitcastExpression* expr) {
+bool ASTPrinter::EmitBitcast(StringStream& out, const ast::BitcastExpression* expr) {
auto* dst_type = TypeOf(expr)->UnwrapRef();
auto* src_type = TypeOf(expr->expr)->UnwrapRef();
@@ -702,7 +701,7 @@
// f32tof16 to get the bits. This should be safe, because the convertion is precise
// for finite and infinite f16 value as they are exactly representable by f32, and
// WGSL spec allow any result if f16 value is NaN.
- return utils::GetOrCreate(
+ return tint::GetOrCreate(
bitcast_funcs_, BinaryType{{src_type, dst_type}}, [&]() -> std::string {
TextBuffer b;
TINT_DEFER(helpers_.Append(b));
@@ -775,7 +774,7 @@
// convertion is precise for finite and infinite f16 result value as they are
// exactly representable by f32, and WGSL spec allow any result if f16 result value
// would be NaN.
- return utils::GetOrCreate(
+ return tint::GetOrCreate(
bitcast_funcs_, BinaryType{{src_type, dst_type}}, [&]() -> std::string {
TextBuffer b;
TINT_DEFER(helpers_.Append(b));
@@ -913,7 +912,7 @@
return true;
}
-bool ASTPrinter::EmitBinary(utils::StringStream& out, const ast::BinaryExpression* expr) {
+bool ASTPrinter::EmitBinary(StringStream& out, const ast::BinaryExpression* expr) {
if (expr->op == ast::BinaryOp::kLogicalAnd || expr->op == ast::BinaryOp::kLogicalOr) {
auto name = UniqueIdentifier(kTempNamePrefix);
@@ -1050,7 +1049,7 @@
return true;
}
-bool ASTPrinter::EmitStatements(utils::VectorRef<const ast::Statement*> stmts) {
+bool ASTPrinter::EmitStatements(VectorRef<const ast::Statement*> stmts) {
for (auto* s : stmts) {
if (!EmitStatement(s)) {
return false;
@@ -1059,7 +1058,7 @@
return true;
}
-bool ASTPrinter::EmitStatementsWithIndent(utils::VectorRef<const ast::Statement*> stmts) {
+bool ASTPrinter::EmitStatementsWithIndent(VectorRef<const ast::Statement*> stmts) {
ScopedIndent si(this);
return EmitStatements(stmts);
}
@@ -1088,7 +1087,7 @@
return true;
}
-bool ASTPrinter::EmitCall(utils::StringStream& out, const ast::CallExpression* expr) {
+bool ASTPrinter::EmitCall(StringStream& out, const ast::CallExpression* expr) {
auto* call = builder_.Sem().Get<sem::Call>(expr);
auto* target = call->Target();
return Switch(
@@ -1103,7 +1102,7 @@
});
}
-bool ASTPrinter::EmitFunctionCall(utils::StringStream& out,
+bool ASTPrinter::EmitFunctionCall(StringStream& out,
const sem::Call* call,
const sem::Function* func) {
auto* expr = call->Declaration();
@@ -1159,7 +1158,7 @@
return true;
}
-bool ASTPrinter::EmitBuiltinCall(utils::StringStream& out,
+bool ASTPrinter::EmitBuiltinCall(StringStream& out,
const sem::Call* call,
const sem::Builtin* builtin) {
const auto type = builtin->Type();
@@ -1247,7 +1246,7 @@
return true;
}
-bool ASTPrinter::EmitValueConversion(utils::StringStream& out,
+bool ASTPrinter::EmitValueConversion(StringStream& out,
const sem::Call* call,
const sem::ValueConversion* conv) {
if (!EmitType(out, conv->Target(), builtin::AddressSpace::kUndefined,
@@ -1264,7 +1263,7 @@
return true;
}
-bool ASTPrinter::EmitValueConstructor(utils::StringStream& out,
+bool ASTPrinter::EmitValueConstructor(StringStream& out,
const sem::Call* call,
const sem::ValueConstructor* ctor) {
auto* type = call->Type();
@@ -1328,7 +1327,7 @@
}
bool ASTPrinter::EmitUniformBufferAccess(
- utils::StringStream& out,
+ StringStream& out,
const ast::CallExpression* expr,
const ast::transform::DecomposeMemoryAccess::Intrinsic* intrinsic) {
auto const buffer = intrinsic->Buffer()->identifier->symbol.Name();
@@ -1400,7 +1399,7 @@
out << ")";
return result;
};
- auto load_u32_to = [&](utils::StringStream& target) {
+ auto load_u32_to = [&](StringStream& target) {
target << buffer;
if (scalar_offset_constant) {
target << "[" << (scalar_offset_index / 4) << "]."
@@ -1413,7 +1412,7 @@
};
auto load_u32 = [&] { return load_u32_to(out); };
// Has a minimum alignment of 8 bytes, so is either .xy or .zw
- auto load_vec2_u32_to = [&](utils::StringStream& target) {
+ auto load_vec2_u32_to = [&](StringStream& target) {
if (scalar_offset_constant) {
target << buffer << "[" << (scalar_offset_index / 4) << "]"
<< ((scalar_offset_index & 2) == 0 ? ".xy" : ".zw");
@@ -1616,7 +1615,7 @@
}
bool ASTPrinter::EmitStorageBufferAccess(
- utils::StringStream& out,
+ StringStream& out,
const ast::CallExpression* expr,
const ast::transform::DecomposeMemoryAccess::Intrinsic* intrinsic) {
auto const buffer = intrinsic->Buffer()->identifier->symbol.Name();
@@ -1985,7 +1984,7 @@
return false;
}
-bool ASTPrinter::EmitWorkgroupAtomicCall(utils::StringStream& out,
+bool ASTPrinter::EmitWorkgroupAtomicCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin) {
std::string result = UniqueIdentifier("atomic_result");
@@ -2160,7 +2159,7 @@
return false;
}
-bool ASTPrinter::EmitSelectCall(utils::StringStream& out, const ast::CallExpression* expr) {
+bool ASTPrinter::EmitSelectCall(StringStream& out, const ast::CallExpression* expr) {
auto* expr_false = expr->args[0];
auto* expr_true = expr->args[1];
auto* expr_cond = expr->args[2];
@@ -2184,7 +2183,7 @@
return true;
}
-bool ASTPrinter::EmitModfCall(utils::StringStream& out,
+bool ASTPrinter::EmitModfCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin) {
return CallBuiltinHelper(
@@ -2217,7 +2216,7 @@
});
}
-bool ASTPrinter::EmitFrexpCall(utils::StringStream& out,
+bool ASTPrinter::EmitFrexpCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin) {
return CallBuiltinHelper(
@@ -2258,7 +2257,7 @@
});
}
-bool ASTPrinter::EmitDegreesCall(utils::StringStream& out,
+bool ASTPrinter::EmitDegreesCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin) {
return CallBuiltinHelper(out, expr, builtin,
@@ -2269,7 +2268,7 @@
});
}
-bool ASTPrinter::EmitRadiansCall(utils::StringStream& out,
+bool ASTPrinter::EmitRadiansCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin) {
return CallBuiltinHelper(out, expr, builtin,
@@ -2283,9 +2282,7 @@
// The HLSL `sign` method always returns an `int` result (scalar or vector). In WGSL the result is
// expected to be the same type as the argument. This injects a cast to the expected WGSL result
// type after the call to `sign`.
-bool ASTPrinter::EmitSignCall(utils::StringStream& out,
- const sem::Call* call,
- const sem::Builtin*) {
+bool ASTPrinter::EmitSignCall(StringStream& out, const sem::Call* call, const sem::Builtin*) {
auto* arg = call->Arguments()[0];
if (!EmitType(out, arg->Type(), builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite,
"")) {
@@ -2299,7 +2296,7 @@
return true;
}
-bool ASTPrinter::EmitQuantizeToF16Call(utils::StringStream& out,
+bool ASTPrinter::EmitQuantizeToF16Call(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin) {
// Cast to f16 and back
@@ -2316,7 +2313,7 @@
return true;
}
-bool ASTPrinter::EmitTruncCall(utils::StringStream& out,
+bool ASTPrinter::EmitTruncCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin) {
// HLSL's trunc is broken for very large/small float values.
@@ -2330,7 +2327,7 @@
});
}
-bool ASTPrinter::EmitDataPackingCall(utils::StringStream& out,
+bool ASTPrinter::EmitDataPackingCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin) {
return CallBuiltinHelper(
@@ -2393,7 +2390,7 @@
});
}
-bool ASTPrinter::EmitDataUnpackingCall(utils::StringStream& out,
+bool ASTPrinter::EmitDataUnpackingCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin) {
return CallBuiltinHelper(
@@ -2460,7 +2457,7 @@
});
}
-bool ASTPrinter::EmitDP4aCall(utils::StringStream& out,
+bool ASTPrinter::EmitDP4aCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin) {
// TODO(crbug.com/tint/1497): support the polyfill version of DP4a functions.
@@ -2488,7 +2485,7 @@
});
}
-bool ASTPrinter::EmitBarrierCall(utils::StringStream& out, const sem::Builtin* builtin) {
+bool ASTPrinter::EmitBarrierCall(StringStream& out, const sem::Builtin* builtin) {
// TODO(crbug.com/tint/661): Combine sequential barriers to a single
// instruction.
if (builtin->Type() == builtin::Function::kWorkgroupBarrier) {
@@ -2503,7 +2500,7 @@
return true;
}
-bool ASTPrinter::EmitTextureCall(utils::StringStream& out,
+bool ASTPrinter::EmitTextureCall(StringStream& out,
const sem::Call* call,
const sem::Builtin* builtin) {
using Usage = sem::ParameterUsage;
@@ -2989,7 +2986,7 @@
return false;
}
- if (!tint::utils::IsAnyOf<ast::BreakStatement>(stmt->body->Last())) {
+ if (!tint::IsAnyOf<ast::BreakStatement>(stmt->body->Last())) {
Line() << "break;";
}
@@ -3011,7 +3008,7 @@
return true;
}
-bool ASTPrinter::EmitExpression(utils::StringStream& out, const ast::Expression* expr) {
+bool ASTPrinter::EmitExpression(StringStream& out, const ast::Expression* expr) {
if (auto* sem = builder_.Sem().GetVal(expr)) {
if (auto* constant = sem->ConstantValue()) {
bool is_variable_initializer = false;
@@ -3040,7 +3037,7 @@
});
}
-bool ASTPrinter::EmitIdentifier(utils::StringStream& out, const ast::IdentifierExpression* expr) {
+bool ASTPrinter::EmitIdentifier(StringStream& out, const ast::IdentifierExpression* expr) {
out << expr->identifier->symbol.Name();
return true;
}
@@ -3066,7 +3063,7 @@
return false;
}
} else {
- if (!EmitStatementsWithIndent(utils::Vector{stmt->else_statement})) {
+ if (!EmitStatementsWithIndent(Vector{stmt->else_statement})) {
return false;
}
}
@@ -3232,7 +3229,7 @@
case builtin::AddressSpace::kPushConstant:
diagnostics_.add_error(
diag::System::Writer,
- "unhandled address space " + utils::ToString(sem->AddressSpace()));
+ "unhandled address space " + tint::ToString(sem->AddressSpace()));
return false;
default: {
TINT_ICE(Writer, diagnostics_)
@@ -3520,7 +3517,7 @@
return true;
}
-bool ASTPrinter::EmitConstant(utils::StringStream& out,
+bool ASTPrinter::EmitConstant(StringStream& out,
const constant::Value* constant,
bool is_variable_initializer) {
return Switch(
@@ -3640,7 +3637,7 @@
return true;
}
- auto emit_member_values = [&](utils::StringStream& o) {
+ auto emit_member_values = [&](StringStream& o) {
o << "{";
for (size_t i = 0; i < s->Members().Length(); i++) {
if (i > 0) {
@@ -3681,7 +3678,7 @@
});
}
-bool ASTPrinter::EmitLiteral(utils::StringStream& out, const ast::LiteralExpression* lit) {
+bool ASTPrinter::EmitLiteral(StringStream& out, const ast::LiteralExpression* lit) {
return Switch(
lit,
[&](const ast::BoolLiteralExpression* l) {
@@ -3717,7 +3714,7 @@
});
}
-bool ASTPrinter::EmitValue(utils::StringStream& out, const type::Type* type, int value) {
+bool ASTPrinter::EmitValue(StringStream& out, const type::Type* type, int value) {
return Switch(
type,
[&](const type::Bool*) {
@@ -3791,7 +3788,7 @@
});
}
-bool ASTPrinter::EmitZeroValue(utils::StringStream& out, const type::Type* type) {
+bool ASTPrinter::EmitZeroValue(StringStream& out, const type::Type* type) {
return EmitValue(out, type, 0);
}
@@ -3840,7 +3837,7 @@
}
TextBuffer cond_pre;
- utils::StringStream cond_buf;
+ StringStream cond_buf;
if (auto* cond = stmt->condition) {
TINT_SCOPED_ASSIGNMENT(current_buffer_, &cond_pre);
if (!EmitExpression(cond_buf, cond)) {
@@ -3912,7 +3909,7 @@
out << cond_buf.str() << "; ";
if (!cont_buf.lines.empty()) {
- out << utils::TrimSuffix(cont_buf.lines[0].content, ";");
+ out << tint::TrimSuffix(cont_buf.lines[0].content, ";");
}
}
out << " {";
@@ -3932,7 +3929,7 @@
bool ASTPrinter::EmitWhile(const ast::WhileStatement* stmt) {
TextBuffer cond_pre;
- utils::StringStream cond_buf;
+ StringStream cond_buf;
{
auto* cond = stmt->condition;
TINT_SCOPED_ASSIGNMENT(current_buffer_, &cond_pre);
@@ -3980,8 +3977,7 @@
return true;
}
-bool ASTPrinter::EmitMemberAccessor(utils::StringStream& out,
- const ast::MemberAccessorExpression* expr) {
+bool ASTPrinter::EmitMemberAccessor(StringStream& out, const ast::MemberAccessorExpression* expr) {
if (!EmitExpression(out, expr->object)) {
return false;
}
@@ -4153,7 +4149,7 @@
return true;
}
-bool ASTPrinter::EmitType(utils::StringStream& out,
+bool ASTPrinter::EmitType(StringStream& out,
const type::Type* type,
builtin::AddressSpace address_space,
builtin::Access access,
@@ -4379,7 +4375,7 @@
});
}
-bool ASTPrinter::EmitTypeAndName(utils::StringStream& out,
+bool ASTPrinter::EmitTypeAndName(StringStream& out,
const type::Type* type,
builtin::AddressSpace address_space,
builtin::Access access,
@@ -4470,7 +4466,7 @@
return true;
}
-bool ASTPrinter::EmitUnaryOp(utils::StringStream& out, const ast::UnaryOpExpression* expr) {
+bool ASTPrinter::EmitUnaryOp(StringStream& out, const ast::UnaryOpExpression* expr) {
switch (expr->op) {
case ast::UnaryOp::kIndirection:
case ast::UnaryOp::kAddressOf:
@@ -4541,12 +4537,12 @@
}
template <typename F>
-bool ASTPrinter::CallBuiltinHelper(utils::StringStream& out,
+bool ASTPrinter::CallBuiltinHelper(StringStream& out,
const ast::CallExpression* call,
const sem::Builtin* builtin,
F&& build) {
// Generate the helper function if it hasn't been created already
- auto fn = utils::GetOrCreate(builtins_, builtin, [&]() -> std::string {
+ auto fn = tint::GetOrCreate(builtins_, builtin, [&]() -> std::string {
TextBuffer b;
TINT_DEFER(helpers_.Append(b));
diff --git a/src/tint/lang/hlsl/writer/ast_printer/ast_printer.h b/src/tint/lang/hlsl/writer/ast_printer/ast_printer.h
index ec67cd9..c6e7dce 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/ast_printer.h
+++ b/src/tint/lang/hlsl/writer/ast_printer/ast_printer.h
@@ -65,7 +65,7 @@
SanitizedResult Sanitize(const Program* program, const Options& options);
/// Implementation class for HLSL generator
-class ASTPrinter : public utils::TextGenerator {
+class ASTPrinter : public tint::TextGenerator {
public:
/// Constructor
/// @param program the program to generate
@@ -79,7 +79,7 @@
/// @param out the output of the expression stream
/// @param expr the expression to emit
/// @returns true if the index accessor was emitted
- bool EmitIndexAccessor(utils::StringStream& out, const ast::IndexAccessorExpression* expr);
+ bool EmitIndexAccessor(StringStream& out, const ast::IndexAccessorExpression* expr);
/// Handles an assignment statement
/// @param stmt the statement to emit
/// @returns true if the statement was emitted successfully
@@ -88,20 +88,20 @@
/// @param out the output of the expression stream
/// @param expr the binary expression
/// @returns true if the expression was emitted, false otherwise
- bool EmitBinary(utils::StringStream& out, const ast::BinaryExpression* expr);
+ bool EmitBinary(StringStream& out, const ast::BinaryExpression* expr);
/// Handles generating a bitcast expression
/// @param out the output of the expression stream
/// @param expr the as expression
/// @returns true if the bitcast was emitted
- bool EmitBitcast(utils::StringStream& out, const ast::BitcastExpression* expr);
+ bool EmitBitcast(StringStream& out, const ast::BitcastExpression* expr);
/// Emits a list of statements
/// @param stmts the statement list
/// @returns true if the statements were emitted successfully
- bool EmitStatements(utils::VectorRef<const ast::Statement*> stmts);
+ bool EmitStatements(VectorRef<const ast::Statement*> stmts);
/// Emits a list of statements with an indentation
/// @param stmts the statement list
/// @returns true if the statements were emitted successfully
- bool EmitStatementsWithIndent(utils::VectorRef<const ast::Statement*> stmts);
+ bool EmitStatementsWithIndent(VectorRef<const ast::Statement*> stmts);
/// Handles a block statement
/// @param stmt the statement to emit
/// @returns true if the statement was emitted successfully
@@ -118,29 +118,25 @@
/// @param out the output of the expression stream
/// @param expr the call expression
/// @returns true if the call expression is emitted
- bool EmitCall(utils::StringStream& out, const ast::CallExpression* expr);
+ bool EmitCall(StringStream& out, const ast::CallExpression* expr);
/// Handles generating a function call expression
/// @param out the output of the expression stream
/// @param call the call expression
/// @param function the function being called
/// @returns true if the expression is emitted
- bool EmitFunctionCall(utils::StringStream& out,
- const sem::Call* call,
- const sem::Function* function);
+ bool EmitFunctionCall(StringStream& out, const sem::Call* call, const sem::Function* function);
/// Handles generating a builtin call expression
/// @param out the output of the expression stream
/// @param call the call expression
/// @param builtin the builtin being called
/// @returns true if the expression is emitted
- bool EmitBuiltinCall(utils::StringStream& out,
- const sem::Call* call,
- const sem::Builtin* builtin);
+ bool EmitBuiltinCall(StringStream& out, const sem::Call* call, const sem::Builtin* builtin);
/// Handles generating a value conversion expression
/// @param out the output of the expression stream
/// @param call the call expression
/// @param conv the value conversion
/// @returns true if the expression is emitted
- bool EmitValueConversion(utils::StringStream& out,
+ bool EmitValueConversion(StringStream& out,
const sem::Call* call,
const sem::ValueConversion* conv);
/// Handles generating a value constructor expression
@@ -148,7 +144,7 @@
/// @param call the call expression
/// @param ctor the value constructor
/// @returns true if the expression is emitted
- bool EmitValueConstructor(utils::StringStream& out,
+ bool EmitValueConstructor(StringStream& out,
const sem::Call* call,
const sem::ValueConstructor* ctor);
/// Handles generating a call expression to a
@@ -157,7 +153,7 @@
/// @param expr the call expression
/// @param intrinsic the ast::transform::DecomposeMemoryAccess::Intrinsic
/// @returns true if the call expression is emitted
- bool EmitUniformBufferAccess(utils::StringStream& out,
+ bool EmitUniformBufferAccess(StringStream& out,
const ast::CallExpression* expr,
const ast::transform::DecomposeMemoryAccess::Intrinsic* intrinsic);
/// Handles generating a call expression to a
@@ -166,20 +162,20 @@
/// @param expr the call expression
/// @param intrinsic the ast::transform::DecomposeMemoryAccess::Intrinsic
/// @returns true if the call expression is emitted
- bool EmitStorageBufferAccess(utils::StringStream& out,
+ bool EmitStorageBufferAccess(StringStream& out,
const ast::CallExpression* expr,
const ast::transform::DecomposeMemoryAccess::Intrinsic* intrinsic);
/// Handles generating a barrier intrinsic call
/// @param out the output of the expression stream
/// @param builtin the semantic information for the barrier builtin
/// @returns true if the call expression is emitted
- bool EmitBarrierCall(utils::StringStream& out, const sem::Builtin* builtin);
+ bool EmitBarrierCall(StringStream& out, const sem::Builtin* builtin);
/// Handles generating an atomic intrinsic call for a storage buffer variable
/// @param out the output of the expression stream
/// @param expr the call expression
/// @param intrinsic the atomic intrinsic
/// @returns true if the call expression is emitted
- bool EmitStorageAtomicCall(utils::StringStream& out,
+ bool EmitStorageAtomicCall(StringStream& out,
const ast::CallExpression* expr,
const ast::transform::DecomposeMemoryAccess::Intrinsic* intrinsic);
/// Handles generating the helper function for the atomic intrinsic function
@@ -194,7 +190,7 @@
/// @param expr the call expression
/// @param builtin the semantic information for the atomic builtin
/// @returns true if the call expression is emitted
- bool EmitWorkgroupAtomicCall(utils::StringStream& out,
+ bool EmitWorkgroupAtomicCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin);
/// Handles generating a call to a texture function (`textureSample`,
@@ -203,20 +199,18 @@
/// @param call the call expression
/// @param builtin the semantic information for the texture builtin
/// @returns true if the call expression is emitted
- bool EmitTextureCall(utils::StringStream& out,
- const sem::Call* call,
- const sem::Builtin* builtin);
+ bool EmitTextureCall(StringStream& out, const sem::Call* call, const sem::Builtin* builtin);
/// Handles generating a call to the `select()` builtin
/// @param out the output of the expression stream
/// @param expr the call expression
/// @returns true if the call expression is emitted
- bool EmitSelectCall(utils::StringStream& out, const ast::CallExpression* expr);
+ bool EmitSelectCall(StringStream& out, const ast::CallExpression* expr);
/// Handles generating a call to the `modf()` builtin
/// @param out the output of the expression stream
/// @param expr the call expression
/// @param builtin the semantic information for the builtin
/// @returns true if the call expression is emitted
- bool EmitModfCall(utils::StringStream& out,
+ bool EmitModfCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin);
/// Handles generating a call to the `frexp()` builtin
@@ -224,7 +218,7 @@
/// @param expr the call expression
/// @param builtin the semantic information for the builtin
/// @returns true if the call expression is emitted
- bool EmitFrexpCall(utils::StringStream& out,
+ bool EmitFrexpCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin);
/// Handles generating a call to the `degrees()` builtin
@@ -232,7 +226,7 @@
/// @param expr the call expression
/// @param builtin the semantic information for the builtin
/// @returns true if the call expression is emitted
- bool EmitDegreesCall(utils::StringStream& out,
+ bool EmitDegreesCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin);
/// Handles generating a call to the `radians()` builtin
@@ -240,7 +234,7 @@
/// @param expr the call expression
/// @param builtin the semantic information for the builtin
/// @returns true if the call expression is emitted
- bool EmitRadiansCall(utils::StringStream& out,
+ bool EmitRadiansCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin);
/// Handles generating a call to the `sign()` builtin
@@ -248,13 +242,13 @@
/// @param call the call semantic node
/// @param builtin the semantic information for the builtin
/// @returns true if the call expression is emitted
- bool EmitSignCall(utils::StringStream& out, const sem::Call* call, const sem::Builtin* builtin);
+ bool EmitSignCall(StringStream& out, const sem::Call* call, const sem::Builtin* builtin);
/// Handles generating a call to data packing builtin
/// @param out the output of the expression stream
/// @param expr the call expression
/// @param builtin the semantic information for the builtin
/// @returns true if the call expression is emitted
- bool EmitDataPackingCall(utils::StringStream& out,
+ bool EmitDataPackingCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin);
/// Handles generating a call to data unpacking builtin
@@ -262,7 +256,7 @@
/// @param expr the call expression
/// @param builtin the semantic information for the builtin
/// @returns true if the call expression is emitted
- bool EmitDataUnpackingCall(utils::StringStream& out,
+ bool EmitDataUnpackingCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin);
/// Handles generating a call to the `quantizeToF16()` intrinsic
@@ -270,7 +264,7 @@
/// @param expr the call expression
/// @param builtin the semantic information for the builtin
/// @returns true if the call expression is emitted
- bool EmitQuantizeToF16Call(utils::StringStream& out,
+ bool EmitQuantizeToF16Call(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin);
/// Handles generating a call to the `trunc()` intrinsic
@@ -278,7 +272,7 @@
/// @param expr the call expression
/// @param builtin the semantic information for the builtin
/// @returns true if the call expression is emitted
- bool EmitTruncCall(utils::StringStream& out,
+ bool EmitTruncCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin);
/// Handles generating a call to DP4a builtins (dot4I8Packed and dot4U8Packed)
@@ -286,7 +280,7 @@
/// @param expr the call expression
/// @param builtin the semantic information for the builtin
/// @returns true if the call expression is emitted
- bool EmitDP4aCall(utils::StringStream& out,
+ bool EmitDP4aCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin);
/// Handles a case statement
@@ -306,7 +300,7 @@
/// @param out the output of the expression stream
/// @param expr the expression
/// @returns true if the expression was emitted
- bool EmitExpression(utils::StringStream& out, const ast::Expression* expr);
+ bool EmitExpression(StringStream& out, const ast::Expression* expr);
/// Handles generating a function
/// @param func the function to generate
/// @returns true if the function was emitted
@@ -363,14 +357,14 @@
/// @param is_variable_initializer true if the constant is used as the RHS of a variable
/// initializer
/// @returns true if the constant value was successfully emitted
- bool EmitConstant(utils::StringStream& out,
+ bool EmitConstant(StringStream& out,
const constant::Value* constant,
bool is_variable_initializer);
/// Handles a literal
/// @param out the output stream
/// @param lit the literal to emit
/// @returns true if the literal was successfully emitted
- bool EmitLiteral(utils::StringStream& out, const ast::LiteralExpression* lit);
+ bool EmitLiteral(StringStream& out, const ast::LiteralExpression* lit);
/// Handles a loop statement
/// @param stmt the statement to emit
/// @returns true if the statement was emitted
@@ -387,12 +381,12 @@
/// @param out the output of the expression stream
/// @param expr the identifier expression
/// @returns true if the identifeir was emitted
- bool EmitIdentifier(utils::StringStream& out, const ast::IdentifierExpression* expr);
+ bool EmitIdentifier(StringStream& out, const ast::IdentifierExpression* expr);
/// Handles a member accessor expression
/// @param out the output of the expression stream
/// @param expr the member accessor expression
/// @returns true if the member accessor was emitted
- bool EmitMemberAccessor(utils::StringStream& out, const ast::MemberAccessorExpression* expr);
+ bool EmitMemberAccessor(StringStream& out, const ast::MemberAccessorExpression* expr);
/// Handles return statements
/// @param stmt the statement to emit
/// @returns true if the statement was successfully emitted
@@ -418,7 +412,7 @@
/// @param name_printed (optional) if not nullptr and an array was printed
/// then the boolean is set to true.
/// @returns true if the type is emitted
- bool EmitType(utils::StringStream& out,
+ bool EmitType(StringStream& out,
const type::Type* type,
builtin::AddressSpace address_space,
builtin::Access access,
@@ -431,7 +425,7 @@
/// @param access the access control type of the variable
/// @param name the name to emit
/// @returns true if the type is emitted
- bool EmitTypeAndName(utils::StringStream& out,
+ bool EmitTypeAndName(StringStream& out,
const type::Type* type,
builtin::AddressSpace address_space,
builtin::Access access,
@@ -446,18 +440,18 @@
/// @param out the output of the expression stream
/// @param expr the expression to emit
/// @returns true if the expression was emitted
- bool EmitUnaryOp(utils::StringStream& out, const ast::UnaryOpExpression* expr);
+ bool EmitUnaryOp(StringStream& out, const ast::UnaryOpExpression* expr);
/// Emits `value` for the given type
/// @param out the output stream
/// @param type the type to emit the value for
/// @param value the value to emit
/// @returns true if the value was successfully emitted.
- bool EmitValue(utils::StringStream& out, const type::Type* type, int value);
+ bool EmitValue(StringStream& out, const type::Type* type, int value);
/// Emits the zero value for the given type
/// @param out the output stream
/// @param type the type to emit the value for
/// @returns true if the zero value was successfully emitted.
- bool EmitZeroValue(utils::StringStream& out, const type::Type* type);
+ bool EmitZeroValue(StringStream& out, const type::Type* type);
/// Handles generating a 'var' declaration
/// @param var the variable to generate
/// @returns true if the variable was emitted
@@ -528,13 +522,13 @@
/// @param i the DMAIntrinsic to hash
/// @returns the hash of `i`
inline std::size_t operator()(const DMAIntrinsic& i) const {
- return utils::Hash(i.op, i.type);
+ return Hash(i.op, i.type);
}
};
};
/// The map key for two semantic types.
- using BinaryType = utils::UnorderedKeyWrapper<std::tuple<const type::Type*, const type::Type*>>;
+ using BinaryType = tint::UnorderedKeyWrapper<std::tuple<const type::Type*, const type::Type*>>;
/// CallBuiltinHelper will call the builtin helper function, creating it
/// if it hasn't been built already. If the builtin needs to be built then
@@ -550,12 +544,12 @@
/// `params` is the name of all the generated function parameters
/// @returns true if the call expression is emitted
template <typename F>
- bool CallBuiltinHelper(utils::StringStream& out,
+ bool CallBuiltinHelper(StringStream& out,
const ast::CallExpression* call,
const sem::Builtin* builtin,
F&& build);
- /// @copydoc utils::TextWrtiter::UniqueIdentifier
+ /// @copydoc tint::TextWrtiter::UniqueIdentifier
std::string UniqueIdentifier(const std::string& prefix = "") override;
/// Alias for builder_.TypeOf(ptr)
diff --git a/src/tint/lang/hlsl/writer/ast_printer/ast_printer_test.cc b/src/tint/lang/hlsl/writer/ast_printer/ast_printer_test.cc
index 6c3b9a2..304dbe9 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/ast_printer_test.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/ast_printer_test.cc
@@ -56,7 +56,7 @@
const char* attribute_name;
};
inline std::ostream& operator<<(std::ostream& out, HlslBuiltinData data) {
- utils::StringStream str;
+ StringStream str;
str << data.builtin;
out << str.str();
return out;
diff --git a/src/tint/lang/hlsl/writer/ast_printer/binary_test.cc b/src/tint/lang/hlsl/writer/ast_printer/binary_test.cc
index fdd92ab..e1e7088 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/binary_test.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/binary_test.cc
@@ -33,7 +33,7 @@
Types valid_for = Types::All;
};
inline std::ostream& operator<<(std::ostream& out, BinaryData data) {
- utils::StringStream str;
+ StringStream str;
str << data.op;
out << str.str();
return out;
@@ -66,7 +66,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), params.result);
}
@@ -98,7 +98,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), params.result);
}
@@ -121,7 +121,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), params.result);
}
@@ -149,7 +149,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), params.result);
}
@@ -186,7 +186,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "(1.0f).xxx");
}
@@ -203,7 +203,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "(float16_t(1.0h)).xxx");
}
@@ -218,7 +218,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "(1.0f).xxx");
}
@@ -235,7 +235,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "(float16_t(1.0h)).xxx");
}
@@ -250,7 +250,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "(mat * 1.0f)");
}
@@ -267,7 +267,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "(mat * float16_t(1.0h))");
}
@@ -282,7 +282,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "(1.0f * mat)");
}
@@ -299,7 +299,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "(float16_t(1.0h) * mat)");
}
@@ -314,7 +314,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "mul((1.0f).xxx, mat)");
}
@@ -331,7 +331,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "mul((float16_t(1.0h)).xxx, mat)");
}
@@ -346,7 +346,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "mul(mat, (1.0f).xxx)");
}
@@ -363,7 +363,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "mul(mat, (float16_t(1.0h)).xxx)");
}
@@ -377,7 +377,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "mul(rhs, lhs)");
}
@@ -393,7 +393,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "mul(rhs, lhs)");
}
@@ -407,7 +407,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "(tint_tmp)");
EXPECT_EQ(gen.Result(), R"(bool tint_tmp = a;
@@ -432,7 +432,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "(tint_tmp)");
EXPECT_EQ(gen.Result(), R"(bool tint_tmp_1 = a;
@@ -459,7 +459,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "(tint_tmp)");
EXPECT_EQ(gen.Result(), R"(bool tint_tmp = a;
@@ -487,7 +487,7 @@
Block(Return(1_i)),
Else(If(create<ast::BinaryExpression>(ast::BinaryOp::kLogicalOr, Expr("b"), Expr("c")),
Block(Return(2_i)), Else(Block(Return(3_i))))));
- Func("func", utils::Empty, ty.i32(), utils::Vector{WrapInStatement(expr)});
+ Func("func", tint::Empty, ty.i32(), Vector{WrapInStatement(expr)});
ASTPrinter& gen = Build();
@@ -523,7 +523,7 @@
ast::BinaryOp::kLogicalOr,
create<ast::BinaryExpression>(ast::BinaryOp::kLogicalAnd, Expr("a"), Expr("b")),
Expr("c")));
- Func("func", utils::Empty, ty.bool_(), utils::Vector{WrapInStatement(expr)});
+ Func("func", tint::Empty, ty.bool_(), Vector{WrapInStatement(expr)});
ASTPrinter& gen = Build();
@@ -607,18 +607,18 @@
// foo(a && b, c || d, (a || c) && (b || d))
Func("foo",
- utils::Vector{
+ Vector{
Param(Sym(), ty.bool_()),
Param(Sym(), ty.bool_()),
Param(Sym(), ty.bool_()),
},
- ty.void_(), utils::Empty, utils::Empty);
+ ty.void_(), tint::Empty, tint::Empty);
GlobalVar("a", ty.bool_(), builtin::AddressSpace::kPrivate);
GlobalVar("b", ty.bool_(), builtin::AddressSpace::kPrivate);
GlobalVar("c", ty.bool_(), builtin::AddressSpace::kPrivate);
GlobalVar("d", ty.bool_(), builtin::AddressSpace::kPrivate);
- utils::Vector params{
+ Vector params{
create<ast::BinaryExpression>(ast::BinaryOp::kLogicalAnd, Expr("a"), Expr("b")),
create<ast::BinaryExpression>(ast::BinaryOp::kLogicalOr, Expr("c"), Expr("d")),
create<ast::BinaryExpression>(
diff --git a/src/tint/lang/hlsl/writer/ast_printer/bitcast_test.cc b/src/tint/lang/hlsl/writer/ast_printer/bitcast_test.cc
index f2efccf..ddba795 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/bitcast_test.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/bitcast_test.cc
@@ -32,7 +32,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, bitcast)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "asfloat(a)");
}
@@ -44,7 +44,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, bitcast)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "asint(a)");
}
@@ -56,7 +56,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, bitcast)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "asuint(a)");
}
diff --git a/src/tint/lang/hlsl/writer/ast_printer/builtin_test.cc b/src/tint/lang/hlsl/writer/ast_printer/builtin_test.cc
index 5850570..81109c3 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/builtin_test.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/builtin_test.cc
@@ -64,7 +64,7 @@
CallParamType type,
ProgramBuilder* builder) {
std::string name;
- utils::StringStream str;
+ StringStream str;
str << name << builtin;
switch (builtin) {
case builtin::Function::kAcos:
@@ -212,11 +212,11 @@
auto* call = GenerateCall(param.builtin, param.type, this);
ASSERT_NE(nullptr, call) << "Unhandled builtin";
- Func("func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("func", tint::Empty, ty.void_(),
+ Vector{
Assign(Phony(), call),
},
- utils::Vector{create<ast::StageAttribute>(ast::PipelineStage::kFragment)});
+ Vector{create<ast::StageAttribute>(ast::PipelineStage::kFragment)});
ASTPrinter& gen = Build();
@@ -349,7 +349,7 @@
ASTPrinter& gen = Build();
gen.IncrementIndent();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "dot(param1, param2)");
}
@@ -362,7 +362,7 @@
ASTPrinter& gen = Build();
gen.IncrementIndent();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "(true ? b : a)");
}
@@ -375,7 +375,7 @@
ASTPrinter& gen = Build();
gen.IncrementIndent();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "(bool2(true, false) ? b : a)");
}
@@ -1399,11 +1399,11 @@
}
TEST_F(HlslASTPrinterTest_Builtin, StorageBarrier) {
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
CallStmt(Call("storageBarrier")),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -1420,11 +1420,11 @@
}
TEST_F(HlslASTPrinterTest_Builtin, WorkgroupBarrier) {
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
CallStmt(Call("workgroupBarrier")),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
diff --git a/src/tint/lang/hlsl/writer/ast_printer/builtin_texture_test.cc b/src/tint/lang/hlsl/writer/ast_printer/builtin_texture_test.cc
index f6eb8fb..902d15f 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/builtin_texture_test.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/builtin_texture_test.cc
@@ -375,8 +375,8 @@
auto* stmt = param.returns_value ? static_cast<const ast::Statement*>(Decl(Var("v", call)))
: static_cast<const ast::Statement*>(CallStmt(call));
- Func("main", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("main", tint::Empty, ty.void_(), Vector{stmt},
+ Vector{Stage(ast::PipelineStage::kFragment)});
ASTPrinter& gen = SanitizeAndBuild();
diff --git a/src/tint/lang/hlsl/writer/ast_printer/call_test.cc b/src/tint/lang/hlsl/writer/ast_printer/call_test.cc
index 2686469..9aad31c 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/call_test.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/call_test.cc
@@ -24,25 +24,25 @@
using HlslASTPrinterTest_Call = TestHelper;
TEST_F(HlslASTPrinterTest_Call, EmitExpression_Call_WithoutParams) {
- Func("my_func", utils::Empty, ty.f32(), utils::Vector{Return(1.23_f)});
+ Func("my_func", tint::Empty, ty.f32(), Vector{Return(1.23_f)});
auto* call = Call("my_func");
WrapInFunction(call);
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "my_func()");
}
TEST_F(HlslASTPrinterTest_Call, EmitExpression_Call_WithParams) {
Func("my_func",
- utils::Vector{
+ Vector{
Param(Sym(), ty.f32()),
Param(Sym(), ty.f32()),
},
- ty.f32(), utils::Vector{Return(1.23_f)});
+ ty.f32(), Vector{Return(1.23_f)});
GlobalVar("param1", ty.f32(), builtin::AddressSpace::kPrivate);
GlobalVar("param2", ty.f32(), builtin::AddressSpace::kPrivate);
@@ -51,18 +51,18 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "my_func(param1, param2)");
}
TEST_F(HlslASTPrinterTest_Call, EmitStatement_Call) {
Func("my_func",
- utils::Vector{
+ Vector{
Param(Sym(), ty.f32()),
Param(Sym(), ty.f32()),
},
- ty.void_(), utils::Empty, utils::Empty);
+ ty.void_(), tint::Empty, tint::Empty);
GlobalVar("param1", ty.f32(), builtin::AddressSpace::kPrivate);
GlobalVar("param2", ty.f32(), builtin::AddressSpace::kPrivate);
diff --git a/src/tint/lang/hlsl/writer/ast_printer/case_test.cc b/src/tint/lang/hlsl/writer/ast_printer/case_test.cc
index 7c63293..ea37007 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/case_test.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/case_test.cc
@@ -53,10 +53,10 @@
}
TEST_F(HlslASTPrinterTest_Case, Emit_Case_MultipleSelectors) {
- auto* s = Switch(1_i,
- Case(utils::Vector{CaseSelector(5_i), CaseSelector(6_i)},
- Block(create<ast::BreakStatement>())),
- DefaultCase());
+ auto* s = Switch(
+ 1_i,
+ Case(Vector{CaseSelector(5_i), CaseSelector(6_i)}, Block(create<ast::BreakStatement>())),
+ DefaultCase());
WrapInFunction(s);
ASTPrinter& gen = Build();
diff --git a/src/tint/lang/hlsl/writer/ast_printer/cast_test.cc b/src/tint/lang/hlsl/writer/ast_printer/cast_test.cc
index 5960837..44d74b8 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/cast_test.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/cast_test.cc
@@ -29,7 +29,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, cast)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "1.0f");
}
@@ -40,7 +40,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, cast)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "float3(1.0f, 2.0f, 3.0f)");
}
diff --git a/src/tint/lang/hlsl/writer/ast_printer/const_assert_test.cc b/src/tint/lang/hlsl/writer/ast_printer/const_assert_test.cc
index dd48b75..b8b0717 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/const_assert_test.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/const_assert_test.cc
@@ -32,7 +32,7 @@
}
TEST_F(HlslASTPrinterTest, Emit_FunctionConstAssert) {
- Func("f", utils::Empty, ty.void_(), utils::Vector{ConstAssert(true)});
+ Func("f", tint::Empty, ty.void_(), Vector{ConstAssert(true)});
ASTPrinter& gen = Build();
diff --git a/src/tint/lang/hlsl/writer/ast_printer/constructor_test.cc b/src/tint/lang/hlsl/writer/ast_printer/constructor_test.cc
index 1cca430..550cfa3 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/constructor_test.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/constructor_test.cc
@@ -419,7 +419,7 @@
}
TEST_F(HlslASTPrinterTest_Constructor, Type_Struct) {
- auto* str = Structure("S", utils::Vector{
+ auto* str = Structure("S", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
Member("c", ty.vec3<i32>()),
@@ -434,7 +434,7 @@
}
TEST_F(HlslASTPrinterTest_Constructor, Type_Struct_Empty) {
- auto* str = Structure("S", utils::Vector{
+ auto* str = Structure("S", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
Member("c", ty.vec3<i32>()),
diff --git a/src/tint/lang/hlsl/writer/ast_printer/discard_test.cc b/src/tint/lang/hlsl/writer/ast_printer/discard_test.cc
index 8441dcc..c416262 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/discard_test.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/discard_test.cc
@@ -22,8 +22,7 @@
TEST_F(HlslASTPrinterTest_Discard, Emit_Discard) {
auto* stmt = Discard();
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASTPrinter& gen = Build();
diff --git a/src/tint/lang/hlsl/writer/ast_printer/function_test.cc b/src/tint/lang/hlsl/writer/ast_printer/function_test.cc
index ed5021a..dd24085 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/function_test.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/function_test.cc
@@ -29,8 +29,8 @@
using HlslASTPrinterTest_Function = TestHelper;
TEST_F(HlslASTPrinterTest_Function, Emit_Function) {
- Func("my_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("my_func", tint::Empty, ty.void_(),
+ Vector{
Return(),
});
@@ -46,8 +46,8 @@
}
TEST_F(HlslASTPrinterTest_Function, Emit_Function_Name_Collision) {
- Func("GeometryShader", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("GeometryShader", tint::Empty, ty.void_(),
+ Vector{
Return(),
});
@@ -63,12 +63,12 @@
TEST_F(HlslASTPrinterTest_Function, Emit_Function_WithParams) {
Func("my_func",
- utils::Vector{
+ Vector{
Param("a", ty.f32()),
Param("b", ty.i32()),
},
ty.void_(),
- utils::Vector{
+ Vector{
Return(),
});
@@ -84,8 +84,8 @@
}
TEST_F(HlslASTPrinterTest_Function, Emit_Attribute_EntryPoint_NoReturn_Void) {
- Func("main", utils::Empty, ty.void_(), utils::Empty /* no explicit return */,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty /* no explicit return */,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -102,8 +102,8 @@
// fn f(foo : ptr<function, f32>) -> f32 {
// return *foo;
// }
- Func("f", utils::Vector{Param("foo", ty.ptr<function, f32>())}, ty.f32(),
- utils::Vector{Return(Deref("foo"))});
+ Func("f", Vector{Param("foo", ty.ptr<function, f32>())}, ty.f32(),
+ Vector{Return(Deref("foo"))});
ASTPrinter& gen = SanitizeAndBuild();
@@ -118,15 +118,15 @@
// fn frag_main(@location(0) foo : f32) -> @location(1) f32 {
// return foo;
// }
- auto* foo_in = Param("foo", ty.f32(), utils::Vector{Location(0_a)});
- Func("frag_main", utils::Vector{foo_in}, ty.f32(),
- utils::Vector{
+ auto* foo_in = Param("foo", ty.f32(), Vector{Location(0_a)});
+ Func("frag_main", Vector{foo_in}, ty.f32(),
+ Vector{
Return("foo"),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(1_a),
});
@@ -158,15 +158,15 @@
// return coord.x;
// }
auto* coord_in =
- Param("coord", ty.vec4<f32>(), utils::Vector{Builtin(builtin::BuiltinValue::kPosition)});
- Func("frag_main", utils::Vector{coord_in}, ty.f32(),
- utils::Vector{
+ Param("coord", ty.vec4<f32>(), Vector{Builtin(builtin::BuiltinValue::kPosition)});
+ Func("frag_main", Vector{coord_in}, ty.f32(),
+ Vector{
Return(MemberAccessor("coord", "x")),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kFragDepth),
});
@@ -209,25 +209,25 @@
// }
auto* interface_struct = Structure(
"Interface",
- utils::Vector{
- Member("pos", ty.vec4<f32>(), utils::Vector{Builtin(builtin::BuiltinValue::kPosition)}),
- Member("col1", ty.f32(), utils::Vector{Location(1_a)}),
- Member("col2", ty.f32(), utils::Vector{Location(2_a)}),
+ Vector{
+ Member("pos", ty.vec4<f32>(), Vector{Builtin(builtin::BuiltinValue::kPosition)}),
+ Member("col1", ty.f32(), Vector{Location(1_a)}),
+ Member("col2", ty.f32(), Vector{Location(2_a)}),
});
- Func("vert_main", utils::Empty, ty.Of(interface_struct),
- utils::Vector{
+ Func("vert_main", tint::Empty, ty.Of(interface_struct),
+ Vector{
Return(Call(ty.Of(interface_struct), Call<vec4<f32>>(), 0.5_f, 0.25_f)),
},
- utils::Vector{Stage(ast::PipelineStage::kVertex)});
+ Vector{Stage(ast::PipelineStage::kVertex)});
- Func("frag_main", utils::Vector{Param("inputs", ty.Of(interface_struct))}, ty.void_(),
- utils::Vector{
+ Func("frag_main", Vector{Param("inputs", ty.Of(interface_struct))}, ty.void_(),
+ Vector{
Decl(Let("r", ty.f32(), MemberAccessor("inputs", "col1"))),
Decl(Let("g", ty.f32(), MemberAccessor("inputs", "col2"))),
Decl(Let("p", ty.vec4<f32>(), MemberAccessor("inputs", "pos"))),
},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Vector{Stage(ast::PipelineStage::kFragment)});
ASTPrinter& gen = SanitizeAndBuild();
@@ -290,28 +290,27 @@
// fn vert_main2() -> VertexOutput {
// return foo(0.25);
// }
- auto* vertex_output_struct =
- Structure("VertexOutput",
- utils::Vector{Member("pos", ty.vec4<f32>(),
- utils::Vector{Builtin(builtin::BuiltinValue::kPosition)})});
+ auto* vertex_output_struct = Structure(
+ "VertexOutput",
+ Vector{Member("pos", ty.vec4<f32>(), Vector{Builtin(builtin::BuiltinValue::kPosition)})});
- Func("foo", utils::Vector{Param("x", ty.f32())}, ty.Of(vertex_output_struct),
- utils::Vector{
+ Func("foo", Vector{Param("x", ty.f32())}, ty.Of(vertex_output_struct),
+ Vector{
Return(Call(ty.Of(vertex_output_struct), Call<vec4<f32>>("x", "x", "x", 1_f))),
},
- utils::Empty);
+ tint::Empty);
- Func("vert_main1", utils::Empty, ty.Of(vertex_output_struct),
- utils::Vector{
+ Func("vert_main1", tint::Empty, ty.Of(vertex_output_struct),
+ Vector{
Return(Call("foo", Expr(0.5_f))),
},
- utils::Vector{Stage(ast::PipelineStage::kVertex)});
+ Vector{Stage(ast::PipelineStage::kVertex)});
- Func("vert_main2", utils::Empty, ty.Of(vertex_output_struct),
- utils::Vector{
+ Func("vert_main2", tint::Empty, ty.Of(vertex_output_struct),
+ Vector{
Return(Call("foo", Expr(0.25_f))),
},
- utils::Vector{Stage(ast::PipelineStage::kVertex)});
+ Vector{Stage(ast::PipelineStage::kVertex)});
ASTPrinter& gen = SanitizeAndBuild();
@@ -358,27 +357,27 @@
}
TEST_F(HlslASTPrinterTest_Function, Emit_Attribute_EntryPoint_With_Uniform) {
- auto* ubo_ty = Structure("UBO", utils::Vector{Member("coord", ty.vec4<f32>())});
+ auto* ubo_ty = Structure("UBO", Vector{Member("coord", ty.vec4<f32>())});
auto* ubo =
GlobalVar("ubo", ty.Of(ubo_ty), builtin::AddressSpace::kUniform, Binding(0_a), Group(1_a));
Func("sub_func",
- utils::Vector{
+ Vector{
Param("param", ty.f32()),
},
ty.f32(),
- utils::Vector{
+ Vector{
Return(MemberAccessor(MemberAccessor(ubo, "coord"), "x")),
});
auto* var = Var("v", ty.f32(), Call("sub_func", 1_f));
- Func("frag_main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("frag_main", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -401,18 +400,18 @@
}
TEST_F(HlslASTPrinterTest_Function, Emit_Attribute_EntryPoint_With_UniformStruct) {
- auto* s = Structure("Uniforms", utils::Vector{Member("coord", ty.vec4<f32>())});
+ auto* s = Structure("Uniforms", Vector{Member("coord", ty.vec4<f32>())});
GlobalVar("uniforms", ty.Of(s), builtin::AddressSpace::kUniform, Binding(0_a), Group(1_a));
auto* var = Var("v", ty.f32(), MemberAccessor(MemberAccessor("uniforms", "coord"), "x"));
- Func("frag_main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("frag_main", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -431,7 +430,7 @@
}
TEST_F(HlslASTPrinterTest_Function, Emit_Attribute_EntryPoint_With_RW_StorageBuffer_Read) {
- auto* s = Structure("Data", utils::Vector{
+ auto* s = Structure("Data", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
});
@@ -441,12 +440,12 @@
auto* var = Var("v", ty.f32(), MemberAccessor("coord", "b"));
- Func("frag_main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("frag_main", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -464,7 +463,7 @@
}
TEST_F(HlslASTPrinterTest_Function, Emit_Attribute_EntryPoint_With_RO_StorageBuffer_Read) {
- auto* s = Structure("Data", utils::Vector{
+ auto* s = Structure("Data", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
});
@@ -474,12 +473,12 @@
auto* var = Var("v", ty.f32(), MemberAccessor("coord", "b"));
- Func("frag_main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("frag_main", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -497,7 +496,7 @@
}
TEST_F(HlslASTPrinterTest_Function, Emit_Attribute_EntryPoint_With_WO_StorageBuffer_Store) {
- auto* s = Structure("Data", utils::Vector{
+ auto* s = Structure("Data", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
});
@@ -505,12 +504,12 @@
GlobalVar("coord", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(0_a), Group(1_a));
- Func("frag_main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("frag_main", tint::Empty, ty.void_(),
+ Vector{
Assign(MemberAccessor("coord", "b"), Expr(2_f)),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -528,7 +527,7 @@
}
TEST_F(HlslASTPrinterTest_Function, Emit_Attribute_EntryPoint_With_StorageBuffer_Store) {
- auto* s = Structure("Data", utils::Vector{
+ auto* s = Structure("Data", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
});
@@ -536,12 +535,12 @@
GlobalVar("coord", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(0_a), Group(1_a));
- Func("frag_main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("frag_main", tint::Empty, ty.void_(),
+ Vector{
Assign(MemberAccessor("coord", "b"), Expr(2_f)),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -559,26 +558,26 @@
}
TEST_F(HlslASTPrinterTest_Function, Emit_Attribute_Called_By_EntryPoint_With_Uniform) {
- auto* s = Structure("S", utils::Vector{Member("x", ty.f32())});
+ auto* s = Structure("S", Vector{Member("x", ty.f32())});
GlobalVar("coord", ty.Of(s), builtin::AddressSpace::kUniform, Binding(0_a), Group(1_a));
Func("sub_func",
- utils::Vector{
+ Vector{
Param("param", ty.f32()),
},
ty.f32(),
- utils::Vector{
+ Vector{
Return(MemberAccessor("coord", "x")),
});
auto* var = Var("v", ty.f32(), Call("sub_func", 1_f));
- Func("frag_main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("frag_main", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -601,27 +600,27 @@
}
TEST_F(HlslASTPrinterTest_Function, Emit_Attribute_Called_By_EntryPoint_With_StorageBuffer) {
- auto* s = Structure("S", utils::Vector{Member("x", ty.f32())});
+ auto* s = Structure("S", Vector{Member("x", ty.f32())});
GlobalVar("coord", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(0_a), Group(1_a));
Func("sub_func",
- utils::Vector{
+ Vector{
Param("param", ty.f32()),
},
ty.f32(),
- utils::Vector{
+ Vector{
Return(MemberAccessor("coord", "x")),
});
auto* var = Var("v", ty.f32(), Call("sub_func", 1_f));
- Func("frag_main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("frag_main", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -643,8 +642,8 @@
}
TEST_F(HlslASTPrinterTest_Function, Emit_Attribute_EntryPoint_WithNameCollision) {
- Func("GeometryShader", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("GeometryShader", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -658,11 +657,11 @@
}
TEST_F(HlslASTPrinterTest_Function, Emit_Attribute_EntryPoint_Compute) {
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Return(),
},
- utils::Vector{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)});
+ Vector{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)});
ASTPrinter& gen = Build();
@@ -675,8 +674,8 @@
}
TEST_F(HlslASTPrinterTest_Function, Emit_Attribute_EntryPoint_Compute_WithWorkgroup_Literal) {
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(2_i, 4_i, 6_i),
});
@@ -695,8 +694,8 @@
GlobalConst("width", ty.i32(), Call<i32>(2_i));
GlobalConst("height", ty.i32(), Call<i32>(3_i));
GlobalConst("depth", ty.i32(), Call<i32>(4_i));
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize("width", "height", "depth"),
});
@@ -716,8 +715,8 @@
Override("width", ty.i32(), Call<i32>(2_i), Id(7_u));
Override("height", ty.i32(), Call<i32>(3_i), Id(8_u));
Override("depth", ty.i32(), Call<i32>(4_i), Id(9_u));
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize("width", "height", "depth"),
});
@@ -732,11 +731,11 @@
TEST_F(HlslASTPrinterTest_Function, Emit_Function_WithArrayParams) {
Func("my_func",
- utils::Vector{
+ Vector{
Param("a", ty.array<f32, 5>()),
},
ty.void_(),
- utils::Vector{
+ Vector{
Return(),
});
@@ -750,8 +749,8 @@
}
TEST_F(HlslASTPrinterTest_Function, Emit_Function_WithArrayReturn) {
- Func("my_func", utils::Empty, ty.array<f32, 5>(),
- utils::Vector{
+ Func("my_func", tint::Empty, ty.array<f32, 5>(),
+ Vector{
Return(Call<array<f32, 5>>()),
});
@@ -766,8 +765,8 @@
}
TEST_F(HlslASTPrinterTest_Function, Emit_Function_WithDiscardAndVoidReturn) {
- Func("my_func", utils::Vector{Param("a", ty.i32())}, ty.void_(),
- utils::Vector{
+ Func("my_func", Vector{Param("a", ty.i32())}, ty.void_(),
+ Vector{
If(Equal("a", 0_i), //
Block(Discard())),
Return(),
@@ -786,8 +785,8 @@
}
TEST_F(HlslASTPrinterTest_Function, Emit_Function_WithDiscardAndNonVoidReturn) {
- Func("my_func", utils::Vector{Param("a", ty.i32())}, ty.i32(),
- utils::Vector{
+ Func("my_func", Vector{Param("a", ty.i32())}, ty.i32(),
+ Vector{
If(Equal("a", 0_i), //
Block(Discard())),
Return(42_i),
@@ -828,7 +827,7 @@
// return;
// }
- auto* s = Structure("Data", utils::Vector{Member("d", ty.f32())});
+ auto* s = Structure("Data", Vector{Member("d", ty.f32())});
GlobalVar("data", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(0_a), Group(0_a));
@@ -836,12 +835,12 @@
{
auto* var = Var("v", ty.f32(), MemberAccessor("data", "d"));
- Func("a", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -850,12 +849,12 @@
{
auto* var = Var("v", ty.f32(), MemberAccessor("data", "d"));
- Func("b", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("b", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
diff --git a/src/tint/lang/hlsl/writer/ast_printer/identifier_test.cc b/src/tint/lang/hlsl/writer/ast_printer/identifier_test.cc
index 840d9ed..c37cef8 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/identifier_test.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/identifier_test.cc
@@ -28,7 +28,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, i)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "foo");
}
diff --git a/src/tint/lang/hlsl/writer/ast_printer/import_test.cc b/src/tint/lang/hlsl/writer/ast_printer/import_test.cc
index e948888..6482e3a 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/import_test.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/import_test.cc
@@ -41,7 +41,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), std::string(param.hlsl_name) + "(1.0f)");
}
@@ -78,7 +78,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), std::string(param.hlsl_name) + "(1)");
}
@@ -95,7 +95,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.Diagnostics();
EXPECT_EQ(
out.str(),
@@ -136,7 +136,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), std::string(param.hlsl_name) + "(1.0f, 2.0f)");
}
@@ -158,7 +158,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), std::string(param.hlsl_name) +
"(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f))");
@@ -183,7 +183,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), std::string(param.hlsl_name) + "(1, 2)");
}
@@ -201,7 +201,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), std::string(param.hlsl_name) + "(1.0f, 2.0f, 3.0f)");
}
@@ -222,7 +222,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.Diagnostics();
EXPECT_EQ(
out.str(),
@@ -245,7 +245,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), std::string(param.hlsl_name) + "(1, 2, 3)");
}
@@ -261,7 +261,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), std::string("determinant(var)"));
}
@@ -274,7 +274,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), std::string("f16tof32(f32tof16(v))"));
}
@@ -287,7 +287,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), std::string("f16tof32(f32tof16(v))"));
}
diff --git a/src/tint/lang/hlsl/writer/ast_printer/loop_test.cc b/src/tint/lang/hlsl/writer/ast_printer/loop_test.cc
index 673536c..2ac0ca7 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/loop_test.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/loop_test.cc
@@ -27,8 +27,7 @@
auto* continuing = Block();
auto* l = Loop(body, continuing);
- Func("F", utils::Empty, ty.void_(), utils::Vector{l},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{l}, Vector{Stage(ast::PipelineStage::kFragment)});
ASTPrinter& gen = Build();
@@ -48,8 +47,7 @@
auto* continuing = Block(CallStmt(Call("a_statement")));
auto* l = Loop(body, continuing);
- Func("F", utils::Empty, ty.void_(), utils::Vector{l},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{l}, Vector{Stage(ast::PipelineStage::kFragment)});
ASTPrinter& gen = Build();
@@ -72,8 +70,7 @@
auto* continuing = Block(CallStmt(Call("a_statement")), BreakIf(true));
auto* l = Loop(body, continuing);
- Func("F", utils::Empty, ty.void_(), utils::Vector{l},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{l}, Vector{Stage(ast::PipelineStage::kFragment)});
ASTPrinter& gen = Build();
@@ -109,8 +106,7 @@
auto* outer = Loop(body, continuing);
- Func("F", utils::Empty, ty.void_(), utils::Vector{outer},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{outer}, Vector{Stage(ast::PipelineStage::kFragment)});
ASTPrinter& gen = Build();
diff --git a/src/tint/lang/hlsl/writer/ast_printer/member_accessor_test.cc b/src/tint/lang/hlsl/writer/ast_printer/member_accessor_test.cc
index e2b6935..f984383 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/member_accessor_test.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/member_accessor_test.cc
@@ -90,7 +90,7 @@
template <typename BASE>
class HlslASTPrinterTest_MemberAccessorBase : public BASE {
public:
- void SetupStorageBuffer(utils::VectorRef<const ast::StructMember*> members) {
+ void SetupStorageBuffer(VectorRef<const ast::StructMember*> members) {
ProgramBuilder& b = *this;
auto* s = b.Structure("Data", members);
@@ -98,7 +98,7 @@
builtin::Access::kReadWrite, b.Group(1_a), b.Binding(0_a));
}
- void SetupUniformBuffer(utils::VectorRef<const ast::StructMember*> members) {
+ void SetupUniformBuffer(VectorRef<const ast::StructMember*> members) {
ProgramBuilder& b = *this;
auto* s = b.Structure("Data", members);
@@ -106,12 +106,12 @@
builtin::Access::kUndefined, b.Group(1_a), b.Binding(1_a));
}
- void SetupFunction(utils::VectorRef<const ast::Statement*> statements) {
+ void SetupFunction(VectorRef<const ast::Statement*> statements) {
ProgramBuilder& b = *this;
- utils::Vector attrs{
+ Vector attrs{
b.Stage(ast::PipelineStage::kFragment),
};
- b.Func("main", utils::Empty, b.ty.void_(), std::move(statements), std::move(attrs));
+ b.Func("main", tint::Empty, b.ty.void_(), std::move(statements), std::move(attrs));
}
};
@@ -122,7 +122,7 @@
HlslASTPrinterTest_MemberAccessorBase<TestParamHelper<T>>;
TEST_F(HlslASTPrinterTest_MemberAccessor, EmitExpression_MemberAccessor) {
- auto* s = Structure("Data", utils::Vector{Member("mem", ty.f32())});
+ auto* s = Structure("Data", Vector{Member("mem", ty.f32())});
GlobalVar("str", ty.Of(s), builtin::AddressSpace::kPrivate);
auto* expr = MemberAccessor("str", "mem");
@@ -168,12 +168,12 @@
Enable(builtin::Extension::kF16);
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("a", ty.i32()),
Member("b", p.member_type(ty)),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("x", MemberAccessor("data", "b"))),
});
@@ -303,19 +303,19 @@
Enable(builtin::Extension::kF16);
- auto* inner = Structure("Inner", utils::Vector{
+ auto* inner = Structure("Inner", Vector{
Member("a", ty.i32()),
Member("b", p.member_type(ty)),
Member("c", ty.vec4(ty.i32())),
});
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("arr", ty.array(ty.Of(inner), 4_i)),
});
auto* i = Var("i", Expr(2_i));
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(i),
Decl(Var("x", MemberAccessor(IndexAccessor(MemberAccessor("data", "arr"), i), "b"))),
});
@@ -442,12 +442,12 @@
Enable(builtin::Extension::kF16);
- SetupUniformBuffer(utils::Vector{
+ SetupUniformBuffer(Vector{
Member("a", ty.i32()),
Member("b", p.member_type(ty)),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("x", MemberAccessor("data", "b"))),
});
@@ -710,19 +710,19 @@
Enable(builtin::Extension::kF16);
- auto* inner = Structure("Inner", utils::Vector{
+ auto* inner = Structure("Inner", Vector{
Member("a", ty.i32()),
Member("b", p.member_type(ty)),
Member("c", ty.vec4(ty.i32())),
});
- SetupUniformBuffer(utils::Vector{
+ SetupUniformBuffer(Vector{
Member("arr", ty.array(ty.Of(inner), 4_i)),
});
auto* i = Var("i", Expr(2_i));
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(i),
Decl(Var("x", MemberAccessor(IndexAccessor(MemberAccessor("data", "arr"), i), "b"))),
});
@@ -992,12 +992,12 @@
Enable(builtin::Extension::kF16);
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("a", ty.i32()),
Member("b", p.member_type(ty)),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("value", p.member_type(ty), Call(p.member_type(ty)))),
Assign(MemberAccessor("data", "b"), Expr("value")),
});
@@ -1128,12 +1128,12 @@
// var<storage> data : Data;
// data.b = mat2x3<f32>();
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("a", ty.i32()),
Member("b", ty.mat2x3<f32>()),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Assign(MemberAccessor("data", "b"), Call<mat2x3<f32>>()),
});
@@ -1164,12 +1164,12 @@
// var<storage> data : Data;
// data.a[2i][1i];
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("z", ty.f32()),
Member("a", ty.mat4x3<f32>()),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("x", IndexAccessor(IndexAccessor(MemberAccessor("data", "a"), 2_i), 1_i))),
});
@@ -1197,12 +1197,12 @@
Enable(builtin::Extension::kF16);
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("z", ty.f16()),
Member("a", ty.mat4x3<f16>()),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("x", IndexAccessor(IndexAccessor(MemberAccessor("data", "a"), 2_i), 1_i))),
});
@@ -1228,12 +1228,12 @@
// var<uniform> data : Data;
// data.a[2i][1i];
- SetupUniformBuffer(utils::Vector{
+ SetupUniformBuffer(Vector{
Member("z", ty.f32()),
Member("a", ty.mat4x3<f32>()),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("x", IndexAccessor(IndexAccessor(MemberAccessor("data", "a"), 2_i), 1_i))),
});
@@ -1263,12 +1263,12 @@
Enable(builtin::Extension::kF16);
- SetupUniformBuffer(utils::Vector{
+ SetupUniformBuffer(Vector{
Member("z", ty.f16()),
Member("a", ty.mat4x3<f16>()),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("x", IndexAccessor(IndexAccessor(MemberAccessor("data", "a"), 2_i), 1_i))),
});
@@ -1297,12 +1297,12 @@
// var<storage> data : Data;
// data.a[2];
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("z", ty.f32()),
Member("a", ty.array<i32, 5>()),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("x", IndexAccessor(MemberAccessor("data", "a"), 2_i))),
});
@@ -1329,12 +1329,12 @@
// var<uniform> data : Data;
// data.a[2];
- SetupUniformBuffer(utils::Vector{
+ SetupUniformBuffer(Vector{
Member("z", ty.f32()),
Member("a", ty.array<vec4<i32>, 5>()),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("x", IndexAccessor(MemberAccessor("data", "a"), 2_i))),
});
@@ -1367,17 +1367,17 @@
// var<storage> data : Data;
// data.a[2i];
- auto* elem_type = Structure(
- "Inner", utils::Vector{
- Member("v", ty.i32(), utils::Vector{MemberSize(16_i), MemberAlign(16_i)}),
- });
+ auto* elem_type =
+ Structure("Inner", Vector{
+ Member("v", ty.i32(), Vector{MemberSize(16_i), MemberAlign(16_i)}),
+ });
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("z", ty.f32()),
Member("a", ty.array(ty.Of(elem_type), 5_i)),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("x", IndexAccessor(MemberAccessor("data", "a"), 2_i))),
});
@@ -1417,17 +1417,17 @@
// var<uniform> data : Data;
// data.a[2i];
- auto* elem_type = Structure(
- "Inner", utils::Vector{
- Member("v", ty.i32(), utils::Vector{MemberSize(16_i), MemberAlign(16_i)}),
- });
+ auto* elem_type =
+ Structure("Inner", Vector{
+ Member("v", ty.i32(), Vector{MemberSize(16_i), MemberAlign(16_i)}),
+ });
- SetupUniformBuffer(utils::Vector{
+ SetupUniformBuffer(Vector{
Member("z", ty.f32()),
Member("a", ty.array(ty.Of(elem_type), 5_i)),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("x", IndexAccessor(MemberAccessor("data", "a"), 2_i))),
});
@@ -1466,12 +1466,12 @@
// var<storage> data : Data;
// data.a[(2i + 4i) - 3i];
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("z", ty.f32()),
Member("a", ty.array<i32, 5>()),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("a", Expr(2_i))),
Decl(Var("b", Expr(4_i))),
Decl(Var("c", Expr(3_i))),
@@ -1504,12 +1504,12 @@
// var<uniform> data : Data;
// data.a[(2i + 4i) - 3i];
- SetupUniformBuffer(utils::Vector{
+ SetupUniformBuffer(Vector{
Member("z", ty.f32()),
Member("a", ty.array<vec4<i32>, 5>()),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("a", Expr(2_i))),
Decl(Var("b", Expr(4_i))),
Decl(Var("c", Expr(3_i))),
@@ -1543,12 +1543,12 @@
// var<storage> data : Data;
// data.a[2i] = 2i;
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("z", ty.f32()),
Member("a", ty.array<i32, 5>()),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Assign(IndexAccessor(MemberAccessor("data", "a"), 2_i), 2_i),
});
@@ -1578,16 +1578,16 @@
// var<storage> data : Data;
// data.c[2i].b
- auto* inner = Structure("Inner", utils::Vector{
+ auto* inner = Structure("Inner", Vector{
Member("a", ty.vec3<i32>()),
Member("b", ty.vec3<f32>()),
});
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("c", ty.array(ty.Of(inner), 4_u)),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("x", MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"))),
});
@@ -1617,16 +1617,16 @@
// var<storage> data : Data;
// data.c[2i].b
- auto* inner = Structure("Inner", utils::Vector{
+ auto* inner = Structure("Inner", Vector{
Member("a", ty.vec3<i32>()),
Member("b", ty.vec3<f32>()),
});
- SetupUniformBuffer(utils::Vector{
+ SetupUniformBuffer(Vector{
Member("c", ty.array(ty.Of(inner), 4_u)),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("x", MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"))),
});
@@ -1658,16 +1658,16 @@
// var<storage> data : Data;
// data.c[2i].b.yx
- auto* inner = Structure("Inner", utils::Vector{
+ auto* inner = Structure("Inner", Vector{
Member("a", ty.vec3<i32>()),
Member("b", ty.vec3<f32>()),
});
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("c", ty.array(ty.Of(inner), 4_u)),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("x",
MemberAccessor(
MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"), "yx"))),
@@ -1699,16 +1699,16 @@
// var<uniform> data : Data;
// data.c[2i].b.yx
- auto* inner = Structure("Inner", utils::Vector{
+ auto* inner = Structure("Inner", Vector{
Member("a", ty.vec3<i32>()),
Member("b", ty.vec3<f32>()),
});
- SetupUniformBuffer(utils::Vector{
+ SetupUniformBuffer(Vector{
Member("c", ty.array(ty.Of(inner), 4_u)),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("x",
MemberAccessor(
MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"), "yx"))),
@@ -1743,16 +1743,16 @@
// var<storage> data : Data;
// data.c[2i].b.g
- auto* inner = Structure("Inner", utils::Vector{
+ auto* inner = Structure("Inner", Vector{
Member("a", ty.vec3<i32>()),
Member("b", ty.vec3<f32>()),
});
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("c", ty.array(ty.Of(inner), 4_u)),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("x",
MemberAccessor(
MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"), "g"))),
@@ -1785,16 +1785,16 @@
// var<uniform> data : Data;
// data.c[2i].b.g
- auto* inner = Structure("Inner", utils::Vector{
+ auto* inner = Structure("Inner", Vector{
Member("a", ty.vec3<i32>()),
Member("b", ty.vec3<f32>()),
});
- SetupUniformBuffer(utils::Vector{
+ SetupUniformBuffer(Vector{
Member("c", ty.array(ty.Of(inner), 4_u)),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("x",
MemberAccessor(
MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"), "g"))),
@@ -1828,16 +1828,16 @@
// var<storage> data : Data;
// data.c[2i].b[1i]
- auto* inner = Structure("Inner", utils::Vector{
+ auto* inner = Structure("Inner", Vector{
Member("a", ty.vec3<i32>()),
Member("b", ty.vec3<f32>()),
});
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("c", ty.array(ty.Of(inner), 4_u)),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("x",
IndexAccessor(MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"),
1_i))),
@@ -1869,16 +1869,16 @@
// var<uniform> data : Data;
// data.c[2i].b[1i]
- auto* inner = Structure("Inner", utils::Vector{
+ auto* inner = Structure("Inner", Vector{
Member("a", ty.vec3<i32>()),
Member("b", ty.vec3<f32>()),
});
- SetupUniformBuffer(utils::Vector{
+ SetupUniformBuffer(Vector{
Member("c", ty.array(ty.Of(inner), 4_u)),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Decl(Var("x",
IndexAccessor(MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"),
1_i))),
@@ -1912,16 +1912,16 @@
// var<storage> data : Pre;
// data.c[2i].b = vec3<f32>(1_f, 2_f, 3_f);
- auto* inner = Structure("Inner", utils::Vector{
+ auto* inner = Structure("Inner", Vector{
Member("a", ty.vec3<i32>()),
Member("b", ty.vec3<f32>()),
});
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("c", ty.array(ty.Of(inner), 4_u)),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Assign(MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"),
Call<vec3<f32>>(1_f, 2_f, 3_f)),
});
@@ -1952,16 +1952,16 @@
// var<storage> data : Pre;
// data.c[2i].b.y = 1.f;
- auto* inner = Structure("Inner", utils::Vector{
+ auto* inner = Structure("Inner", Vector{
Member("a", ty.vec3<i32>()),
Member("b", ty.vec3<f32>()),
});
- SetupStorageBuffer(utils::Vector{
+ SetupStorageBuffer(Vector{
Member("c", ty.array(ty.Of(inner), 4_u)),
});
- SetupFunction(utils::Vector{
+ SetupFunction(Vector{
Assign(MemberAccessor(MemberAccessor(IndexAccessor(MemberAccessor("data", "c"), 2_i), "b"),
"y"),
Expr(1_f)),
diff --git a/src/tint/lang/hlsl/writer/ast_printer/module_constant_test.cc b/src/tint/lang/hlsl/writer/ast_printer/module_constant_test.cc
index d3b2f27..a1bd8d4 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/module_constant_test.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/module_constant_test.cc
@@ -25,7 +25,7 @@
TEST_F(HlslASTPrinterTest_ModuleConstant, Emit_GlobalConst_AInt) {
auto* var = GlobalConst("G", Expr(1_a));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
@@ -39,7 +39,7 @@
TEST_F(HlslASTPrinterTest_ModuleConstant, Emit_GlobalConst_AFloat) {
auto* var = GlobalConst("G", Expr(1._a));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
@@ -53,7 +53,7 @@
TEST_F(HlslASTPrinterTest_ModuleConstant, Emit_GlobalConst_i32) {
auto* var = GlobalConst("G", Expr(1_i));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
@@ -67,7 +67,7 @@
TEST_F(HlslASTPrinterTest_ModuleConstant, Emit_GlobalConst_u32) {
auto* var = GlobalConst("G", Expr(1_u));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
@@ -81,7 +81,7 @@
TEST_F(HlslASTPrinterTest_ModuleConstant, Emit_GlobalConst_f32) {
auto* var = GlobalConst("G", Expr(1_f));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
@@ -97,7 +97,7 @@
Enable(builtin::Extension::kF16);
auto* var = GlobalConst("G", Expr(1_h));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
@@ -111,7 +111,7 @@
TEST_F(HlslASTPrinterTest_ModuleConstant, Emit_GlobalConst_vec3_AInt) {
auto* var = GlobalConst("G", Call<vec3<Infer>>(1_a, 2_a, 3_a));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
@@ -125,7 +125,7 @@
TEST_F(HlslASTPrinterTest_ModuleConstant, Emit_GlobalConst_vec3_AFloat) {
auto* var = GlobalConst("G", Call<vec3<Infer>>(1._a, 2._a, 3._a));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
@@ -139,7 +139,7 @@
TEST_F(HlslASTPrinterTest_ModuleConstant, Emit_GlobalConst_vec3_f32) {
auto* var = GlobalConst("G", Call<vec3<f32>>(1_f, 2_f, 3_f));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
@@ -155,7 +155,7 @@
Enable(builtin::Extension::kF16);
auto* var = GlobalConst("G", Call<vec3<f16>>(1_h, 2_h, 3_h));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
@@ -169,7 +169,7 @@
TEST_F(HlslASTPrinterTest_ModuleConstant, Emit_GlobalConst_mat2x3_AFloat) {
auto* var = GlobalConst("G", Call<mat2x3<Infer>>(1._a, 2._a, 3._a, 4._a, 5._a, 6._a));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
@@ -183,7 +183,7 @@
TEST_F(HlslASTPrinterTest_ModuleConstant, Emit_GlobalConst_mat2x3_f32) {
auto* var = GlobalConst("G", Call<mat2x3<f32>>(1_f, 2_f, 3_f, 4_f, 5_f, 6_f));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
@@ -199,7 +199,7 @@
Enable(builtin::Extension::kF16);
auto* var = GlobalConst("G", Call<mat2x3<f16>>(1_h, 2_h, 3_h, 4_h, 5_h, 6_h));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
@@ -213,7 +213,7 @@
TEST_F(HlslASTPrinterTest_ModuleConstant, Emit_GlobalConst_arr_f32) {
auto* var = GlobalConst("G", Call<array<f32, 3>>(1_f, 2_f, 3_f));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
@@ -230,7 +230,7 @@
Call<vec2<bool>>(true, false), //
Call<vec2<bool>>(false, true), //
Call<vec2<bool>>(true, true)));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
diff --git a/src/tint/lang/hlsl/writer/ast_printer/return_test.cc b/src/tint/lang/hlsl/writer/ast_printer/return_test.cc
index 0d4993e..432c55e 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/return_test.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/return_test.cc
@@ -35,7 +35,7 @@
TEST_F(HlslASTPrinterTest_Return, Emit_ReturnWithValue) {
auto* r = Return(123_i);
- Func("f", utils::Empty, ty.i32(), utils::Vector{r});
+ Func("f", tint::Empty, ty.i32(), Vector{r});
ASTPrinter& gen = Build();
diff --git a/src/tint/lang/hlsl/writer/ast_printer/sanitizer_test.cc b/src/tint/lang/hlsl/writer/ast_printer/sanitizer_test.cc
index 2ed9ba9..f98a547 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/sanitizer_test.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/sanitizer_test.cc
@@ -26,15 +26,15 @@
using HlslSanitizerTest = TestHelper;
TEST_F(HlslSanitizerTest, Call_ArrayLength) {
- auto* s = Structure("my_struct", utils::Vector{Member(0, "a", ty.array<f32>())});
+ auto* s = Structure("my_struct", Vector{Member(0, "a", ty.array<f32>())});
GlobalVar("b", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(2_a));
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("len", ty.u32(), Call("arrayLength", AddressOf(MemberAccessor("b", "a"))))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -57,18 +57,18 @@
}
TEST_F(HlslSanitizerTest, Call_ArrayLength_OtherMembersInStruct) {
- auto* s = Structure("my_struct", utils::Vector{
+ auto* s = Structure("my_struct", Vector{
Member(0, "z", ty.f32()),
Member(4, "a", ty.array<f32>()),
});
GlobalVar("b", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(2_a));
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("len", ty.u32(), Call("arrayLength", AddressOf(MemberAccessor("b", "a"))))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -92,20 +92,20 @@
}
TEST_F(HlslSanitizerTest, Call_ArrayLength_ViaLets) {
- auto* s = Structure("my_struct", utils::Vector{Member(0, "a", ty.array<f32>())});
+ auto* s = Structure("my_struct", Vector{Member(0, "a", ty.array<f32>())});
GlobalVar("b", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(2_a));
auto* p = Let("p", AddressOf("b"));
auto* p2 = Let("p2", AddressOf(MemberAccessor(Deref(p), "a")));
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(p),
Decl(p2),
Decl(Var("len", ty.u32(), Call("arrayLength", p2))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -129,19 +129,19 @@
}
TEST_F(HlslSanitizerTest, Call_ArrayLength_ArrayLengthFromUniform) {
- auto* s = Structure("my_struct", utils::Vector{Member(0, "a", ty.array<f32>())});
+ auto* s = Structure("my_struct", Vector{Member(0, "a", ty.array<f32>())});
GlobalVar("b", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(2_a));
GlobalVar("c", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kRead, Binding(2_a),
Group(2_a));
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("len", ty.u32(),
Add(Call("arrayLength", AddressOf(MemberAccessor("b", "a"))),
Call("arrayLength", AddressOf(MemberAccessor("c", "a")))))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -173,12 +173,12 @@
TEST_F(HlslSanitizerTest, PromoteArrayInitializerToConstVar) {
auto* array_init = Call<array<i32, 4>>(1_i, 2_i, 3_i, 4_i);
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("idx", Expr(3_i))),
Decl(Var("pos", ty.i32(), IndexAccessor(array_init, "idx"))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -199,7 +199,7 @@
TEST_F(HlslSanitizerTest, PromoteStructInitializerToConstVar) {
auto* runtime_value = Var("runtime_value", Expr(3_f));
- auto* str = Structure("S", utils::Vector{
+ auto* str = Structure("S", Vector{
Member("a", ty.i32()),
Member("b", ty.vec3<f32>()),
Member("c", ty.i32()),
@@ -208,12 +208,12 @@
auto* struct_access = MemberAccessor(struct_init, "b");
auto* pos = Var("pos", ty.vec3<f32>(), struct_access);
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(runtime_value),
Decl(pos),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -246,13 +246,13 @@
auto* p = Let("p", ty.ptr<function, i32>(), AddressOf(v));
auto* x = Var("x", ty.i32(), Deref(p));
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(v),
Decl(p),
Decl(x),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -282,15 +282,15 @@
auto* vp = Let("vp", ty.ptr<function, vec4<f32>>(), AddressOf(IndexAccessor(Deref(mp), 2_i)));
auto* v = Var("v", ty.vec4<f32>(), Deref(vp));
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(a),
Decl(ap),
Decl(mp),
Decl(vp),
Decl(v),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
diff --git a/src/tint/lang/hlsl/writer/ast_printer/switch_test.cc b/src/tint/lang/hlsl/writer/ast_printer/switch_test.cc
index 2007f62..f69f375 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/switch_test.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/switch_test.cc
@@ -49,7 +49,7 @@
GlobalVar("cond", ty.i32(), builtin::AddressSpace::kPrivate);
auto* s = Switch( //
Expr("cond"), //
- Case(utils::Vector{CaseSelector(5_i), DefaultCaseSelector()}, Block(Break())));
+ Case(Vector{CaseSelector(5_i), DefaultCaseSelector()}, Block(Break())));
WrapInFunction(s);
ASTPrinter& gen = Build();
@@ -111,9 +111,9 @@
// }
GlobalVar("global", ty.i32(), builtin::AddressSpace::kPrivate);
Func("bar", {}, ty.i32(),
- utils::Vector{ //
- Assign("global", Expr(84_i)), //
- Return("global")});
+ Vector{ //
+ Assign("global", Expr(84_i)), //
+ Return("global")});
GlobalVar("a", ty.i32(), builtin::AddressSpace::kPrivate);
auto* s = Switch( //
diff --git a/src/tint/lang/hlsl/writer/ast_printer/type_test.cc b/src/tint/lang/hlsl/writer/ast_printer/type_test.cc
index 5f18157..e543ec4 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/type_test.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/type_test.cc
@@ -39,7 +39,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, program->TypeOf(ty), builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, "ary"))
<< gen.Diagnostics();
@@ -52,7 +52,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, program->TypeOf(ty), builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, "ary"))
<< gen.Diagnostics();
@@ -65,7 +65,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, program->TypeOf(ty), builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, "ary"))
<< gen.Diagnostics();
@@ -78,7 +78,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, program->TypeOf(ty), builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, ""))
<< gen.Diagnostics();
@@ -90,7 +90,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, bool_, builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, ""))
<< gen.Diagnostics();
@@ -102,7 +102,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(
gen.EmitType(out, f16, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.Diagnostics();
@@ -114,7 +114,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(
gen.EmitType(out, f32, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.Diagnostics();
@@ -126,7 +126,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(
gen.EmitType(out, i32, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.Diagnostics();
@@ -140,7 +140,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, mat2x3, builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, ""))
<< gen.Diagnostics();
@@ -154,7 +154,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, mat2x3, builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, ""))
<< gen.Diagnostics();
@@ -162,7 +162,7 @@
}
TEST_F(HlslASTPrinterTest_Type, EmitType_StructDecl) {
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
});
@@ -170,7 +170,7 @@
ASTPrinter& gen = Build();
- utils::TextGenerator::TextBuffer buf;
+ tint::TextGenerator::TextBuffer buf;
auto* str = program->TypeOf(s)->As<type::Struct>();
ASSERT_TRUE(gen.EmitStructType(&buf, str)) << gen.Diagnostics();
EXPECT_EQ(buf.String(), R"(struct S {
@@ -181,7 +181,7 @@
}
TEST_F(HlslASTPrinterTest_Type, EmitType_StructDecl_OmittedIfStorageBuffer) {
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
});
@@ -195,7 +195,7 @@
}
TEST_F(HlslASTPrinterTest_Type, EmitType_Struct) {
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
});
@@ -204,7 +204,7 @@
ASTPrinter& gen = Build();
auto* str = program->TypeOf(s)->As<type::Struct>();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(
gen.EmitType(out, str, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.Diagnostics();
@@ -212,7 +212,7 @@
}
TEST_F(HlslASTPrinterTest_Type, EmitType_Struct_NameCollision) {
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("double", ty.i32()),
Member("float", ty.f32()),
});
@@ -229,15 +229,15 @@
}
TEST_F(HlslASTPrinterTest_Type, EmitType_Struct_WithOffsetAttributes) {
- auto* s = Structure("S", utils::Vector{
- Member("a", ty.i32(), utils::Vector{MemberOffset(0_a)}),
- Member("b", ty.f32(), utils::Vector{MemberOffset(8_a)}),
+ auto* s = Structure("S", Vector{
+ Member("a", ty.i32(), Vector{MemberOffset(0_a)}),
+ Member("b", ty.f32(), Vector{MemberOffset(8_a)}),
});
GlobalVar("g", ty.Of(s), builtin::AddressSpace::kPrivate);
ASTPrinter& gen = Build();
- utils::TextGenerator::TextBuffer buf;
+ tint::TextGenerator::TextBuffer buf;
auto* str = program->TypeOf(s)->As<type::Struct>();
ASSERT_TRUE(gen.EmitStructType(&buf, str)) << gen.Diagnostics();
EXPECT_EQ(buf.String(), R"(struct S {
@@ -252,7 +252,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(
gen.EmitType(out, u32, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.Diagnostics();
@@ -265,7 +265,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(
gen.EmitType(out, vec3, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.Diagnostics();
@@ -277,7 +277,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, void_, builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, ""))
<< gen.Diagnostics();
@@ -289,7 +289,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, sampler, builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, ""))
<< gen.Diagnostics();
@@ -301,7 +301,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, sampler, builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, ""))
<< gen.Diagnostics();
@@ -313,7 +313,7 @@
std::string result;
};
inline std::ostream& operator<<(std::ostream& out, HlslDepthTextureData data) {
- utils::StringStream str;
+ StringStream str;
str << data.dim;
out << str.str();
return out;
@@ -326,11 +326,11 @@
GlobalVar("tex", t, Binding(1_a), Group(2_a));
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v", Call("textureDimensions", "tex"))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -357,11 +357,11 @@
GlobalVar("tex", t, Binding(1_a), Group(2_a));
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v", Call("textureDimensions", "tex"))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -378,7 +378,7 @@
std::string result;
};
inline std::ostream& operator<<(std::ostream& out, HlslSampledTextureData data) {
- utils::StringStream str;
+ StringStream str;
str << data.dim;
out << str.str();
return out;
@@ -403,11 +403,11 @@
GlobalVar("tex", t, Binding(1_a), Group(2_a));
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v", Call("textureDimensions", "tex"))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -516,7 +516,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(
gen.EmitType(out, s, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.Diagnostics();
@@ -529,7 +529,7 @@
std::string result;
};
inline std::ostream& operator<<(std::ostream& out, HlslStorageTextureData data) {
- utils::StringStream str;
+ StringStream str;
str << data.dim;
out << str.str();
return out;
@@ -541,16 +541,16 @@
auto t = ty.storage_texture(params.dim, params.imgfmt, builtin::Access::kWrite);
GlobalVar("tex", t,
- utils::Vector{
+ Vector{
Group(2_a),
Binding(1_a),
});
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v", Call("textureDimensions", "tex"))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
diff --git a/src/tint/lang/hlsl/writer/ast_printer/unary_op_test.cc b/src/tint/lang/hlsl/writer/ast_printer/unary_op_test.cc
index f5b9b66..839d10a 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/unary_op_test.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/unary_op_test.cc
@@ -27,7 +27,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, op)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "expr");
}
@@ -39,7 +39,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, op)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "~(expr)");
}
@@ -52,7 +52,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, op)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "expr");
}
@@ -64,7 +64,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, op)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "!(expr)");
}
@@ -76,7 +76,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, op)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "-(expr)");
}
diff --git a/src/tint/lang/hlsl/writer/ast_printer/variable_decl_statement_test.cc b/src/tint/lang/hlsl/writer/ast_printer/variable_decl_statement_test.cc
index 1078fb6..28b2374 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/variable_decl_statement_test.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/variable_decl_statement_test.cc
@@ -67,8 +67,8 @@
TEST_F(HlslASTPrinterTest_VariableDecl, Emit_VariableDeclStatement_Const_AInt) {
auto* C = Const("C", Expr(1_a));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -85,8 +85,8 @@
TEST_F(HlslASTPrinterTest_VariableDecl, Emit_VariableDeclStatement_Const_AFloat) {
auto* C = Const("C", Expr(1._a));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -103,8 +103,8 @@
TEST_F(HlslASTPrinterTest_VariableDecl, Emit_VariableDeclStatement_Const_i32) {
auto* C = Const("C", Expr(1_i));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -121,8 +121,8 @@
TEST_F(HlslASTPrinterTest_VariableDecl, Emit_VariableDeclStatement_Const_u32) {
auto* C = Const("C", Expr(1_u));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -139,8 +139,8 @@
TEST_F(HlslASTPrinterTest_VariableDecl, Emit_VariableDeclStatement_Const_f32) {
auto* C = Const("C", Expr(1_f));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -159,8 +159,8 @@
Enable(builtin::Extension::kF16);
auto* C = Const("C", Expr(1_h));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -177,8 +177,8 @@
TEST_F(HlslASTPrinterTest_VariableDecl, Emit_VariableDeclStatement_Const_vec3_AInt) {
auto* C = Const("C", Call<vec3<Infer>>(1_a, 2_a, 3_a));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -195,8 +195,8 @@
TEST_F(HlslASTPrinterTest_VariableDecl, Emit_VariableDeclStatement_Const_vec3_AFloat) {
auto* C = Const("C", Call<vec3<Infer>>(1._a, 2._a, 3._a));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -213,8 +213,8 @@
TEST_F(HlslASTPrinterTest_VariableDecl, Emit_VariableDeclStatement_Const_vec3_f32) {
auto* C = Const("C", Call<vec3<f32>>(1_f, 2_f, 3_f));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -233,8 +233,8 @@
Enable(builtin::Extension::kF16);
auto* C = Const("C", Call<vec3<f16>>(1_h, 2_h, 3_h));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -251,8 +251,8 @@
TEST_F(HlslASTPrinterTest_VariableDecl, Emit_VariableDeclStatement_Const_mat2x3_AFloat) {
auto* C = Const("C", Call<mat2x3<Infer>>(1._a, 2._a, 3._a, 4._a, 5._a, 6._a));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -269,8 +269,8 @@
TEST_F(HlslASTPrinterTest_VariableDecl, Emit_VariableDeclStatement_Const_mat2x3_f32) {
auto* C = Const("C", Call<mat2x3<f32>>(1_f, 2_f, 3_f, 4_f, 5_f, 6_f));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -289,8 +289,8 @@
Enable(builtin::Extension::kF16);
auto* C = Const("C", Call<mat2x3<f16>>(1_h, 2_h, 3_h, 4_h, 5_h, 6_h));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -307,8 +307,8 @@
TEST_F(HlslASTPrinterTest_VariableDecl, Emit_VariableDeclStatement_Const_arr_f32) {
auto* C = Const("C", Call(ty.array<f32, 3>(), 1_f, 2_f, 3_f));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -328,8 +328,8 @@
Call<vec2<bool>>(true, false), //
Call<vec2<bool>>(false, true), //
Call<vec2<bool>>(true, true)));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
diff --git a/src/tint/lang/hlsl/writer/ast_printer/workgroup_var_test.cc b/src/tint/lang/hlsl/writer/ast_printer/workgroup_var_test.cc
index c46bacb..f8f1e19 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/workgroup_var_test.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/workgroup_var_test.cc
@@ -29,8 +29,8 @@
TEST_F(HlslASTPrinterTest_WorkgroupVar, Basic) {
GlobalVar("wg", ty.f32(), builtin::AddressSpace::kWorkgroup);
- Func("main", utils::Empty, ty.void_(), utils::Vector{Assign("wg", 1.2_f)},
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), Vector{Assign("wg", 1.2_f)},
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -45,8 +45,8 @@
GlobalVar("wg", ty.Of(alias), builtin::AddressSpace::kWorkgroup);
- Func("main", utils::Empty, ty.void_(), utils::Vector{Assign("wg", 1.2_f)},
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), Vector{Assign("wg", 1.2_f)},
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
diff --git a/src/tint/lang/msl/validate/msl.cc b/src/tint/lang/msl/validate/msl.cc
index 32c0e8d..b3d0000 100644
--- a/src/tint/lang/msl/validate/msl.cc
+++ b/src/tint/lang/msl/validate/msl.cc
@@ -24,14 +24,14 @@
Result Msl(const std::string& xcrun_path, const std::string& source) {
Result result;
- auto xcrun = utils::Command(xcrun_path);
+ auto xcrun = tint::Command(xcrun_path);
if (!xcrun.Found()) {
result.output = "xcrun not found at '" + std::string(xcrun_path) + "'";
result.failed = true;
return result;
}
- utils::TmpFile file(".metal");
+ tint::TmpFile file(".metal");
file << source;
#ifdef _WIN32
diff --git a/src/tint/lang/msl/writer/ast_printer/array_accessor_test.cc b/src/tint/lang/msl/writer/ast_printer/array_accessor_test.cc
index 0b01fce..071e1ef 100644
--- a/src/tint/lang/msl/writer/ast_printer/array_accessor_test.cc
+++ b/src/tint/lang/msl/writer/ast_printer/array_accessor_test.cc
@@ -29,7 +29,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "ary[5]");
}
@@ -43,7 +43,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "(*(p))[5]");
}
diff --git a/src/tint/lang/msl/writer/ast_printer/ast_function_test.cc b/src/tint/lang/msl/writer/ast_printer/ast_function_test.cc
index 03a4fb8..b18522b 100644
--- a/src/tint/lang/msl/writer/ast_printer/ast_function_test.cc
+++ b/src/tint/lang/msl/writer/ast_printer/ast_function_test.cc
@@ -25,8 +25,8 @@
using MslASTPrinterTest = TestHelper;
TEST_F(MslASTPrinterTest, Emit_Function) {
- Func("my_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("my_func", tint::Empty, ty.void_(),
+ Vector{
Return(),
});
@@ -47,12 +47,12 @@
TEST_F(MslASTPrinterTest, Emit_Function_WithParams) {
Func("my_func",
- utils::Vector{
+ Vector{
Param("a", ty.f32()),
Param("b", ty.i32()),
},
ty.void_(),
- utils::Vector{
+ Vector{
Return(),
});
@@ -72,8 +72,8 @@
}
TEST_F(MslASTPrinterTest, Emit_Attribute_EntryPoint_NoReturn_Void) {
- Func("main", utils::Empty, ty.void_(), {/* no explicit return */},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("main", tint::Empty, ty.void_(), {/* no explicit return */},
+ Vector{Stage(ast::PipelineStage::kFragment)});
ASTPrinter& gen = Build();
@@ -92,15 +92,15 @@
// fn frag_main(@location(0) foo : f32) -> @location(1) f32 {
// return foo;
// }
- auto* foo_in = Param("foo", ty.f32(), utils::Vector{Location(0_a)});
- Func("frag_main", utils::Vector{foo_in}, ty.f32(),
- utils::Vector{
+ auto* foo_in = Param("foo", ty.f32(), Vector{Location(0_a)});
+ Func("frag_main", Vector{foo_in}, ty.f32(),
+ Vector{
Return("foo"),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(1_a),
});
@@ -137,15 +137,15 @@
// return coord.x;
// }
auto* coord_in =
- Param("coord", ty.vec4<f32>(), utils::Vector{Builtin(builtin::BuiltinValue::kPosition)});
- Func("frag_main", utils::Vector{coord_in}, ty.f32(),
- utils::Vector{
+ Param("coord", ty.vec4<f32>(), Vector{Builtin(builtin::BuiltinValue::kPosition)});
+ Func("frag_main", Vector{coord_in}, ty.f32(),
+ Vector{
Return(MemberAccessor("coord", "x")),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kFragDepth),
});
@@ -188,22 +188,22 @@
// }
auto* interface_struct = Structure(
"Interface",
- utils::Vector{
- Member("col1", ty.f32(), utils::Vector{Location(1_a)}),
- Member("col2", ty.f32(), utils::Vector{Location(2_a)}),
- Member("pos", ty.vec4<f32>(), utils::Vector{Builtin(builtin::BuiltinValue::kPosition)}),
+ Vector{
+ Member("col1", ty.f32(), Vector{Location(1_a)}),
+ Member("col2", ty.f32(), Vector{Location(2_a)}),
+ Member("pos", ty.vec4<f32>(), Vector{Builtin(builtin::BuiltinValue::kPosition)}),
});
- Func("vert_main", utils::Empty, ty.Of(interface_struct),
- utils::Vector{Return(Call(ty.Of(interface_struct), 0.5_f, 0.25_f, Call<vec4<f32>>()))},
- utils::Vector{Stage(ast::PipelineStage::kVertex)});
+ Func("vert_main", tint::Empty, ty.Of(interface_struct),
+ Vector{Return(Call(ty.Of(interface_struct), 0.5_f, 0.25_f, Call<vec4<f32>>()))},
+ Vector{Stage(ast::PipelineStage::kVertex)});
- Func("frag_main", utils::Vector{Param("colors", ty.Of(interface_struct))}, ty.void_(),
- utils::Vector{
+ Func("frag_main", Vector{Param("colors", ty.Of(interface_struct))}, ty.void_(),
+ Vector{
WrapInStatement(Let("r", ty.f32(), MemberAccessor("colors", "col1"))),
WrapInStatement(Let("g", ty.f32(), MemberAccessor("colors", "col2"))),
},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Vector{Stage(ast::PipelineStage::kFragment)});
ASTPrinter& gen = SanitizeAndBuild();
@@ -271,21 +271,21 @@
// }
auto* vertex_output_struct = Structure(
"VertexOutput",
- utils::Vector{
- Member("pos", ty.vec4<f32>(), utils::Vector{Builtin(builtin::BuiltinValue::kPosition)}),
+ Vector{
+ Member("pos", ty.vec4<f32>(), Vector{Builtin(builtin::BuiltinValue::kPosition)}),
});
- Func("foo", utils::Vector{Param("x", ty.f32())}, ty.Of(vertex_output_struct),
- utils::Vector{
+ Func("foo", Vector{Param("x", ty.f32())}, ty.Of(vertex_output_struct),
+ Vector{
Return(Call(ty.Of(vertex_output_struct), Call<vec4<f32>>("x", "x", "x", 1_f))),
});
- Func("vert_main1", utils::Empty, ty.Of(vertex_output_struct),
- utils::Vector{Return(Expr(Call("foo", Expr(0.5_f))))},
- utils::Vector{Stage(ast::PipelineStage::kVertex)});
+ Func("vert_main1", tint::Empty, ty.Of(vertex_output_struct),
+ Vector{Return(Expr(Call("foo", Expr(0.5_f))))},
+ Vector{Stage(ast::PipelineStage::kVertex)});
- Func("vert_main2", utils::Empty, ty.Of(vertex_output_struct),
- utils::Vector{Return(Expr(Call("foo", Expr(0.25_f))))},
- utils::Vector{Stage(ast::PipelineStage::kVertex)});
+ Func("vert_main2", tint::Empty, ty.Of(vertex_output_struct),
+ Vector{Return(Expr(Call("foo", Expr(0.25_f))))},
+ Vector{Stage(ast::PipelineStage::kVertex)});
ASTPrinter& gen = SanitizeAndBuild();
@@ -336,7 +336,7 @@
}
TEST_F(MslASTPrinterTest, Emit_FunctionAttribute_EntryPoint_With_RW_StorageBuffer) {
- auto* s = Structure("Data", utils::Vector{
+ auto* s = Structure("Data", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
});
@@ -346,12 +346,12 @@
auto* var = Var("v", ty.f32(), MemberAccessor("coord", "b"));
- Func("frag_main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("frag_main", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -375,7 +375,7 @@
}
TEST_F(MslASTPrinterTest, Emit_FunctionAttribute_EntryPoint_With_RO_StorageBuffer) {
- auto* s = Structure("Data", utils::Vector{
+ auto* s = Structure("Data", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
});
@@ -385,12 +385,12 @@
auto* var = Var("v", ty.f32(), MemberAccessor("coord", "b"));
- Func("frag_main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("frag_main", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -414,27 +414,27 @@
}
TEST_F(MslASTPrinterTest, Emit_Attribute_Called_By_EntryPoint_With_Uniform) {
- auto* ubo_ty = Structure("UBO", utils::Vector{Member("coord", ty.vec4<f32>())});
+ auto* ubo_ty = Structure("UBO", Vector{Member("coord", ty.vec4<f32>())});
auto* ubo =
GlobalVar("ubo", ty.Of(ubo_ty), builtin::AddressSpace::kUniform, Group(0_a), Binding(0_a));
Func("sub_func",
- utils::Vector{
+ Vector{
Param("param", ty.f32()),
},
ty.f32(),
- utils::Vector{
+ Vector{
Return(MemberAccessor(MemberAccessor(ubo, "coord"), "x")),
});
auto* var = Var("v", ty.f32(), Call("sub_func", 1_f));
- Func("frag_main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("frag_main", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -461,7 +461,7 @@
}
TEST_F(MslASTPrinterTest, Emit_FunctionAttribute_Called_By_EntryPoint_With_RW_StorageBuffer) {
- auto* s = Structure("Data", utils::Vector{
+ auto* s = Structure("Data", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
});
@@ -470,22 +470,22 @@
Group(0_a), Binding(0_a));
Func("sub_func",
- utils::Vector{
+ Vector{
Param("param", ty.f32()),
},
ty.f32(),
- utils::Vector{
+ Vector{
Return(MemberAccessor("coord", "b")),
});
auto* var = Var("v", ty.f32(), Call("sub_func", 1_f));
- Func("frag_main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("frag_main", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -513,7 +513,7 @@
}
TEST_F(MslASTPrinterTest, Emit_FunctionAttribute_Called_By_EntryPoint_With_RO_StorageBuffer) {
- auto* s = Structure("Data", utils::Vector{
+ auto* s = Structure("Data", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
});
@@ -522,22 +522,22 @@
Group(0_a), Binding(0_a));
Func("sub_func",
- utils::Vector{
+ Vector{
Param("param", ty.f32()),
},
ty.f32(),
- utils::Vector{
+ Vector{
Return(MemberAccessor("coord", "b")),
});
auto* var = Var("v", ty.f32(), Call("sub_func", 1_f));
- Func("frag_main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("frag_main", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -566,11 +566,11 @@
TEST_F(MslASTPrinterTest, Emit_Function_WithArrayParams) {
Func("my_func",
- utils::Vector{
+ Vector{
Param("a", ty.array<f32, 5>()),
},
ty.void_(),
- utils::Vector{
+ Vector{
Return(),
});
@@ -603,8 +603,8 @@
}
TEST_F(MslASTPrinterTest, Emit_Function_WithArrayReturn) {
- Func("my_func", utils::Empty, ty.array<f32, 5>(),
- utils::Vector{
+ Func("my_func", tint::Empty, ty.array<f32, 5>(),
+ Vector{
Return(Call(ty.array<f32, 5>())),
});
@@ -654,7 +654,7 @@
// return;
// }
- auto* s = Structure("Data", utils::Vector{Member("d", ty.f32())});
+ auto* s = Structure("Data", Vector{Member("d", ty.f32())});
GlobalVar("data", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
Group(0_a), Binding(0_a));
@@ -662,12 +662,12 @@
{
auto* var = Var("v", ty.f32(), MemberAccessor("data", "d"));
- Func("a", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -676,12 +676,12 @@
{
auto* var = Var("v", ty.f32(), MemberAccessor("data", "d"));
- Func("b", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("b", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
diff --git a/src/tint/lang/msl/writer/ast_printer/ast_printer.cc b/src/tint/lang/msl/writer/ast_printer/ast_printer.cc
index 9342871..b9aa6c1 100644
--- a/src/tint/lang/msl/writer/ast_printer/ast_printer.cc
+++ b/src/tint/lang/msl/writer/ast_printer/ast_printer.cc
@@ -91,13 +91,13 @@
namespace {
bool last_is_break(const ast::BlockStatement* stmts) {
- return utils::IsAnyOf<ast::BreakStatement>(stmts->Last());
+ return tint::IsAnyOf<ast::BreakStatement>(stmts->Last());
}
class ScopedBitCast {
public:
ScopedBitCast(ASTPrinter* generator,
- utils::StringStream& stream,
+ StringStream& stream,
const type::Type* curr_type,
const type::Type* target_type)
: s(stream) {
@@ -118,7 +118,7 @@
~ScopedBitCast() { s << ")"; }
private:
- utils::StringStream& s;
+ StringStream& s;
};
} // namespace
@@ -239,7 +239,7 @@
bool ASTPrinter::Generate() {
if (!tint::writer::CheckSupportedExtensions(
"MSL", builder_.AST(), diagnostics_,
- utils::Vector{
+ Vector{
builtin::Extension::kChromiumDisableUniformityAnalysis,
builtin::Extension::kChromiumExperimentalFullPtrParameters,
builtin::Extension::kChromiumExperimentalPushConstant,
@@ -338,8 +338,7 @@
return true;
}
-bool ASTPrinter::EmitIndexAccessor(utils::StringStream& out,
- const ast::IndexAccessorExpression* expr) {
+bool ASTPrinter::EmitIndexAccessor(StringStream& out, const ast::IndexAccessorExpression* expr) {
bool paren_lhs =
!expr->object
->IsAnyOf<ast::AccessorExpression, ast::CallExpression, ast::IdentifierExpression>();
@@ -364,7 +363,7 @@
return true;
}
-bool ASTPrinter::EmitBitcast(utils::StringStream& out, const ast::BitcastExpression* expr) {
+bool ASTPrinter::EmitBitcast(StringStream& out, const ast::BitcastExpression* expr) {
out << "as_type<";
if (!EmitType(out, TypeOf(expr)->UnwrapRef())) {
return false;
@@ -397,7 +396,7 @@
return true;
}
-bool ASTPrinter::EmitBinary(utils::StringStream& out, const ast::BinaryExpression* expr) {
+bool ASTPrinter::EmitBinary(StringStream& out, const ast::BinaryExpression* expr) {
auto emit_op = [&] {
out << " ";
@@ -606,7 +605,7 @@
return true;
}
-bool ASTPrinter::EmitCall(utils::StringStream& out, const ast::CallExpression* expr) {
+bool ASTPrinter::EmitCall(StringStream& out, const ast::CallExpression* expr) {
auto* call = builder_.Sem().Get<sem::Call>(expr);
auto* target = call->Target();
return Switch(
@@ -620,7 +619,7 @@
});
}
-bool ASTPrinter::EmitFunctionCall(utils::StringStream& out,
+bool ASTPrinter::EmitFunctionCall(StringStream& out,
const sem::Call* call,
const sem::Function* fn) {
out << fn->Declaration()->name->symbol.Name() << "(";
@@ -641,7 +640,7 @@
return true;
}
-bool ASTPrinter::EmitBuiltinCall(utils::StringStream& out,
+bool ASTPrinter::EmitBuiltinCall(StringStream& out,
const sem::Call* call,
const sem::Builtin* builtin) {
auto* expr = call->Declaration();
@@ -755,7 +754,7 @@
return true;
}
-bool ASTPrinter::EmitTypeConversion(utils::StringStream& out,
+bool ASTPrinter::EmitTypeConversion(StringStream& out,
const sem::Call* call,
const sem::ValueConversion* conv) {
if (!EmitType(out, conv->Target())) {
@@ -771,7 +770,7 @@
return true;
}
-bool ASTPrinter::EmitTypeInitializer(utils::StringStream& out,
+bool ASTPrinter::EmitTypeInitializer(StringStream& out,
const sem::Call* call,
const sem::ValueConstructor* ctor) {
auto* type = ctor->ReturnType();
@@ -827,7 +826,7 @@
return true;
}
-bool ASTPrinter::EmitAtomicCall(utils::StringStream& out,
+bool ASTPrinter::EmitAtomicCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin) {
auto call = [&](const std::string& name, bool append_memory_order_relaxed) {
@@ -886,7 +885,7 @@
auto sc = ptr_ty->AddressSpace();
auto* str = builtin->ReturnType()->As<type::Struct>();
- auto func = utils::GetOrCreate(
+ auto func = tint::GetOrCreate(
atomicCompareExchangeWeak_, ACEWKeyType{{sc, str}}, [&]() -> std::string {
if (!EmitStructType(&helpers_, builtin->ReturnType()->As<type::Struct>())) {
return "";
@@ -951,7 +950,7 @@
return false;
}
-bool ASTPrinter::EmitTextureCall(utils::StringStream& out,
+bool ASTPrinter::EmitTextureCall(StringStream& out,
const sem::Call* call,
const sem::Builtin* builtin) {
using Usage = sem::ParameterUsage;
@@ -1200,7 +1199,7 @@
out << "gradientcube(";
break;
default: {
- utils::StringStream err;
+ StringStream err;
err << "MSL does not support gradients for " << dim << " textures";
diagnostics_.add_error(diag::System::Writer, err.str());
return false;
@@ -1263,7 +1262,7 @@
return true;
}
-bool ASTPrinter::EmitDotCall(utils::StringStream& out,
+bool ASTPrinter::EmitDotCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin) {
auto* vec_ty = builtin->Parameters()[0]->Type()->As<type::Vector>();
@@ -1271,7 +1270,7 @@
if (vec_ty->type()->is_integer_scalar()) {
// MSL does not have a builtin for dot() with integer vector types.
// Generate the helper function if it hasn't been created already
- fn = utils::GetOrCreate(int_dot_funcs_, vec_ty->Width(), [&]() -> std::string {
+ fn = tint::GetOrCreate(int_dot_funcs_, vec_ty->Width(), [&]() -> std::string {
TextBuffer b;
TINT_DEFER(helpers_.Append(b));
@@ -1308,7 +1307,7 @@
return true;
}
-bool ASTPrinter::EmitModfCall(utils::StringStream& out,
+bool ASTPrinter::EmitModfCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin) {
return CallBuiltinHelper(
@@ -1334,7 +1333,7 @@
});
}
-bool ASTPrinter::EmitFrexpCall(utils::StringStream& out,
+bool ASTPrinter::EmitFrexpCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin) {
return CallBuiltinHelper(
@@ -1360,7 +1359,7 @@
});
}
-bool ASTPrinter::EmitDegreesCall(utils::StringStream& out,
+bool ASTPrinter::EmitDegreesCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin) {
return CallBuiltinHelper(out, expr, builtin,
@@ -1371,7 +1370,7 @@
});
}
-bool ASTPrinter::EmitRadiansCall(utils::StringStream& out,
+bool ASTPrinter::EmitRadiansCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin) {
return CallBuiltinHelper(out, expr, builtin,
@@ -1583,7 +1582,7 @@
return true;
}
-bool ASTPrinter::EmitZeroValue(utils::StringStream& out, const type::Type* type) {
+bool ASTPrinter::EmitZeroValue(StringStream& out, const type::Type* type) {
return Switch(
type,
[&](const type::Bool*) {
@@ -1631,7 +1630,7 @@
});
}
-bool ASTPrinter::EmitConstant(utils::StringStream& out, const constant::Value* constant) {
+bool ASTPrinter::EmitConstant(StringStream& out, const constant::Value* constant) {
return Switch(
constant->Type(), //
[&](const type::Bool*) {
@@ -1757,7 +1756,7 @@
});
}
-bool ASTPrinter::EmitLiteral(utils::StringStream& out, const ast::LiteralExpression* lit) {
+bool ASTPrinter::EmitLiteral(StringStream& out, const ast::LiteralExpression* lit) {
return Switch(
lit,
[&](const ast::BoolLiteralExpression* l) {
@@ -1793,7 +1792,7 @@
});
}
-bool ASTPrinter::EmitExpression(utils::StringStream& out, const ast::Expression* expr) {
+bool ASTPrinter::EmitExpression(StringStream& out, const ast::Expression* expr) {
if (auto* sem = builder_.Sem().GetVal(expr)) {
if (auto* constant = sem->ConstantValue()) {
return EmitConstant(out, constant);
@@ -1816,7 +1815,7 @@
});
}
-void ASTPrinter::EmitStage(utils::StringStream& out, ast::PipelineStage stage) {
+void ASTPrinter::EmitStage(StringStream& out, ast::PipelineStage stage) {
switch (stage) {
case ast::PipelineStage::kFragment:
out << "fragment";
@@ -2021,7 +2020,7 @@
return true;
}
-bool ASTPrinter::EmitIdentifier(utils::StringStream& out, const ast::IdentifierExpression* expr) {
+bool ASTPrinter::EmitIdentifier(StringStream& out, const ast::IdentifierExpression* expr) {
out << expr->identifier->symbol.Name();
return true;
}
@@ -2062,7 +2061,7 @@
}
TextBuffer cond_pre;
- utils::StringStream cond_buf;
+ StringStream cond_buf;
if (auto* cond = stmt->condition) {
TINT_SCOPED_ASSIGNMENT(current_buffer_, &cond_pre);
if (!EmitExpression(cond_buf, cond)) {
@@ -2143,7 +2142,7 @@
out << cond_buf.str() << "; ";
if (!cont_buf.lines.empty()) {
- out << utils::TrimSuffix(cont_buf.lines[0].content, ";");
+ out << tint::TrimSuffix(cont_buf.lines[0].content, ";");
}
}
out << " {";
@@ -2163,7 +2162,7 @@
bool ASTPrinter::EmitWhile(const ast::WhileStatement* stmt) {
TextBuffer cond_pre;
- utils::StringStream cond_buf;
+ StringStream cond_buf;
{
auto* cond = stmt->condition;
@@ -2239,7 +2238,7 @@
return false;
}
} else {
- if (!EmitStatementsWithIndent(utils::Vector{stmt->else_statement})) {
+ if (!EmitStatementsWithIndent(Vector{stmt->else_statement})) {
return false;
}
}
@@ -2249,8 +2248,7 @@
return true;
}
-bool ASTPrinter::EmitMemberAccessor(utils::StringStream& out,
- const ast::MemberAccessorExpression* expr) {
+bool ASTPrinter::EmitMemberAccessor(StringStream& out, const ast::MemberAccessorExpression* expr) {
auto write_lhs = [&] {
bool paren_lhs = !expr->object->IsAnyOf<ast::AccessorExpression, ast::CallExpression,
ast::IdentifierExpression>();
@@ -2398,7 +2396,7 @@
});
}
-bool ASTPrinter::EmitStatements(utils::VectorRef<const ast::Statement*> stmts) {
+bool ASTPrinter::EmitStatements(VectorRef<const ast::Statement*> stmts) {
for (auto* s : stmts) {
if (!EmitStatement(s)) {
return false;
@@ -2407,7 +2405,7 @@
return true;
}
-bool ASTPrinter::EmitStatementsWithIndent(utils::VectorRef<const ast::Statement*> stmts) {
+bool ASTPrinter::EmitStatementsWithIndent(VectorRef<const ast::Statement*> stmts) {
ScopedIndent si(this);
return EmitStatements(stmts);
}
@@ -2436,7 +2434,7 @@
return true;
}
-bool ASTPrinter::EmitType(utils::StringStream& out, const type::Type* type) {
+bool ASTPrinter::EmitType(StringStream& out, const type::Type* type) {
return Switch(
type,
[&](const type::Atomic* atomic) {
@@ -2633,7 +2631,7 @@
});
}
-bool ASTPrinter::EmitTypeAndName(utils::StringStream& out,
+bool ASTPrinter::EmitTypeAndName(StringStream& out,
const type::Type* type,
const std::string& name) {
if (!EmitType(out, type)) {
@@ -2643,7 +2641,7 @@
return true;
}
-bool ASTPrinter::EmitAddressSpace(utils::StringStream& out, builtin::AddressSpace sc) {
+bool ASTPrinter::EmitAddressSpace(StringStream& out, builtin::AddressSpace sc) {
switch (sc) {
case builtin::AddressSpace::kFunction:
case builtin::AddressSpace::kPrivate:
@@ -2677,7 +2675,7 @@
bool is_host_shareable = str->IsHostShareable();
// Emits a `/* 0xnnnn */` byte offset comment for a struct member.
- auto add_byte_offset_comment = [&](utils::StringStream& out, uint32_t offset) {
+ auto add_byte_offset_comment = [&](StringStream& out, uint32_t offset) {
std::ios_base::fmtflags saved_flag_state(out.flags());
out << "/* 0x" << std::hex << std::setfill('0') << std::setw(4) << offset << " */ ";
out.flags(saved_flag_state);
@@ -2803,12 +2801,12 @@
return true;
}
-bool ASTPrinter::EmitUnaryOp(utils::StringStream& out, const ast::UnaryOpExpression* expr) {
+bool ASTPrinter::EmitUnaryOp(StringStream& out, const ast::UnaryOpExpression* expr) {
// Handle `-e` when `e` is signed, so that we ensure that if `e` is the
// largest negative value, it returns `e`.
auto* expr_type = TypeOf(expr->expr)->UnwrapRef();
if (expr->op == ast::UnaryOp::kNegation && expr_type->is_signed_integer_scalar_or_vector()) {
- auto fn = utils::GetOrCreate(unary_minus_funcs_, expr_type, [&]() -> std::string {
+ auto fn = tint::GetOrCreate(unary_minus_funcs_, expr_type, [&]() -> std::string {
// e.g.:
// int tint_unary_minus(const int v) {
// return (v == -2147483648) ? v : -v;
@@ -2957,12 +2955,12 @@
}
template <typename F>
-bool ASTPrinter::CallBuiltinHelper(utils::StringStream& out,
+bool ASTPrinter::CallBuiltinHelper(StringStream& out,
const ast::CallExpression* call,
const sem::Builtin* builtin,
F&& build) {
// Generate the helper function if it hasn't been created already
- auto fn = utils::GetOrCreate(builtins_, builtin, [&]() -> std::string {
+ auto fn = tint::GetOrCreate(builtins_, builtin, [&]() -> std::string {
TextBuffer b;
TINT_DEFER(helpers_.Append(b));
diff --git a/src/tint/lang/msl/writer/ast_printer/ast_printer.h b/src/tint/lang/msl/writer/ast_printer/ast_printer.h
index 068bb74..522771e 100644
--- a/src/tint/lang/msl/writer/ast_printer/ast_printer.h
+++ b/src/tint/lang/msl/writer/ast_printer/ast_printer.h
@@ -81,7 +81,7 @@
SanitizedResult Sanitize(const Program* program, const Options& options);
/// Implementation class for MSL generator
-class ASTPrinter : public utils::TextGenerator {
+class ASTPrinter : public tint::TextGenerator {
public:
/// Constructor
/// @param program the program to generate
@@ -108,7 +108,7 @@
/// @param out the output of the expression stream
/// @param expr the expression to emit
/// @returns true if the index accessor was emitted
- bool EmitIndexAccessor(utils::StringStream& out, const ast::IndexAccessorExpression* expr);
+ bool EmitIndexAccessor(StringStream& out, const ast::IndexAccessorExpression* expr);
/// Handles an assignment statement
/// @param stmt the statement to emit
/// @returns true if the statement was emitted successfully
@@ -117,12 +117,12 @@
/// @param out the output of the expression stream
/// @param expr the binary expression
/// @returns true if the expression was emitted, false otherwise
- bool EmitBinary(utils::StringStream& out, const ast::BinaryExpression* expr);
+ bool EmitBinary(StringStream& out, const ast::BinaryExpression* expr);
/// Handles generating a bitcast expression
/// @param out the output of the expression stream
/// @param expr the bitcast expression
/// @returns true if the bitcast was emitted
- bool EmitBitcast(utils::StringStream& out, const ast::BitcastExpression* expr);
+ bool EmitBitcast(StringStream& out, const ast::BitcastExpression* expr);
/// Handles a block statement
/// @param stmt the statement to emit
/// @returns true if the statement was emitted successfully
@@ -139,21 +139,19 @@
/// @param out the output of the expression stream
/// @param expr the call expression
/// @returns true if the call expression is emitted
- bool EmitCall(utils::StringStream& out, const ast::CallExpression* expr);
+ bool EmitCall(StringStream& out, const ast::CallExpression* expr);
/// Handles generating a builtin call expression
/// @param out the output of the expression stream
/// @param call the call expression
/// @param builtin the builtin being called
/// @returns true if the call expression is emitted
- bool EmitBuiltinCall(utils::StringStream& out,
- const sem::Call* call,
- const sem::Builtin* builtin);
+ bool EmitBuiltinCall(StringStream& out, const sem::Call* call, const sem::Builtin* builtin);
/// Handles generating a value conversion expression
/// @param out the output of the expression stream
/// @param call the call expression
/// @param conv the value conversion
/// @returns true if the expression is emitted
- bool EmitTypeConversion(utils::StringStream& out,
+ bool EmitTypeConversion(StringStream& out,
const sem::Call* call,
const sem::ValueConversion* conv);
/// Handles generating a value constructor
@@ -161,7 +159,7 @@
/// @param call the call expression
/// @param ctor the value constructor
/// @returns true if the initializer is emitted
- bool EmitTypeInitializer(utils::StringStream& out,
+ bool EmitTypeInitializer(StringStream& out,
const sem::Call* call,
const sem::ValueConstructor* ctor);
/// Handles generating a function call
@@ -169,16 +167,14 @@
/// @param call the call expression
/// @param func the target function
/// @returns true if the call is emitted
- bool EmitFunctionCall(utils::StringStream& out,
- const sem::Call* call,
- const sem::Function* func);
+ bool EmitFunctionCall(StringStream& out, const sem::Call* call, const sem::Function* func);
/// Handles generating a call to an atomic function (`atomicAdd`,
/// `atomicMax`, etc)
/// @param out the output of the expression stream
/// @param expr the call expression
/// @param builtin the semantic information for the atomic builtin
/// @returns true if the call expression is emitted
- bool EmitAtomicCall(utils::StringStream& out,
+ bool EmitAtomicCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin);
/// Handles generating a call to a texture function (`textureSample`,
@@ -187,15 +183,13 @@
/// @param call the call expression
/// @param builtin the semantic information for the texture builtin
/// @returns true if the call expression is emitted
- bool EmitTextureCall(utils::StringStream& out,
- const sem::Call* call,
- const sem::Builtin* builtin);
+ bool EmitTextureCall(StringStream& out, const sem::Call* call, const sem::Builtin* builtin);
/// Handles generating a call to the `dot()` builtin
/// @param out the output of the expression stream
/// @param expr the call expression
/// @param builtin the semantic information for the builtin
/// @returns true if the call expression is emitted
- bool EmitDotCall(utils::StringStream& out,
+ bool EmitDotCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin);
/// Handles generating a call to the `modf()` builtin
@@ -203,7 +197,7 @@
/// @param expr the call expression
/// @param builtin the semantic information for the builtin
/// @returns true if the call expression is emitted
- bool EmitModfCall(utils::StringStream& out,
+ bool EmitModfCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin);
/// Handles generating a call to the `frexp()` builtin
@@ -211,7 +205,7 @@
/// @param expr the call expression
/// @param builtin the semantic information for the builtin
/// @returns true if the call expression is emitted
- bool EmitFrexpCall(utils::StringStream& out,
+ bool EmitFrexpCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin);
/// Handles generating a call to the `degrees()` builtin
@@ -219,7 +213,7 @@
/// @param expr the call expression
/// @param builtin the semantic information for the builtin
/// @returns true if the call expression is emitted
- bool EmitDegreesCall(utils::StringStream& out,
+ bool EmitDegreesCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin);
/// Handles generating a call to the `radians()` builtin
@@ -227,7 +221,7 @@
/// @param expr the call expression
/// @param builtin the semantic information for the builtin
/// @returns true if the call expression is emitted
- bool EmitRadiansCall(utils::StringStream& out,
+ bool EmitRadiansCall(StringStream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin);
/// Handles a case statement
@@ -250,7 +244,7 @@
/// @param out the output of the expression stream
/// @param expr the expression
/// @returns true if the expression was emitted
- bool EmitExpression(utils::StringStream& out, const ast::Expression* expr);
+ bool EmitExpression(StringStream& out, const ast::Expression* expr);
/// Handles generating a function
/// @param func the function to generate
/// @returns true if the function was emitted
@@ -259,7 +253,7 @@
/// @param out the output of the expression stream
/// @param expr the identifier expression
/// @returns true if the identifier was emitted
- bool EmitIdentifier(utils::StringStream& out, const ast::IdentifierExpression* expr);
+ bool EmitIdentifier(StringStream& out, const ast::IdentifierExpression* expr);
/// Handles an if statement
/// @param stmt the statement to emit
/// @returns true if the statement was successfully emitted
@@ -268,12 +262,12 @@
/// @param out the output stream
/// @param constant the constant value to emit
/// @returns true if the constant value was successfully emitted
- bool EmitConstant(utils::StringStream& out, const constant::Value* constant);
+ bool EmitConstant(StringStream& out, const constant::Value* constant);
/// Handles a literal
/// @param out the output of the expression stream
/// @param lit the literal to emit
/// @returns true if the literal was successfully emitted
- bool EmitLiteral(utils::StringStream& out, const ast::LiteralExpression* lit);
+ bool EmitLiteral(StringStream& out, const ast::LiteralExpression* lit);
/// Handles a loop statement
/// @param stmt the statement to emit
/// @returns true if the statement was emitted
@@ -290,7 +284,7 @@
/// @param out the output of the expression stream
/// @param expr the member accessor expression
/// @returns true if the member accessor was emitted
- bool EmitMemberAccessor(utils::StringStream& out, const ast::MemberAccessorExpression* expr);
+ bool EmitMemberAccessor(StringStream& out, const ast::MemberAccessorExpression* expr);
/// Handles return statements
/// @param stmt the statement to emit
/// @returns true if the statement was successfully emitted
@@ -298,7 +292,7 @@
/// Handles emitting a pipeline stage name
/// @param out the output of the expression stream
/// @param stage the stage to emit
- void EmitStage(utils::StringStream& out, ast::PipelineStage stage);
+ void EmitStage(StringStream& out, ast::PipelineStage stage);
/// Handles statement
/// @param stmt the statement to emit
/// @returns true if the statement was emitted
@@ -306,11 +300,11 @@
/// Emits a list of statements
/// @param stmts the statement list
/// @returns true if the statements were emitted successfully
- bool EmitStatements(utils::VectorRef<const ast::Statement*> stmts);
+ bool EmitStatements(VectorRef<const ast::Statement*> stmts);
/// Emits a list of statements with an indentation
/// @param stmts the statement list
/// @returns true if the statements were emitted successfully
- bool EmitStatementsWithIndent(utils::VectorRef<const ast::Statement*> stmts);
+ bool EmitStatementsWithIndent(VectorRef<const ast::Statement*> stmts);
/// Handles generating a switch statement
/// @param stmt the statement to emit
/// @returns true if the statement was emitted
@@ -319,18 +313,18 @@
/// @param out the output of the type stream
/// @param type the type to generate
/// @returns true if the type is emitted
- bool EmitType(utils::StringStream& out, const type::Type* type);
+ bool EmitType(StringStream& out, const type::Type* type);
/// Handles generating type and name
/// @param out the output stream
/// @param type the type to generate
/// @param name the name to emit
/// @returns true if the type is emitted
- bool EmitTypeAndName(utils::StringStream& out, const type::Type* type, const std::string& name);
+ bool EmitTypeAndName(StringStream& out, const type::Type* type, const std::string& name);
/// Handles generating a address space
/// @param out the output of the type stream
/// @param sc the address space to generate
/// @returns true if the address space is emitted
- bool EmitAddressSpace(utils::StringStream& out, builtin::AddressSpace sc);
+ bool EmitAddressSpace(StringStream& out, builtin::AddressSpace sc);
/// Handles generating a struct declaration. If the structure has already been emitted, then
/// this function will simply return `true` without emitting anything.
/// @param buffer the text buffer that the type declaration will be written to
@@ -341,7 +335,7 @@
/// @param out the output of the expression stream
/// @param expr the expression to emit
/// @returns true if the expression was emitted
- bool EmitUnaryOp(utils::StringStream& out, const ast::UnaryOpExpression* expr);
+ bool EmitUnaryOp(StringStream& out, const ast::UnaryOpExpression* expr);
/// Handles generating a 'var' declaration
/// @param var the variable to generate
/// @returns true if the variable was emitted
@@ -354,7 +348,7 @@
/// @param out the output of the expression stream
/// @param type the type to emit the value for
/// @returns true if the zero value was successfully emitted.
- bool EmitZeroValue(utils::StringStream& out, const type::Type* type);
+ bool EmitZeroValue(StringStream& out, const type::Type* type);
/// Handles generating a builtin name
/// @param builtin the semantic info for the builtin
@@ -376,7 +370,7 @@
/// `params` is the name of all the generated function parameters
/// @returns true if the call expression is emitted
template <typename F>
- bool CallBuiltinHelper(utils::StringStream& out,
+ bool CallBuiltinHelper(StringStream& out,
const ast::CallExpression* call,
const sem::Builtin* builtin,
F&& build);
@@ -385,7 +379,7 @@
/// first call.
const std::string& ArrayType();
- /// @copydoc utils::TextWrtiter::UniqueIdentifier
+ /// @copydoc tint::TextWrtiter::UniqueIdentifier
std::string UniqueIdentifier(const std::string& prefix = "") override;
/// Alias for builder_.TypeOf(ptr)
@@ -403,7 +397,7 @@
/// Name of atomicCompareExchangeWeak() helper for the given pointer storage
/// class and struct return type
using ACEWKeyType =
- utils::UnorderedKeyWrapper<std::tuple<builtin::AddressSpace, const type::Struct*>>;
+ tint::UnorderedKeyWrapper<std::tuple<builtin::AddressSpace, const type::Struct*>>;
std::unordered_map<ACEWKeyType, std::string> atomicCompareExchangeWeak_;
/// Unique name of the 'TINT_INVARIANT' preprocessor define.
diff --git a/src/tint/lang/msl/writer/ast_printer/ast_printer_test.cc b/src/tint/lang/msl/writer/ast_printer/ast_printer_test.cc
index 7ecbab0..0e6326e 100644
--- a/src/tint/lang/msl/writer/ast_printer/ast_printer_test.cc
+++ b/src/tint/lang/msl/writer/ast_printer/ast_printer_test.cc
@@ -43,8 +43,8 @@
}
TEST_F(MslASTPrinterTest, Generate) {
- Func("my_func", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("my_func", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -63,15 +63,15 @@
}
TEST_F(MslASTPrinterTest, HasInvariantAttribute_True) {
- auto* out = Structure("Out", utils::Vector{
+ auto* out = Structure("Out", Vector{
Member("pos", ty.vec4<f32>(),
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kPosition),
Invariant(),
}),
});
- Func("vert_main", utils::Empty, ty.Of(out), utils::Vector{Return(Call(ty.Of(out)))},
- utils::Vector{
+ Func("vert_main", tint::Empty, ty.Of(out), Vector{Return(Call(ty.Of(out)))},
+ Vector{
Stage(ast::PipelineStage::kVertex),
});
@@ -101,14 +101,14 @@
}
TEST_F(MslASTPrinterTest, HasInvariantAttribute_False) {
- auto* out = Structure("Out", utils::Vector{
+ auto* out = Structure("Out", Vector{
Member("pos", ty.vec4<f32>(),
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kPosition),
}),
});
- Func("vert_main", utils::Empty, ty.Of(out), utils::Vector{Return(Call(ty.Of(out)))},
- utils::Vector{
+ Func("vert_main", tint::Empty, ty.Of(out), Vector{Return(Call(ty.Of(out)))},
+ Vector{
Stage(ast::PipelineStage::kVertex),
});
@@ -132,8 +132,8 @@
TEST_F(MslASTPrinterTest, WorkgroupMatrix) {
GlobalVar("m", ty.mat2x2<f32>(), builtin::AddressSpace::kWorkgroup);
- Func("comp_main", utils::Empty, ty.void_(), utils::Vector{Decl(Let("x", Expr("m")))},
- utils::Vector{
+ Func("comp_main", tint::Empty, ty.void_(), Vector{Decl(Let("x", Expr("m")))},
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -172,8 +172,8 @@
TEST_F(MslASTPrinterTest, WorkgroupMatrixInArray) {
GlobalVar("m", ty.array(ty.mat2x2<f32>(), 4_i), builtin::AddressSpace::kWorkgroup);
- Func("comp_main", utils::Empty, ty.void_(), utils::Vector{Decl(Let("x", Expr("m")))},
- utils::Vector{
+ Func("comp_main", tint::Empty, ty.void_(), Vector{Decl(Let("x", Expr("m")))},
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -225,16 +225,16 @@
}
TEST_F(MslASTPrinterTest, WorkgroupMatrixInStruct) {
- Structure("S1", utils::Vector{
+ Structure("S1", Vector{
Member("m1", ty.mat2x2<f32>()),
Member("m2", ty.mat4x4<f32>()),
});
- Structure("S2", utils::Vector{
+ Structure("S2", Vector{
Member("s", ty("S1")),
});
GlobalVar("s", ty("S2"), builtin::AddressSpace::kWorkgroup);
- Func("comp_main", utils::Empty, ty.void_(), utils::Vector{Decl(Let("x", Expr("s")))},
- utils::Vector{
+ Func("comp_main", tint::Empty, ty.void_(), Vector{Decl(Let("x", Expr("s")))},
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -291,38 +291,38 @@
GlobalVar("m7", ty.mat4x2<f32>(), builtin::AddressSpace::kWorkgroup);
GlobalVar("m8", ty.mat4x3<f32>(), builtin::AddressSpace::kWorkgroup);
GlobalVar("m9", ty.mat4x4<f32>(), builtin::AddressSpace::kWorkgroup);
- Func("main1", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main1", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("a1", Expr("m1"))),
Decl(Let("a2", Expr("m2"))),
Decl(Let("a3", Expr("m3"))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
- Func("main2", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main2", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("a1", Expr("m4"))),
Decl(Let("a2", Expr("m5"))),
Decl(Let("a3", Expr("m6"))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
- Func("main3", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main3", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("a1", Expr("m7"))),
Decl(Let("a2", Expr("m8"))),
Decl(Let("a3", Expr("m9"))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
- Func("main4_no_usages", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main4_no_usages", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
diff --git a/src/tint/lang/msl/writer/ast_printer/ast_type_test.cc b/src/tint/lang/msl/writer/ast_printer/ast_type_test.cc
index bcc9419..ce9d642 100644
--- a/src/tint/lang/msl/writer/ast_printer/ast_type_test.cc
+++ b/src/tint/lang/msl/writer/ast_printer/ast_type_test.cc
@@ -33,7 +33,7 @@
using namespace tint::builtin::fluent_types; // NOLINT
using namespace tint::number_suffixes; // NOLINT
-void FormatMSLField(utils::StringStream& out,
+void FormatMSLField(StringStream& out,
const char* addr,
const char* type,
size_t array_count,
@@ -95,7 +95,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, program->TypeOf(type))) << gen.Diagnostics();
EXPECT_EQ(out.str(), "tint_array<bool, 4>");
}
@@ -107,7 +107,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, program->TypeOf(type))) << gen.Diagnostics();
EXPECT_EQ(out.str(), "tint_array<tint_array<bool, 4>, 5>");
}
@@ -120,7 +120,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, program->TypeOf(type))) << gen.Diagnostics();
EXPECT_EQ(out.str(), "tint_array<tint_array<tint_array<bool, 4>, 5>, 6>");
}
@@ -131,7 +131,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, program->TypeOf(type))) << gen.Diagnostics();
EXPECT_EQ(out.str(), "tint_array<bool, 4>");
}
@@ -142,7 +142,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, program->TypeOf(type))) << gen.Diagnostics();
EXPECT_EQ(out.str(), "tint_array<bool, 1>");
}
@@ -152,7 +152,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, bool_)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "bool");
}
@@ -162,7 +162,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, f32)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "float");
}
@@ -172,7 +172,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, f16)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "half");
}
@@ -182,7 +182,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, i32)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "int");
}
@@ -194,7 +194,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, mat2x3)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "float2x3");
}
@@ -206,7 +206,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, mat2x3)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "half2x3");
}
@@ -218,33 +218,33 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, p)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "threadgroup float*");
}
TEST_F(MslASTPrinterTest, EmitType_Struct) {
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
});
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, program->TypeOf(s))) << gen.Diagnostics();
EXPECT_EQ(out.str(), "S");
}
TEST_F(MslASTPrinterTest, EmitType_StructDecl) {
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
});
ASTPrinter& gen = Build();
- utils::TextGenerator::TextBuffer buf;
+ tint::TextGenerator::TextBuffer buf;
auto* str = program->TypeOf(s)->As<type::Struct>();
ASSERT_TRUE(gen.EmitStructType(&buf, str)) << gen.Diagnostics();
EXPECT_EQ(buf.String(), R"(struct S {
@@ -255,35 +255,35 @@
}
TEST_F(MslASTPrinterTest, EmitType_Struct_Layout_NonComposites) {
- auto* s = Structure(
- "S", utils::Vector{
- Member("a", ty.i32(), utils::Vector{MemberSize(32_a)}),
- Member("b", ty.f32(), utils::Vector{MemberAlign(128_i), MemberSize(128_a)}),
- Member("c", ty.vec2<f32>()),
- Member("d", ty.u32()),
- Member("e", ty.vec3<f32>()),
- Member("f", ty.u32()),
- Member("g", ty.vec4<f32>()),
- Member("h", ty.u32()),
- Member("i", ty.mat2x2<f32>()),
- Member("j", ty.u32()),
- Member("k", ty.mat2x3<f32>()),
- Member("l", ty.u32()),
- Member("m", ty.mat2x4<f32>()),
- Member("n", ty.u32()),
- Member("o", ty.mat3x2<f32>()),
- Member("p", ty.u32()),
- Member("q", ty.mat3x3<f32>()),
- Member("r", ty.u32()),
- Member("s", ty.mat3x4<f32>()),
- Member("t", ty.u32()),
- Member("u", ty.mat4x2<f32>()),
- Member("v", ty.u32()),
- Member("w", ty.mat4x3<f32>()),
- Member("x", ty.u32()),
- Member("y", ty.mat4x4<f32>()),
- Member("z", ty.f32()),
- });
+ auto* s =
+ Structure("S", Vector{
+ Member("a", ty.i32(), Vector{MemberSize(32_a)}),
+ Member("b", ty.f32(), Vector{MemberAlign(128_i), MemberSize(128_a)}),
+ Member("c", ty.vec2<f32>()),
+ Member("d", ty.u32()),
+ Member("e", ty.vec3<f32>()),
+ Member("f", ty.u32()),
+ Member("g", ty.vec4<f32>()),
+ Member("h", ty.u32()),
+ Member("i", ty.mat2x2<f32>()),
+ Member("j", ty.u32()),
+ Member("k", ty.mat2x3<f32>()),
+ Member("l", ty.u32()),
+ Member("m", ty.mat2x4<f32>()),
+ Member("n", ty.u32()),
+ Member("o", ty.mat3x2<f32>()),
+ Member("p", ty.u32()),
+ Member("q", ty.mat3x3<f32>()),
+ Member("r", ty.u32()),
+ Member("s", ty.mat3x4<f32>()),
+ Member("t", ty.u32()),
+ Member("u", ty.mat4x2<f32>()),
+ Member("v", ty.u32()),
+ Member("w", ty.mat4x3<f32>()),
+ Member("x", ty.u32()),
+ Member("y", ty.mat4x4<f32>()),
+ Member("z", ty.f32()),
+ });
ast::Type type = GlobalVar("G", ty.Of(s), builtin::AddressSpace::kStorage,
builtin::Access::kRead, Binding(0_a), Group(0_a))
@@ -291,7 +291,7 @@
ASTPrinter& gen = Build();
- utils::TextGenerator::TextBuffer buf;
+ tint::TextGenerator::TextBuffer buf;
auto* str = program->TypeOf(type)->As<type::Struct>();
ASSERT_TRUE(gen.EmitStructType(&buf, str)) << gen.Diagnostics();
@@ -339,7 +339,7 @@
FIELD(0x0304, int8_t, 124, tint_pad_12)
// Check that the generated string is as expected.
- utils::StringStream expect;
+ StringStream expect;
expect << "struct S {\n";
#define FIELD(ADDR, TYPE, ARRAY_COUNT, NAME) \
FormatMSLField(expect, #ADDR, #TYPE, ARRAY_COUNT, #NAME);
@@ -373,20 +373,18 @@
TEST_F(MslASTPrinterTest, EmitType_Struct_Layout_Structures) {
// inner_x: size(1024), align(512)
- auto* inner_x =
- Structure("inner_x", utils::Vector{
- Member("a", ty.i32()),
- Member("b", ty.f32(), utils::Vector{MemberAlign(512_i)}),
- });
+ auto* inner_x = Structure("inner_x", Vector{
+ Member("a", ty.i32()),
+ Member("b", ty.f32(), Vector{MemberAlign(512_i)}),
+ });
// inner_y: size(516), align(4)
- auto* inner_y =
- Structure("inner_y", utils::Vector{
- Member("a", ty.i32(), utils::Vector{MemberSize(512_a)}),
- Member("b", ty.f32()),
- });
+ auto* inner_y = Structure("inner_y", Vector{
+ Member("a", ty.i32(), Vector{MemberSize(512_a)}),
+ Member("b", ty.f32()),
+ });
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("a", ty.i32()),
Member("b", ty.Of(inner_x)),
Member("c", ty.f32()),
@@ -400,7 +398,7 @@
ASTPrinter& gen = Build();
- utils::TextGenerator::TextBuffer buf;
+ tint::TextGenerator::TextBuffer buf;
auto* str = program->TypeOf(type)->As<type::Struct>();
ASSERT_TRUE(gen.EmitStructType(&buf, str)) << gen.Diagnostics();
@@ -416,7 +414,7 @@
FIELD(0x080c, int8_t, 500, tint_pad_1)
// Check that the generated string is as expected.
- utils::StringStream expect;
+ StringStream expect;
expect << "struct S {\n";
#define FIELD(ADDR, TYPE, ARRAY_COUNT, NAME) \
FormatMSLField(expect, #ADDR, #TYPE, ARRAY_COUNT, #NAME);
@@ -463,9 +461,9 @@
TEST_F(MslASTPrinterTest, EmitType_Struct_Layout_ArrayDefaultStride) {
// inner: size(1024), align(512)
- auto* inner = Structure("inner", utils::Vector{
+ auto* inner = Structure("inner", Vector{
Member("a", ty.i32()),
- Member("b", ty.f32(), utils::Vector{MemberAlign(512_i)}),
+ Member("b", ty.f32(), Vector{MemberAlign(512_i)}),
});
// array_x: size(28), align(4)
@@ -477,7 +475,7 @@
// array_z: size(4), align(4)
auto array_z = ty.array<f32>();
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("a", ty.i32()),
Member("b", array_x),
Member("c", ty.f32()),
@@ -492,7 +490,7 @@
ASTPrinter& gen = Build();
- utils::TextGenerator::TextBuffer buf;
+ tint::TextGenerator::TextBuffer buf;
auto* str = program->TypeOf(type)->As<type::Struct>();
ASSERT_TRUE(gen.EmitStructType(&buf, str)) << gen.Diagnostics();
@@ -509,7 +507,7 @@
FIELD(0x1208, int8_t, 504, tint_pad_1)
// Check that the generated string is as expected.
- utils::StringStream expect;
+ StringStream expect;
expect << "struct S {\n";
#define FIELD(ADDR, TYPE, ARRAY_COUNT, NAME) \
FormatMSLField(expect, #ADDR, #TYPE, ARRAY_COUNT, #NAME);
@@ -564,7 +562,7 @@
// array: size(64), align(16)
auto array = ty.array<vec3<f32>, 4>();
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("a", ty.i32()),
Member("b", array),
Member("c", ty.i32()),
@@ -576,7 +574,7 @@
ASTPrinter& gen = Build();
- utils::TextGenerator::TextBuffer buf;
+ tint::TextGenerator::TextBuffer buf;
auto* str = program->TypeOf(type)->As<type::Struct>();
ASSERT_TRUE(gen.EmitStructType(&buf, str)) << gen.Diagnostics();
@@ -590,7 +588,7 @@
FIELD(0x0054, int8_t, 12, tint_pad_1)
// Check that the generated string is as expected.
- utils::StringStream expect;
+ StringStream expect;
expect << "struct S {\n";
#define FIELD(ADDR, TYPE, ARRAY_COUNT, NAME) \
FormatMSLField(expect, #ADDR, #TYPE, ARRAY_COUNT, #NAME);
@@ -601,36 +599,36 @@
}
TEST_F(MslASTPrinterTest, AttemptTintPadSymbolCollision) {
- auto* s = Structure("S", utils::Vector{
- // uses symbols tint_pad_[0..9] and tint_pad_[20..35]
- Member("tint_pad_2", ty.i32(), utils::Vector{MemberSize(32_a)}),
- Member("tint_pad_20", ty.f32(),
- utils::Vector{MemberAlign(128_i), MemberSize(128_u)}),
- Member("tint_pad_33", ty.vec2<f32>()),
- Member("tint_pad_1", ty.u32()),
- Member("tint_pad_3", ty.vec3<f32>()),
- Member("tint_pad_7", ty.u32()),
- Member("tint_pad_25", ty.vec4<f32>()),
- Member("tint_pad_5", ty.u32()),
- Member("tint_pad_27", ty.mat2x2<f32>()),
- Member("tint_pad_24", ty.u32()),
- Member("tint_pad_23", ty.mat2x3<f32>()),
- Member("tint_pad", ty.u32()),
- Member("tint_pad_8", ty.mat2x4<f32>()),
- Member("tint_pad_26", ty.u32()),
- Member("tint_pad_29", ty.mat3x2<f32>()),
- Member("tint_pad_6", ty.u32()),
- Member("tint_pad_22", ty.mat3x3<f32>()),
- Member("tint_pad_32", ty.u32()),
- Member("tint_pad_34", ty.mat3x4<f32>()),
- Member("tint_pad_35", ty.u32()),
- Member("tint_pad_30", ty.mat4x2<f32>()),
- Member("tint_pad_9", ty.u32()),
- Member("tint_pad_31", ty.mat4x3<f32>()),
- Member("tint_pad_28", ty.u32()),
- Member("tint_pad_4", ty.mat4x4<f32>()),
- Member("tint_pad_21", ty.f32()),
- });
+ auto* s = Structure(
+ "S", Vector{
+ // uses symbols tint_pad_[0..9] and tint_pad_[20..35]
+ Member("tint_pad_2", ty.i32(), Vector{MemberSize(32_a)}),
+ Member("tint_pad_20", ty.f32(), Vector{MemberAlign(128_i), MemberSize(128_u)}),
+ Member("tint_pad_33", ty.vec2<f32>()),
+ Member("tint_pad_1", ty.u32()),
+ Member("tint_pad_3", ty.vec3<f32>()),
+ Member("tint_pad_7", ty.u32()),
+ Member("tint_pad_25", ty.vec4<f32>()),
+ Member("tint_pad_5", ty.u32()),
+ Member("tint_pad_27", ty.mat2x2<f32>()),
+ Member("tint_pad_24", ty.u32()),
+ Member("tint_pad_23", ty.mat2x3<f32>()),
+ Member("tint_pad", ty.u32()),
+ Member("tint_pad_8", ty.mat2x4<f32>()),
+ Member("tint_pad_26", ty.u32()),
+ Member("tint_pad_29", ty.mat3x2<f32>()),
+ Member("tint_pad_6", ty.u32()),
+ Member("tint_pad_22", ty.mat3x3<f32>()),
+ Member("tint_pad_32", ty.u32()),
+ Member("tint_pad_34", ty.mat3x4<f32>()),
+ Member("tint_pad_35", ty.u32()),
+ Member("tint_pad_30", ty.mat4x2<f32>()),
+ Member("tint_pad_9", ty.u32()),
+ Member("tint_pad_31", ty.mat4x3<f32>()),
+ Member("tint_pad_28", ty.u32()),
+ Member("tint_pad_4", ty.mat4x4<f32>()),
+ Member("tint_pad_21", ty.f32()),
+ });
ast::Type type = GlobalVar("G", ty.Of(s), builtin::AddressSpace::kStorage,
builtin::Access::kRead, Binding(0_a), Group(0_a))
@@ -638,7 +636,7 @@
ASTPrinter& gen = Build();
- utils::TextGenerator::TextBuffer buf;
+ tint::TextGenerator::TextBuffer buf;
auto* str = program->TypeOf(type)->As<type::Struct>();
ASSERT_TRUE(gen.EmitStructType(&buf, str)) << gen.Diagnostics();
EXPECT_EQ(buf.String(), R"(struct S {
@@ -686,7 +684,7 @@
}
TEST_F(MslASTPrinterTest, EmitType_Struct_WithAttribute) {
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
});
@@ -697,7 +695,7 @@
ASTPrinter& gen = Build();
- utils::TextGenerator::TextBuffer buf;
+ tint::TextGenerator::TextBuffer buf;
auto* str = program->TypeOf(type)->As<type::Struct>();
ASSERT_TRUE(gen.EmitStructType(&buf, str)) << gen.Diagnostics();
EXPECT_EQ(buf.String(), R"(struct S {
@@ -712,7 +710,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, u32)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "uint");
}
@@ -723,7 +721,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, vec3)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "float3");
}
@@ -733,7 +731,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, void_)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "void");
}
@@ -743,7 +741,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, sampler)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "sampler");
}
@@ -753,7 +751,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, sampler)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "sampler");
}
@@ -763,7 +761,7 @@
std::string result;
};
inline std::ostream& operator<<(std::ostream& out, MslDepthTextureData data) {
- utils::StringStream str;
+ StringStream str;
str << data.dim;
out << str.str();
return out;
@@ -776,7 +774,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, &s)) << gen.Diagnostics();
EXPECT_EQ(out.str(), params.result);
}
@@ -797,7 +795,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, &s)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "depth2d_ms<float, access::read>");
}
@@ -807,7 +805,7 @@
std::string result;
};
inline std::ostream& operator<<(std::ostream& out, MslTextureData data) {
- utils::StringStream str;
+ StringStream str;
str << data.dim;
out << str.str();
return out;
@@ -821,7 +819,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, s)) << gen.Diagnostics();
EXPECT_EQ(out.str(), params.result);
}
@@ -843,7 +841,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, ms)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "texture2d_ms<uint, access::read>");
}
@@ -853,7 +851,7 @@
std::string result;
};
inline std::ostream& operator<<(std::ostream& out, MslStorageTextureData data) {
- utils::StringStream str;
+ StringStream str;
str << data.dim;
return out << str.str();
}
@@ -867,7 +865,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitType(out, program->TypeOf(type))) << gen.Diagnostics();
EXPECT_EQ(out.str(), params.result);
}
diff --git a/src/tint/lang/msl/writer/ast_printer/binary_test.cc b/src/tint/lang/msl/writer/ast_printer/binary_test.cc
index 5eba16e..e8d9556 100644
--- a/src/tint/lang/msl/writer/ast_printer/binary_test.cc
+++ b/src/tint/lang/msl/writer/ast_printer/binary_test.cc
@@ -23,7 +23,7 @@
ast::BinaryOp op;
};
inline std::ostream& operator<<(std::ostream& out, BinaryData data) {
- utils::StringStream str;
+ StringStream str;
str << data.op;
out << str.str();
return out;
@@ -47,7 +47,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), params.result);
}
@@ -91,7 +91,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), params.result);
}
@@ -125,7 +125,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr2)) << gen.Diagnostics();
EXPECT_EQ(out.str(), params.result);
}
@@ -152,7 +152,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "fmod(left, right)");
}
@@ -167,7 +167,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "fmod(left, right)");
}
@@ -180,7 +180,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "fmod(left, right)");
}
@@ -195,7 +195,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "fmod(left, right)");
}
@@ -208,7 +208,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "bool(left & right)");
}
@@ -221,7 +221,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "bool(left | right)");
}
diff --git a/src/tint/lang/msl/writer/ast_printer/bitcast_test.cc b/src/tint/lang/msl/writer/ast_printer/bitcast_test.cc
index ec6c54a..81ee78f 100644
--- a/src/tint/lang/msl/writer/ast_printer/bitcast_test.cc
+++ b/src/tint/lang/msl/writer/ast_printer/bitcast_test.cc
@@ -29,7 +29,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, bitcast)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "as_type<float>(a)");
}
diff --git a/src/tint/lang/msl/writer/ast_printer/builtin_test.cc b/src/tint/lang/msl/writer/ast_printer/builtin_test.cc
index f3917d9..ad6f92d 100644
--- a/src/tint/lang/msl/writer/ast_printer/builtin_test.cc
+++ b/src/tint/lang/msl/writer/ast_printer/builtin_test.cc
@@ -61,7 +61,7 @@
CallParamType type,
ProgramBuilder* builder) {
std::string name;
- utils::StringStream str;
+ StringStream str;
str << name << builtin;
switch (builtin) {
case builtin::Function::kAcos:
@@ -234,8 +234,8 @@
auto* call = GenerateCall(param.builtin, param.type, this);
ASSERT_NE(nullptr, call) << "Unhandled builtin";
- Func("func", utils::Empty, ty.void_(), utils::Vector{Ignore(call)},
- utils::Vector{create<ast::StageAttribute>(ast::PipelineStage::kFragment)});
+ Func("func", tint::Empty, ty.void_(), Vector{Ignore(call)},
+ Vector{create<ast::StageAttribute>(ast::PipelineStage::kFragment)});
ASTPrinter& gen = Build();
@@ -384,7 +384,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "dot(param1, param2)");
}
@@ -395,7 +395,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "threadgroup_barrier(mem_flags::mem_device)");
}
@@ -406,7 +406,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "threadgroup_barrier(mem_flags::mem_threadgroup)");
}
@@ -1058,7 +1058,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "as_type<uint>(half2(p1))");
}
@@ -1070,7 +1070,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "float2(as_type<half2>(p1))");
}
@@ -1104,11 +1104,11 @@
}
TEST_F(MslASTPrinterTest, Ignore) {
- Func("f", utils::Vector{Param("a", ty.i32()), Param("b", ty.i32()), Param("c", ty.i32())},
- ty.i32(), utils::Vector{Return(Mul(Add("a", "b"), "c"))});
+ Func("f", Vector{Param("a", ty.i32()), Param("b", ty.i32()), Param("c", ty.i32())}, ty.i32(),
+ Vector{Return(Mul(Add("a", "b"), "c"))});
- Func("func", utils::Empty, ty.void_(), utils::Vector{CallStmt(Call("f", 1_i, 2_i, 3_i))},
- utils::Vector{
+ Func("func", tint::Empty, ty.void_(), Vector{CallStmt(Call("f", 1_i, 2_i, 3_i))},
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
diff --git a/src/tint/lang/msl/writer/ast_printer/builtin_texture_test.cc b/src/tint/lang/msl/writer/ast_printer/builtin_texture_test.cc
index a6a308d..eabcf4e 100644
--- a/src/tint/lang/msl/writer/ast_printer/builtin_texture_test.cc
+++ b/src/tint/lang/msl/writer/ast_printer/builtin_texture_test.cc
@@ -280,12 +280,12 @@
auto* stmt = param.returns_value ? static_cast<const ast::Statement*>(Assign(Phony(), call))
: static_cast<const ast::Statement*>(CallStmt(call));
- Func("main", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("main", tint::Empty, ty.void_(), Vector{stmt},
+ Vector{Stage(ast::PipelineStage::kFragment)});
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.Diagnostics();
auto expected = expected_texture_overload(param.overload);
diff --git a/src/tint/lang/msl/writer/ast_printer/call_test.cc b/src/tint/lang/msl/writer/ast_printer/call_test.cc
index 97ee8ce..c6b4a5b 100644
--- a/src/tint/lang/msl/writer/ast_printer/call_test.cc
+++ b/src/tint/lang/msl/writer/ast_printer/call_test.cc
@@ -24,26 +24,26 @@
using MslASTPrinterTest = TestHelper;
TEST_F(MslASTPrinterTest, EmitExpression_Call_WithoutParams) {
- Func("my_func", utils::Empty, ty.f32(), utils::Vector{Return(1.23_f)});
+ Func("my_func", tint::Empty, ty.f32(), Vector{Return(1.23_f)});
auto* call = Call("my_func");
WrapInFunction(call);
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "my_func()");
}
TEST_F(MslASTPrinterTest, EmitExpression_Call_WithParams) {
Func("my_func",
- utils::Vector{
+ Vector{
Param(Sym(), ty.f32()),
Param(Sym(), ty.f32()),
},
ty.f32(),
- utils::Vector{
+ Vector{
Return(1.23_f),
});
GlobalVar("param1", ty.f32(), builtin::AddressSpace::kPrivate);
@@ -54,18 +54,18 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "my_func(param1, param2)");
}
TEST_F(MslASTPrinterTest, EmitStatement_Call) {
Func("my_func",
- utils::Vector{
+ Vector{
Param(Sym(), ty.f32()),
Param(Sym(), ty.f32()),
},
- ty.void_(), utils::Empty, utils::Empty);
+ ty.void_(), tint::Empty, tint::Empty);
GlobalVar("param1", ty.f32(), builtin::AddressSpace::kPrivate);
GlobalVar("param2", ty.f32(), builtin::AddressSpace::kPrivate);
diff --git a/src/tint/lang/msl/writer/ast_printer/case_test.cc b/src/tint/lang/msl/writer/ast_printer/case_test.cc
index 48997a5..bffde38 100644
--- a/src/tint/lang/msl/writer/ast_printer/case_test.cc
+++ b/src/tint/lang/msl/writer/ast_printer/case_test.cc
@@ -55,7 +55,7 @@
TEST_F(MslASTPrinterTest, Emit_Case_MultipleSelectors) {
auto* s = Switch(1_i,
Case(
- utils::Vector{
+ Vector{
CaseSelector(5_i),
CaseSelector(6_i),
},
diff --git a/src/tint/lang/msl/writer/ast_printer/cast_test.cc b/src/tint/lang/msl/writer/ast_printer/cast_test.cc
index bc9eb32..e35aa6b 100644
--- a/src/tint/lang/msl/writer/ast_printer/cast_test.cc
+++ b/src/tint/lang/msl/writer/ast_printer/cast_test.cc
@@ -29,7 +29,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, cast)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "1.0f");
}
@@ -40,7 +40,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, cast)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "float3(1.0f, 2.0f, 3.0f)");
}
@@ -51,7 +51,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, cast)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "2147483648u");
}
diff --git a/src/tint/lang/msl/writer/ast_printer/const_assert_test.cc b/src/tint/lang/msl/writer/ast_printer/const_assert_test.cc
index ead3ac2..7a41eef 100644
--- a/src/tint/lang/msl/writer/ast_printer/const_assert_test.cc
+++ b/src/tint/lang/msl/writer/ast_printer/const_assert_test.cc
@@ -35,7 +35,7 @@
}
TEST_F(MslASTPrinterTest, Emit_FunctionConstAssert) {
- Func("f", utils::Empty, ty.void_(), utils::Vector{ConstAssert(true)});
+ Func("f", tint::Empty, ty.void_(), Vector{ConstAssert(true)});
ASTPrinter& gen = Build();
diff --git a/src/tint/lang/msl/writer/ast_printer/constructor_test.cc b/src/tint/lang/msl/writer/ast_printer/constructor_test.cc
index 51367f2..913a6d0 100644
--- a/src/tint/lang/msl/writer/ast_printer/constructor_test.cc
+++ b/src/tint/lang/msl/writer/ast_printer/constructor_test.cc
@@ -388,7 +388,7 @@
}
TEST_F(MslASTPrinterTest_Constructor, Type_Struct) {
- auto* str = Structure("S", utils::Vector{
+ auto* str = Structure("S", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
Member("c", ty.vec3<i32>()),
@@ -403,7 +403,7 @@
}
TEST_F(MslASTPrinterTest_Constructor, Type_Struct_Empty) {
- auto* str = Structure("S", utils::Vector{
+ auto* str = Structure("S", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
Member("c", ty.vec3<i32>()),
diff --git a/src/tint/lang/msl/writer/ast_printer/discard_test.cc b/src/tint/lang/msl/writer/ast_printer/discard_test.cc
index 2abcf27..939041a 100644
--- a/src/tint/lang/msl/writer/ast_printer/discard_test.cc
+++ b/src/tint/lang/msl/writer/ast_printer/discard_test.cc
@@ -22,8 +22,7 @@
TEST_F(MslASTPrinterTest, Emit_Discard) {
auto* stmt = Discard();
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASTPrinter& gen = Build();
diff --git a/src/tint/lang/msl/writer/ast_printer/identifier_test.cc b/src/tint/lang/msl/writer/ast_printer/identifier_test.cc
index cbda963..4a96dca 100644
--- a/src/tint/lang/msl/writer/ast_printer/identifier_test.cc
+++ b/src/tint/lang/msl/writer/ast_printer/identifier_test.cc
@@ -28,7 +28,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, i)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "foo");
}
diff --git a/src/tint/lang/msl/writer/ast_printer/import_test.cc b/src/tint/lang/msl/writer/ast_printer/import_test.cc
index c22f2a1..e8a23be 100644
--- a/src/tint/lang/msl/writer/ast_printer/import_test.cc
+++ b/src/tint/lang/msl/writer/ast_printer/import_test.cc
@@ -83,7 +83,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), R"(abs(1))");
}
@@ -94,7 +94,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), R"(fabs(2.0f))");
}
@@ -108,7 +108,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), std::string(param.msl_name) + "(1.0f, 2.0f)");
}
@@ -126,7 +126,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), R"(fabs(2.0f - 3.0f))");
}
@@ -140,7 +140,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), std::string(param.msl_name) +
R"((float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f)))");
@@ -165,7 +165,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), std::string(param.msl_name) + "(1, 2)");
}
@@ -182,7 +182,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), std::string(param.msl_name) + "(1.0f, 2.0f, 3.0f)");
}
@@ -203,7 +203,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.Diagnostics();
EXPECT_EQ(
out.str(),
@@ -226,7 +226,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), std::string(param.msl_name) + "(1, 2, 3)");
}
@@ -244,7 +244,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), std::string("determinant(var)"));
}
@@ -257,7 +257,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "float(half(v))");
}
@@ -270,7 +270,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "float3(half3(v))");
}
diff --git a/src/tint/lang/msl/writer/ast_printer/loop_test.cc b/src/tint/lang/msl/writer/ast_printer/loop_test.cc
index 096a038..5a0ab36 100644
--- a/src/tint/lang/msl/writer/ast_printer/loop_test.cc
+++ b/src/tint/lang/msl/writer/ast_printer/loop_test.cc
@@ -27,8 +27,7 @@
auto* continuing = Block();
auto* l = Loop(body, continuing);
- Func("F", utils::Empty, ty.void_(), utils::Vector{l},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{l}, Vector{Stage(ast::PipelineStage::kFragment)});
ASTPrinter& gen = Build();
@@ -42,14 +41,13 @@
}
TEST_F(MslASTPrinterTest, Emit_LoopWithContinuing) {
- Func("a_statement", {}, ty.void_(), utils::Empty);
+ Func("a_statement", {}, ty.void_(), tint::Empty);
auto* body = Block(Break());
auto* continuing = Block(CallStmt(Call("a_statement")));
auto* l = Loop(body, continuing);
- Func("F", utils::Empty, ty.void_(), utils::Vector{l},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{l}, Vector{Stage(ast::PipelineStage::kFragment)});
ASTPrinter& gen = Build();
@@ -72,8 +70,7 @@
auto* continuing = Block(CallStmt(Call("a_statement")), BreakIf(true));
auto* l = Loop(body, continuing);
- Func("F", utils::Empty, ty.void_(), utils::Vector{l},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{l}, Vector{Stage(ast::PipelineStage::kFragment)});
ASTPrinter& gen = Build();
@@ -91,7 +88,7 @@
}
TEST_F(MslASTPrinterTest, Emit_LoopNestedWithContinuing) {
- Func("a_statement", {}, ty.void_(), utils::Empty);
+ Func("a_statement", {}, ty.void_(), tint::Empty);
GlobalVar("lhs", ty.f32(), builtin::AddressSpace::kPrivate);
GlobalVar("rhs", ty.f32(), builtin::AddressSpace::kPrivate);
@@ -106,8 +103,7 @@
auto* outer = Loop(body, continuing);
- Func("F", utils::Empty, ty.void_(), utils::Vector{outer},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{outer}, Vector{Stage(ast::PipelineStage::kFragment)});
ASTPrinter& gen = Build();
@@ -213,7 +209,7 @@
// return;
// }
- Func("f", utils::Vector{Param("i", ty.i32())}, ty.void_(), utils::Empty);
+ Func("f", Vector{Param("i", ty.i32())}, ty.void_(), tint::Empty);
auto f = [&](auto&& expr) { return CallStmt(Call("f", expr)); };
GlobalVar("a", ty.atomic<i32>(), builtin::AddressSpace::kWorkgroup);
@@ -289,7 +285,7 @@
// return;
// }
- Func("f", utils::Vector{Param("i", ty.i32())}, ty.void_(), utils::Empty);
+ Func("f", Vector{Param("i", ty.i32())}, ty.void_(), tint::Empty);
auto f = [&](auto&& expr) { return CallStmt(Call("f", expr)); };
GlobalVar("a", ty.atomic<i32>(), builtin::AddressSpace::kWorkgroup);
@@ -318,7 +314,7 @@
// return;
// }
- Func("a_statement", {}, ty.void_(), utils::Empty);
+ Func("a_statement", {}, ty.void_(), tint::Empty);
auto* f = For(Decl(Var("i", ty.i32())), true, Assign("i", Add("i", 1_i)),
Block(CallStmt(Call("a_statement"))));
@@ -344,7 +340,7 @@
// return;
// }
- Func("f", utils::Vector{Param("i", ty.i32())}, ty.void_(), utils::Empty);
+ Func("f", Vector{Param("i", ty.i32())}, ty.void_(), tint::Empty);
auto f = [&](auto&& expr) { return CallStmt(Call("f", expr)); };
GlobalVar("a", ty.atomic<i32>(), builtin::AddressSpace::kWorkgroup);
diff --git a/src/tint/lang/msl/writer/ast_printer/member_accessor_test.cc b/src/tint/lang/msl/writer/ast_printer/member_accessor_test.cc
index ee7d353..9bfae62 100644
--- a/src/tint/lang/msl/writer/ast_printer/member_accessor_test.cc
+++ b/src/tint/lang/msl/writer/ast_printer/member_accessor_test.cc
@@ -21,14 +21,14 @@
using MslASTPrinterTest = TestHelper;
TEST_F(MslASTPrinterTest, EmitExpression_MemberAccessor) {
- GlobalVar("str", ty.Of(Structure("my_str", utils::Vector{Member("mem", ty.f32())})),
+ GlobalVar("str", ty.Of(Structure("my_str", Vector{Member("mem", ty.f32())})),
builtin::AddressSpace::kPrivate);
auto* expr = MemberAccessor("str", "mem");
WrapInFunction(expr);
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "str.mem");
}
@@ -40,7 +40,7 @@
WrapInFunction(expr);
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "my_vec.xyz");
}
@@ -52,7 +52,7 @@
WrapInFunction(expr);
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "my_vec.gbr");
}
diff --git a/src/tint/lang/msl/writer/ast_printer/module_constant_test.cc b/src/tint/lang/msl/writer/ast_printer/module_constant_test.cc
index f209be0..06d0c94 100644
--- a/src/tint/lang/msl/writer/ast_printer/module_constant_test.cc
+++ b/src/tint/lang/msl/writer/ast_printer/module_constant_test.cc
@@ -25,7 +25,7 @@
TEST_F(MslASTPrinterTest, Emit_GlobalConst_AInt) {
auto* var = GlobalConst("G", Expr(1_a));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
@@ -43,7 +43,7 @@
TEST_F(MslASTPrinterTest, Emit_GlobalConst_AFloat) {
auto* var = GlobalConst("G", Expr(1._a));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
@@ -61,7 +61,7 @@
TEST_F(MslASTPrinterTest, Emit_GlobalConst_i32) {
auto* var = GlobalConst("G", Expr(1_i));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
@@ -79,7 +79,7 @@
TEST_F(MslASTPrinterTest, Emit_GlobalConst_u32) {
auto* var = GlobalConst("G", Expr(1_u));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
@@ -97,7 +97,7 @@
TEST_F(MslASTPrinterTest, Emit_GlobalConst_f32) {
auto* var = GlobalConst("G", Expr(1_f));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
@@ -117,7 +117,7 @@
Enable(builtin::Extension::kF16);
auto* var = GlobalConst("G", Expr(1_h));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
@@ -135,7 +135,7 @@
TEST_F(MslASTPrinterTest, Emit_GlobalConst_vec3_AInt) {
auto* var = GlobalConst("G", Call<vec3<Infer>>(1_a, 2_a, 3_a));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
@@ -153,7 +153,7 @@
TEST_F(MslASTPrinterTest, Emit_GlobalConst_vec3_AFloat) {
auto* var = GlobalConst("G", Call<vec3<Infer>>(1._a, 2._a, 3._a));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
@@ -171,7 +171,7 @@
TEST_F(MslASTPrinterTest, Emit_GlobalConst_vec3_f32) {
auto* var = GlobalConst("G", Call<vec3<f32>>(1_f, 2_f, 3_f));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
@@ -191,7 +191,7 @@
Enable(builtin::Extension::kF16);
auto* var = GlobalConst("G", Call<vec3<f16>>(1_h, 2_h, 3_h));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
@@ -209,7 +209,7 @@
TEST_F(MslASTPrinterTest, Emit_GlobalConst_mat2x3_AFloat) {
auto* var = GlobalConst("G", Call<mat2x3<Infer>>(1._a, 2._a, 3._a, 4._a, 5._a, 6._a));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
@@ -227,7 +227,7 @@
TEST_F(MslASTPrinterTest, Emit_GlobalConst_mat2x3_f32) {
auto* var = GlobalConst("G", Call<mat2x3<f32>>(1_f, 2_f, 3_f, 4_f, 5_f, 6_f));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
@@ -247,7 +247,7 @@
Enable(builtin::Extension::kF16);
auto* var = GlobalConst("G", Call<mat2x3<f16>>(1_h, 2_h, 3_h, 4_h, 5_h, 6_h));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
@@ -265,7 +265,7 @@
TEST_F(MslASTPrinterTest, Emit_GlobalConst_arr_f32) {
auto* var = GlobalConst("G", Call(ty.array<f32, 3>(), 1_f, 2_f, 3_f));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
@@ -298,7 +298,7 @@
auto* var = GlobalConst("G", Call<array<vec2<bool>, 3>>(Call<vec2<bool>>(true, false), //
Call<vec2<bool>>(false, true), //
Call<vec2<bool>>(true, true)));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(Let("l", Expr(var)))});
ASTPrinter& gen = Build();
diff --git a/src/tint/lang/msl/writer/ast_printer/return_test.cc b/src/tint/lang/msl/writer/ast_printer/return_test.cc
index f7ac018..f33122b 100644
--- a/src/tint/lang/msl/writer/ast_printer/return_test.cc
+++ b/src/tint/lang/msl/writer/ast_printer/return_test.cc
@@ -35,7 +35,7 @@
TEST_F(MslASTPrinterTest, Emit_ReturnWithValue) {
auto* r = Return(123_i);
- Func("f", utils::Empty, ty.i32(), utils::Vector{r});
+ Func("f", tint::Empty, ty.i32(), Vector{r});
ASTPrinter& gen = Build();
diff --git a/src/tint/lang/msl/writer/ast_printer/sanitizer_test.cc b/src/tint/lang/msl/writer/ast_printer/sanitizer_test.cc
index 007fea2..079fe4c 100644
--- a/src/tint/lang/msl/writer/ast_printer/sanitizer_test.cc
+++ b/src/tint/lang/msl/writer/ast_printer/sanitizer_test.cc
@@ -27,15 +27,15 @@
using MslSanitizerTest = TestHelper;
TEST_F(MslSanitizerTest, Call_ArrayLength) {
- auto* s = Structure("my_struct", utils::Vector{Member(0, "a", ty.array<f32>())});
+ auto* s = Structure("my_struct", Vector{Member(0, "a", ty.array<f32>())});
GlobalVar("b", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(2_a));
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("len", ty.u32(), Call("arrayLength", AddressOf(MemberAccessor("b", "a"))))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -81,18 +81,18 @@
}
TEST_F(MslSanitizerTest, Call_ArrayLength_OtherMembersInStruct) {
- auto* s = Structure("my_struct", utils::Vector{
+ auto* s = Structure("my_struct", Vector{
Member(0, "z", ty.f32()),
Member(4, "a", ty.array<f32>()),
});
GlobalVar("b", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(2_a));
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("len", ty.u32(), Call("arrayLength", AddressOf(MemberAccessor("b", "a"))))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -140,20 +140,20 @@
}
TEST_F(MslSanitizerTest, Call_ArrayLength_ViaLets) {
- auto* s = Structure("my_struct", utils::Vector{Member(0, "a", ty.array<f32>())});
+ auto* s = Structure("my_struct", Vector{Member(0, "a", ty.array<f32>())});
GlobalVar("b", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(2_a));
auto* p = Let("p", AddressOf("b"));
auto* p2 = Let("p2", AddressOf(MemberAccessor(Deref(p), "a")));
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(p),
Decl(p2),
Decl(Var("len", ty.u32(), Call("arrayLength", p2))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -200,19 +200,19 @@
}
TEST_F(MslSanitizerTest, Call_ArrayLength_ArrayLengthFromUniform) {
- auto* s = Structure("my_struct", utils::Vector{Member(0, "a", ty.array<f32>())});
+ auto* s = Structure("my_struct", Vector{Member(0, "a", ty.array<f32>())});
GlobalVar("b", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(0_a));
GlobalVar("c", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kRead, Binding(2_a),
Group(0_a));
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("len", ty.u32(),
Add(Call("arrayLength", AddressOf(MemberAccessor("b", "a"))),
Call("arrayLength", AddressOf(MemberAccessor("c", "a")))))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -259,19 +259,19 @@
}
TEST_F(MslSanitizerTest, Call_ArrayLength_ArrayLengthFromUniformMissingBinding) {
- auto* s = Structure("my_struct", utils::Vector{Member(0, "a", ty.array<f32>())});
+ auto* s = Structure("my_struct", Vector{Member(0, "a", ty.array<f32>())});
GlobalVar("b", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(0_a));
GlobalVar("c", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kRead, Binding(2_a),
Group(0_a));
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("len", ty.u32(),
Add(Call("arrayLength", AddressOf(MemberAccessor("b", "a"))),
Call("arrayLength", AddressOf(MemberAccessor("c", "a")))))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
diff --git a/src/tint/lang/msl/writer/ast_printer/switch_test.cc b/src/tint/lang/msl/writer/ast_printer/switch_test.cc
index 5dc47c9..8e308a2 100644
--- a/src/tint/lang/msl/writer/ast_printer/switch_test.cc
+++ b/src/tint/lang/msl/writer/ast_printer/switch_test.cc
@@ -30,7 +30,7 @@
auto* case_body = Block(create<ast::BreakStatement>());
auto* case_stmt = Case(CaseSelector(5_i), case_body);
- utils::Vector body{case_stmt, def};
+ Vector body{case_stmt, def};
auto* s = Switch(cond, body);
WrapInFunction(cond, s);
ASTPrinter& gen = Build();
@@ -53,7 +53,7 @@
auto* cond = Var("cond", ty.i32());
auto* def_body = Block(create<ast::BreakStatement>());
- auto* def = Case(utils::Vector{CaseSelector(5_i), DefaultCaseSelector()}, def_body);
+ auto* def = Case(Vector{CaseSelector(5_i), DefaultCaseSelector()}, def_body);
auto* s = Switch(cond, def);
WrapInFunction(cond, s);
diff --git a/src/tint/lang/msl/writer/ast_printer/unary_op_test.cc b/src/tint/lang/msl/writer/ast_printer/unary_op_test.cc
index 420c906..c82729b 100644
--- a/src/tint/lang/msl/writer/ast_printer/unary_op_test.cc
+++ b/src/tint/lang/msl/writer/ast_printer/unary_op_test.cc
@@ -27,7 +27,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, op)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "&(expr)");
}
@@ -39,7 +39,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, op)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "~(expr)");
}
@@ -52,7 +52,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, op)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "*(expr)");
}
@@ -64,7 +64,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, op)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "!(expr)");
}
@@ -76,7 +76,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, op)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "tint_unary_minus(expr)");
}
@@ -87,7 +87,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, op)) << gen.Diagnostics();
EXPECT_EQ(out.str(), "(-2147483647 - 1)");
}
diff --git a/src/tint/lang/msl/writer/ast_printer/variable_decl_statement_test.cc b/src/tint/lang/msl/writer/ast_printer/variable_decl_statement_test.cc
index f41180a..c7b8344 100644
--- a/src/tint/lang/msl/writer/ast_printer/variable_decl_statement_test.cc
+++ b/src/tint/lang/msl/writer/ast_printer/variable_decl_statement_test.cc
@@ -66,7 +66,7 @@
TEST_F(MslASTPrinterTest, Emit_VariableDeclStatement_Const_AInt) {
auto* C = Const("C", Expr(1_a));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(C), Decl(Let("l", Expr(C)))});
ASTPrinter& gen = Build();
@@ -84,7 +84,7 @@
TEST_F(MslASTPrinterTest, Emit_VariableDeclStatement_Const_AFloat) {
auto* C = Const("C", Expr(1._a));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(C), Decl(Let("l", Expr(C)))});
ASTPrinter& gen = Build();
@@ -102,7 +102,7 @@
TEST_F(MslASTPrinterTest, Emit_VariableDeclStatement_Const_i32) {
auto* C = Const("C", Expr(1_i));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(C), Decl(Let("l", Expr(C)))});
ASTPrinter& gen = Build();
@@ -120,7 +120,7 @@
TEST_F(MslASTPrinterTest, Emit_VariableDeclStatement_Const_u32) {
auto* C = Const("C", Expr(1_u));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(C), Decl(Let("l", Expr(C)))});
ASTPrinter& gen = Build();
@@ -138,7 +138,7 @@
TEST_F(MslASTPrinterTest, Emit_VariableDeclStatement_Const_f32) {
auto* C = Const("C", Expr(1_f));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(C), Decl(Let("l", Expr(C)))});
ASTPrinter& gen = Build();
@@ -158,7 +158,7 @@
Enable(builtin::Extension::kF16);
auto* C = Const("C", Expr(1_h));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(C), Decl(Let("l", Expr(C)))});
ASTPrinter& gen = Build();
@@ -176,7 +176,7 @@
TEST_F(MslASTPrinterTest, Emit_VariableDeclStatement_Const_vec3_AInt) {
auto* C = Const("C", Call<vec3<Infer>>(1_a, 2_a, 3_a));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(C), Decl(Let("l", Expr(C)))});
ASTPrinter& gen = Build();
@@ -194,7 +194,7 @@
TEST_F(MslASTPrinterTest, Emit_VariableDeclStatement_Const_vec3_AFloat) {
auto* C = Const("C", Call<vec3<Infer>>(1._a, 2._a, 3._a));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(C), Decl(Let("l", Expr(C)))});
ASTPrinter& gen = Build();
@@ -212,7 +212,7 @@
TEST_F(MslASTPrinterTest, Emit_VariableDeclStatement_Const_vec3_f32) {
auto* C = Const("C", Call<vec3<f32>>(1_f, 2_f, 3_f));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(C), Decl(Let("l", Expr(C)))});
ASTPrinter& gen = Build();
@@ -232,7 +232,7 @@
Enable(builtin::Extension::kF16);
auto* C = Const("C", Call<vec3<f16>>(1_h, 2_h, 3_h));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(C), Decl(Let("l", Expr(C)))});
ASTPrinter& gen = Build();
@@ -250,7 +250,7 @@
TEST_F(MslASTPrinterTest, Emit_VariableDeclStatement_Const_mat2x3_AFloat) {
auto* C = Const("C", Call<mat2x3<Infer>>(1._a, 2._a, 3._a, 4._a, 5._a, 6._a));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(C), Decl(Let("l", Expr(C)))});
ASTPrinter& gen = Build();
@@ -268,7 +268,7 @@
TEST_F(MslASTPrinterTest, Emit_VariableDeclStatement_Const_mat2x3_f32) {
auto* C = Const("C", Call<mat2x3<f32>>(1_f, 2_f, 3_f, 4_f, 5_f, 6_f));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(C), Decl(Let("l", Expr(C)))});
ASTPrinter& gen = Build();
@@ -288,7 +288,7 @@
Enable(builtin::Extension::kF16);
auto* C = Const("C", Call<mat2x3<f16>>(1_h, 2_h, 3_h, 4_h, 5_h, 6_h));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(C), Decl(Let("l", Expr(C)))});
ASTPrinter& gen = Build();
@@ -306,7 +306,7 @@
TEST_F(MslASTPrinterTest, Emit_VariableDeclStatement_Const_arr_f32) {
auto* C = Const("C", Call<array<f32, 3>>(1_f, 2_f, 3_f));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(C), Decl(Let("l", Expr(C)))});
ASTPrinter& gen = Build();
@@ -340,7 +340,7 @@
Call<vec2<bool>>(true, false), //
Call<vec2<bool>>(false, true), //
Call<vec2<bool>>(true, true)));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))});
+ Func("f", tint::Empty, ty.void_(), Vector{Decl(C), Decl(Let("l", Expr(C)))});
ASTPrinter& gen = Build();
@@ -383,7 +383,7 @@
}
TEST_F(MslASTPrinterTest, Emit_VariableDeclStatement_Struct) {
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("a", ty.f32()),
Member("b", ty.f32()),
});
diff --git a/src/tint/lang/msl/writer/printer/constant_test.cc b/src/tint/lang/msl/writer/printer/constant_test.cc
index d3d148b..9fa3f0c 100644
--- a/src/tint/lang/msl/writer/printer/constant_test.cc
+++ b/src/tint/lang/msl/writer/printer/constant_test.cc
@@ -26,76 +26,76 @@
auto* c = b.Constant(true);
generator_.EmitConstant(generator_.Line(), c);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), std::string("true"));
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), std::string("true"));
}
TEST_F(MslPrinterTest, Constant_Bool_False) {
auto* c = b.Constant(false);
generator_.EmitConstant(generator_.Line(), c);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), std::string("false"));
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), std::string("false"));
}
TEST_F(MslPrinterTest, Constant_i32) {
auto* c = b.Constant(-12345_i);
generator_.EmitConstant(generator_.Line(), c);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), std::string("-12345"));
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), std::string("-12345"));
}
TEST_F(MslPrinterTest, Constant_u32) {
auto* c = b.Constant(12345_u);
generator_.EmitConstant(generator_.Line(), c);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), std::string("12345u"));
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), std::string("12345u"));
}
TEST_F(MslPrinterTest, Constant_F32) {
auto* c = b.Constant(f32((1 << 30) - 4));
generator_.EmitConstant(generator_.Line(), c);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), std::string("1073741824.0f"));
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), std::string("1073741824.0f"));
}
TEST_F(MslPrinterTest, Constant_F16) {
auto* c = b.Constant(f16((1 << 15) - 8));
generator_.EmitConstant(generator_.Line(), c);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), std::string("32752.0h"));
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), std::string("32752.0h"));
}
TEST_F(MslPrinterTest, Constant_Vector_Splat) {
auto* c = b.Constant(mod.constant_values.Splat(ty.vec3<f32>(), b.Constant(1.5_f)->Value(), 3));
generator_.EmitConstant(generator_.Line(), c);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), std::string("float3(1.5f)"));
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), std::string("float3(1.5f)"));
}
TEST_F(MslPrinterTest, Constant_Vector_Composite) {
auto* c = b.Constant(mod.constant_values.Composite(
- ty.vec3<f32>(), utils::Vector{b.Constant(1.5_f)->Value(), b.Constant(1.0_f)->Value(),
- b.Constant(1.5_f)->Value()}));
+ ty.vec3<f32>(), Vector{b.Constant(1.5_f)->Value(), b.Constant(1.0_f)->Value(),
+ b.Constant(1.5_f)->Value()}));
generator_.EmitConstant(generator_.Line(), c);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), std::string("float3(1.5f, 1.0f, 1.5f)"));
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), std::string("float3(1.5f, 1.0f, 1.5f)"));
}
TEST_F(MslPrinterTest, Constant_Vector_Composite_AnyZero) {
auto* c = b.Constant(mod.constant_values.Composite(
- ty.vec3<f32>(), utils::Vector{b.Constant(1.0_f)->Value(), b.Constant(0.0_f)->Value(),
- b.Constant(1.5_f)->Value()}));
+ ty.vec3<f32>(), Vector{b.Constant(1.0_f)->Value(), b.Constant(0.0_f)->Value(),
+ b.Constant(1.5_f)->Value()}));
generator_.EmitConstant(generator_.Line(), c);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), std::string("float3(1.0f, 0.0f, 1.5f)"));
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), std::string("float3(1.0f, 0.0f, 1.5f)"));
}
TEST_F(MslPrinterTest, Constant_Vector_Composite_AllZero) {
auto* c = b.Constant(mod.constant_values.Composite(
- ty.vec3<f32>(), utils::Vector{b.Constant(0.0_f)->Value(), b.Constant(0.0_f)->Value(),
- b.Constant(0.0_f)->Value()}));
+ ty.vec3<f32>(), Vector{b.Constant(0.0_f)->Value(), b.Constant(0.0_f)->Value(),
+ b.Constant(0.0_f)->Value()}));
generator_.EmitConstant(generator_.Line(), c);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), std::string("float3(0.0f)"));
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), std::string("float3(0.0f)"));
}
TEST_F(MslPrinterTest, Constant_Matrix_Splat) {
@@ -103,57 +103,49 @@
b.Constant(mod.constant_values.Splat(ty.mat3x2<f32>(), b.Constant(1.5_f)->Value(), 3));
generator_.EmitConstant(generator_.Line(), c);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), std::string("float3x2(1.5f, 1.5f, 1.5f)"));
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), std::string("float3x2(1.5f, 1.5f, 1.5f)"));
}
TEST_F(MslPrinterTest, Constant_Matrix_Composite) {
auto* c = b.Constant(mod.constant_values.Composite(
ty.mat3x2<f32>(),
- utils::Vector{mod.constant_values.Composite(
- ty.vec2<f32>(),
- utils::Vector{b.Constant(1.5_f)->Value(), b.Constant(1.0_f)->Value()}),
- mod.constant_values.Composite(
- ty.vec2<f32>(),
- utils::Vector{b.Constant(1.5_f)->Value(), b.Constant(2.0_f)->Value()}),
- mod.constant_values.Composite(
- ty.vec2<f32>(),
- utils::Vector{b.Constant(2.5_f)->Value(), b.Constant(3.5_f)->Value()})}));
+ Vector{mod.constant_values.Composite(
+ ty.vec2<f32>(), Vector{b.Constant(1.5_f)->Value(), b.Constant(1.0_f)->Value()}),
+ mod.constant_values.Composite(
+ ty.vec2<f32>(), Vector{b.Constant(1.5_f)->Value(), b.Constant(2.0_f)->Value()}),
+ mod.constant_values.Composite(ty.vec2<f32>(), Vector{b.Constant(2.5_f)->Value(),
+ b.Constant(3.5_f)->Value()})}));
generator_.EmitConstant(generator_.Line(), c);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()),
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()),
std::string("float3x2(float2(1.5f, 1.0f), float2(1.5f, 2.0f), float2(2.5f, 3.5f))"));
}
TEST_F(MslPrinterTest, Constant_Matrix_Composite_AnyZero) {
auto* c = b.Constant(mod.constant_values.Composite(
ty.mat2x2<f32>(),
- utils::Vector{mod.constant_values.Composite(
- ty.vec2<f32>(),
- utils::Vector{b.Constant(1.0_f)->Value(), b.Constant(0.0_f)->Value()}),
- mod.constant_values.Composite(
- ty.vec2<f32>(),
- utils::Vector{b.Constant(1.5_f)->Value(), b.Constant(2.5_f)->Value()})}));
+ Vector{mod.constant_values.Composite(
+ ty.vec2<f32>(), Vector{b.Constant(1.0_f)->Value(), b.Constant(0.0_f)->Value()}),
+ mod.constant_values.Composite(ty.vec2<f32>(), Vector{b.Constant(1.5_f)->Value(),
+ b.Constant(2.5_f)->Value()})}));
generator_.EmitConstant(generator_.Line(), c);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()),
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()),
std::string("float2x2(float2(1.0f, 0.0f), float2(1.5f, 2.5f))"));
}
TEST_F(MslPrinterTest, Constant_Matrix_Composite_AllZero) {
auto* c = b.Constant(mod.constant_values.Composite(
ty.mat3x2<f32>(),
- utils::Vector{mod.constant_values.Composite(
- ty.vec2<f32>(),
- utils::Vector{b.Constant(0.0_f)->Value(), b.Constant(0.0_f)->Value()}),
- mod.constant_values.Composite(
- ty.vec2<f32>(),
- utils::Vector{b.Constant(0.0_f)->Value(), b.Constant(0.0_f)->Value()}),
- mod.constant_values.Composite(
- ty.vec2<f32>(),
- utils::Vector{b.Constant(0.0_f)->Value(), b.Constant(0.0_f)->Value()})}));
+ Vector{mod.constant_values.Composite(
+ ty.vec2<f32>(), Vector{b.Constant(0.0_f)->Value(), b.Constant(0.0_f)->Value()}),
+ mod.constant_values.Composite(
+ ty.vec2<f32>(), Vector{b.Constant(0.0_f)->Value(), b.Constant(0.0_f)->Value()}),
+ mod.constant_values.Composite(ty.vec2<f32>(), Vector{b.Constant(0.0_f)->Value(),
+ b.Constant(0.0_f)->Value()})}));
generator_.EmitConstant(generator_.Line(), c);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()),
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()),
std::string("float3x2(float2(0.0f), float2(0.0f), float2(0.0f))"));
}
@@ -162,7 +154,7 @@
b.Constant(mod.constant_values.Splat(ty.array<f32, 3>(), b.Constant(1.5_f)->Value(), 3));
generator_.EmitConstant(generator_.Line(), c);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), R"(template<typename T, size_t N>
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), R"(template<typename T, size_t N>
struct tint_array {
const constant T& operator[](size_t i) const constant { return elements[i]; }
device T& operator[](size_t i) device { return elements[i]; }
@@ -180,11 +172,11 @@
TEST_F(MslPrinterTest, Constant_Array_Composite) {
auto* c = b.Constant(mod.constant_values.Composite(
- ty.array<f32, 3>(), utils::Vector{b.Constant(1.5_f)->Value(), b.Constant(1.0_f)->Value(),
- b.Constant(2.0_f)->Value()}));
+ ty.array<f32, 3>(), Vector{b.Constant(1.5_f)->Value(), b.Constant(1.0_f)->Value(),
+ b.Constant(2.0_f)->Value()}));
generator_.EmitConstant(generator_.Line(), c);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), std::string(R"(template<typename T, size_t N>
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), std::string(R"(template<typename T, size_t N>
struct tint_array {
const constant T& operator[](size_t i) const constant { return elements[i]; }
device T& operator[](size_t i) device { return elements[i]; }
@@ -202,10 +194,10 @@
TEST_F(MslPrinterTest, Constant_Array_Composite_AnyZero) {
auto* c = b.Constant(mod.constant_values.Composite(
- ty.array<f32, 2>(), utils::Vector{b.Constant(1.0_f)->Value(), b.Constant(0.0_f)->Value()}));
+ ty.array<f32, 2>(), Vector{b.Constant(1.0_f)->Value(), b.Constant(0.0_f)->Value()}));
generator_.EmitConstant(generator_.Line(), c);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), R"(template<typename T, size_t N>
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), R"(template<typename T, size_t N>
struct tint_array {
const constant T& operator[](size_t i) const constant { return elements[i]; }
device T& operator[](size_t i) device { return elements[i]; }
@@ -223,11 +215,11 @@
TEST_F(MslPrinterTest, Constant_Array_Composite_AllZero) {
auto* c = b.Constant(mod.constant_values.Composite(
- ty.array<f32, 3>(), utils::Vector{b.Constant(0.0_f)->Value(), b.Constant(0.0_f)->Value(),
- b.Constant(0.0_f)->Value()}));
+ ty.array<f32, 3>(), Vector{b.Constant(0.0_f)->Value(), b.Constant(0.0_f)->Value(),
+ b.Constant(0.0_f)->Value()}));
generator_.EmitConstant(generator_.Line(), c);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), R"(template<typename T, size_t N>
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), R"(template<typename T, size_t N>
struct tint_array {
const constant T& operator[](size_t i) const constant { return elements[i]; }
device T& operator[](size_t i) device { return elements[i]; }
@@ -251,7 +243,7 @@
auto* c = b.Constant(mod.constant_values.Splat(s, b.Constant(1.5_f)->Value(), 2));
generator_.EmitConstant(generator_.Line(), c);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), std::string(R"(struct S {
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), std::string(R"(struct S {
float a;
float b;
};
@@ -265,10 +257,10 @@
{mod.symbols.Register("b"), ty.f32()},
});
auto* c = b.Constant(mod.constant_values.Composite(
- s, utils::Vector{b.Constant(1.5_f)->Value(), b.Constant(1.0_f)->Value()}));
+ s, Vector{b.Constant(1.5_f)->Value(), b.Constant(1.0_f)->Value()}));
generator_.EmitConstant(generator_.Line(), c);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), std::string(R"(struct S {
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), std::string(R"(struct S {
float a;
float b;
};
@@ -282,10 +274,10 @@
{mod.symbols.Register("b"), ty.f32()},
});
auto* c = b.Constant(mod.constant_values.Composite(
- s, utils::Vector{b.Constant(1.0_f)->Value(), b.Constant(0.0_f)->Value()}));
+ s, Vector{b.Constant(1.0_f)->Value(), b.Constant(0.0_f)->Value()}));
generator_.EmitConstant(generator_.Line(), c);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), std::string(R"(struct S {
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), std::string(R"(struct S {
float a;
float b;
};
@@ -299,10 +291,10 @@
{mod.symbols.Register("b"), ty.f32()},
});
auto* c = b.Constant(mod.constant_values.Composite(
- s, utils::Vector{b.Constant(0.0_f)->Value(), b.Constant(0.0_f)->Value()}));
+ s, Vector{b.Constant(0.0_f)->Value(), b.Constant(0.0_f)->Value()}));
generator_.EmitConstant(generator_.Line(), c);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), std::string(R"(struct S {
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), std::string(R"(struct S {
float a;
float b;
};
diff --git a/src/tint/lang/msl/writer/printer/printer.cc b/src/tint/lang/msl/writer/printer/printer.cc
index 64af954..3427bce 100644
--- a/src/tint/lang/msl/writer/printer/printer.cc
+++ b/src/tint/lang/msl/writer/printer/printer.cc
@@ -91,7 +91,7 @@
}
std::string Printer::Result() const {
- utils::StringStream ss;
+ StringStream ss;
ss << preamble_buffer_.String() << std::endl << main_buffer_.String();
return ss.str();
}
@@ -132,7 +132,7 @@
return array_template_name_;
}
-void Printer::EmitAddressSpace(utils::StringStream& out, builtin::AddressSpace sc) {
+void Printer::EmitAddressSpace(StringStream& out, builtin::AddressSpace sc) {
switch (sc) {
case builtin::AddressSpace::kFunction:
case builtin::AddressSpace::kPrivate:
@@ -154,7 +154,7 @@
}
}
-void Printer::EmitType(utils::StringStream& out, const type::Type* ty) {
+void Printer::EmitType(StringStream& out, const type::Type* ty) {
tint::Switch(
ty, //
[&](const type::Bool*) { out << "bool"; }, //
@@ -179,7 +179,7 @@
[&](Default) { UNHANDLED_CASE(ty); });
}
-void Printer::EmitPointerType(utils::StringStream& out, const type::Pointer* ptr) {
+void Printer::EmitPointerType(StringStream& out, const type::Pointer* ptr) {
if (ptr->Access() == builtin::Access::kRead) {
out << "const ";
}
@@ -189,7 +189,7 @@
out << "*";
}
-void Printer::EmitAtomicType(utils::StringStream& out, const type::Atomic* atomic) {
+void Printer::EmitAtomicType(StringStream& out, const type::Atomic* atomic) {
if (atomic->Type()->Is<type::I32>()) {
out << "atomic_int";
return;
@@ -201,7 +201,7 @@
TINT_ICE(Writer, diagnostics_) << "unhandled atomic type " << atomic->Type()->FriendlyName();
}
-void Printer::EmitArrayType(utils::StringStream& out, const type::Array* arr) {
+void Printer::EmitArrayType(StringStream& out, const type::Array* arr) {
out << ArrayTemplateName() << "<";
EmitType(out, arr->ElemType());
out << ", ";
@@ -218,7 +218,7 @@
out << ">";
}
-void Printer::EmitVectorType(utils::StringStream& out, const type::Vector* vec) {
+void Printer::EmitVectorType(StringStream& out, const type::Vector* vec) {
if (vec->Packed()) {
out << "packed_";
}
@@ -226,12 +226,12 @@
out << vec->Width();
}
-void Printer::EmitMatrixType(utils::StringStream& out, const type::Matrix* mat) {
+void Printer::EmitMatrixType(StringStream& out, const type::Matrix* mat) {
EmitType(out, mat->type());
out << mat->columns() << "x" << mat->rows();
}
-void Printer::EmitTextureType(utils::StringStream& out, const type::Texture* tex) {
+void Printer::EmitTextureType(StringStream& out, const type::Texture* tex) {
if (TINT_UNLIKELY(tex->Is<type::ExternalTexture>())) {
TINT_ICE(Writer, diagnostics_) << "Multiplanar external texture transform was not run.";
return;
@@ -318,7 +318,7 @@
bool is_host_shareable = str->IsHostShareable();
// Emits a `/* 0xnnnn */` byte offset comment for a struct member.
- auto add_byte_offset_comment = [&](utils::StringStream& out, uint32_t offset) {
+ auto add_byte_offset_comment = [&](StringStream& out, uint32_t offset) {
std::ios_base::fmtflags saved_flag_state(out.flags());
out << "/* 0x" << std::hex << std::setfill('0') << std::setw(4) << offset << " */ ";
out.flags(saved_flag_state);
@@ -438,11 +438,11 @@
preamble_buffer_.Append(str_buf);
}
-void Printer::EmitConstant(utils::StringStream& out, ir::Constant* c) {
+void Printer::EmitConstant(StringStream& out, ir::Constant* c) {
EmitConstant(out, c->Value());
}
-void Printer::EmitConstant(utils::StringStream& out, const constant::Value* c) {
+void Printer::EmitConstant(StringStream& out, const constant::Value* c) {
auto emit_values = [&](uint32_t count) {
for (size_t i = 0; i < count; i++) {
if (i > 0) {
diff --git a/src/tint/lang/msl/writer/printer/printer.h b/src/tint/lang/msl/writer/printer/printer.h
index d2e2085..101ff6a 100644
--- a/src/tint/lang/msl/writer/printer/printer.h
+++ b/src/tint/lang/msl/writer/printer/printer.h
@@ -27,7 +27,7 @@
namespace tint::msl::writer {
/// Implementation class for the MSL generator
-class Printer : public utils::TextGenerator {
+class Printer : public tint::TextGenerator {
public:
/// Constructor
/// @param module the Tint IR module to generate
@@ -37,7 +37,7 @@
/// @returns true on successful generation; false otherwise
bool Generate();
- /// @copydoc utils::TextGenerator::Result
+ /// @copydoc tint::TextGenerator::Result
std::string Result() const override;
/// Emit the function
@@ -47,32 +47,32 @@
/// Emit a type
/// @param out the stream to emit too
/// @param ty the type to emit
- void EmitType(utils::StringStream& out, const type::Type* ty);
+ void EmitType(StringStream& out, const type::Type* ty);
/// Handles generating an array declaration
/// @param out the output stream
/// @param arr the array to emit
- void EmitArrayType(utils::StringStream& out, const type::Array* arr);
+ void EmitArrayType(StringStream& out, const type::Array* arr);
/// Handles generating an atomic declaration
/// @param out the output stream
/// @param atomic the atomic to emit
- void EmitAtomicType(utils::StringStream& out, const type::Atomic* atomic);
+ void EmitAtomicType(StringStream& out, const type::Atomic* atomic);
/// Handles generating a pointer declaration
/// @param out the output stream
/// @param ptr the pointer to emit
- void EmitPointerType(utils::StringStream& out, const type::Pointer* ptr);
+ void EmitPointerType(StringStream& out, const type::Pointer* ptr);
/// Handles generating a vector declaration
/// @param out the output stream
/// @param vec the vector to emit
- void EmitVectorType(utils::StringStream& out, const type::Vector* vec);
+ void EmitVectorType(StringStream& out, const type::Vector* vec);
/// Handles generating a matrix declaration
/// @param out the output stream
/// @param mat the matrix to emit
- void EmitMatrixType(utils::StringStream& out, const type::Matrix* mat);
+ void EmitMatrixType(StringStream& out, const type::Matrix* mat);
/// Handles generating a texture declaration
/// @param out the output stream
/// @param tex the texture to emit
- void EmitTextureType(utils::StringStream& out, const type::Texture* tex);
+ void EmitTextureType(StringStream& out, const type::Texture* tex);
/// Handles generating a struct declaration. If the structure has already been emitted, then
/// this function will simply return without emitting anything.
/// @param str the struct to generate
@@ -81,16 +81,16 @@
/// Handles generating a address space
/// @param out the output of the type stream
/// @param sc the address space to generate
- void EmitAddressSpace(utils::StringStream& out, builtin::AddressSpace sc);
+ void EmitAddressSpace(StringStream& out, builtin::AddressSpace sc);
/// Handles ir::Constant values
/// @param out the stream to write the constant too
/// @param c the constant to emit
- void EmitConstant(utils::StringStream& out, ir::Constant* c);
+ void EmitConstant(StringStream& out, ir::Constant* c);
/// Handles constant::Value values
/// @param out the stream to write the constant too
/// @param c the constant to emit
- void EmitConstant(utils::StringStream& out, const constant::Value* c);
+ void EmitConstant(StringStream& out, const constant::Value* c);
/// @returns the name of the templated `tint_array` helper type, generating it if needed
const std::string& ArrayTemplateName();
@@ -100,7 +100,7 @@
std::string array_template_name_;
private:
- /// @copydoc utils::TextWrtiter::UniqueIdentifier
+ /// @copydoc tint::TextWrtiter::UniqueIdentifier
std::string UniqueIdentifier(const std::string& prefix = "") override;
ir::Module* const ir_;
diff --git a/src/tint/lang/msl/writer/printer/type_test.cc b/src/tint/lang/msl/writer/printer/type_test.cc
index 20a9eb8..8b23008 100644
--- a/src/tint/lang/msl/writer/printer/type_test.cc
+++ b/src/tint/lang/msl/writer/printer/type_test.cc
@@ -34,7 +34,7 @@
TEST_F(MslPrinterTest, EmitType_Array) {
generator_.EmitType(generator_.Line(), ty.array<bool, 4>());
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), R"(template<typename T, size_t N>
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), R"(template<typename T, size_t N>
struct tint_array {
const constant T& operator[](size_t i) const constant { return elements[i]; }
device T& operator[](size_t i) device { return elements[i]; }
@@ -53,7 +53,7 @@
TEST_F(MslPrinterTest, EmitType_ArrayOfArray) {
generator_.EmitType(generator_.Line(), ty.array(ty.array<bool, 4>(), 5));
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), R"(template<typename T, size_t N>
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), R"(template<typename T, size_t N>
struct tint_array {
const constant T& operator[](size_t i) const constant { return elements[i]; }
device T& operator[](size_t i) device { return elements[i]; }
@@ -72,7 +72,7 @@
TEST_F(MslPrinterTest, EmitType_ArrayOfArrayOfArray) {
generator_.EmitType(generator_.Line(), ty.array(ty.array(ty.array<bool, 4>(), 5), 6));
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), R"(template<typename T, size_t N>
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), R"(template<typename T, size_t N>
struct tint_array {
const constant T& operator[](size_t i) const constant { return elements[i]; }
device T& operator[](size_t i) device { return elements[i]; }
@@ -91,7 +91,7 @@
TEST_F(MslPrinterTest, EmitType_RuntimeArray) {
generator_.EmitType(generator_.Line(), ty.array<bool, 0>());
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), R"(template<typename T, size_t N>
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), R"(template<typename T, size_t N>
struct tint_array {
const constant T& operator[](size_t i) const constant { return elements[i]; }
device T& operator[](size_t i) device { return elements[i]; }
@@ -110,85 +110,85 @@
TEST_F(MslPrinterTest, EmitType_Bool) {
generator_.EmitType(generator_.Line(), ty.bool_());
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), "bool");
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), "bool");
}
TEST_F(MslPrinterTest, EmitType_F32) {
generator_.EmitType(generator_.Line(), ty.f32());
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), "float");
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), "float");
}
TEST_F(MslPrinterTest, EmitType_F16) {
generator_.EmitType(generator_.Line(), ty.f16());
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), "half");
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), "half");
}
TEST_F(MslPrinterTest, EmitType_I32) {
generator_.EmitType(generator_.Line(), ty.i32());
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), "int");
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), "int");
}
TEST_F(MslPrinterTest, EmitType_Matrix_F32) {
generator_.EmitType(generator_.Line(), ty.mat2x3<f32>());
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), "float2x3");
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), "float2x3");
}
TEST_F(MslPrinterTest, EmitType_Matrix_F16) {
generator_.EmitType(generator_.Line(), ty.mat2x3<f16>());
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), "half2x3");
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), "half2x3");
}
TEST_F(MslPrinterTest, EmitType_U32) {
generator_.EmitType(generator_.Line(), ty.u32());
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), "uint");
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), "uint");
}
TEST_F(MslPrinterTest, EmitType_Atomic_U32) {
generator_.EmitType(generator_.Line(), ty.atomic<u32>());
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), "atomic_uint");
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), "atomic_uint");
}
TEST_F(MslPrinterTest, EmitType_Atomic_I32) {
generator_.EmitType(generator_.Line(), ty.atomic<i32>());
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), "atomic_int");
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), "atomic_int");
}
TEST_F(MslPrinterTest, EmitType_Vector) {
generator_.EmitType(generator_.Line(), ty.vec3<f32>());
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), "float3");
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), "float3");
}
TEST_F(MslPrinterTest, EmitType_VectorPacked) {
generator_.EmitType(generator_.Line(), ty.packed_vec(ty.f32(), 3));
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), "packed_float3");
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), "packed_float3");
}
TEST_F(MslPrinterTest, EmitType_Void) {
generator_.EmitType(generator_.Line(), ty.void_());
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), "void");
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), "void");
}
TEST_F(MslPrinterTest, EmitType_Pointer_Workgroup) {
generator_.EmitType(generator_.Line(), ty.ptr<workgroup, f32, read_write>());
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), "threadgroup float*");
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), "threadgroup float*");
}
TEST_F(MslPrinterTest, EmitType_Pointer_Const) {
generator_.EmitType(generator_.Line(), ty.ptr<function, f32, read>());
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), "const thread float*");
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), "const thread float*");
}
struct MslAddressSpaceData {
@@ -196,7 +196,7 @@
std::string result;
};
inline std::ostream& operator<<(std::ostream& out, MslAddressSpaceData data) {
- utils::StringStream str;
+ StringStream str;
str << data.space;
out << str.str();
return out;
@@ -220,7 +220,7 @@
});
generator_.EmitType(generator_.Line(), s);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_STREQ(std::string(utils::TrimSpace(generator_.Result())).c_str(), R"(struct S {
+ EXPECT_STREQ(std::string(tint::TrimSpace(generator_.Result())).c_str(), R"(struct S {
int a;
float b;
};
@@ -236,7 +236,7 @@
generator_.EmitType(generator_.Line(), s);
generator_.EmitType(generator_.Line(), s);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_STREQ(std::string(utils::TrimSpace(generator_.Result())).c_str(), R"(struct S {
+ EXPECT_STREQ(std::string(tint::TrimSpace(generator_.Result())).c_str(), R"(struct S {
int a;
float b;
};
@@ -245,7 +245,7 @@
S)");
}
-void FormatMSLField(utils::StringStream& out,
+void FormatMSLField(StringStream& out,
const char* addr,
const char* type,
size_t array_count,
@@ -308,8 +308,8 @@
type::Struct* MkStruct(ir::Module& mod,
type::Manager& ty,
std::string_view name,
- utils::VectorRef<MemberData> data) {
- utils::Vector<const type::StructMember*, 26> members;
+ VectorRef<MemberData> data) {
+ Vector<const type::StructMember*, 26> members;
uint32_t align = 0;
uint32_t size = 0;
for (uint32_t i = 0; i < data.Length(); ++i) {
@@ -318,7 +318,7 @@
uint32_t mem_align = d.align == 0 ? d.type->Align() : d.align;
uint32_t mem_size = d.size == 0 ? d.type->Size() : d.size;
- uint32_t offset = utils::RoundUp(mem_align, size);
+ uint32_t offset = tint::RoundUp(mem_align, size);
members.Push(ty.Get<type::StructMember>(d.name, d.type, i, offset, mem_align, mem_size,
type::StructMemberAttributes{}));
@@ -327,36 +327,36 @@
}
return ty.Get<type::Struct>(mod.symbols.New(name), std::move(members), align,
- utils::RoundUp(align, size), size);
+ tint::RoundUp(align, size), size);
}
TEST_F(MslPrinterTest, EmitType_Struct_Layout_NonComposites) {
- utils::Vector<MemberData, 26> data = {{mod.symbols.Register("a"), ty.i32(), 32}, //
- {mod.symbols.Register("b"), ty.f32(), 128, 128}, //
- {mod.symbols.Register("c"), ty.vec2<f32>()}, //
- {mod.symbols.Register("d"), ty.u32()}, //
- {mod.symbols.Register("e"), ty.vec3<f32>()}, //
- {mod.symbols.Register("f"), ty.u32()}, //
- {mod.symbols.Register("g"), ty.vec4<f32>()}, //
- {mod.symbols.Register("h"), ty.u32()}, //
- {mod.symbols.Register("i"), ty.mat2x2<f32>()}, //
- {mod.symbols.Register("j"), ty.u32()}, //
- {mod.symbols.Register("k"), ty.mat2x3<f32>()}, //
- {mod.symbols.Register("l"), ty.u32()}, //
- {mod.symbols.Register("m"), ty.mat2x4<f32>()}, //
- {mod.symbols.Register("n"), ty.u32()}, //
- {mod.symbols.Register("o"), ty.mat3x2<f32>()}, //
- {mod.symbols.Register("p"), ty.u32()}, //
- {mod.symbols.Register("q"), ty.mat3x3<f32>()}, //
- {mod.symbols.Register("r"), ty.u32()}, //
- {mod.symbols.Register("s"), ty.mat3x4<f32>()}, //
- {mod.symbols.Register("t"), ty.u32()}, //
- {mod.symbols.Register("u"), ty.mat4x2<f32>()}, //
- {mod.symbols.Register("v"), ty.u32()}, //
- {mod.symbols.Register("w"), ty.mat4x3<f32>()}, //
- {mod.symbols.Register("x"), ty.u32()}, //
- {mod.symbols.Register("y"), ty.mat4x4<f32>()}, //
- {mod.symbols.Register("z"), ty.f32()}};
+ Vector<MemberData, 26> data = {{mod.symbols.Register("a"), ty.i32(), 32}, //
+ {mod.symbols.Register("b"), ty.f32(), 128, 128}, //
+ {mod.symbols.Register("c"), ty.vec2<f32>()}, //
+ {mod.symbols.Register("d"), ty.u32()}, //
+ {mod.symbols.Register("e"), ty.vec3<f32>()}, //
+ {mod.symbols.Register("f"), ty.u32()}, //
+ {mod.symbols.Register("g"), ty.vec4<f32>()}, //
+ {mod.symbols.Register("h"), ty.u32()}, //
+ {mod.symbols.Register("i"), ty.mat2x2<f32>()}, //
+ {mod.symbols.Register("j"), ty.u32()}, //
+ {mod.symbols.Register("k"), ty.mat2x3<f32>()}, //
+ {mod.symbols.Register("l"), ty.u32()}, //
+ {mod.symbols.Register("m"), ty.mat2x4<f32>()}, //
+ {mod.symbols.Register("n"), ty.u32()}, //
+ {mod.symbols.Register("o"), ty.mat3x2<f32>()}, //
+ {mod.symbols.Register("p"), ty.u32()}, //
+ {mod.symbols.Register("q"), ty.mat3x3<f32>()}, //
+ {mod.symbols.Register("r"), ty.u32()}, //
+ {mod.symbols.Register("s"), ty.mat3x4<f32>()}, //
+ {mod.symbols.Register("t"), ty.u32()}, //
+ {mod.symbols.Register("u"), ty.mat4x2<f32>()}, //
+ {mod.symbols.Register("v"), ty.u32()}, //
+ {mod.symbols.Register("w"), ty.mat4x3<f32>()}, //
+ {mod.symbols.Register("x"), ty.u32()}, //
+ {mod.symbols.Register("y"), ty.mat4x4<f32>()}, //
+ {mod.symbols.Register("z"), ty.f32()}};
auto* s = MkStruct(mod, ty, "S", data);
s->AddUsage(builtin::AddressSpace::kStorage);
@@ -405,7 +405,7 @@
FIELD(0x0304, int8_t, 124, tint_pad_12)
// Check that the generated string is as expected.
- utils::StringStream expect;
+ StringStream expect;
expect << R"(template<typename T, size_t N>
struct tint_array {
const constant T& operator[](size_t i) const constant { return elements[i]; }
@@ -429,7 +429,7 @@
generator_.EmitType(generator_.Line(), s);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), expect.str());
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), expect.str());
// 1.4 Metal and C++14
// The Metal programming language is a C++14-based Specification with
@@ -456,13 +456,13 @@
TEST_F(MslPrinterTest, EmitType_Struct_Layout_Structures) {
// inner_x: size(1024), align(512)
- utils::Vector<MemberData, 2> inner_x_data = {{{mod.symbols.Register("a"), ty.i32()}, //
- {mod.symbols.Register("b"), ty.f32(), 0, 512}}};
+ Vector<MemberData, 2> inner_x_data = {{{mod.symbols.Register("a"), ty.i32()}, //
+ {mod.symbols.Register("b"), ty.f32(), 0, 512}}};
auto* inner_x = MkStruct(mod, ty, "inner_x", inner_x_data);
// inner_y: size(516), align(4)
- utils::Vector<MemberData, 2> inner_y_data = {{mod.symbols.Register("a"), ty.i32(), 512},
- {mod.symbols.Register("b"), ty.f32()}};
+ Vector<MemberData, 2> inner_y_data = {{mod.symbols.Register("a"), ty.i32(), 512},
+ {mod.symbols.Register("b"), ty.f32()}};
auto* inner_y = MkStruct(mod, ty, "inner_y", inner_y_data);
@@ -485,7 +485,7 @@
FIELD(0x080c, int8_t, 500, tint_pad_1)
// Check that the generated string is as expected.
- utils::StringStream expect;
+ StringStream expect;
expect << R"(template<typename T, size_t N>
struct tint_array {
const constant T& operator[](size_t i) const constant { return elements[i]; }
@@ -517,7 +517,7 @@
generator_.EmitType(generator_.Line(), s);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), expect.str());
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), expect.str());
// 1.4 Metal and C++14
// The Metal programming language is a C++14-based Specification with
@@ -557,8 +557,8 @@
TEST_F(MslPrinterTest, EmitType_Struct_Layout_ArrayDefaultStride) {
// inner: size(1024), align(512)
- utils::Vector<MemberData, 2> inner_data = {{mod.symbols.Register("a"), ty.i32()},
- {mod.symbols.Register("b"), ty.f32(), 0, 512}};
+ Vector<MemberData, 2> inner_data = {{mod.symbols.Register("a"), ty.i32()},
+ {mod.symbols.Register("b"), ty.f32(), 0, 512}};
auto* inner = MkStruct(mod, ty, "inner", inner_data);
@@ -592,7 +592,7 @@
FIELD(0x1208, int8_t, 504, tint_pad_1)
// Check that the generated string is as expected.
- utils::StringStream expect;
+ StringStream expect;
expect << R"(template<typename T, size_t N>
struct tint_array {
@@ -621,7 +621,7 @@
generator_.EmitType(generator_.Line(), s);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), expect.str());
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), expect.str());
// 1.4 Metal and C++14
// The Metal programming language is a C++14-based Specification with
@@ -686,7 +686,7 @@
FIELD(0x0054, int8_t, 12, tint_pad_1)
// Check that the generated string is as expected.
- utils::StringStream expect;
+ StringStream expect;
expect << R"(template<typename T, size_t N>
struct tint_array {
@@ -711,38 +711,37 @@
generator_.EmitType(generator_.Line(), s);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), expect.str());
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), expect.str());
}
TEST_F(MslPrinterTest, AttemptTintPadSymbolCollision) {
- utils::Vector<MemberData, 26> data = {
- // uses symbols tint_pad_[0..9] and tint_pad_[20..35]
- {mod.symbols.Register("tint_pad_2"), ty.i32(), 32}, //
- {mod.symbols.Register("tint_pad_20"), ty.f32(), 128, 128}, //
- {mod.symbols.Register("tint_pad_33"), ty.vec2<f32>()}, //
- {mod.symbols.Register("tint_pad_1"), ty.u32()}, //
- {mod.symbols.Register("tint_pad_3"), ty.vec3<f32>()}, //
- {mod.symbols.Register("tint_pad_7"), ty.u32()}, //
- {mod.symbols.Register("tint_pad_25"), ty.vec4<f32>()}, //
- {mod.symbols.Register("tint_pad_5"), ty.u32()}, //
- {mod.symbols.Register("tint_pad_27"), ty.mat2x2<f32>()}, //
- {mod.symbols.Register("tint_pad_24"), ty.u32()}, //
- {mod.symbols.Register("tint_pad_23"), ty.mat2x3<f32>()}, //
- {mod.symbols.Register("tint_pad"), ty.u32()}, //
- {mod.symbols.Register("tint_pad_8"), ty.mat2x4<f32>()}, //
- {mod.symbols.Register("tint_pad_26"), ty.u32()}, //
- {mod.symbols.Register("tint_pad_29"), ty.mat3x2<f32>()}, //
- {mod.symbols.Register("tint_pad_6"), ty.u32()}, //
- {mod.symbols.Register("tint_pad_22"), ty.mat3x3<f32>()}, //
- {mod.symbols.Register("tint_pad_32"), ty.u32()}, //
- {mod.symbols.Register("tint_pad_34"), ty.mat3x4<f32>()}, //
- {mod.symbols.Register("tint_pad_35"), ty.u32()}, //
- {mod.symbols.Register("tint_pad_30"), ty.mat4x2<f32>()}, //
- {mod.symbols.Register("tint_pad_9"), ty.u32()}, //
- {mod.symbols.Register("tint_pad_31"), ty.mat4x3<f32>()}, //
- {mod.symbols.Register("tint_pad_28"), ty.u32()}, //
- {mod.symbols.Register("tint_pad_4"), ty.mat4x4<f32>()}, //
- {mod.symbols.Register("tint_pad_21"), ty.f32()}};
+ Vector<MemberData, 26> data = {// uses symbols tint_pad_[0..9] and tint_pad_[20..35]
+ {mod.symbols.Register("tint_pad_2"), ty.i32(), 32}, //
+ {mod.symbols.Register("tint_pad_20"), ty.f32(), 128, 128}, //
+ {mod.symbols.Register("tint_pad_33"), ty.vec2<f32>()}, //
+ {mod.symbols.Register("tint_pad_1"), ty.u32()}, //
+ {mod.symbols.Register("tint_pad_3"), ty.vec3<f32>()}, //
+ {mod.symbols.Register("tint_pad_7"), ty.u32()}, //
+ {mod.symbols.Register("tint_pad_25"), ty.vec4<f32>()}, //
+ {mod.symbols.Register("tint_pad_5"), ty.u32()}, //
+ {mod.symbols.Register("tint_pad_27"), ty.mat2x2<f32>()}, //
+ {mod.symbols.Register("tint_pad_24"), ty.u32()}, //
+ {mod.symbols.Register("tint_pad_23"), ty.mat2x3<f32>()}, //
+ {mod.symbols.Register("tint_pad"), ty.u32()}, //
+ {mod.symbols.Register("tint_pad_8"), ty.mat2x4<f32>()}, //
+ {mod.symbols.Register("tint_pad_26"), ty.u32()}, //
+ {mod.symbols.Register("tint_pad_29"), ty.mat3x2<f32>()}, //
+ {mod.symbols.Register("tint_pad_6"), ty.u32()}, //
+ {mod.symbols.Register("tint_pad_22"), ty.mat3x3<f32>()}, //
+ {mod.symbols.Register("tint_pad_32"), ty.u32()}, //
+ {mod.symbols.Register("tint_pad_34"), ty.mat3x4<f32>()}, //
+ {mod.symbols.Register("tint_pad_35"), ty.u32()}, //
+ {mod.symbols.Register("tint_pad_30"), ty.mat4x2<f32>()}, //
+ {mod.symbols.Register("tint_pad_9"), ty.u32()}, //
+ {mod.symbols.Register("tint_pad_31"), ty.mat4x3<f32>()}, //
+ {mod.symbols.Register("tint_pad_28"), ty.u32()}, //
+ {mod.symbols.Register("tint_pad_4"), ty.mat4x4<f32>()}, //
+ {mod.symbols.Register("tint_pad_21"), ty.f32()}};
auto* s = MkStruct(mod, ty, "S", data);
s->AddUsage(builtin::AddressSpace::kStorage);
@@ -805,19 +804,19 @@
generator_.EmitType(generator_.Line(), s);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_STREQ(std::string(utils::TrimSpace(generator_.Result())).c_str(), expect);
+ EXPECT_STREQ(std::string(tint::TrimSpace(generator_.Result())).c_str(), expect);
}
TEST_F(MslPrinterTest, EmitType_Sampler) {
generator_.EmitType(generator_.Line(), ty.sampler());
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), "sampler");
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), "sampler");
}
TEST_F(MslPrinterTest, EmitType_SamplerComparison) {
generator_.EmitType(generator_.Line(), ty.comparison_sampler());
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), "sampler");
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), "sampler");
}
struct MslDepthTextureData {
@@ -825,7 +824,7 @@
std::string result;
};
inline std::ostream& operator<<(std::ostream& out, MslDepthTextureData data) {
- utils::StringStream str;
+ StringStream str;
str << data.dim;
out << str.str();
return out;
@@ -837,7 +836,7 @@
auto* t = ty.Get<type::DepthTexture>(params.dim);
generator_.EmitType(generator_.Line(), t);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), params.result);
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), params.result);
}
INSTANTIATE_TEST_SUITE_P(
MslPrinterTest,
@@ -854,7 +853,7 @@
auto* t = ty.Get<type::DepthMultisampledTexture>(type::TextureDimension::k2d);
generator_.EmitType(generator_.Line(), t);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), "depth2d_ms<float, access::read>");
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), "depth2d_ms<float, access::read>");
}
struct MslTextureData {
@@ -862,7 +861,7 @@
std::string result;
};
inline std::ostream& operator<<(std::ostream& out, MslTextureData data) {
- utils::StringStream str;
+ StringStream str;
str << data.dim;
out << str.str();
return out;
@@ -874,7 +873,7 @@
auto* t = ty.Get<type::SampledTexture>(params.dim, ty.f32());
generator_.EmitType(generator_.Line(), t);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), params.result);
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), params.result);
}
INSTANTIATE_TEST_SUITE_P(
MslPrinterTest,
@@ -892,7 +891,7 @@
auto* ms = ty.Get<type::MultisampledTexture>(type::TextureDimension::k2d, ty.u32());
generator_.EmitType(generator_.Line(), ms);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), "texture2d_ms<uint, access::read>");
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), "texture2d_ms<uint, access::read>");
}
struct MslStorageTextureData {
@@ -900,7 +899,7 @@
std::string result;
};
inline std::ostream& operator<<(std::ostream& out, MslStorageTextureData data) {
- utils::StringStream str;
+ StringStream str;
str << data.dim;
return out << str.str();
}
@@ -913,7 +912,7 @@
builtin::Access::kWrite, f32);
generator_.EmitType(generator_.Line(), s);
ASSERT_TRUE(generator_.Diagnostics().empty()) << generator_.Diagnostics().str();
- EXPECT_EQ(utils::TrimSpace(generator_.Result()), params.result);
+ EXPECT_EQ(tint::TrimSpace(generator_.Result()), params.result);
}
INSTANTIATE_TEST_SUITE_P(
MslPrinterTest,
diff --git a/src/tint/lang/msl/writer/printer_support.cc b/src/tint/lang/msl/writer/printer_support.cc
index 940fd0f..b664b57 100644
--- a/src/tint/lang/msl/writer/printer_support.cc
+++ b/src/tint/lang/msl/writer/printer_support.cc
@@ -216,7 +216,7 @@
});
}
-void PrintF32(utils::StringStream& out, float value) {
+void PrintF32(StringStream& out, float value) {
// Note: Currently inf and nan should not be constructable, but this is implemented for the day
// we support them.
if (std::isinf(value)) {
@@ -228,7 +228,7 @@
}
}
-void PrintF16(utils::StringStream& out, float value) {
+void PrintF16(StringStream& out, float value) {
// Note: Currently inf and nan should not be constructable, but this is implemented for the day
// we support them.
if (std::isinf(value)) {
@@ -242,7 +242,7 @@
}
}
-void PrintI32(utils::StringStream& out, int32_t value) {
+void PrintI32(StringStream& out, int32_t value) {
// MSL (and C++) parse `-2147483648` as a `long` because it parses unary minus and `2147483648`
// as separate tokens, and the latter doesn't fit into an (32-bit) `int`.
// WGSL, on the other hand, parses this as an `i32`.
diff --git a/src/tint/lang/msl/writer/printer_support.h b/src/tint/lang/msl/writer/printer_support.h
index 6900515..10965fd 100644
--- a/src/tint/lang/msl/writer/printer_support.h
+++ b/src/tint/lang/msl/writer/printer_support.h
@@ -53,17 +53,17 @@
/// Prints a float32 to the output stream
/// @param out the stream to write too
/// @param value the float32 value
-void PrintF32(utils::StringStream& out, float value);
+void PrintF32(StringStream& out, float value);
/// Prints a float16 to the output stream
/// @param out the stream to write too
/// @param value the float16 value
-void PrintF16(utils::StringStream& out, float value);
+void PrintF16(StringStream& out, float value);
/// Prints an int32 to the output stream
/// @param out the stream to write too
/// @param value the int32 value
-void PrintI32(utils::StringStream& out, int32_t value);
+void PrintI32(StringStream& out, int32_t value);
} // namespace tint::msl::writer
diff --git a/src/tint/lang/msl/writer/printer_support_test.cc b/src/tint/lang/msl/writer/printer_support_test.cc
index d4b4f82..84ea0e7 100644
--- a/src/tint/lang/msl/writer/printer_support_test.cc
+++ b/src/tint/lang/msl/writer/printer_support_test.cc
@@ -23,7 +23,7 @@
const char* attribute_name;
};
inline std::ostream& operator<<(std::ostream& out, MslBuiltinData data) {
- utils::StringStream str;
+ StringStream str;
str << data.builtin;
out << str.str();
return out;
diff --git a/src/tint/lang/spirv/reader/ast_parser/ast_parser.cc b/src/tint/lang/spirv/reader/ast_parser/ast_parser.cc
index a98e1a0..80a2b3c 100644
--- a/src/tint/lang/spirv/reader/ast_parser/ast_parser.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/ast_parser.cc
@@ -885,8 +885,8 @@
TINT_ASSERT(Reader, !inner_implementation_name.empty());
TINT_ASSERT(Reader, ep_name != inner_implementation_name);
- utils::UniqueVector<uint32_t, 8> inputs;
- utils::UniqueVector<uint32_t, 8> outputs;
+ UniqueVector<uint32_t, 8> inputs;
+ UniqueVector<uint32_t, 8> outputs;
for (unsigned iarg = 3; iarg < entry_point.NumInOperands(); iarg++) {
const uint32_t var_id = entry_point.GetSingleWordInOperand(iarg);
if (const auto* var_inst = def_use_mgr_->GetDef(var_id)) {
@@ -903,9 +903,9 @@
}
}
// Save the lists, in ID-sorted order.
- utils::Vector<uint32_t, 8> sorted_inputs(inputs);
+ tint::Vector<uint32_t, 8> sorted_inputs(inputs);
std::sort(sorted_inputs.begin(), sorted_inputs.end());
- utils::Vector<uint32_t, 8> sorted_outputs(outputs);
+ tint::Vector<uint32_t, 8> sorted_outputs(outputs);
std::sort(sorted_outputs.begin(), sorted_outputs.end());
const auto ast_stage = enum_converter_.ToPipelineStage(stage);
@@ -1073,7 +1073,7 @@
}
// Compute members
- utils::Vector<const ast::StructMember*, 8> ast_members;
+ tint::Vector<const ast::StructMember*, 8> ast_members;
const auto members = struct_ty->element_types();
if (members.empty()) {
Fail() << "WGSL does not support empty structures. can't convert type: "
@@ -1173,7 +1173,7 @@
// Now make the struct.
auto sym = builder_.Symbols().Register(name);
auto* ast_struct =
- create<ast::Struct>(Source{}, builder_.Ident(sym), std::move(ast_members), utils::Empty);
+ create<ast::Struct>(Source{}, builder_.Ident(sym), std::move(ast_members), tint::Empty);
if (num_non_writable_members == members.size()) {
read_only_struct_types_.insert(ast_struct->name->symbol);
}
@@ -1616,7 +1616,7 @@
const ast::Let* ASTParser::MakeLet(uint32_t id, const ast::Expression* initializer) {
auto sym = builder_.Symbols().Register(namer_.Name(id));
- return builder_.Let(Source{}, sym, initializer, utils::Empty);
+ return builder_.Let(Source{}, sym, initializer, tint::Empty);
}
const ast::Override* ASTParser::MakeOverride(uint32_t id,
@@ -1858,7 +1858,7 @@
auto z = MakeConstantExpression(workgroup_size_builtin_.z_id);
auto* ast_type = ty_.Vector(x.type, 3);
return {ast_type, builder_.Call(Source{}, ast_type->Build(builder_),
- utils::Vector{x.expr, y.expr, z.expr})};
+ tint::Vector{x.expr, y.expr, z.expr})};
} else if (id == workgroup_size_builtin_.x_id) {
return MakeConstantExpressionForScalarSpirvConstant(
Source{}, ConvertType(workgroup_size_builtin_.component_type_id),
diff --git a/src/tint/lang/spirv/reader/ast_parser/ast_parser.h b/src/tint/lang/spirv/reader/ast_parser/ast_parser.h
index ea62390..54b4e7a 100644
--- a/src/tint/lang/spirv/reader/ast_parser/ast_parser.h
+++ b/src/tint/lang/spirv/reader/ast_parser/ast_parser.h
@@ -123,7 +123,7 @@
/// Parser implementation for SPIR-V.
class ASTParser {
- using ExpressionList = utils::Vector<const ast::Expression*, 8>;
+ using ExpressionList = tint::Vector<const ast::Expression*, 8>;
public:
/// Creates a new parser
@@ -819,7 +819,7 @@
// Is the parse successful?
bool success_ = true;
// Collector for diagnostic messages.
- utils::StringStream errors_;
+ StringStream errors_;
FailStream fail_stream_;
spvtools::MessageConsumer message_consumer_;
@@ -906,7 +906,7 @@
std::unordered_map<const spvtools::opt::Instruction*, const Type*> handle_type_;
/// Maps the SPIR-V ID of a module-scope variable to its AST variable.
- utils::Hashmap<uint32_t, ModuleVariable, 16> module_variable_;
+ Hashmap<uint32_t, ModuleVariable, 16> module_variable_;
// Set of symbols of declared type that have been added, used to avoid
// adding duplicates.
diff --git a/src/tint/lang/spirv/reader/ast_parser/attributes.h b/src/tint/lang/spirv/reader/ast_parser/attributes.h
index 3a56fe2..b13e2f8 100644
--- a/src/tint/lang/spirv/reader/ast_parser/attributes.h
+++ b/src/tint/lang/spirv/reader/ast_parser/attributes.h
@@ -71,9 +71,9 @@
}
/// The attributes
- utils::Vector<const ast::Attribute*, 8> list;
+ tint::Vector<const ast::Attribute*, 8> list;
/// The additional metadata flags
- utils::EnumSet<Flags> flags;
+ tint::EnumSet<Flags> flags;
};
} // namespace tint::spirv::reader
diff --git a/src/tint/lang/spirv/reader/ast_parser/construct.h b/src/tint/lang/spirv/reader/ast_parser/construct.h
index e14c8a2..bcc35a3 100644
--- a/src/tint/lang/spirv/reader/ast_parser/construct.h
+++ b/src/tint/lang/spirv/reader/ast_parser/construct.h
@@ -147,7 +147,7 @@
};
/// ConstructList is a list of Construct unique pointers.
-using ConstructList = utils::Vector<std::unique_ptr<Construct>, 8>;
+using ConstructList = tint::Vector<std::unique_ptr<Construct>, 8>;
/// Converts a construct kind to a string.
/// @param kind the construct kind to convert
@@ -173,7 +173,7 @@
/// @returns a short summary string
inline std::string ToStringBrief(const Construct* c) {
if (c) {
- utils::StringStream ss;
+ StringStream ss;
ss << ToString(c->kind) << "@" << c->begin_id;
return ss.str();
}
@@ -184,7 +184,7 @@
/// @param o the stream
/// @param c the structured construct
/// @returns the stream
-inline utils::StringStream& operator<<(utils::StringStream& o, const Construct& c) {
+inline StringStream& operator<<(StringStream& o, const Construct& c) {
o << "Construct{ " << ToString(c.kind) << " [" << c.begin_pos << "," << c.end_pos << ")"
<< " begin_id:" << c.begin_id << " end_id:" << c.end_id << " depth:" << c.depth;
@@ -215,8 +215,7 @@
/// @param o the stream
/// @param c the structured construct
/// @returns the stream
-inline utils::StringStream& operator<<(utils::StringStream& o,
- const std::unique_ptr<Construct>& c) {
+inline StringStream& operator<<(StringStream& o, const std::unique_ptr<Construct>& c) {
return o << *(c.get());
}
@@ -224,7 +223,7 @@
/// @param c the construct
/// @returns the string representation
inline std::string ToString(const Construct& c) {
- utils::StringStream ss;
+ StringStream ss;
ss << c;
return ss.str();
}
@@ -247,7 +246,7 @@
/// @param o the stream
/// @param cl the construct list
/// @returns the stream
-inline utils::StringStream& operator<<(utils::StringStream& o, const ConstructList& cl) {
+inline StringStream& operator<<(StringStream& o, const ConstructList& cl) {
o << "ConstructList{\n";
for (const auto& c : cl) {
o << " " << c << "\n";
@@ -260,7 +259,7 @@
/// @param cl the construct list
/// @returns the string representation
inline std::string ToString(const ConstructList& cl) {
- utils::StringStream ss;
+ StringStream ss;
ss << cl;
return ss.str();
}
diff --git a/src/tint/lang/spirv/reader/ast_parser/entry_point_info.cc b/src/tint/lang/spirv/reader/ast_parser/entry_point_info.cc
index 7725a9d..69a2e13 100644
--- a/src/tint/lang/spirv/reader/ast_parser/entry_point_info.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/entry_point_info.cc
@@ -22,8 +22,8 @@
ast::PipelineStage the_stage,
bool the_owns_inner_implementation,
std::string the_inner_name,
- utils::VectorRef<uint32_t> the_inputs,
- utils::VectorRef<uint32_t> the_outputs,
+ VectorRef<uint32_t> the_inputs,
+ VectorRef<uint32_t> the_outputs,
GridSize the_wg_size)
: name(the_name),
stage(the_stage),
diff --git a/src/tint/lang/spirv/reader/ast_parser/entry_point_info.h b/src/tint/lang/spirv/reader/ast_parser/entry_point_info.h
index 2a84d61..acddabd 100644
--- a/src/tint/lang/spirv/reader/ast_parser/entry_point_info.h
+++ b/src/tint/lang/spirv/reader/ast_parser/entry_point_info.h
@@ -48,8 +48,8 @@
ast::PipelineStage the_stage,
bool the_owns_inner_implementation,
std::string the_inner_name,
- utils::VectorRef<uint32_t> the_inputs,
- utils::VectorRef<uint32_t> the_outputs,
+ VectorRef<uint32_t> the_inputs,
+ VectorRef<uint32_t> the_outputs,
GridSize the_wg_size);
/// Copy constructor
/// @param other the other entry point info to be built from
@@ -75,9 +75,9 @@
/// The name of the inner implementation function of the entry point.
std::string inner_name;
/// IDs of pipeline input variables, sorted and without duplicates.
- utils::Vector<uint32_t, 8> inputs;
+ tint::Vector<uint32_t, 8> inputs;
/// IDs of pipeline output variables, sorted and without duplicates.
- utils::Vector<uint32_t, 8> outputs;
+ tint::Vector<uint32_t, 8> outputs;
/// If this is a compute shader, this is the workgroup size in the x, y,
/// and z dimensions set via LocalSize, or via the composite value
diff --git a/src/tint/lang/spirv/reader/ast_parser/enum_converter_test.cc b/src/tint/lang/spirv/reader/ast_parser/enum_converter_test.cc
index 0e80701..8a45c07 100644
--- a/src/tint/lang/spirv/reader/ast_parser/enum_converter_test.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/enum_converter_test.cc
@@ -46,7 +46,7 @@
protected:
bool success_ = true;
- utils::StringStream errors_;
+ StringStream errors_;
FailStream fail_stream_;
EnumConverter converter_;
};
@@ -104,7 +104,7 @@
protected:
bool success_ = true;
- utils::StringStream errors_;
+ StringStream errors_;
FailStream fail_stream_;
EnumConverter converter_;
};
@@ -165,7 +165,7 @@
protected:
bool success_ = true;
- utils::StringStream errors_;
+ StringStream errors_;
FailStream fail_stream_;
EnumConverter converter_;
};
@@ -240,7 +240,7 @@
protected:
bool success_ = true;
- utils::StringStream errors_;
+ StringStream errors_;
FailStream fail_stream_;
EnumConverter converter_;
};
@@ -312,7 +312,7 @@
protected:
bool success_ = true;
- utils::StringStream errors_;
+ StringStream errors_;
FailStream fail_stream_;
EnumConverter converter_;
};
diff --git a/src/tint/lang/spirv/reader/ast_parser/fail_stream.h b/src/tint/lang/spirv/reader/ast_parser/fail_stream.h
index 16e0a0a..19f80b6 100644
--- a/src/tint/lang/spirv/reader/ast_parser/fail_stream.h
+++ b/src/tint/lang/spirv/reader/ast_parser/fail_stream.h
@@ -29,7 +29,7 @@
/// to be a valid pointer to bool.
/// @param out output stream where a message should be written to explain
/// the failure
- FailStream(bool* status_ptr, utils::StringStream* out) : status_ptr_(status_ptr), out_(out) {}
+ FailStream(bool* status_ptr, StringStream* out) : status_ptr_(status_ptr), out_(out) {}
/// Copy constructor
/// @param other the fail stream to clone
FailStream(const FailStream& other) = default;
@@ -61,7 +61,7 @@
private:
bool* status_ptr_;
- utils::StringStream* out_;
+ StringStream* out_;
};
} // namespace tint::spirv::reader
diff --git a/src/tint/lang/spirv/reader/ast_parser/fail_stream_test.cc b/src/tint/lang/spirv/reader/ast_parser/fail_stream_test.cc
index 9116955..ab62e38 100644
--- a/src/tint/lang/spirv/reader/ast_parser/fail_stream_test.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/fail_stream_test.cc
@@ -57,7 +57,7 @@
TEST_F(FailStreamTest, ShiftOperatorAccumulatesValues) {
bool flag = true;
- utils::StringStream ss;
+ StringStream ss;
FailStream fs(&flag, &ss);
ss << "prefix ";
diff --git a/src/tint/lang/spirv/reader/ast_parser/function.cc b/src/tint/lang/spirv/reader/ast_parser/function.cc
index e6a5c24..ad14013 100644
--- a/src/tint/lang/spirv/reader/ast_parser/function.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/function.cc
@@ -674,7 +674,7 @@
VisitBackward(terminator->GetSingleWordInOperand(0));
} else if (opcode == spv::Op::OpSwitch) {
// TODO(dneto): Consider visiting the labels in literal-value order.
- utils::Vector<uint32_t, 32> successors;
+ tint::Vector<uint32_t, 32> successors;
bb->ForEachSuccessorLabel(
[&successors](const uint32_t succ_id) { successors.Push(succ_id); });
for (auto succ_id : successors) {
@@ -687,14 +687,13 @@
const spvtools::opt::Function& function_;
std::unordered_map<uint32_t, const spvtools::opt::BasicBlock*> id_to_block_;
- utils::Vector<uint32_t, 32> visit_order_;
+ tint::Vector<uint32_t, 32> visit_order_;
std::unordered_set<uint32_t> visited_;
};
/// A StatementBuilder for ast::SwitchStatement
/// @see StatementBuilder
-struct SwitchStatementBuilder final
- : public utils::Castable<SwitchStatementBuilder, StatementBuilder> {
+struct SwitchStatementBuilder final : public Castable<SwitchStatementBuilder, StatementBuilder> {
/// Constructor
/// @param cond the switch statement condition
explicit SwitchStatementBuilder(const ast::Expression* cond) : condition(cond) {}
@@ -713,12 +712,12 @@
/// Switch statement condition
const ast::Expression* const condition;
/// Switch statement cases
- utils::Vector<ast::CaseStatement*, 4> cases;
+ tint::Vector<ast::CaseStatement*, 4> cases;
};
/// A StatementBuilder for ast::IfStatement
/// @see StatementBuilder
-struct IfStatementBuilder final : public utils::Castable<IfStatementBuilder, StatementBuilder> {
+struct IfStatementBuilder final : public Castable<IfStatementBuilder, StatementBuilder> {
/// Constructor
/// @param c the if-statement condition
explicit IfStatementBuilder(const ast::Expression* c) : cond(c) {}
@@ -726,7 +725,7 @@
/// @param builder the program builder
/// @returns the built ast::IfStatement
const ast::IfStatement* Build(ProgramBuilder* builder) const override {
- return builder->create<ast::IfStatement>(Source{}, cond, body, else_stmt, utils::Empty);
+ return builder->create<ast::IfStatement>(Source{}, cond, body, else_stmt, tint::Empty);
}
/// If-statement condition
@@ -739,11 +738,11 @@
/// A StatementBuilder for ast::LoopStatement
/// @see StatementBuilder
-struct LoopStatementBuilder final : public utils::Castable<LoopStatementBuilder, StatementBuilder> {
+struct LoopStatementBuilder final : public Castable<LoopStatementBuilder, StatementBuilder> {
/// @param builder the program builder
/// @returns the built ast::LoopStatement
ast::LoopStatement* Build(ProgramBuilder* builder) const override {
- return builder->create<ast::LoopStatement>(Source{}, body, continuing, utils::Empty);
+ return builder->create<ast::LoopStatement>(Source{}, body, continuing, tint::Empty);
}
/// Loop-statement block body
@@ -873,7 +872,7 @@
auto* builder = AddStatementBuilder<IfStatementBuilder>(cond);
PushNewStatementBlock(top.GetConstruct(), end_id, [=](const StatementList& stmts) {
- builder->body = create<ast::BlockStatement>(Source{}, stmts, utils::Empty);
+ builder->body = create<ast::BlockStatement>(Source{}, stmts, tint::Empty);
});
}
@@ -885,7 +884,7 @@
auto* builder = AddStatementBuilder<IfStatementBuilder>(cond);
PushNewStatementBlock(top.GetConstruct(), end_id, [=](const StatementList& stmts) {
- builder->body = create<ast::BlockStatement>(Source{}, stmts, utils::Empty);
+ builder->body = create<ast::BlockStatement>(Source{}, stmts, tint::Empty);
});
}
@@ -975,7 +974,7 @@
statements_stack_[0].Finalize(&builder_);
auto& statements = statements_stack_[0].GetStatements();
- auto* body = create<ast::BlockStatement>(Source{}, statements, utils::Empty);
+ auto* body = create<ast::BlockStatement>(Source{}, statements, tint::Empty);
// Maintain the invariant by repopulating the one and only element.
statements_stack_.Clear();
@@ -986,7 +985,7 @@
bool FunctionEmitter::EmitPipelineInput(std::string var_name,
const Type* var_type,
- utils::Vector<int, 8> index_prefix,
+ tint::Vector<int, 8> index_prefix,
const Type* tip_type,
const Type* forced_param_type,
Attributes& attrs,
@@ -1118,7 +1117,7 @@
bool FunctionEmitter::EmitPipelineOutput(std::string var_name,
const Type* var_type,
- utils::Vector<int, 8> index_prefix,
+ tint::Vector<int, 8> index_prefix,
const Type* tip_type,
const Type* forced_member_type,
Attributes& attrs,
@@ -1239,7 +1238,7 @@
Source source;
// The statements in the body.
- utils::Vector<const ast::Statement*, 8> stmts;
+ tint::Vector<const ast::Statement*, 8> stmts;
FunctionDeclaration decl;
decl.source = source;
@@ -1317,7 +1316,7 @@
const auto var_name = namer_.GetName(var_id);
return_members.Push(
builder_.Member(var_name, param_type->Build(builder_),
- utils::Vector{
+ tint::Vector{
builder_.Builtin(source, builtin::BuiltinValue::kPosition),
}));
return_exprs.Push(builder_.Expr(var_name));
@@ -1369,7 +1368,7 @@
} else {
// Create and register the result type.
auto* str = create<ast::Struct>(Source{}, builder_.Ident(return_struct_sym),
- return_members, utils::Empty);
+ return_members, tint::Empty);
parser_impl_.AddTypeDecl(return_struct_sym, str);
return_type = builder_.ty.Of(str);
@@ -1379,7 +1378,7 @@
}
}
- utils::Vector<const ast::Attribute*, 2> fn_attrs{
+ tint::Vector<const ast::Attribute*, 2> fn_attrs{
create<ast::StageAttribute>(source, ep_info_->stage),
};
@@ -1771,7 +1770,7 @@
const auto entry_id = block_order_[0];
// The stack of enclosing constructs.
- utils::Vector<Construct*, 4> enclosing;
+ tint::Vector<Construct*, 4> enclosing;
// Creates a control flow construct and pushes it onto the stack.
// Its parent is the top of the stack, or nullptr if the stack is empty.
@@ -1852,7 +1851,7 @@
// If the loop header branches to two different blocks inside the loop
// construct, then the loop body should be modeled as an if-selection
// construct
- utils::Vector<uint32_t, 4> targets;
+ tint::Vector<uint32_t, 4> targets;
header_info->basic_block->ForEachSuccessorLabel(
[&targets](const uint32_t target) { targets.Push(target); });
if ((targets.Length() == 2u) && targets[0] != targets[1]) {
@@ -1946,8 +1945,8 @@
default_block->default_is_merge = default_block->pos == construct->end_pos;
// Map a case target to the list of values selecting that case.
- std::unordered_map<uint32_t, utils::Vector<uint64_t, 4>> block_to_values;
- utils::Vector<uint32_t, 4> case_targets;
+ std::unordered_map<uint32_t, tint::Vector<uint64_t, 4>> block_to_values;
+ tint::Vector<uint32_t, 4> case_targets;
std::unordered_set<uint64_t> case_values;
// Process case targets.
@@ -2084,7 +2083,7 @@
const auto& src_construct = *(src_info->construct);
// Compute the ordered list of unique successors.
- utils::Vector<uint32_t, 4> successors;
+ tint::Vector<uint32_t, 4> successors;
{
std::unordered_set<uint32_t> visited;
src_info->basic_block->ForEachSuccessorLabel(
@@ -2103,8 +2102,8 @@
// These count toward the need to have a merge instruction. We also track kIfBreak edges
// because when used with normal forward edges, we'll need to generate a flow guard
// variable.
- utils::Vector<uint32_t, 4> normal_forward_edges;
- utils::Vector<uint32_t, 4> if_break_edges;
+ tint::Vector<uint32_t, 4> normal_forward_edges;
+ tint::Vector<uint32_t, 4> if_break_edges;
if (successors.IsEmpty() && src_construct.enclosing_continue) {
// Kill and return are not allowed in a continue construct.
@@ -2663,7 +2662,7 @@
// Enter new constructs.
- utils::Vector<const Construct*, 4> entering_constructs; // inner most comes first
+ tint::Vector<const Construct*, 4> entering_constructs; // inner most comes first
{
auto* here = block_info.construct;
auto* const top_construct = statements_stack_.Back().GetConstruct();
@@ -2906,7 +2905,7 @@
if (!stmts.IsEmpty()) {
// The "else" consists of the statement list from the top of
// statements stack, without an "else if" condition.
- builder->else_stmt = create<ast::BlockStatement>(Source{}, stmts, utils::Empty);
+ builder->else_stmt = create<ast::BlockStatement>(Source{}, stmts, tint::Empty);
}
});
if (false_is_break) {
@@ -2953,7 +2952,7 @@
// Push the then clause onto the stack.
PushNewStatementBlock(construct, then_end, [=](const StatementList& stmts) {
- builder->body = create<ast::BlockStatement>(Source{}, stmts, utils::Empty);
+ builder->body = create<ast::BlockStatement>(Source{}, stmts, tint::Empty);
});
if (true_is_break) {
AddStatement(create<ast::BreakStatement>(Source{}));
@@ -2989,7 +2988,7 @@
// We will push statement-blocks onto the stack to gather the statements in
// the default clause and cases clauses. Determine the list of blocks
// that start each clause.
- utils::Vector<const BlockInfo*, 4> clause_heads;
+ tint::Vector<const BlockInfo*, 4> clause_heads;
// Collect the case clauses, even if they are just the merge block.
// First the default clause.
@@ -3026,7 +3025,7 @@
for (size_t i = last_clause_index;; --i) {
// Create a list of integer literals for the selector values leading to
// this case clause.
- utils::Vector<const ast::CaseSelector*, 4> selectors;
+ tint::Vector<const ast::CaseSelector*, 4> selectors;
const bool has_selectors = clause_heads[i]->case_values.has_value();
if (has_selectors) {
auto values = clause_heads[i]->case_values.value();
@@ -3066,7 +3065,7 @@
auto case_idx = swch->cases.Length();
swch->cases.Push(nullptr);
PushNewStatementBlock(construct, end_id, [=](const StatementList& stmts) {
- auto* body = create<ast::BlockStatement>(Source{}, stmts, utils::Empty);
+ auto* body = create<ast::BlockStatement>(Source{}, stmts, tint::Empty);
swch->cases[case_idx] = create<ast::CaseStatement>(Source{}, selectors, body);
});
@@ -3081,7 +3080,7 @@
bool FunctionEmitter::EmitLoopStart(const Construct* construct) {
auto* builder = AddStatementBuilder<LoopStatementBuilder>();
PushNewStatementBlock(construct, construct->end_id, [=](const StatementList& stmts) {
- builder->body = create<ast::BlockStatement>(Source{}, stmts, utils::Empty);
+ builder->body = create<ast::BlockStatement>(Source{}, stmts, tint::Empty);
});
return success();
}
@@ -3096,7 +3095,7 @@
"expected loop on top of stack";
}
PushNewStatementBlock(construct, construct->end_id, [=](const StatementList& stmts) {
- loop->continuing = create<ast::BlockStatement>(Source{}, stmts, utils::Empty);
+ loop->continuing = create<ast::BlockStatement>(Source{}, stmts, tint::Empty);
});
return success();
@@ -3318,15 +3317,15 @@
if (then_stmt != nullptr) {
if_stmts.Push(then_stmt);
}
- auto* if_block = create<ast::BlockStatement>(Source{}, if_stmts, utils::Empty);
+ auto* if_block = create<ast::BlockStatement>(Source{}, if_stmts, tint::Empty);
const ast::Statement* else_block = nullptr;
if (else_stmt) {
- else_block = create<ast::BlockStatement>(StatementList{else_stmt}, utils::Empty);
+ else_block = create<ast::BlockStatement>(StatementList{else_stmt}, tint::Empty);
}
auto* if_stmt =
- create<ast::IfStatement>(Source{}, condition, if_block, else_block, utils::Empty);
+ create<ast::IfStatement>(Source{}, condition, if_block, else_block, tint::Empty);
return if_stmt;
}
@@ -3380,7 +3379,7 @@
// Do it in index order.
if (!block_info.phi_assignments.IsEmpty()) {
// Keep only the phis that are used.
- utils::Vector<BlockInfo::PhiAssignment, 4> worklist;
+ tint::Vector<BlockInfo::PhiAssignment, 4> worklist;
worklist.Reserve(block_info.phi_assignments.Length());
for (const auto assignment : block_info.phi_assignments) {
if (GetDefInfo(assignment.phi_id)->local->num_uses > 0) {
@@ -3400,13 +3399,13 @@
// the assignments.
// The set of IDs that are read by the assignments.
- utils::Hashset<uint32_t, 8> read_set;
+ Hashset<uint32_t, 8> read_set;
for (const auto assignment : worklist) {
read_set.Add(assignment.value_id);
}
// Generate a let-declaration to capture the current value of each phi
// that will be both read and written.
- utils::Hashmap<uint32_t, Symbol, 8> copied_phis;
+ Hashmap<uint32_t, Symbol, 8> copied_phis;
for (const auto assignment : worklist) {
const auto phi_id = assignment.phi_id;
if (read_set.Contains(phi_id)) {
@@ -3984,7 +3983,7 @@
auto e1 = MakeOperand(inst, 2);
auto e2 = ToSignedIfUnsigned(MakeOperand(inst, 3));
- return {e1.type, builder_.Call("ldexp", utils::Vector{e1.expr, e2.expr})};
+ return {e1.type, builder_.Call("ldexp", tint::Vector{e1.expr, e2.expr})};
}
auto* result_type = parser_impl_.ConvertType(inst.type_id());
@@ -4020,7 +4019,7 @@
ty_.F32(),
builder_.Call(
Source{}, "select",
- utils::Vector{
+ tint::Vector{
create<ast::UnaryOpExpression>(Source{}, ast::UnaryOp::kNegation,
normal.expr),
normal.expr,
@@ -4063,7 +4062,7 @@
f32,
builder_.MemberAccessor(
builder_.Call("refract",
- utils::Vector{
+ tint::Vector{
builder_.Call("vec2f", incident.expr, 0_f),
builder_.Call("vec2f", normal.expr, 0_f),
eta.expr,
@@ -5720,7 +5719,7 @@
if (is_non_dref_sample || (op == spv::Op::OpImageFetch)) {
value = builder_.Call(Source{},
result_type->Build(builder_), // a vec4
- utils::Vector{
+ tint::Vector{
value,
parser_impl_.MakeNullValue(result_component_type),
parser_impl_.MakeNullValue(result_component_type),
@@ -5828,7 +5827,7 @@
// The WGSL bulitin returns u32.
// If they aren't the same then convert the result.
if (!result_type->Is<U32>()) {
- ast_expr = builder_.Call(result_type->Build(builder_), utils::Vector{ast_expr});
+ ast_expr = builder_.Call(result_type->Build(builder_), tint::Vector{ast_expr});
}
TypedExpression expr{result_type, ast_expr};
return EmitConstDefOrWriteToHoistedVar(inst, expr);
@@ -5865,7 +5864,7 @@
Source{}, builder_.Symbols().New(std::string("stub_") + builtin::str(builtin)),
std::move(params), ret_type,
/* body */ nullptr,
- utils::Vector{
+ tint::Vector{
builder_.ASTNodes().Create<ast::transform::SpirvAtomic::Stub>(
builder_.ID(), builder_.AllocateNodeID(), builtin),
builder_.Disable(ast::DisabledValidation::kFunctionHasNoBody),
@@ -6147,14 +6146,14 @@
if (!value || value.type->Is<I32>()) {
return value;
}
- return {ty_.I32(), builder_.Call(builder_.ty.i32(), utils::Vector{value.expr})};
+ return {ty_.I32(), builder_.Call(builder_.ty.i32(), tint::Vector{value.expr})};
}
TypedExpression FunctionEmitter::ToU32(TypedExpression value) {
if (!value || value.type->Is<U32>()) {
return value;
}
- return {ty_.U32(), builder_.Call(builder_.ty.u32(), utils::Vector{value.expr})};
+ return {ty_.U32(), builder_.Call(builder_.ty.u32(), tint::Vector{value.expr})};
}
TypedExpression FunctionEmitter::ToSignedIfUnsigned(TypedExpression value) {
@@ -6163,7 +6162,7 @@
}
if (auto* vec_type = value.type->As<Vector>()) {
auto* new_type = ty_.Vector(ty_.I32(), vec_type->size);
- return {new_type, builder_.Call(new_type->Build(builder_), utils::Vector{value.expr})};
+ return {new_type, builder_.Call(new_type->Build(builder_), tint::Vector{value.expr})};
}
return ToI32(value);
}
diff --git a/src/tint/lang/spirv/reader/ast_parser/function.h b/src/tint/lang/spirv/reader/ast_parser/function.h
index ed589dd..91544ab 100644
--- a/src/tint/lang/spirv/reader/ast_parser/function.h
+++ b/src/tint/lang/spirv/reader/ast_parser/function.h
@@ -128,7 +128,7 @@
/// switch?
bool default_is_merge = false;
/// The list of switch values that cause a branch to this block.
- std::optional<utils::Vector<uint64_t, 4>> case_values;
+ std::optional<tint::Vector<uint64_t, 4>> case_values;
/// The following fields record relationships among blocks in a selection
/// construct for an OpBranchConditional instruction.
@@ -161,7 +161,7 @@
/// The result IDs that this block is responsible for declaring as a
/// hoisted variable.
/// @see DefInfo#requires_hoisted_var_def
- utils::Vector<uint32_t, 4> hoisted_ids;
+ tint::Vector<uint32_t, 4> hoisted_ids;
/// A PhiAssignment represents the assignment of a value to the state
/// variable associated with an OpPhi in a successor block.
@@ -173,17 +173,17 @@
};
/// If this basic block branches to a visited basic block containing phis,
/// then this is the list of writes to the variables associated those phis.
- utils::Vector<PhiAssignment, 4> phi_assignments;
+ tint::Vector<PhiAssignment, 4> phi_assignments;
/// The IDs of OpPhi instructions which require their associated state
/// variable to be declared in this basic block.
- utils::Vector<uint32_t, 4> phis_needing_state_vars;
+ tint::Vector<uint32_t, 4> phis_needing_state_vars;
};
/// Writes the BlockInfo to the stream
/// @param o the stream
/// @param bi the BlockInfo
/// @returns the stream so calls can be chained
-inline utils::StringStream& operator<<(utils::StringStream& o, const BlockInfo& bi) {
+inline StringStream& operator<<(StringStream& o, const BlockInfo& bi) {
o << "BlockInfo{"
<< " id: " << bi.id << " pos: " << bi.pos << " merge_for_header: " << bi.merge_for_header
<< " continue_for_header: " << bi.continue_for_header
@@ -358,7 +358,7 @@
/// @param o the stream
/// @param di the DefInfo
/// @returns the stream so calls can be chained
-inline utils::StringStream& operator<<(utils::StringStream& o, const DefInfo& di) {
+inline StringStream& operator<<(StringStream& o, const DefInfo& di) {
o << "DefInfo{"
<< " inst.result_id: " << di.inst.result_id();
if (di.local.has_value()) {
@@ -407,7 +407,7 @@
/// become immutable. The builders may hold mutable state while the
/// StatementBlock is being constructed, which becomes an immutable node on
/// StatementBlock::Finalize().
-class StatementBuilder : public utils::Castable<StatementBuilder, ast::Statement> {
+class StatementBuilder : public Castable<StatementBuilder, ast::Statement> {
public:
/// Constructor
StatementBuilder() : Base(GenerationID(), ast::NodeID(), Source{}) {}
@@ -422,10 +422,10 @@
/// A FunctionEmitter emits a SPIR-V function onto a Tint AST module.
class FunctionEmitter {
- using StructMemberList = utils::Vector<const ast::StructMember*, 8>;
- using ExpressionList = utils::Vector<const ast::Expression*, 8>;
- using ParameterList = utils::Vector<const ast::Parameter*, 8>;
- using StatementList = utils::Vector<const ast::Statement*, 8>;
+ using StructMemberList = tint::Vector<const ast::StructMember*, 8>;
+ using ExpressionList = tint::Vector<const ast::Expression*, 8>;
+ using ParameterList = tint::Vector<const ast::Parameter*, 8>;
+ using StatementList = tint::Vector<const ast::Statement*, 8>;
public:
/// Creates a FunctionEmitter, and prepares to write to the AST module
@@ -493,7 +493,7 @@
/// @returns false if emission failed
bool EmitPipelineInput(std::string var_name,
const Type* var_type,
- utils::Vector<int, 8> index_prefix,
+ tint::Vector<int, 8> index_prefix,
const Type* tip_type,
const Type* forced_param_type,
Attributes& attributes,
@@ -519,7 +519,7 @@
/// @returns false if emission failed
bool EmitPipelineOutput(std::string var_name,
const Type* var_type,
- utils::Vector<int, 8> index_prefix,
+ tint::Vector<int, 8> index_prefix,
const Type* tip_type,
const Type* forced_member_type,
Attributes& attributes,
@@ -1316,7 +1316,7 @@
// for the entire function. This stack is never empty.
// The `construct` member for the 0th element is only valid during the
// lifetime of the EmitFunctionBodyStatements method.
- utils::Vector<StatementBlock, 8> statements_stack_;
+ tint::Vector<StatementBlock, 8> statements_stack_;
// The map of IDs that have already had an identifier name generated for it,
// to their Type.
diff --git a/src/tint/lang/spirv/reader/ast_parser/function_arithmetic_test.cc b/src/tint/lang/spirv/reader/ast_parser/function_arithmetic_test.cc
index ea98948..4ba6734 100644
--- a/src/tint/lang/spirv/reader/ast_parser/function_arithmetic_test.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/function_arithmetic_test.cc
@@ -309,7 +309,7 @@
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error() << "\n" << assembly;
auto fe = p->function_emitter(100);
EXPECT_TRUE(fe.EmitBody()) << p->error();
- utils::StringStream ss;
+ StringStream ss;
ss << "let x_1 = (" << GetParam().ast_lhs << " " << GetParam().ast_op << " "
<< GetParam().ast_rhs << ");";
auto ast_body = fe.ast_body();
@@ -349,7 +349,7 @@
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error() << "\n" << assembly;
auto fe = p->function_emitter(100);
EXPECT_TRUE(fe.EmitBody()) << p->error();
- utils::StringStream ss;
+ StringStream ss;
ss << "let x_1 = " << GetParam().expected << ";";
auto ast_body = fe.ast_body();
auto got = test::ToString(p->program(), ast_body);
diff --git a/src/tint/lang/spirv/reader/ast_parser/function_bit_test.cc b/src/tint/lang/spirv/reader/ast_parser/function_bit_test.cc
index 9792733..20690f7 100644
--- a/src/tint/lang/spirv/reader/ast_parser/function_bit_test.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/function_bit_test.cc
@@ -128,7 +128,7 @@
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error() << "\n" << assembly;
auto fe = p->function_emitter(100);
EXPECT_TRUE(fe.EmitBody()) << p->error();
- utils::StringStream ss;
+ StringStream ss;
ss << "let x_1 = (" << GetParam().ast_lhs << " " << GetParam().ast_op << " "
<< GetParam().ast_rhs << ");";
auto ast_body = fe.ast_body();
@@ -166,7 +166,7 @@
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error() << "\n" << assembly;
auto fe = p->function_emitter(100);
EXPECT_TRUE(fe.EmitBody()) << p->error() << assembly;
- utils::StringStream ss;
+ StringStream ss;
ss << "let x_1 = " << GetParam().expected << ";\nreturn;\n";
auto ast_body = fe.ast_body();
auto got = test::ToString(p->program(), ast_body);
diff --git a/src/tint/lang/spirv/reader/ast_parser/function_call_test.cc b/src/tint/lang/spirv/reader/ast_parser/function_call_test.cc
index 10fa31e..7534fd7 100644
--- a/src/tint/lang/spirv/reader/ast_parser/function_call_test.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/function_call_test.cc
@@ -123,13 +123,13 @@
OpFunctionEnd
)"));
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
- utils::Vector<const ast::Statement*, 4> f100;
+ tint::Vector<const ast::Statement*, 4> f100;
{
auto fe = p->function_emitter(100);
EXPECT_TRUE(fe.EmitBody()) << p->error();
f100 = fe.ast_body();
}
- utils::Vector<const ast::Statement*, 4> f50;
+ tint::Vector<const ast::Statement*, 4> f50;
{
auto fe = p->function_emitter(50);
EXPECT_TRUE(fe.EmitBody()) << p->error();
@@ -164,13 +164,13 @@
OpFunctionEnd
)"));
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
- utils::Vector<const ast::Statement*, 4> f100;
+ tint::Vector<const ast::Statement*, 4> f100;
{
auto fe = p->function_emitter(100);
EXPECT_TRUE(fe.EmitBody()) << p->error();
f100 = fe.ast_body();
}
- utils::Vector<const ast::Statement*, 4> f50;
+ tint::Vector<const ast::Statement*, 4> f50;
{
auto fe = p->function_emitter(50);
EXPECT_TRUE(fe.EmitBody()) << p->error();
diff --git a/src/tint/lang/spirv/reader/ast_parser/function_cfg_test.cc b/src/tint/lang/spirv/reader/ast_parser/function_cfg_test.cc
index 073629a..336e886 100644
--- a/src/tint/lang/spirv/reader/ast_parser/function_cfg_test.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/function_cfg_test.cc
@@ -28,7 +28,7 @@
using SpvParserCFGTest = SpirvASTParserTest;
std::string Dump(const std::vector<uint32_t>& v) {
- utils::StringStream o;
+ tint::StringStream o;
o << "{";
for (auto a : v) {
o << a << " ";
@@ -2599,7 +2599,7 @@
fe.RegisterMerges();
EXPECT_FALSE(fe.VerifyHeaderContinueMergeOrder());
- utils::StringStream result;
+ tint::StringStream result;
result << *fe.GetBlockInfo(50) << std::endl << *fe.GetBlockInfo(20) << std::endl;
EXPECT_THAT(p->error(), Eq("Header 50 does not strictly dominate its merge block 20"))
<< result.str() << Dump(fe.block_order());
@@ -2635,7 +2635,7 @@
fe.ComputeBlockOrderAndPositions();
fe.RegisterMerges();
EXPECT_FALSE(fe.VerifyHeaderContinueMergeOrder());
- utils::StringStream str;
+ tint::StringStream str;
str << *fe.GetBlockInfo(50) << std::endl << *fe.GetBlockInfo(20) << std::endl;
EXPECT_THAT(p->error(), Eq("Loop header 50 does not dominate its continue target 20"))
<< str.str() << Dump(fe.block_order());
@@ -2754,7 +2754,7 @@
const auto& constructs = fe.constructs();
EXPECT_EQ(constructs.Length(), 2u);
- utils::StringStream str;
+ tint::StringStream str;
str << constructs;
EXPECT_THAT(ToString(constructs), Eq(R"(ConstructList{
@@ -2805,7 +2805,7 @@
const auto& constructs = fe.constructs();
EXPECT_EQ(constructs.Length(), 2u);
- utils::StringStream str;
+ tint::StringStream str;
str << constructs;
EXPECT_THAT(ToString(constructs), Eq(R"(ConstructList{
@@ -2854,7 +2854,7 @@
const auto& constructs = fe.constructs();
EXPECT_EQ(constructs.Length(), 2u);
- utils::StringStream str;
+ tint::StringStream str;
str << constructs;
EXPECT_THAT(ToString(constructs), Eq(R"(ConstructList{
@@ -2896,7 +2896,7 @@
const auto& constructs = fe.constructs();
EXPECT_EQ(constructs.Length(), 2u);
- utils::StringStream str;
+ tint::StringStream str;
str << constructs;
// A single-block loop consists *only* of a continue target with one block in
@@ -2947,7 +2947,7 @@
EXPECT_TRUE(fe.LabelControlFlowConstructs());
const auto& constructs = fe.constructs();
- utils::StringStream str;
+ tint::StringStream str;
str << constructs;
EXPECT_THAT(ToString(constructs), Eq(R"(ConstructList{
@@ -3000,7 +3000,7 @@
EXPECT_TRUE(fe.LabelControlFlowConstructs());
const auto& constructs = fe.constructs();
- utils::StringStream str;
+ tint::StringStream str;
str << constructs;
EXPECT_THAT(ToString(constructs), Eq(R"(ConstructList{
@@ -3051,7 +3051,7 @@
const auto& constructs = fe.constructs();
EXPECT_EQ(constructs.Length(), 3u);
- utils::StringStream str;
+ tint::StringStream str;
str << constructs;
// A single-block loop consists *only* of a continue target with one block in
@@ -3104,7 +3104,7 @@
const auto& constructs = fe.constructs();
EXPECT_EQ(constructs.Length(), 4u);
- utils::StringStream str;
+ tint::StringStream str;
str << constructs;
EXPECT_THAT(ToString(constructs), Eq(R"(ConstructList{
@@ -3168,7 +3168,7 @@
const auto& constructs = fe.constructs();
EXPECT_EQ(constructs.Length(), 4u);
- utils::StringStream str;
+ tint::StringStream str;
str << constructs;
EXPECT_THAT(ToString(constructs), Eq(R"(ConstructList{
@@ -3233,7 +3233,7 @@
const auto& constructs = fe.constructs();
EXPECT_EQ(constructs.Length(), 4u);
- utils::StringStream str;
+ tint::StringStream str;
str << constructs;
// The ordering among siblings depends on the computed block order.
@@ -3288,7 +3288,7 @@
const auto& constructs = fe.constructs();
EXPECT_EQ(constructs.Length(), 3u);
- utils::StringStream str;
+ tint::StringStream str;
str << constructs;
EXPECT_THAT(ToString(constructs), Eq(R"(ConstructList{
@@ -3347,7 +3347,7 @@
const auto& constructs = fe.constructs();
EXPECT_EQ(constructs.Length(), 4u);
- utils::StringStream str;
+ tint::StringStream str;
str << constructs;
EXPECT_THAT(ToString(constructs), Eq(R"(ConstructList{
@@ -3407,7 +3407,7 @@
const auto& constructs = fe.constructs();
EXPECT_EQ(constructs.Length(), 4u);
- utils::StringStream str;
+ tint::StringStream str;
str << constructs;
EXPECT_THAT(ToString(constructs), Eq(R"(ConstructList{
@@ -3463,7 +3463,7 @@
const auto& constructs = fe.constructs();
EXPECT_EQ(constructs.Length(), 4u);
- utils::StringStream str;
+ tint::StringStream str;
str << constructs;
EXPECT_THAT(ToString(constructs), Eq(R"(ConstructList{
@@ -3511,7 +3511,7 @@
const auto& constructs = fe.constructs();
EXPECT_EQ(constructs.Length(), 3u);
- utils::StringStream str;
+ tint::StringStream str;
str << constructs;
EXPECT_THAT(ToString(constructs), Eq(R"(ConstructList{
@@ -3564,7 +3564,7 @@
const auto& constructs = fe.constructs();
EXPECT_EQ(constructs.Length(), 4u);
- utils::StringStream str;
+ tint::StringStream str;
str << constructs;
EXPECT_THAT(ToString(constructs), Eq(R"(ConstructList{
@@ -3619,7 +3619,7 @@
const auto& constructs = fe.constructs();
EXPECT_EQ(constructs.Length(), 4u);
- utils::StringStream str;
+ tint::StringStream str;
str << constructs;
ASSERT_THAT(ToString(constructs), Eq(R"(ConstructList{
diff --git a/src/tint/lang/spirv/reader/ast_parser/function_decl_test.cc b/src/tint/lang/spirv/reader/ast_parser/function_decl_test.cc
index ea17cb3..3f36fc8 100644
--- a/src/tint/lang/spirv/reader/ast_parser/function_decl_test.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/function_decl_test.cc
@@ -35,7 +35,7 @@
/// @returns a SPIR-V assembly segment which assigns debug names
/// to particular IDs.
std::string Names(std::vector<std::string> ids) {
- utils::StringStream outs;
+ StringStream outs;
for (auto& id : ids) {
outs << " OpName %" << id << " \"" << id << "\"\n";
}
diff --git a/src/tint/lang/spirv/reader/ast_parser/function_logical_test.cc b/src/tint/lang/spirv/reader/ast_parser/function_logical_test.cc
index b79d803..4e49cba 100644
--- a/src/tint/lang/spirv/reader/ast_parser/function_logical_test.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/function_logical_test.cc
@@ -189,7 +189,7 @@
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error() << "\n" << assembly;
auto fe = p->function_emitter(100);
EXPECT_TRUE(fe.EmitBody()) << p->error();
- utils::StringStream ss;
+ StringStream ss;
ss << "let x_1 = (" << GetParam().ast_lhs << " " << GetParam().ast_op << " "
<< GetParam().ast_rhs << ");";
auto ast_body = fe.ast_body();
diff --git a/src/tint/lang/spirv/reader/ast_parser/function_var_test.cc b/src/tint/lang/spirv/reader/ast_parser/function_var_test.cc
index cc594ee..cce99eb 100644
--- a/src/tint/lang/spirv/reader/ast_parser/function_var_test.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/function_var_test.cc
@@ -27,7 +27,7 @@
/// @returns a SPIR-V assembly segment which assigns debug names
/// to particular IDs.
std::string Names(std::vector<std::string> ids) {
- utils::StringStream outs;
+ StringStream outs;
for (auto& id : ids) {
outs << " OpName %" << id << " \"" << id << "\"\n";
}
diff --git a/src/tint/lang/spirv/reader/ast_parser/handle_test.cc b/src/tint/lang/spirv/reader/ast_parser/handle_test.cc
index ebeb0ac..ee5ec63 100644
--- a/src/tint/lang/spirv/reader/ast_parser/handle_test.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/handle_test.cc
@@ -236,7 +236,7 @@
}
std::string Bindings(std::vector<uint32_t> ids) {
- utils::StringStream os;
+ StringStream os;
int binding = 0;
for (auto id : ids) {
os << " OpDecorate %" << id << " DescriptorSet 0\n"
diff --git a/src/tint/lang/spirv/reader/ast_parser/module_function_decl_test.cc b/src/tint/lang/spirv/reader/ast_parser/module_function_decl_test.cc
index ca1f50a..6063569 100644
--- a/src/tint/lang/spirv/reader/ast_parser/module_function_decl_test.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/module_function_decl_test.cc
@@ -48,7 +48,7 @@
/// @returns a SPIR-V assembly segment which assigns debug names
/// to particular IDs.
std::string Names(std::vector<std::string> ids) {
- utils::StringStream outs;
+ StringStream outs;
for (auto& id : ids) {
outs << " OpName %" << id << " \"" << id << "\"\n";
}
diff --git a/src/tint/lang/spirv/reader/ast_parser/module_var_test.cc b/src/tint/lang/spirv/reader/ast_parser/module_var_test.cc
index 610ba06..debaea3 100644
--- a/src/tint/lang/spirv/reader/ast_parser/module_var_test.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/module_var_test.cc
@@ -3239,13 +3239,13 @@
}
)";
- expected = utils::ReplaceAll(expected, "${wgsl_type}", wgsl_type);
- expected = utils::ReplaceAll(expected, "${unsigned_wgsl_type}", unsigned_wgsl_type);
- expected = utils::ReplaceAll(expected, "${wgsl_builtin}", wgsl_builtin);
- expected = utils::ReplaceAll(expected, "${assignment_value}",
- (wgsl_type == unsigned_wgsl_type)
- ? "x_1_param"
- : "bitcast<" + signed_wgsl_type + ">(x_1_param)");
+ expected = tint::ReplaceAll(expected, "${wgsl_type}", wgsl_type);
+ expected = tint::ReplaceAll(expected, "${unsigned_wgsl_type}", unsigned_wgsl_type);
+ expected = tint::ReplaceAll(expected, "${wgsl_builtin}", wgsl_builtin);
+ expected = tint::ReplaceAll(expected, "${assignment_value}",
+ (wgsl_type == unsigned_wgsl_type)
+ ? "x_1_param"
+ : "bitcast<" + signed_wgsl_type + ">(x_1_param)");
EXPECT_EQ(module_str, expected) << module_str;
}
@@ -3285,13 +3285,13 @@
}
)";
- expected = utils::ReplaceAll(expected, "${wgsl_type}", wgsl_type);
- expected = utils::ReplaceAll(expected, "${unsigned_wgsl_type}", unsigned_wgsl_type);
- expected = utils::ReplaceAll(expected, "${wgsl_builtin}", wgsl_builtin);
- expected = utils::ReplaceAll(expected, "${assignment_value}",
- (wgsl_type == unsigned_wgsl_type)
- ? "x_1_param"
- : "bitcast<" + signed_wgsl_type + ">(x_1_param)");
+ expected = tint::ReplaceAll(expected, "${wgsl_type}", wgsl_type);
+ expected = tint::ReplaceAll(expected, "${unsigned_wgsl_type}", unsigned_wgsl_type);
+ expected = tint::ReplaceAll(expected, "${wgsl_builtin}", wgsl_builtin);
+ expected = tint::ReplaceAll(expected, "${assignment_value}",
+ (wgsl_type == unsigned_wgsl_type)
+ ? "x_1_param"
+ : "bitcast<" + signed_wgsl_type + ">(x_1_param)");
EXPECT_EQ(module_str, expected) << module_str;
}
@@ -3330,13 +3330,13 @@
}
)";
- expected = utils::ReplaceAll(expected, "${wgsl_type}", wgsl_type);
- expected = utils::ReplaceAll(expected, "${unsigned_wgsl_type}", unsigned_wgsl_type);
- expected = utils::ReplaceAll(expected, "${wgsl_builtin}", wgsl_builtin);
- expected = utils::ReplaceAll(expected, "${assignment_value}",
- (wgsl_type == unsigned_wgsl_type)
- ? "x_1_param"
- : "bitcast<" + signed_wgsl_type + ">(x_1_param)");
+ expected = tint::ReplaceAll(expected, "${wgsl_type}", wgsl_type);
+ expected = tint::ReplaceAll(expected, "${unsigned_wgsl_type}", unsigned_wgsl_type);
+ expected = tint::ReplaceAll(expected, "${wgsl_builtin}", wgsl_builtin);
+ expected = tint::ReplaceAll(expected, "${assignment_value}",
+ (wgsl_type == unsigned_wgsl_type)
+ ? "x_1_param"
+ : "bitcast<" + signed_wgsl_type + ">(x_1_param)");
EXPECT_EQ(module_str, expected) << module_str;
}
@@ -3405,14 +3405,14 @@
}
)";
- expected = utils::ReplaceAll(expected, "${wgsl_type}", wgsl_type);
- expected = utils::ReplaceAll(expected, "${wgsl_component_type}", wgsl_component_type);
- expected = utils::ReplaceAll(expected, "${unsigned_wgsl_type}", unsigned_wgsl_type);
- expected = utils::ReplaceAll(expected, "${wgsl_builtin}", wgsl_builtin);
- expected = utils::ReplaceAll(expected, "${assignment_value}",
- (wgsl_type == unsigned_wgsl_type)
- ? "x_1_param"
- : "bitcast<" + signed_wgsl_type + ">(x_1_param)");
+ expected = tint::ReplaceAll(expected, "${wgsl_type}", wgsl_type);
+ expected = tint::ReplaceAll(expected, "${wgsl_component_type}", wgsl_component_type);
+ expected = tint::ReplaceAll(expected, "${unsigned_wgsl_type}", unsigned_wgsl_type);
+ expected = tint::ReplaceAll(expected, "${wgsl_builtin}", wgsl_builtin);
+ expected = tint::ReplaceAll(expected, "${assignment_value}",
+ (wgsl_type == unsigned_wgsl_type)
+ ? "x_1_param"
+ : "bitcast<" + signed_wgsl_type + ">(x_1_param)");
EXPECT_EQ(module_str, expected) << module_str;
}
diff --git a/src/tint/lang/spirv/reader/ast_parser/namer.cc b/src/tint/lang/spirv/reader/ast_parser/namer.cc
index 96a193a..e48bc65 100644
--- a/src/tint/lang/spirv/reader/ast_parser/namer.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/namer.cc
@@ -223,7 +223,7 @@
std::string derived_name;
uint32_t& i = next_unusued_derived_name_id_[base_name];
while (i != 0xffffffff) {
- utils::StringStream new_name_stream;
+ StringStream new_name_stream;
new_name_stream << base_name;
if (i > 0) {
new_name_stream << "_" << i;
@@ -309,7 +309,7 @@
uint32_t i = 1;
std::string new_name;
do {
- utils::StringStream new_name_stream;
+ StringStream new_name_stream;
new_name_stream << suggestion << "_" << i;
new_name = new_name_stream.str();
++i;
@@ -335,7 +335,7 @@
uint32_t index = 0;
for (auto& name : name_vector) {
if (name.empty()) {
- utils::StringStream suggestion;
+ StringStream suggestion;
suggestion << "field" << index;
// Again, modify the name-vector in-place.
name = disambiguate_name(suggestion.str());
diff --git a/src/tint/lang/spirv/reader/ast_parser/namer_test.cc b/src/tint/lang/spirv/reader/ast_parser/namer_test.cc
index ed36693..28fe84c 100644
--- a/src/tint/lang/spirv/reader/ast_parser/namer_test.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/namer_test.cc
@@ -31,7 +31,7 @@
std::string error() { return errors_.str(); }
protected:
- utils::StringStream errors_;
+ StringStream errors_;
bool success_ = true;
FailStream fail_stream_;
};
@@ -353,7 +353,7 @@
TEST_P(SpvNamerReservedWordTest, ReservedWordsAreUsed) {
bool success;
- utils::StringStream errors;
+ StringStream errors;
FailStream fail_stream(&success, &errors);
Namer namer(fail_stream);
const std::string reserved = GetParam();
@@ -398,7 +398,7 @@
TEST_P(SpvNamerBuiltinFunctionTest, BuiltinFunctionsAreUsed) {
bool success;
- utils::StringStream errors;
+ StringStream errors;
FailStream fail_stream(&success, &errors);
Namer namer(fail_stream);
const std::string builtin_fn = GetParam();
diff --git a/src/tint/lang/spirv/reader/ast_parser/spirv_tools_helpers_test.cc b/src/tint/lang/spirv/reader/ast_parser/spirv_tools_helpers_test.cc
index 1c06054..26ef27f 100644
--- a/src/tint/lang/spirv/reader/ast_parser/spirv_tools_helpers_test.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/spirv_tools_helpers_test.cc
@@ -25,7 +25,7 @@
// (The target environment doesn't affect assembly.
spvtools::SpirvTools tools(SPV_ENV_UNIVERSAL_1_0);
- utils::StringStream errors;
+ StringStream errors;
std::vector<uint32_t> result;
tools.SetMessageConsumer([&errors](spv_message_level_t, const char*,
const spv_position_t& position, const char* message) {
@@ -41,7 +41,7 @@
std::string Disassemble(const std::vector<uint32_t>& spirv_module) {
spvtools::SpirvTools tools(SPV_ENV_UNIVERSAL_1_0);
- utils::StringStream errors;
+ StringStream errors;
tools.SetMessageConsumer([&errors](spv_message_level_t, const char*,
const spv_position_t& position, const char* message) {
errors << "disassmbly error:" << position.line << ":" << position.column << ": " << message;
diff --git a/src/tint/lang/spirv/reader/ast_parser/test_helper.cc b/src/tint/lang/spirv/reader/ast_parser/test_helper.cc
index ada184a..20a6e9d 100644
--- a/src/tint/lang/spirv/reader/ast_parser/test_helper.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/test_helper.cc
@@ -45,7 +45,7 @@
return writer.Result();
}
-std::string ToString(const Program& program, utils::VectorRef<const ast::Statement*> stmts) {
+std::string ToString(const Program& program, VectorRef<const ast::Statement*> stmts) {
wgsl::writer::ASTPrinter writer(&program);
for (const auto* stmt : stmts) {
writer.EmitStatement(stmt);
@@ -61,7 +61,7 @@
return Switch(
node,
[&](const ast::Expression* expr) {
- utils::StringStream out;
+ StringStream out;
writer.EmitExpression(out, expr);
if (!writer.Diagnostics().empty()) {
return "WGSL writer error: " + writer.Diagnostics().str();
diff --git a/src/tint/lang/spirv/reader/ast_parser/test_helper.h b/src/tint/lang/spirv/reader/ast_parser/test_helper.h
index 3cdce29..43b4b8f 100644
--- a/src/tint/lang/spirv/reader/ast_parser/test_helper.h
+++ b/src/tint/lang/spirv/reader/ast_parser/test_helper.h
@@ -272,7 +272,7 @@
/// @param program the Program
/// @param stmts the statement list
/// @returns the WGSL printed string of a statement list.
-std::string ToString(const Program& program, utils::VectorRef<const ast::Statement*> stmts);
+std::string ToString(const Program& program, VectorRef<const ast::Statement*> stmts);
/// Returns the WGSL printed string of an AST node.
/// @param program the Program
diff --git a/src/tint/lang/spirv/reader/ast_parser/type.cc b/src/tint/lang/spirv/reader/ast_parser/type.cc
index 18dc52c..54ad1d9 100644
--- a/src/tint/lang/spirv/reader/ast_parser/type.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/type.cc
@@ -54,61 +54,55 @@
namespace {
struct PointerHasher {
- size_t operator()(const Pointer& t) const {
- return utils::Hash(t.address_space, t.type, t.access);
- }
+ size_t operator()(const Pointer& t) const { return Hash(t.address_space, t.type, t.access); }
};
struct ReferenceHasher {
- size_t operator()(const Reference& t) const {
- return utils::Hash(t.address_space, t.type, t.access);
- }
+ size_t operator()(const Reference& t) const { return Hash(t.address_space, t.type, t.access); }
};
struct VectorHasher {
- size_t operator()(const Vector& t) const { return utils::Hash(t.type, t.size); }
+ size_t operator()(const Vector& t) const { return Hash(t.type, t.size); }
};
struct MatrixHasher {
- size_t operator()(const Matrix& t) const { return utils::Hash(t.type, t.columns, t.rows); }
+ size_t operator()(const Matrix& t) const { return Hash(t.type, t.columns, t.rows); }
};
struct ArrayHasher {
- size_t operator()(const Array& t) const { return utils::Hash(t.type, t.size, t.stride); }
+ size_t operator()(const Array& t) const { return Hash(t.type, t.size, t.stride); }
};
struct AliasHasher {
- size_t operator()(const Alias& t) const { return utils::Hash(t.name); }
+ size_t operator()(const Alias& t) const { return Hash(t.name); }
};
struct StructHasher {
- size_t operator()(const Struct& t) const { return utils::Hash(t.name); }
+ size_t operator()(const Struct& t) const { return Hash(t.name); }
};
struct SamplerHasher {
- size_t operator()(const Sampler& s) const { return utils::Hash(s.kind); }
+ size_t operator()(const Sampler& s) const { return Hash(s.kind); }
};
struct DepthTextureHasher {
- size_t operator()(const DepthTexture& t) const { return utils::Hash(t.dims); }
+ size_t operator()(const DepthTexture& t) const { return Hash(t.dims); }
};
struct DepthMultisampledTextureHasher {
- size_t operator()(const DepthMultisampledTexture& t) const { return utils::Hash(t.dims); }
+ size_t operator()(const DepthMultisampledTexture& t) const { return Hash(t.dims); }
};
struct MultisampledTextureHasher {
- size_t operator()(const MultisampledTexture& t) const { return utils::Hash(t.dims, t.type); }
+ size_t operator()(const MultisampledTexture& t) const { return Hash(t.dims, t.type); }
};
struct SampledTextureHasher {
- size_t operator()(const SampledTexture& t) const { return utils::Hash(t.dims, t.type); }
+ size_t operator()(const SampledTexture& t) const { return Hash(t.dims, t.type); }
};
struct StorageTextureHasher {
- size_t operator()(const StorageTexture& t) const {
- return utils::Hash(t.dims, t.format, t.access);
- }
+ size_t operator()(const StorageTexture& t) const { return Hash(t.dims, t.format, t.access); }
};
} // namespace
@@ -231,13 +225,13 @@
ast::Type Array::Build(ProgramBuilder& b) const {
if (size > 0) {
if (stride > 0) {
- return b.ty.array(type->Build(b), u32(size), utils::Vector{b.Stride(stride)});
+ return b.ty.array(type->Build(b), u32(size), tint::Vector{b.Stride(stride)});
} else {
return b.ty.array(type->Build(b), u32(size));
}
} else {
if (stride > 0) {
- return b.ty.array(type->Build(b), utils::Vector{b.Stride(stride)});
+ return b.ty.array(type->Build(b), tint::Vector{b.Stride(stride)});
} else {
return b.ty.array(type->Build(b));
}
@@ -313,7 +307,7 @@
/// The PIMPL state of the Types object.
struct TypeManager::State {
/// The allocator of primitive types
- utils::BlockAllocator<Type> allocator_;
+ BlockAllocator<Type> allocator_;
/// The lazily-created Void type
reader::Void const* void_ = nullptr;
/// The lazily-created Bool type
@@ -325,33 +319,32 @@
/// The lazily-created I32 type
reader::I32 const* i32_ = nullptr;
/// Unique Pointer instances
- utils::UniqueAllocator<reader::Pointer, PointerHasher> pointers_;
+ UniqueAllocator<reader::Pointer, PointerHasher> pointers_;
/// Unique Reference instances
- utils::UniqueAllocator<reader::Reference, ReferenceHasher> references_;
+ UniqueAllocator<reader::Reference, ReferenceHasher> references_;
/// Unique Vector instances
- utils::UniqueAllocator<reader::Vector, VectorHasher> vectors_;
+ UniqueAllocator<reader::Vector, VectorHasher> vectors_;
/// Unique Matrix instances
- utils::UniqueAllocator<reader::Matrix, MatrixHasher> matrices_;
+ UniqueAllocator<reader::Matrix, MatrixHasher> matrices_;
/// Unique Array instances
- utils::UniqueAllocator<reader::Array, ArrayHasher> arrays_;
+ UniqueAllocator<reader::Array, ArrayHasher> arrays_;
/// Unique Alias instances
- utils::UniqueAllocator<reader::Alias, AliasHasher> aliases_;
+ UniqueAllocator<reader::Alias, AliasHasher> aliases_;
/// Unique Struct instances
- utils::UniqueAllocator<reader::Struct, StructHasher> structs_;
+ UniqueAllocator<reader::Struct, StructHasher> structs_;
/// Unique Sampler instances
- utils::UniqueAllocator<reader::Sampler, SamplerHasher> samplers_;
+ UniqueAllocator<reader::Sampler, SamplerHasher> samplers_;
/// Unique DepthTexture instances
- utils::UniqueAllocator<reader::DepthTexture, DepthTextureHasher> depth_textures_;
+ UniqueAllocator<reader::DepthTexture, DepthTextureHasher> depth_textures_;
/// Unique DepthMultisampledTexture instances
- utils::UniqueAllocator<reader::DepthMultisampledTexture, DepthMultisampledTextureHasher>
+ UniqueAllocator<reader::DepthMultisampledTexture, DepthMultisampledTextureHasher>
depth_multisampled_textures_;
/// Unique MultisampledTexture instances
- utils::UniqueAllocator<reader::MultisampledTexture, MultisampledTextureHasher>
- multisampled_textures_;
+ UniqueAllocator<reader::MultisampledTexture, MultisampledTextureHasher> multisampled_textures_;
/// Unique SampledTexture instances
- utils::UniqueAllocator<reader::SampledTexture, SampledTextureHasher> sampled_textures_;
+ UniqueAllocator<reader::SampledTexture, SampledTextureHasher> sampled_textures_;
/// Unique StorageTexture instances
- utils::UniqueAllocator<reader::StorageTexture, StorageTextureHasher> storage_textures_;
+ UniqueAllocator<reader::StorageTexture, StorageTextureHasher> storage_textures_;
};
const Type* Type::UnwrapPtr() const {
@@ -571,31 +564,31 @@
}
std::string Pointer::String() const {
- utils::StringStream ss;
- ss << "ptr<" << utils::ToString(address_space) << ", " << type->String() + ">";
+ StringStream ss;
+ ss << "ptr<" << tint::ToString(address_space) << ", " << type->String() + ">";
return ss.str();
}
std::string Reference::String() const {
- utils::StringStream ss;
- ss << "ref<" + utils::ToString(address_space) << ", " << type->String() << ">";
+ StringStream ss;
+ ss << "ref<" + tint::ToString(address_space) << ", " << type->String() << ">";
return ss.str();
}
std::string Vector::String() const {
- utils::StringStream ss;
+ StringStream ss;
ss << "vec" << size << "<" << type->String() << ">";
return ss.str();
}
std::string Matrix::String() const {
- utils::StringStream ss;
+ StringStream ss;
ss << "mat" << columns << "x" << rows << "<" << type->String() << ">";
return ss.str();
}
std::string Array::String() const {
- utils::StringStream ss;
+ StringStream ss;
ss << "array<" << type->String() << ", " << size << ", " << stride << ">";
return ss.str();
}
@@ -611,31 +604,31 @@
}
std::string DepthTexture::String() const {
- utils::StringStream ss;
+ StringStream ss;
ss << "depth_" << dims;
return ss.str();
}
std::string DepthMultisampledTexture::String() const {
- utils::StringStream ss;
+ StringStream ss;
ss << "depth_multisampled_" << dims;
return ss.str();
}
std::string MultisampledTexture::String() const {
- utils::StringStream ss;
+ StringStream ss;
ss << "texture_multisampled_" << dims << "<" << type << ">";
return ss.str();
}
std::string SampledTexture::String() const {
- utils::StringStream ss;
+ StringStream ss;
ss << "texture_" << dims << "<" << type << ">";
return ss.str();
}
std::string StorageTexture::String() const {
- utils::StringStream ss;
+ StringStream ss;
ss << "texture_storage_" << dims << "<" << format << ", " << access << ">";
return ss.str();
}
diff --git a/src/tint/lang/spirv/reader/ast_parser/type.h b/src/tint/lang/spirv/reader/ast_parser/type.h
index 5339018..832ac94 100644
--- a/src/tint/lang/spirv/reader/ast_parser/type.h
+++ b/src/tint/lang/spirv/reader/ast_parser/type.h
@@ -37,7 +37,7 @@
namespace tint::spirv::reader {
/// Type is the base class for all types
-class Type : public utils::Castable<Type> {
+class Type : public Castable<Type> {
public:
/// Constructor
Type();
@@ -97,7 +97,7 @@
using TypeList = std::vector<const Type*>;
/// `void` type
-struct Void final : public utils::Castable<Void, Type> {
+struct Void final : public Castable<Void, Type> {
/// @param b the ProgramBuilder used to construct the AST types
/// @returns the constructed ast::Type node for the given type
ast::Type Build(ProgramBuilder& b) const override;
@@ -109,7 +109,7 @@
};
/// `bool` type
-struct Bool final : public utils::Castable<Bool, Type> {
+struct Bool final : public Castable<Bool, Type> {
/// @param b the ProgramBuilder used to construct the AST types
/// @returns the constructed ast::Type node for the given type
ast::Type Build(ProgramBuilder& b) const override;
@@ -121,7 +121,7 @@
};
/// `u32` type
-struct U32 final : public utils::Castable<U32, Type> {
+struct U32 final : public Castable<U32, Type> {
/// @param b the ProgramBuilder used to construct the AST types
/// @returns the constructed ast::Type node for the given type
ast::Type Build(ProgramBuilder& b) const override;
@@ -133,7 +133,7 @@
};
/// `f32` type
-struct F32 final : public utils::Castable<F32, Type> {
+struct F32 final : public Castable<F32, Type> {
/// @param b the ProgramBuilder used to construct the AST types
/// @returns the constructed ast::Type node for the given type
ast::Type Build(ProgramBuilder& b) const override;
@@ -145,7 +145,7 @@
};
/// `i32` type
-struct I32 final : public utils::Castable<I32, Type> {
+struct I32 final : public Castable<I32, Type> {
/// @param b the ProgramBuilder used to construct the AST types
/// @returns the constructed ast::Type node for the given type
ast::Type Build(ProgramBuilder& b) const override;
@@ -157,7 +157,7 @@
};
/// `ptr<SC, T, AM>` type
-struct Pointer final : public utils::Castable<Pointer, Type> {
+struct Pointer final : public Castable<Pointer, Type> {
/// Constructor
/// @param sc the pointer address space
/// @param ty the store type
@@ -188,7 +188,7 @@
/// `ref<SC, T, AM>` type
/// Note this has no AST representation, but is used for type tracking in the
/// reader.
-struct Reference final : public utils::Castable<Reference, Type> {
+struct Reference final : public Castable<Reference, Type> {
/// Constructor
/// @param sc the reference address space
/// @param ty the referenced type
@@ -217,7 +217,7 @@
};
/// `vecN<T>` type
-struct Vector final : public utils::Castable<Vector, Type> {
+struct Vector final : public Castable<Vector, Type> {
/// Constructor
/// @param ty the element type
/// @param sz the number of elements in the vector
@@ -243,7 +243,7 @@
};
/// `matNxM<T>` type
-struct Matrix final : public utils::Castable<Matrix, Type> {
+struct Matrix final : public Castable<Matrix, Type> {
/// Constructor
/// @param ty the matrix element type
/// @param c the number of columns in the matrix
@@ -272,7 +272,7 @@
};
/// `array<T, N>` type
-struct Array final : public utils::Castable<Array, Type> {
+struct Array final : public Castable<Array, Type> {
/// Constructor
/// @param el the element type
/// @param sz the number of elements in the array. 0 represents runtime-sized
@@ -302,7 +302,7 @@
};
/// `sampler` type
-struct Sampler final : public utils::Castable<Sampler, Type> {
+struct Sampler final : public Castable<Sampler, Type> {
/// Constructor
/// @param k the sampler kind
explicit Sampler(type::SamplerKind k);
@@ -325,7 +325,7 @@
};
/// Base class for texture types
-struct Texture : public utils::Castable<Texture, Type> {
+struct Texture : public Castable<Texture, Type> {
~Texture() override;
/// Constructor
@@ -341,7 +341,7 @@
};
/// `texture_depth_D` type
-struct DepthTexture final : public utils::Castable<DepthTexture, Texture> {
+struct DepthTexture final : public Castable<DepthTexture, Texture> {
/// Constructor
/// @param d the texture dimensions
explicit DepthTexture(type::TextureDimension d);
@@ -361,7 +361,7 @@
};
/// `texture_depth_multisampled_D` type
-struct DepthMultisampledTexture final : public utils::Castable<DepthMultisampledTexture, Texture> {
+struct DepthMultisampledTexture final : public Castable<DepthMultisampledTexture, Texture> {
/// Constructor
/// @param d the texture dimensions
explicit DepthMultisampledTexture(type::TextureDimension d);
@@ -381,7 +381,7 @@
};
/// `texture_multisampled_D<T>` type
-struct MultisampledTexture final : public utils::Castable<MultisampledTexture, Texture> {
+struct MultisampledTexture final : public Castable<MultisampledTexture, Texture> {
/// Constructor
/// @param d the texture dimensions
/// @param t the multisampled texture type
@@ -405,7 +405,7 @@
};
/// `texture_D<T>` type
-struct SampledTexture final : public utils::Castable<SampledTexture, Texture> {
+struct SampledTexture final : public Castable<SampledTexture, Texture> {
/// Constructor
/// @param d the texture dimensions
/// @param t the sampled texture type
@@ -429,7 +429,7 @@
};
/// `texture_storage_D<F>` type
-struct StorageTexture final : public utils::Castable<StorageTexture, Texture> {
+struct StorageTexture final : public Castable<StorageTexture, Texture> {
/// Constructor
/// @param d the texture dimensions
/// @param f the storage image format
@@ -457,7 +457,7 @@
};
/// Base class for named types
-struct Named : public utils::Castable<Named, Type> {
+struct Named : public Castable<Named, Type> {
/// Constructor
/// @param n the type name
explicit Named(Symbol n);
@@ -479,7 +479,7 @@
};
/// `type T = N` type
-struct Alias final : public utils::Castable<Alias, Named> {
+struct Alias final : public Castable<Alias, Named> {
/// Constructor
/// @param n the alias name
/// @param t the aliased type
@@ -498,7 +498,7 @@
};
/// `struct N { ... };` type
-struct Struct final : public utils::Castable<Struct, Named> {
+struct Struct final : public Castable<Struct, Named> {
/// Constructor
/// @param n the struct name
/// @param m the member types
diff --git a/src/tint/lang/spirv/reader/ast_parser/usage.cc b/src/tint/lang/spirv/reader/ast_parser/usage.cc
index 90d8bb2..0b4d447 100644
--- a/src/tint/lang/spirv/reader/ast_parser/usage.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/usage.cc
@@ -22,7 +22,7 @@
Usage::Usage(const Usage& other) = default;
Usage::~Usage() = default;
-utils::StringStream& Usage::operator<<(utils::StringStream& out) const {
+StringStream& Usage::operator<<(StringStream& out) const {
out << "Usage(";
if (IsSampler()) {
out << "Sampler(";
@@ -179,7 +179,7 @@
}
std::string Usage::to_str() const {
- utils::StringStream ss;
+ StringStream ss;
ss << *this;
return ss.str();
}
diff --git a/src/tint/lang/spirv/reader/ast_parser/usage.h b/src/tint/lang/spirv/reader/ast_parser/usage.h
index 4111ee6..4d7fbb5 100644
--- a/src/tint/lang/spirv/reader/ast_parser/usage.h
+++ b/src/tint/lang/spirv/reader/ast_parser/usage.h
@@ -75,7 +75,7 @@
/// Emits this usage to the given stream
/// @param out the output stream.
/// @returns the modified stream.
- utils::StringStream& operator<<(utils::StringStream& out) const;
+ StringStream& operator<<(StringStream& out) const;
/// Equality operator
/// @param other the RHS of the equality test.
@@ -128,7 +128,7 @@
/// @param out the stream
/// @param u the Usage
/// @returns the stream so calls can be chained
-inline utils::StringStream& operator<<(utils::StringStream& out, const Usage& u) {
+inline StringStream& operator<<(StringStream& out, const Usage& u) {
return u.operator<<(out);
}
diff --git a/src/tint/lang/spirv/reader/ast_parser/usage_test.cc b/src/tint/lang/spirv/reader/ast_parser/usage_test.cc
index e9da7e3..1c7babc 100644
--- a/src/tint/lang/spirv/reader/ast_parser/usage_test.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/usage_test.cc
@@ -39,7 +39,7 @@
}
TEST_F(SpirvASTParserTest, Usage_Trivial_Output) {
- utils::StringStream ss;
+ StringStream ss;
Usage u;
ss << u;
EXPECT_THAT(ss.str(), Eq("Usage()"));
@@ -90,13 +90,13 @@
EXPECT_TRUE(a.IsStorageReadTexture());
EXPECT_FALSE(a.IsStorageWriteTexture());
- utils::StringStream ss;
+ StringStream ss;
ss << a;
EXPECT_THAT(ss.str(), Eq("Usage(Sampler( comparison )Texture( read ))"));
}
TEST_F(SpirvASTParserTest, Usage_AddSampler) {
- utils::StringStream ss;
+ StringStream ss;
Usage u;
u.AddSampler();
@@ -121,7 +121,7 @@
}
TEST_F(SpirvASTParserTest, Usage_AddComparisonSampler) {
- utils::StringStream ss;
+ StringStream ss;
Usage u;
u.AddComparisonSampler();
@@ -145,7 +145,7 @@
}
TEST_F(SpirvASTParserTest, Usage_AddTexture) {
- utils::StringStream ss;
+ StringStream ss;
Usage u;
u.AddTexture();
@@ -169,7 +169,7 @@
}
TEST_F(SpirvASTParserTest, Usage_AddSampledTexture) {
- utils::StringStream ss;
+ StringStream ss;
Usage u;
u.AddSampledTexture();
@@ -193,7 +193,7 @@
}
TEST_F(SpirvASTParserTest, Usage_AddMultisampledTexture) {
- utils::StringStream ss;
+ StringStream ss;
Usage u;
u.AddMultisampledTexture();
@@ -217,7 +217,7 @@
}
TEST_F(SpirvASTParserTest, Usage_AddDepthTexture) {
- utils::StringStream ss;
+ StringStream ss;
Usage u;
u.AddDepthTexture();
@@ -241,7 +241,7 @@
}
TEST_F(SpirvASTParserTest, Usage_AddStorageReadTexture) {
- utils::StringStream ss;
+ StringStream ss;
Usage u;
u.AddStorageReadTexture();
@@ -265,7 +265,7 @@
}
TEST_F(SpirvASTParserTest, Usage_AddStorageWriteTexture) {
- utils::StringStream ss;
+ StringStream ss;
Usage u;
u.AddStorageWriteTexture();
diff --git a/src/tint/lang/spirv/writer/ast_printer/accessor_expression_test.cc b/src/tint/lang/spirv/writer/ast_printer/accessor_expression_test.cc
index 06052ef..f864421 100644
--- a/src/tint/lang/spirv/writer/ast_printer/accessor_expression_test.cc
+++ b/src/tint/lang/spirv/writer/ast_printer/accessor_expression_test.cc
@@ -929,7 +929,7 @@
// var ident : my_struct
// ident.b
- auto* s = Structure("my_struct", utils::Vector{
+ auto* s = Structure("my_struct", Vector{
Member("a", ty.f32()),
Member("b", ty.f32()),
});
@@ -976,12 +976,12 @@
//
// var ident : my_struct
// ident.inner.a
- auto* inner_struct = Structure("Inner", utils::Vector{
+ auto* inner_struct = Structure("Inner", Vector{
Member("a", ty.f32()),
Member("b", ty.f32()),
});
- auto* s_type = Structure("my_struct", utils::Vector{Member("inner", ty.Of(inner_struct))});
+ auto* s_type = Structure("my_struct", Vector{Member("inner", ty.Of(inner_struct))});
auto* var = Var("ident", ty.Of(s_type));
auto* expr = MemberAccessor(MemberAccessor("ident", "inner"), "b");
@@ -1023,7 +1023,7 @@
// let ident : my_struct = my_struct();
// ident.b
- auto* s = Structure("my_struct", utils::Vector{
+ auto* s = Structure("my_struct", Vector{
Member("a", ty.f32()),
Member("b", ty.f32()),
});
@@ -1063,12 +1063,12 @@
//
// let ident : my_struct = my_struct();
// ident.inner.a
- auto* inner_struct = Structure("Inner", utils::Vector{
+ auto* inner_struct = Structure("Inner", Vector{
Member("a", ty.f32()),
Member("b", ty.f32()),
});
- auto* s_type = Structure("my_struct", utils::Vector{Member("inner", ty.Of(inner_struct))});
+ auto* s_type = Structure("my_struct", Vector{Member("inner", ty.Of(inner_struct))});
auto* var =
Let("ident", ty.Of(s_type), Call(ty.Of(s_type), Call(ty.Of(inner_struct), 0_f, 0_f)));
@@ -1108,13 +1108,13 @@
//
// var ident : my_struct
// ident.inner.a
- auto* inner_struct = Structure("Inner", utils::Vector{
+ auto* inner_struct = Structure("Inner", Vector{
Member("a", ty.f32()),
Member("b", ty.f32()),
});
auto* alias = Alias("Alias", ty.Of(inner_struct));
- auto* s_type = Structure("Outer", utils::Vector{Member("inner", ty.Of(alias))});
+ auto* s_type = Structure("Outer", Vector{Member("inner", ty.Of(alias))});
auto* var = Var("ident", ty.Of(s_type));
auto* expr = MemberAccessor(MemberAccessor("ident", "inner"), "a");
@@ -1157,12 +1157,12 @@
//
// var ident : my_struct
// ident.inner.a = 2.0f;
- auto* inner_struct = Structure("Inner", utils::Vector{
+ auto* inner_struct = Structure("Inner", Vector{
Member("a", ty.f32()),
Member("b", ty.f32()),
});
- auto* s_type = Structure("my_struct", utils::Vector{Member("inner", ty.Of(inner_struct))});
+ auto* s_type = Structure("my_struct", Vector{Member("inner", ty.Of(inner_struct))});
auto* var = Var("ident", ty.Of(s_type));
auto* expr = Assign(MemberAccessor(MemberAccessor("ident", "inner"), "a"), Expr(2_f));
@@ -1207,12 +1207,12 @@
// var ident : my_struct
// var store : f32 = ident.inner.a
- auto* inner_struct = Structure("Inner", utils::Vector{
+ auto* inner_struct = Structure("Inner", Vector{
Member("a", ty.f32()),
Member("b", ty.f32()),
});
- auto* s_type = Structure("my_struct", utils::Vector{Member("inner", ty.Of(inner_struct))});
+ auto* s_type = Structure("my_struct", Vector{Member("inner", ty.Of(inner_struct))});
auto* var = Var("ident", ty.Of(s_type));
auto* store = Var("store", ty.f32());
@@ -1425,11 +1425,11 @@
// var index : array<A, 2u>
// index[0i].foo[2i].bar.baz.yx
- auto* c_type = Structure("C", utils::Vector{Member("baz", ty.vec3<f32>())});
+ auto* c_type = Structure("C", Vector{Member("baz", ty.vec3<f32>())});
- auto* b_type = Structure("B", utils::Vector{Member("bar", ty.Of(c_type))});
+ auto* b_type = Structure("B", Vector{Member("bar", ty.Of(c_type))});
auto b_ary_type = ty.array(ty.Of(b_type), 3_u);
- auto* a_type = Structure("A", utils::Vector{Member("foo", b_ary_type)});
+ auto* a_type = Structure("A", Vector{Member("foo", b_ary_type)});
auto a_ary_type = ty.array(ty.Of(a_type), 2_u);
auto* var = Var("index", a_ary_type);
diff --git a/src/tint/lang/spirv/writer/ast_printer/assign_test.cc b/src/tint/lang/spirv/writer/ast_printer/assign_test.cc
index 40d10af..ea5f40d 100644
--- a/src/tint/lang/spirv/writer/ast_printer/assign_test.cc
+++ b/src/tint/lang/spirv/writer/ast_printer/assign_test.cc
@@ -176,7 +176,7 @@
// var ident : my_struct
// ident.b = 4.0;
- auto* s = Structure("my_struct", utils::Vector{
+ auto* s = Structure("my_struct", Vector{
Member("a", ty.f32()),
Member("b", ty.f32()),
});
diff --git a/src/tint/lang/spirv/writer/ast_printer/ast_builtin_test.cc b/src/tint/lang/spirv/writer/ast_printer/ast_builtin_test.cc
index 46f8ba5..a8a4bd3 100644
--- a/src/tint/lang/spirv/writer/ast_printer/ast_builtin_test.cc
+++ b/src/tint/lang/spirv/writer/ast_printer/ast_builtin_test.cc
@@ -53,16 +53,16 @@
auto* expr2 =
Call("textureSampleCompare", "texture", "sampler", Call<vec2<f32>>(1_f, 2_f), 2_f);
- Func("f1", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f1", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", expr1)),
},
- utils::Empty);
- Func("f2", utils::Empty, ty.void_(),
- utils::Vector{
+ tint::Empty);
+ Func("f2", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", expr2)),
},
- utils::Empty);
+ tint::Empty);
Builder& b = Build();
@@ -103,8 +103,8 @@
TEST_F(BuiltinSpirvASTPrinterTest, Call_GLSLMethod_WithLoad_f32) {
auto* var = GlobalVar("ident", ty.f32(), builtin::AddressSpace::kPrivate);
auto* expr = Call("round", "ident");
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", expr)),
});
@@ -139,8 +139,8 @@
auto* var = GlobalVar("ident", ty.f16(), builtin::AddressSpace::kPrivate);
auto* expr = Call("round", "ident");
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", expr)),
});
@@ -178,8 +178,8 @@
auto param = GetParam();
auto* var = GlobalVar("v", ty.bool_(), builtin::AddressSpace::kPrivate);
auto* expr = Call(param.name, "v");
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", expr)),
});
@@ -205,8 +205,8 @@
auto param = GetParam();
auto* var = GlobalVar("v", ty.vec3<bool>(), builtin::AddressSpace::kPrivate);
auto* expr = Call(param.name, "v");
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", expr)),
});
@@ -224,11 +224,11 @@
%6 = OpTypeFunction %7
)");
- auto expected = utils::ReplaceAll(R"(%11 = OpLoad %3 %1
+ auto expected = tint::ReplaceAll(R"(%11 = OpLoad %3 %1
%10 = ${op} %4 %11
OpReturn
)",
- "${op}", param.op);
+ "${op}", param.op);
EXPECT_EQ(DumpInstructions(b.Module().Functions()[0].instructions()), expected);
}
INSTANTIATE_TEST_SUITE_P(BuiltinSpirvASTPrinterTest,
@@ -240,8 +240,8 @@
auto* bool_v3 = GlobalVar("bool_v3", ty.vec3<bool>(), builtin::AddressSpace::kPrivate);
auto* expr = Call("select", "v3", "v3", "bool_v3");
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", expr)),
});
@@ -279,18 +279,18 @@
namespace array_builtin_tests {
TEST_F(BuiltinSpirvASTPrinterTest, Call_ArrayLength) {
- auto* s = Structure("my_struct", utils::Vector{
+ auto* s = Structure("my_struct", Vector{
Member("a", ty.array<f32>()),
});
GlobalVar("b", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(2_a));
auto* expr = Call("arrayLength", AddressOf(MemberAccessor("b", "a")));
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", expr)),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -322,7 +322,7 @@
}
TEST_F(BuiltinSpirvASTPrinterTest, Call_ArrayLength_OtherMembersInStruct) {
- auto* s = Structure("my_struct", utils::Vector{
+ auto* s = Structure("my_struct", Vector{
Member("z", ty.f32()),
Member(4, "a", ty.array<f32>()),
});
@@ -330,11 +330,11 @@
Group(2_a));
auto* expr = Call("arrayLength", AddressOf(MemberAccessor("b", "a")));
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", expr)),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -366,7 +366,7 @@
}
TEST_F(BuiltinSpirvASTPrinterTest, Call_ArrayLength_ViaLets) {
- auto* s = Structure("my_struct", utils::Vector{
+ auto* s = Structure("my_struct", Vector{
Member("a", ty.array<f32>()),
});
GlobalVar("b", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
@@ -376,13 +376,13 @@
auto* p2 = Let("p2", AddressOf(MemberAccessor(Deref(p), "a")));
auto* expr = Call("arrayLength", p2);
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(p),
Decl(p2),
Decl(Let("l", expr)),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -425,7 +425,7 @@
// let p3 = &((*p).a);
// arrayLength(&*p3);
// }
- auto* s = Structure("my_struct", utils::Vector{
+ auto* s = Structure("my_struct", Vector{
Member("a", ty.array<f32>()),
});
GlobalVar("b", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
@@ -436,14 +436,14 @@
auto* p3 = Let("p3", AddressOf(MemberAccessor(Deref(p2), "a")));
auto* expr = Call("arrayLength", AddressOf(Deref(p3)));
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(p),
Decl(p2),
Decl(p3),
Decl(Let("l", expr)),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -485,8 +485,8 @@
// Use a variable to prevent the function being evaluated as constant.
auto* scalar = Var("a", Expr(1_f));
auto* expr = Call(param.name, scalar);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(scalar),
Decl(Let("l", expr)),
});
@@ -526,8 +526,8 @@
// Use a variable to prevent the function being evaluated as constant.
auto* scalar = Var("a", Expr(1_h));
auto* expr = Call(param.name, scalar);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(scalar),
Decl(Let("l", expr)),
});
@@ -566,8 +566,8 @@
// Use a variable to prevent the function being evaluated as constant.
auto* vec = Var("a", Call<vec2<f32>>(1_f, 1_f));
auto* expr = Call(param.name, vec);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(vec),
Decl(Let("l", expr)),
});
@@ -610,8 +610,8 @@
// Use a variable to prevent the function being evaluated as constant.
auto* vec = Var("a", Call<vec2<f16>>(1_h, 1_h));
auto* expr = Call(param.name, vec);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(vec),
Decl(Let("l", expr)),
});
@@ -676,8 +676,8 @@
TEST_F(BuiltinSpirvASTPrinterTest, Call_Length_Scalar_f32) {
auto* scalar = Var("a", Expr(1_f));
auto* expr = Call("length", scalar);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(scalar),
Decl(Let("l", expr)),
});
@@ -713,8 +713,8 @@
auto* scalar = Var("a", Expr(1_h));
auto* expr = Call("length", scalar);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(scalar),
Decl(Let("l", expr)),
});
@@ -748,8 +748,8 @@
TEST_F(BuiltinSpirvASTPrinterTest, Call_Length_Vector_f32) {
auto* vec = Var("a", Call<vec2<f32>>(1_f, 1_f));
auto* expr = Call("length", vec);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(vec),
Decl(Let("l", expr)),
});
@@ -787,8 +787,8 @@
auto* vec = Var("a", Call<vec2<f16>>(1_h, 1_h));
auto* expr = Call("length", vec);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(vec),
Decl(Let("l", expr)),
});
@@ -824,8 +824,8 @@
TEST_F(BuiltinSpirvASTPrinterTest, Call_Normalize_f32) {
auto* vec = Var("a", Call<vec2<f32>>(1_f, 1_f));
auto* expr = Call("normalize", vec);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(vec),
Decl(Let("l", expr)),
});
@@ -863,8 +863,8 @@
auto* vec = Var("a", Call<vec2<f16>>(1_h, 1_h));
auto* expr = Call("normalize", vec);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(vec),
Decl(Let("l", expr)),
});
@@ -902,8 +902,8 @@
auto param = GetParam();
auto* scalar = Var("scalar", Expr(1_f));
auto* expr = Call(param.name, scalar, scalar);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(scalar),
Decl(Let("l", expr)),
});
@@ -943,8 +943,8 @@
auto param = GetParam();
auto* scalar = Var("scalar", Expr(1_h));
auto* expr = Call(param.name, scalar, scalar);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(scalar),
Decl(Let("l", expr)),
});
@@ -982,8 +982,8 @@
auto param = GetParam();
auto* vec = Var("vec", Call<vec2<f32>>(1_f, 1_f));
auto* expr = Call(param.name, vec, vec);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(vec),
Decl(Let("l", expr)),
});
@@ -1025,8 +1025,8 @@
auto param = GetParam();
auto* vec = Var("vec", Call<vec2<f16>>(1_h, 1_h));
auto* expr = Call(param.name, vec, vec);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(vec),
Decl(Let("l", expr)),
});
@@ -1073,8 +1073,8 @@
TEST_F(BuiltinSpirvASTPrinterTest, Call_Reflect_Vector_f32) {
auto* vec = Var("vec", Call<vec2<f32>>(1_f, 1_f));
auto* expr = Call("reflect", vec, vec);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(vec),
Decl(Let("l", expr)),
});
@@ -1113,8 +1113,8 @@
auto* vec = Var("vec", Call<vec2<f16>>(1_h, 1_h));
auto* expr = Call("reflect", vec, vec);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(vec),
Decl(Let("l", expr)),
});
@@ -1151,8 +1151,8 @@
TEST_F(BuiltinSpirvASTPrinterTest, Call_Distance_Scalar_f32) {
auto* scalar = Var("scalar", Expr(1_f));
auto* expr = Call("distance", scalar, scalar);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(scalar),
Decl(Let("l", expr)),
});
@@ -1189,8 +1189,8 @@
auto* scalar = Var("scalar", Expr(1_h));
auto* expr = Call("distance", scalar, scalar);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(scalar),
Decl(Let("l", expr)),
});
@@ -1225,8 +1225,8 @@
TEST_F(BuiltinSpirvASTPrinterTest, Call_Distance_Vector_f32) {
auto* vec = Var("vec", Call<vec2<f32>>(1_f, 1_f));
auto* expr = Call("distance", vec, vec);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(vec),
Decl(Let("l", expr)),
});
@@ -1265,8 +1265,8 @@
auto* vec = Var("vec", Call<vec2<f16>>(1_h, 1_h));
auto* expr = Call("distance", vec, vec);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(vec),
Decl(Let("l", expr)),
});
@@ -1303,8 +1303,8 @@
TEST_F(BuiltinSpirvASTPrinterTest, Call_Cross_f32) {
auto* vec = Var("vec", Call<vec3<f32>>(1_f, 1_f, 1_f));
auto* expr = Call("cross", vec, vec);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(vec),
Decl(Let("l", expr)),
});
@@ -1343,8 +1343,8 @@
auto* vec = Var("vec", Call<vec3<f16>>(1_h, 1_h, 1_h));
auto* expr = Call("cross", vec, vec);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(vec),
Decl(Let("l", expr)),
});
@@ -1383,8 +1383,8 @@
auto param = GetParam();
auto* scalar = Var("scalar", Expr(1_f));
auto* expr = Call(param.name, scalar, scalar, scalar);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(scalar),
Decl(Let("l", expr)),
});
@@ -1425,8 +1425,8 @@
auto param = GetParam();
auto* scalar = Var("scalar", Expr(1_h));
auto* expr = Call(param.name, scalar, scalar, scalar);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(scalar),
Decl(Let("l", expr)),
});
@@ -1465,8 +1465,8 @@
auto param = GetParam();
auto* vec = Var("vec", Call<vec2<f32>>(1_f, 1_f));
auto* expr = Call(param.name, vec, vec, vec);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(vec),
Decl(Let("l", expr)),
});
@@ -1509,8 +1509,8 @@
auto param = GetParam();
auto* vec = Var("vec", Call<vec2<f16>>(1_h, 1_h));
auto* expr = Call(param.name, vec, vec, vec);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(vec),
Decl(Let("l", expr)),
});
@@ -1558,8 +1558,8 @@
TEST_F(BuiltinSpirvASTPrinterTest, Call_FaceForward_Vector_f32) {
auto* vec = Var("vec", Call<vec2<f32>>(1_f, 1_f));
auto* expr = Call("faceForward", vec, vec, vec);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(vec),
Decl(Let("l", expr)),
});
@@ -1599,8 +1599,8 @@
auto* vec = Var("vec", Call<vec2<f16>>(1_h, 1_h));
auto* expr = Call("faceForward", vec, vec, vec);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(vec),
Decl(Let("l", expr)),
});
@@ -1638,12 +1638,12 @@
TEST_F(BuiltinSpirvASTPrinterTest, Runtime_Call_Modf_f32) {
auto* vec = Var("vec", Call<vec2<f32>>(1_f, 2_f));
auto* expr = Call("modf", vec);
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(vec),
Decl(Let("l", expr)),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1692,12 +1692,12 @@
auto* vec = Var("vec", Call<vec2<f16>>(1_h, 2_h));
auto* expr = Call("modf", vec);
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(vec),
Decl(Let("l", expr)),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1747,11 +1747,11 @@
TEST_F(BuiltinSpirvASTPrinterTest, Const_Call_Modf_f32) {
auto* expr = Call("modf", Call<vec2<f32>>(1_f, 2_f));
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", expr)),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1793,11 +1793,11 @@
Enable(builtin::Extension::kF16);
auto* expr = Call("modf", Call<vec2<f16>>(1_h, 2_h));
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", expr)),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1842,12 +1842,12 @@
TEST_F(BuiltinSpirvASTPrinterTest, Runtime_Call_Frexp_f32) {
auto* vec = Var("vec", Call<vec2<f32>>(1_f, 2_f));
auto* expr = Call("frexp", vec);
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(vec),
Decl(Let("l", expr)),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1898,12 +1898,12 @@
auto* vec = Var("vec", Call<vec2<f16>>(1_h, 2_h));
auto* expr = Call("frexp", vec);
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(vec),
Decl(Let("l", expr)),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1954,11 +1954,11 @@
}
TEST_F(BuiltinSpirvASTPrinterTest, Const_Call_Frexp_f32) {
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", Call("frexp", Call<vec2<f32>>(1_f, 2_f)))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2002,11 +2002,11 @@
TEST_F(BuiltinSpirvASTPrinterTest, Const_Call_Frexp_f16) {
Enable(builtin::Extension::kF16);
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", Call("frexp", Call<vec2<f16>>(1_h, 2_h)))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2054,11 +2054,11 @@
TEST_F(BuiltinSpirvASTPrinterTest, Call_QuantizeToF16_Scalar) {
GlobalVar("v", Expr(2_f), builtin::AddressSpace::kPrivate);
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", Call("quantizeToF16", "v"))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2093,11 +2093,11 @@
TEST_F(BuiltinSpirvASTPrinterTest, Call_QuantizeToF16_Vector) {
GlobalVar("v", Call<vec3<f32>>(2_f), builtin::AddressSpace::kPrivate);
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", Call("quantizeToF16", "v"))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2160,8 +2160,8 @@
auto param = GetParam();
auto* var = GlobalVar("v", ty.i32(), builtin::AddressSpace::kPrivate);
auto* expr = Call(param.name, "v");
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", expr)),
});
@@ -2178,11 +2178,11 @@
%5 = OpTypeFunction %6
)");
- auto expected = utils::ReplaceAll(R"(%10 = OpLoad %3 %1
+ auto expected = tint::ReplaceAll(R"(%10 = OpLoad %3 %1
%9 = ${op} %3 %10
OpReturn
)",
- "${op}", param.op);
+ "${op}", param.op);
EXPECT_EQ(DumpInstructions(b.Module().Functions()[0].instructions()), expected);
}
@@ -2190,8 +2190,8 @@
auto param = GetParam();
auto* var = GlobalVar("v", ty.vec3<i32>(), builtin::AddressSpace::kPrivate);
auto* expr = Call(param.name, "v");
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", expr)),
});
@@ -2209,11 +2209,11 @@
%6 = OpTypeFunction %7
)");
- auto expected = utils::ReplaceAll(R"(%11 = OpLoad %3 %1
+ auto expected = tint::ReplaceAll(R"(%11 = OpLoad %3 %1
%10 = ${op} %3 %11
OpReturn
)",
- "${op}", param.op);
+ "${op}", param.op);
EXPECT_EQ(DumpInstructions(b.Module().Functions()[0].instructions()), expected);
}
@@ -2221,8 +2221,8 @@
auto param = GetParam();
auto* var = GlobalVar("v", ty.u32(), builtin::AddressSpace::kPrivate);
auto* expr = Call(param.name, "v");
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", expr)),
});
@@ -2239,11 +2239,11 @@
%5 = OpTypeFunction %6
)");
- auto expected = utils::ReplaceAll(R"(%10 = OpLoad %3 %1
+ auto expected = tint::ReplaceAll(R"(%10 = OpLoad %3 %1
%9 = ${op} %3 %10
OpReturn
)",
- "${op}", param.op);
+ "${op}", param.op);
EXPECT_EQ(DumpInstructions(b.Module().Functions()[0].instructions()), expected);
}
@@ -2251,8 +2251,8 @@
auto param = GetParam();
auto* var = GlobalVar("v", ty.vec3<u32>(), builtin::AddressSpace::kPrivate);
auto* expr = Call(param.name, "v");
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", expr)),
});
@@ -2270,11 +2270,11 @@
%6 = OpTypeFunction %7
)");
- auto expected = utils::ReplaceAll(R"(%11 = OpLoad %3 %1
+ auto expected = tint::ReplaceAll(R"(%11 = OpLoad %3 %1
%10 = ${op} %3 %11
OpReturn
)",
- "${op}", param.op);
+ "${op}", param.op);
EXPECT_EQ(DumpInstructions(b.Module().Functions()[0].instructions()), expected);
}
INSTANTIATE_TEST_SUITE_P(BuiltinSpirvASTPrinterTest,
@@ -2287,8 +2287,8 @@
auto param = GetParam();
auto* scalar = Var("scalar", Expr(1_i));
auto* expr = Call(param.name, scalar);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(scalar),
Decl(Let("l", expr)),
});
@@ -2325,8 +2325,8 @@
auto param = GetParam();
auto* vec = Var("vec", Call<vec2<i32>>(1_i, 1_i));
auto* expr = Call(param.name, vec);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(vec),
Decl(Let("l", expr)),
});
@@ -2369,8 +2369,8 @@
TEST_F(Builtin_Builder_Abs_Uint_Test, Call_Scalar) {
auto* scalar = Var("scalar", Expr(1_u));
auto* expr = Call("abs", scalar);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(scalar),
Decl(Let("l", expr)),
});
@@ -2402,8 +2402,8 @@
TEST_F(Builtin_Builder_Abs_Uint_Test, Call_Vector) {
auto* scalar = Var("scalar", Call<vec2<u32>>(1_u, 1_u));
auto* expr = Call("abs", scalar);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(scalar),
Decl(Let("l", expr)),
});
@@ -2439,8 +2439,8 @@
auto param = GetParam();
auto* scalar = Var("scalar", Expr(1_i));
auto* expr = Call(param.name, scalar, scalar);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(scalar),
Decl(Let("l", expr)),
});
@@ -2478,8 +2478,8 @@
auto param = GetParam();
auto* vec = Var("vec", Call<vec2<i32>>(1_i, 1_i));
auto* expr = Call(param.name, vec, vec);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(vec),
Decl(Let("l", expr)),
});
@@ -2523,8 +2523,8 @@
auto param = GetParam();
auto* scalar = Var("scalar", Expr(1_u));
auto* expr = Call(param.name, scalar, scalar);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(scalar),
Decl(Let("l", expr)),
});
@@ -2562,8 +2562,8 @@
auto param = GetParam();
auto* vec = Var("vec", Call<vec2<u32>>(1_u, 1_u));
auto* expr = Call(param.name, vec, vec);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(vec),
Decl(Let("l", expr)),
});
@@ -2607,8 +2607,8 @@
auto param = GetParam();
auto* scalar = Var("scalar", Expr(1_i));
auto* expr = Call(param.name, scalar, scalar, scalar);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(scalar),
Decl(Let("l", expr)),
});
@@ -2647,8 +2647,8 @@
auto param = GetParam();
auto* vec = Var("vec", Call<vec2<i32>>(1_i, 1_i));
auto* expr = Call(param.name, vec, vec, vec);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(vec),
Decl(Let("l", expr)),
});
@@ -2693,8 +2693,8 @@
auto param = GetParam();
auto* scalar = Var("scalar", Expr(1_u));
auto* expr = Call(param.name, scalar, scalar, scalar);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(scalar),
Decl(Let("l", expr)),
});
@@ -2733,8 +2733,8 @@
auto param = GetParam();
auto* vec = Var("vec", Call<vec2<u32>>(1_u, 1_u));
auto* expr = Call(param.name, vec, vec, vec);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(vec),
Decl(Let("l", expr)),
});
@@ -3122,8 +3122,8 @@
TEST_F(BuiltinSpirvASTPrinterTest, Call_Determinant_f32) {
auto* var = GlobalVar("var", ty.mat3x3<f32>(), builtin::AddressSpace::kPrivate);
auto* expr = Call("determinant", "var");
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", expr)),
});
@@ -3159,8 +3159,8 @@
auto* var = GlobalVar("var", ty.mat3x3<f16>(), builtin::AddressSpace::kPrivate);
auto* expr = Call("determinant", "var");
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", expr)),
});
@@ -3194,8 +3194,8 @@
TEST_F(BuiltinSpirvASTPrinterTest, Call_Transpose_f32) {
auto* var = GlobalVar("var", ty.mat2x3<f32>(), builtin::AddressSpace::kPrivate);
auto* expr = Call("transpose", "var");
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", expr)),
});
@@ -3232,8 +3232,8 @@
auto* var = GlobalVar("var", ty.mat2x3<f16>(), builtin::AddressSpace::kPrivate);
auto* expr = Call("transpose", "var");
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", expr)),
});
@@ -3273,8 +3273,8 @@
TEST_F(BuiltinSpirvASTPrinterTest, Call_Dot_F32) {
auto* var = GlobalVar("v", ty.vec3<f32>(), builtin::AddressSpace::kPrivate);
auto* expr = Call("dot", "v", "v");
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", expr)),
});
@@ -3304,8 +3304,8 @@
auto* var = GlobalVar("v", ty.vec3<f16>(), builtin::AddressSpace::kPrivate);
auto* expr = Call("dot", "v", "v");
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", expr)),
});
@@ -3333,8 +3333,8 @@
TEST_F(BuiltinSpirvASTPrinterTest, Call_Dot_U32) {
auto* var = GlobalVar("v", ty.vec3<u32>(), builtin::AddressSpace::kPrivate);
auto* expr = Call("dot", "v", "v");
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", expr)),
});
@@ -3372,8 +3372,8 @@
TEST_F(BuiltinSpirvASTPrinterTest, Call_Dot_I32) {
auto* var = GlobalVar("v", ty.vec3<i32>(), builtin::AddressSpace::kPrivate);
auto* expr = Call("dot", "v", "v");
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", expr)),
});
@@ -3418,11 +3418,11 @@
auto param = GetParam();
auto* var = GlobalVar("v", ty.f32(), builtin::AddressSpace::kPrivate);
auto* expr = Call(param.name, "v");
- auto* func = Func("func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", expr)),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -3439,11 +3439,11 @@
%5 = OpTypeFunction %6
)");
- auto expected = utils::ReplaceAll(R"(%10 = OpLoad %3 %1
+ auto expected = tint::ReplaceAll(R"(%10 = OpLoad %3 %1
%9 = ${op} %3 %10
OpReturn
)",
- "${op}", param.op);
+ "${op}", param.op);
EXPECT_EQ(DumpInstructions(b.Module().Functions()[0].instructions()), expected);
}
@@ -3451,11 +3451,11 @@
auto param = GetParam();
auto* var = GlobalVar("v", ty.vec3<f32>(), builtin::AddressSpace::kPrivate);
auto* expr = Call(param.name, "v");
- auto* func = Func("func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", expr)),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -3479,11 +3479,11 @@
%6 = OpTypeFunction %7
)");
- auto expected = utils::ReplaceAll(R"(%11 = OpLoad %3 %1
+ auto expected = tint::ReplaceAll(R"(%11 = OpLoad %3 %1
%10 = ${op} %3 %11
OpReturn
)",
- "${op}", param.op);
+ "${op}", param.op);
EXPECT_EQ(DumpInstructions(b.Module().Functions()[0].instructions()), expected);
}
INSTANTIATE_TEST_SUITE_P(BuiltinSpirvASTPrinterTest,
@@ -3515,19 +3515,19 @@
// let u : u32 = atomicLoad(&b.u);
// let i : i32 = atomicLoad(&b.i);
// }
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("u", ty.atomic<u32>()),
Member("i", ty.atomic<i32>()),
});
GlobalVar("b", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(1_a), Group(2_a));
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("u", ty.u32(), Call("atomicLoad", AddressOf(MemberAccessor("b", "u"))))),
Decl(Let("i", ty.i32(), Call("atomicLoad", AddressOf(MemberAccessor("b", "i"))))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -3579,21 +3579,21 @@
// atomicStore(&b.u, u);
// atomicStore(&b.i, i);
// }
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("u", ty.atomic<u32>()),
Member("i", ty.atomic<i32>()),
});
GlobalVar("b", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(1_a), Group(2_a));
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("u", Expr(1_u))),
Decl(Var("i", Expr(2_i))),
CallStmt(Call("atomicStore", AddressOf(MemberAccessor("b", "u")), "u")),
CallStmt(Call("atomicStore", AddressOf(MemberAccessor("b", "i")), "i")),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -3652,19 +3652,19 @@
// var v = 10;
// let x : i32 = atomicOP(&b.v, v);
// }
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("v", ty.atomic<i32>()),
});
GlobalVar("b", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(1_a), Group(2_a));
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v", Expr(10_i))),
Decl(Let("x", ty.i32(),
Call(GetParam().name, AddressOf(MemberAccessor("b", "v")), "v"))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -3725,19 +3725,19 @@
// var v = 10u;
// let x : u32 = atomicOP(&b.v, v);
// }
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("v", ty.atomic<u32>()),
});
GlobalVar("b", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(1_a), Group(2_a));
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v", Expr(10_u))),
Decl(Let("x", ty.u32(),
Call(GetParam().name, AddressOf(MemberAccessor("b", "v")), "v"))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -3799,15 +3799,15 @@
// let r : u32 = atomicExchange(&b.u, u);
// let s : i32 = atomicExchange(&b.i, i);
// }
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("u", ty.atomic<u32>()),
Member("i", ty.atomic<i32>()),
});
GlobalVar("b", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(1_a), Group(2_a));
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("u", Expr(10_u))),
Decl(Var("i", Expr(10_i))),
Decl(Let("r", ty.u32(),
@@ -3815,7 +3815,7 @@
Decl(Let("s", ty.i32(),
Call("atomicExchange", AddressOf(MemberAccessor("b", "i")), "i"))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -3875,21 +3875,21 @@
// let u = atomicCompareExchangeWeak(&b.u, 10u, 20u);
// let i = atomicCompareExchangeWeak(&b.i, 10, 10);
// }
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("u", ty.atomic<u32>()),
Member("i", ty.atomic<i32>()),
});
GlobalVar("b", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(1_a), Group(2_a));
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("u", Call("atomicCompareExchangeWeak", AddressOf(MemberAccessor("b", "u")),
10_u, 20_u))),
Decl(Let("i", Call("atomicCompareExchangeWeak", AddressOf(MemberAccessor("b", "i")),
10_i, 20_i))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -3950,8 +3950,8 @@
bool pack4 = param.name == "pack4x8snorm" || param.name == "pack4x8unorm";
auto* call =
pack4 ? Call(param.name, Call<vec4<f32>>("one")) : Call(param.name, Call<vec2<f32>>("one"));
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("one", Expr(1_f))),
Decl(Let("l", call)),
});
@@ -4021,8 +4021,8 @@
auto param = GetParam();
bool pack4 = param.name == "unpack4x8snorm" || param.name == "unpack4x8unorm";
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("one", Expr(1_u))),
Decl(Let("l", Call(param.name, "one"))),
});
@@ -4086,11 +4086,11 @@
namespace synchronization_builtin_tests {
TEST_F(BuiltinSpirvASTPrinterTest, Call_WorkgroupBarrier) {
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
CallStmt(Call("workgroupBarrier")),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -4120,11 +4120,11 @@
}
TEST_F(BuiltinSpirvASTPrinterTest, Call_StorageBarrier) {
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
CallStmt(Call("storageBarrier")),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
diff --git a/src/tint/lang/spirv/writer/ast_printer/ast_discard_test.cc b/src/tint/lang/spirv/writer/ast_printer/ast_discard_test.cc
index 2d6ee6f..acae909 100644
--- a/src/tint/lang/spirv/writer/ast_printer/ast_discard_test.cc
+++ b/src/tint/lang/spirv/writer/ast_printer/ast_discard_test.cc
@@ -23,8 +23,7 @@
TEST_F(SpirvASTPrinterTest, Discard) {
auto* stmt = Discard();
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
Builder& b = Build();
diff --git a/src/tint/lang/spirv/writer/ast_printer/ast_function_test.cc b/src/tint/lang/spirv/writer/ast_printer/ast_function_test.cc
index 1b08088..97fb806 100644
--- a/src/tint/lang/spirv/writer/ast_printer/ast_function_test.cc
+++ b/src/tint/lang/spirv/writer/ast_printer/ast_function_test.cc
@@ -24,7 +24,7 @@
using SpirvASTPrinterTest = TestHelper;
TEST_F(SpirvASTPrinterTest, Function_Empty) {
- Func("a_func", utils::Empty, ty.void_(), utils::Empty);
+ Func("a_func", tint::Empty, ty.void_(), tint::Empty);
Builder& b = Build();
@@ -41,8 +41,8 @@
}
TEST_F(SpirvASTPrinterTest, Function_Terminator_Return) {
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Return(),
});
@@ -63,7 +63,7 @@
TEST_F(SpirvASTPrinterTest, Function_Terminator_ReturnValue) {
GlobalVar("a", ty.f32(), builtin::AddressSpace::kPrivate);
- Func("a_func", utils::Empty, ty.f32(), utils::Vector{Return("a")}, utils::Empty);
+ Func("a_func", tint::Empty, ty.f32(), Vector{Return("a")}, tint::Empty);
Builder& b = Build();
@@ -88,8 +88,8 @@
}
TEST_F(SpirvASTPrinterTest, Function_Terminator_Discard) {
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Discard(),
});
@@ -109,11 +109,11 @@
TEST_F(SpirvASTPrinterTest, Function_WithParams) {
Func("a_func",
- utils::Vector{
+ Vector{
Param("a", ty.f32()),
Param("b", ty.i32()),
},
- ty.f32(), utils::Vector{Return("a")}, utils::Empty);
+ ty.f32(), Vector{Return("a")}, tint::Empty);
Builder& b = Build();
@@ -135,8 +135,8 @@
}
TEST_F(SpirvASTPrinterTest, Function_WithBody) {
- Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Return(),
});
@@ -155,7 +155,7 @@
}
TEST_F(SpirvASTPrinterTest, FunctionType) {
- Func("a_func", utils::Empty, ty.void_(), utils::Empty, utils::Empty);
+ Func("a_func", tint::Empty, ty.void_(), tint::Empty, tint::Empty);
Builder& b = Build();
@@ -167,8 +167,8 @@
}
TEST_F(SpirvASTPrinterTest, FunctionType_DeDuplicate) {
- auto* func1 = Func("a_func", utils::Empty, ty.void_(), utils::Empty, utils::Empty);
- auto* func2 = Func("b_func", utils::Empty, ty.void_(), utils::Empty, utils::Empty);
+ auto* func1 = Func("a_func", tint::Empty, ty.void_(), tint::Empty, tint::Empty);
+ auto* func2 = Func("b_func", tint::Empty, ty.void_(), tint::Empty, tint::Empty);
Builder& b = Build();
@@ -196,7 +196,7 @@
// return;
// }
- auto* s = Structure("Data", utils::Vector{Member("d", ty.f32())});
+ auto* s = Structure("Data", Vector{Member("d", ty.f32())});
GlobalVar("data", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(0_a), Group(0_a));
@@ -204,23 +204,23 @@
{
auto* var = Var("v", ty.f32(), MemberAccessor("data", "d"));
- Func("a", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
Return(),
},
- utils::Vector{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)});
+ Vector{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)});
}
{
auto* var = Var("v", ty.f32(), MemberAccessor("data", "d"));
- Func("b", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("b", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
Return(),
},
- utils::Vector{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)});
+ Vector{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)});
}
Builder& b = SanitizeAndBuild();
diff --git a/src/tint/lang/spirv/writer/ast_printer/ast_if_test.cc b/src/tint/lang/spirv/writer/ast_printer/ast_if_test.cc
index 85c73a5..dbbc891 100644
--- a/src/tint/lang/spirv/writer/ast_printer/ast_if_test.cc
+++ b/src/tint/lang/spirv/writer/ast_printer/ast_if_test.cc
@@ -439,8 +439,8 @@
// return;
// }
- auto* fn = Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* fn = Func("f", tint::Empty, ty.void_(),
+ Vector{
If(true, Block(Return())),
});
@@ -468,8 +468,8 @@
// }
// return true;
- auto* fn = Func("f", utils::Empty, ty.bool_(),
- utils::Vector{
+ auto* fn = Func("f", tint::Empty, ty.bool_(),
+ Vector{
If(true, Block(Return(false))),
Return(true),
});
@@ -499,8 +499,8 @@
// return true;
// }
- auto* fn = Func("f", utils::Empty, ty.bool_(),
- utils::Vector{
+ auto* fn = Func("f", tint::Empty, ty.bool_(),
+ Vector{
If(true, //
Block(Return(true)), //
Else(Block(Return(true)))),
@@ -538,8 +538,8 @@
// }
// return true;
- auto* fn = Func("f", utils::Empty, ty.bool_(),
- utils::Vector{
+ auto* fn = Func("f", tint::Empty, ty.bool_(),
+ Vector{
If(true, Block(Block(Block(Block(Return(false)))))),
Return(true),
});
@@ -568,8 +568,8 @@
// }
auto* var = GlobalVar("a", ty.bool_(), builtin::AddressSpace::kPrivate);
- auto* fn = Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* fn = Func("f", tint::Empty, ty.void_(),
+ Vector{
If("a", Block()),
});
@@ -603,7 +603,7 @@
// }
auto* if_stmt = If(false, Block(), Else(If(true, Block(Return()))));
- auto* fn = Func("f", utils::Empty, ty.void_(), utils::Vector{if_stmt});
+ auto* fn = Func("f", tint::Empty, ty.void_(), Vector{if_stmt});
Builder& b = Build();
@@ -641,8 +641,8 @@
// }
auto* if_stmt = If(false, Block(), Else(If(true, Block(Break()))));
- auto* fn = Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* fn = Func("f", tint::Empty, ty.void_(),
+ Vector{
Loop(Block(if_stmt)),
});
diff --git a/src/tint/lang/spirv/writer/ast_printer/ast_switch_test.cc b/src/tint/lang/spirv/writer/ast_printer/ast_switch_test.cc
index c8bee18..be14a3e 100644
--- a/src/tint/lang/spirv/writer/ast_printer/ast_switch_test.cc
+++ b/src/tint/lang/spirv/writer/ast_printer/ast_switch_test.cc
@@ -59,8 +59,8 @@
auto* v = GlobalVar("v", ty.i32(), builtin::AddressSpace::kPrivate);
auto* a = GlobalVar("a", ty.i32(), builtin::AddressSpace::kPrivate);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Switch("a", //
Case(CaseSelector(1_i), Block(Assign("v", 1_i))), //
Case(CaseSelector(2_i), Block(Assign("v", 2_i))), //
@@ -116,8 +116,8 @@
auto* v = GlobalVar("v", ty.i32(), builtin::AddressSpace::kPrivate);
auto* a = GlobalVar("a", ty.u32(), builtin::AddressSpace::kPrivate);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Switch("a", //
Case(CaseSelector(1_u), Block(Assign("v", 1_i))), //
Case(CaseSelector(2_u), Block(Assign("v", 2_i))), //
@@ -173,8 +173,8 @@
auto* v = GlobalVar("v", ty.i32(), builtin::AddressSpace::kPrivate);
auto* a = GlobalVar("a", ty.i32(), builtin::AddressSpace::kPrivate);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Switch("a", //
DefaultCase(Block(Assign("v", 1_i)))), //
});
@@ -223,13 +223,13 @@
auto* v = GlobalVar("v", ty.i32(), builtin::AddressSpace::kPrivate);
auto* a = GlobalVar("a", ty.i32(), builtin::AddressSpace::kPrivate);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
- Switch(Expr("a"), //
- Case(CaseSelector(1_i), //
- Block(Assign("v", 1_i))), //
- Case(utils::Vector{CaseSelector(2_i), CaseSelector(3_i)}, //
- Block(Assign("v", 2_i))), //
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
+ Switch(Expr("a"), //
+ Case(CaseSelector(1_i), //
+ Block(Assign("v", 1_i))), //
+ Case(Vector{CaseSelector(2_i), CaseSelector(3_i)}, //
+ Block(Assign("v", 2_i))), //
DefaultCase(Block(Assign("v", 3_i)))),
});
@@ -283,14 +283,14 @@
auto* v = GlobalVar("v", ty.i32(), builtin::AddressSpace::kPrivate);
auto* a = GlobalVar("a", ty.i32(), builtin::AddressSpace::kPrivate);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{Switch(Expr("a"), //
- Case(CaseSelector(1_i), //
- Block(Assign("v", 1_i))), //
- Case(utils::Vector{CaseSelector(2_i), CaseSelector(3_i),
- DefaultCaseSelector()}, //
- Block(Assign("v", 2_i))) //
- )});
+ auto* func = Func(
+ "a_func", tint::Empty, ty.void_(),
+ Vector{Switch(Expr("a"), //
+ Case(CaseSelector(1_i), //
+ Block(Assign("v", 1_i))), //
+ Case(Vector{CaseSelector(2_i), CaseSelector(3_i), DefaultCaseSelector()}, //
+ Block(Assign("v", 2_i))) //
+ )});
Builder& b = Build();
@@ -340,8 +340,8 @@
auto* v = GlobalVar("v", ty.i32(), builtin::AddressSpace::kPrivate);
auto* a = GlobalVar("a", ty.i32(), builtin::AddressSpace::kPrivate);
- auto* func = Func("a_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("a_func", tint::Empty, ty.void_(),
+ Vector{
Switch("a", //
Case(CaseSelector(1_i), //
Block( //
@@ -403,8 +403,8 @@
// }
// }
- auto* fn = Func("f", utils::Empty, ty.i32(),
- utils::Vector{
+ auto* fn = Func("f", tint::Empty, ty.i32(),
+ Vector{
Switch(1_i, //
Case(CaseSelector(1_i), Block(Return(1_i))), //
Case(CaseSelector(2_i), Block(Return(1_i))), //
diff --git a/src/tint/lang/spirv/writer/ast_printer/ast_type_test.cc b/src/tint/lang/spirv/writer/ast_printer/ast_type_test.cc
index 4990a71..e528b09 100644
--- a/src/tint/lang/spirv/writer/ast_printer/ast_type_test.cc
+++ b/src/tint/lang/spirv/writer/ast_printer/ast_type_test.cc
@@ -28,7 +28,7 @@
TEST_F(SpirvASTPrinterTest_Type, GenerateRuntimeArray) {
auto ary = ty.array(ty.i32());
- auto* str = Structure("S", utils::Vector{Member("x", ary)});
+ auto* str = Structure("S", Vector{Member("x", ary)});
GlobalVar("a", ty.Of(str), builtin::AddressSpace::kStorage, builtin::Access::kRead,
Binding(0_a), Group(0_a));
ast::Type type = str->members[0]->type;
@@ -46,7 +46,7 @@
TEST_F(SpirvASTPrinterTest_Type, ReturnsGeneratedRuntimeArray) {
auto ary = ty.array(ty.i32());
- auto* str = Structure("S", utils::Vector{Member("x", ary)});
+ auto* str = Structure("S", Vector{Member("x", ary)});
GlobalVar("a", ty.Of(str), builtin::AddressSpace::kStorage, builtin::Access::kRead,
Binding(0_a), Group(0_a));
ast::Type type = str->members[0]->type;
@@ -80,7 +80,7 @@
}
TEST_F(SpirvASTPrinterTest_Type, GenerateArray_WithStride) {
- auto ary = ty.array<i32, 4>(utils::Vector{Stride(16)});
+ auto ary = ty.array<i32, 4>(Vector{Stride(16)});
ast::Type ty = GlobalVar("a", ary, builtin::AddressSpace::kPrivate)->type;
Builder& b = Build();
@@ -324,7 +324,7 @@
TEST_F(SpirvASTPrinterTest_Type, GenerateStruct) {
Enable(builtin::Extension::kF16);
- auto* s = Structure("my_struct", utils::Vector{Member("a", ty.f32()), Member("b", ty.f16())});
+ auto* s = Structure("my_struct", Vector{Member("a", ty.f32()), Member("b", ty.f16())});
Builder& b = Build();
@@ -345,10 +345,10 @@
TEST_F(SpirvASTPrinterTest_Type, GenerateStruct_DecoratedMembers) {
Enable(builtin::Extension::kF16);
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("a", ty.f32()),
- Member("b", ty.f32(), utils::Vector{MemberAlign(8_i)}),
- Member("c", ty.f16(), utils::Vector{MemberAlign(8_u)}),
+ Member("b", ty.f32(), Vector{MemberAlign(8_i)}),
+ Member("c", ty.f16(), Vector{MemberAlign(8_u)}),
Member("d", ty.f16()),
});
@@ -378,15 +378,14 @@
TEST_F(SpirvASTPrinterTest_Type, GenerateStruct_DecoratedMembers_Matrix) {
Enable(builtin::Extension::kF16);
- auto* s =
- Structure("S", utils::Vector{
- Member("mat2x2_f32", ty.mat2x2<f32>()),
- Member("mat2x3_f32", ty.mat2x3<f32>(), utils::Vector{MemberAlign(64_i)}),
- Member("mat4x4_f32", ty.mat4x4<f32>()),
- Member("mat2x2_f16", ty.mat2x2<f16>(), utils::Vector{MemberAlign(32_i)}),
- Member("mat2x3_f16", ty.mat2x3<f16>()),
- Member("mat4x4_f16", ty.mat4x4<f16>(), utils::Vector{MemberAlign(64_i)}),
- });
+ auto* s = Structure("S", Vector{
+ Member("mat2x2_f32", ty.mat2x2<f32>()),
+ Member("mat2x3_f32", ty.mat2x3<f32>(), Vector{MemberAlign(64_i)}),
+ Member("mat4x4_f32", ty.mat4x4<f32>()),
+ Member("mat2x2_f16", ty.mat2x2<f16>(), Vector{MemberAlign(32_i)}),
+ Member("mat2x3_f16", ty.mat2x3<f16>()),
+ Member("mat4x4_f16", ty.mat4x4<f16>(), Vector{MemberAlign(64_i)}),
+ });
Builder& b = Build();
@@ -451,10 +450,10 @@
auto rtarr_mat4x4 = ty.array(ty.mat4x4<f32>()); // Runtime array
auto* s = Structure(
- "S", utils::Vector{
+ "S", Vector{
Member("arr_mat2x2_f32", arr_mat2x2_f32),
- Member("arr_mat2x2_f16", arr_mat2x2_f16, utils::Vector{MemberAlign(64_i)}),
- Member("arr_arr_mat2x3_f32", arr_arr_mat2x3_f32, utils::Vector{MemberAlign(64_i)}),
+ Member("arr_mat2x2_f16", arr_mat2x2_f16, Vector{MemberAlign(64_i)}),
+ Member("arr_arr_mat2x3_f32", arr_arr_mat2x3_f32, Vector{MemberAlign(64_i)}),
Member("arr_arr_mat2x3_f16", arr_arr_mat2x3_f16),
Member("rtarr_mat4x4", rtarr_mat4x4),
});
@@ -611,7 +610,7 @@
SpvStorageClass result;
};
inline std::ostream& operator<<(std::ostream& out, PtrData data) {
- utils::StringStream str;
+ StringStream str;
str << data.ast_class;
out << str.str();
return out;
diff --git a/src/tint/lang/spirv/writer/ast_printer/binary_expression_test.cc b/src/tint/lang/spirv/writer/ast_printer/binary_expression_test.cc
index e1c4df3..013419c 100644
--- a/src/tint/lang/spirv/writer/ast_printer/binary_expression_test.cc
+++ b/src/tint/lang/spirv/writer/ast_printer/binary_expression_test.cc
@@ -28,7 +28,7 @@
std::string name;
};
inline std::ostream& operator<<(std::ostream& out, BinaryData data) {
- utils::StringStream str;
+ StringStream str;
str << data.op;
out << str.str();
return out;
diff --git a/src/tint/lang/spirv/writer/ast_printer/builder.cc b/src/tint/lang/spirv/writer/ast_printer/builder.cc
index 4f4fc82..f317a93 100644
--- a/src/tint/lang/spirv/writer/ast_printer/builder.cc
+++ b/src/tint/lang/spirv/writer/ast_printer/builder.cc
@@ -255,7 +255,7 @@
bool Builder::Build() {
if (!tint::writer::CheckSupportedExtensions(
"SPIR-V", builder_.AST(), builder_.Diagnostics(),
- utils::Vector{
+ Vector{
builtin::Extension::kChromiumDisableUniformityAnalysis,
builtin::Extension::kChromiumExperimentalDp4A,
builtin::Extension::kChromiumExperimentalFullPtrParameters,
@@ -600,7 +600,7 @@
}
uint32_t Builder::GenerateFunctionTypeIfNeeded(const sem::Function* func) {
- return utils::GetOrCreate(func_sig_to_id_, func->Signature(), [&]() -> uint32_t {
+ return tint::GetOrCreate(func_sig_to_id_, func->Signature(), [&]() -> uint32_t {
auto func_op = result_op();
auto func_type_id = std::get<uint32_t>(func_op);
@@ -1385,7 +1385,7 @@
? scope_stack_[0] // Global scope
: scope_stack_.back(); // Lexical scope
- return utils::GetOrCreate(stack.type_init_to_id_, OperandListKey{ops}, [&]() -> uint32_t {
+ return tint::GetOrCreate(stack.type_init_to_id_, OperandListKey{ops}, [&]() -> uint32_t {
auto result = result_op();
ops[kOpsResultIdx] = result;
@@ -1627,13 +1627,13 @@
}
auto& global_scope = scope_stack_[0];
- return utils::GetOrCreate(
- global_scope.type_init_to_id_, OperandListKey{ops}, [&]() -> uint32_t {
- auto result = result_op();
- ops[kOpsResultIdx] = result;
- module_.PushType(spv::Op::OpConstantComposite, std::move(ops));
- return std::get<uint32_t>(result);
- });
+ return tint::GetOrCreate(global_scope.type_init_to_id_, OperandListKey{ops},
+ [&]() -> uint32_t {
+ auto result = result_op();
+ ops[kOpsResultIdx] = result;
+ module_.PushType(spv::Op::OpConstantComposite, std::move(ops));
+ return std::get<uint32_t>(result);
+ });
};
return Switch(
@@ -1756,7 +1756,7 @@
return 0;
}
- return utils::GetOrCreate(const_null_to_id_, type, [&] {
+ return tint::GetOrCreate(const_null_to_id_, type, [&] {
auto result = result_op();
module_.PushType(spv::Op::OpConstantNull, {Operand(type_id), result});
@@ -1772,7 +1772,7 @@
}
uint64_t key = (static_cast<uint64_t>(type->Width()) << 32) + value_id;
- return utils::GetOrCreate(const_splat_to_id_, key, [&] {
+ return tint::GetOrCreate(const_splat_to_id_, key, [&] {
auto result = result_op();
auto result_id = std::get<uint32_t>(result);
@@ -3251,7 +3251,7 @@
}
uint32_t sampled_image_type_id =
- utils::GetOrCreate(texture_type_to_sampled_image_type_id_, texture_type, [&] {
+ tint::GetOrCreate(texture_type_to_sampled_image_type_id_, texture_type, [&] {
// We need to create the sampled image type and cache the result.
auto sampled_image_type = result_op();
auto texture_type_id = GenerateTypeIfNeeded(texture_type);
@@ -3635,7 +3635,7 @@
builtin::Access::kReadWrite);
}
- return utils::GetOrCreate(type_to_id_, type, [&]() -> uint32_t {
+ return tint::GetOrCreate(type_to_id_, type, [&]() -> uint32_t {
auto result = result_op();
auto id = std::get<uint32_t>(result);
bool ok = Switch(
@@ -4104,7 +4104,7 @@
bool Builder::push_function_inst(spv::Op op, const OperandList& operands) {
if (!current_function_) {
- utils::StringStream ss;
+ StringStream ss;
ss << "Internal error: trying to add SPIR-V instruction " << int(op)
<< " outside a function";
TINT_ICE(Writer, builder_.Diagnostics()) << ss.str();
diff --git a/src/tint/lang/spirv/writer/ast_printer/builtin_texture_test.cc b/src/tint/lang/spirv/writer/ast_printer/builtin_texture_test.cc
index b523c19..c0dc007 100644
--- a/src/tint/lang/spirv/writer/ast_printer/builtin_texture_test.cc
+++ b/src/tint/lang/spirv/writer/ast_printer/builtin_texture_test.cc
@@ -3720,8 +3720,8 @@
auto* call = Call(param.function, param.args(this));
auto* stmt = param.returns_value ? static_cast<const ast::Statement*>(Assign(Phony(), call))
: static_cast<const ast::Statement*>(CallStmt(call));
- Func("func", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{
+ Func("func", tint::Empty, ty.void_(), Vector{stmt},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -3750,8 +3750,8 @@
auto* stmt = param.returns_value ? static_cast<const ast::Statement*>(Assign(Phony(), call))
: static_cast<const ast::Statement*>(CallStmt(call));
- Func("main", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), Vector{stmt},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -3781,8 +3781,8 @@
? static_cast<const ast::Statement*>(pb.Assign(pb.Phony(), call))
: static_cast<const ast::Statement*>(pb.CallStmt(call));
- pb.Func("func", utils::Empty, pb.ty.void_(), utils::Vector{stmt},
- utils::Vector{
+ pb.Func("func", tint::Empty, pb.ty.void_(), Vector{stmt},
+ Vector{
pb.Stage(ast::PipelineStage::kFragment),
});
diff --git a/src/tint/lang/spirv/writer/ast_printer/call_test.cc b/src/tint/lang/spirv/writer/ast_printer/call_test.cc
index 9004eb4..64004e9 100644
--- a/src/tint/lang/spirv/writer/ast_printer/call_test.cc
+++ b/src/tint/lang/spirv/writer/ast_printer/call_test.cc
@@ -26,13 +26,13 @@
TEST_F(SpirvASTPrinterTest, Expression_Call) {
auto* a_func = Func("a_func",
- utils::Vector{
+ Vector{
Param("a", ty.f32()),
Param("b", ty.f32()),
},
- ty.f32(), utils::Vector{Return(Add("a", "b"))});
- auto* func = Func("main", utils::Empty, ty.void_(),
- utils::Vector{Assign(Phony(), Call("a_func", 1_f, 1_f))});
+ ty.f32(), Vector{Return(Add("a", "b"))});
+ auto* func =
+ Func("main", tint::Empty, ty.void_(), Vector{Assign(Phony(), Call("a_func", 1_f, 1_f))});
Builder& b = Build();
@@ -65,14 +65,13 @@
TEST_F(SpirvASTPrinterTest, Statement_Call) {
auto* a_func = Func("a_func",
- utils::Vector{
+ Vector{
Param("a", ty.f32()),
Param("b", ty.f32()),
},
- ty.f32(), utils::Vector{Return(Add("a", "b"))});
+ ty.f32(), Vector{Return(Add("a", "b"))});
- auto* func =
- Func("main", utils::Empty, ty.void_(), utils::Vector{CallStmt(Call("a_func", 1_f, 1_f))});
+ auto* func = Func("main", tint::Empty, ty.void_(), Vector{CallStmt(Call("a_func", 1_f, 1_f))});
Builder& b = Build();
diff --git a/src/tint/lang/spirv/writer/ast_printer/const_assert_test.cc b/src/tint/lang/spirv/writer/ast_printer/const_assert_test.cc
index 8e58927..d9f8349 100644
--- a/src/tint/lang/spirv/writer/ast_printer/const_assert_test.cc
+++ b/src/tint/lang/spirv/writer/ast_printer/const_assert_test.cc
@@ -35,7 +35,7 @@
}
TEST_F(SpirvASTPrinterTest, FunctionConstAssert) {
- Func("f", utils::Empty, ty.void_(), utils::Vector{ConstAssert(true)});
+ Func("f", tint::Empty, ty.void_(), Vector{ConstAssert(true)});
Builder& b = Build();
diff --git a/src/tint/lang/spirv/writer/ast_printer/constructor_expression_test.cc b/src/tint/lang/spirv/writer/ast_printer/constructor_expression_test.cc
index 1d8931f..9fa75f2 100644
--- a/src/tint/lang/spirv/writer/ast_printer/constructor_expression_test.cc
+++ b/src/tint/lang/spirv/writer/ast_printer/constructor_expression_test.cc
@@ -3705,7 +3705,7 @@
}
TEST_F(SpvBuilderConstructorTest, Type_Struct) {
- auto* s = Structure("my_struct", utils::Vector{
+ auto* s = Structure("my_struct", Vector{
Member("a", ty.f32()),
Member("b", ty.vec3<f32>()),
});
@@ -3895,7 +3895,7 @@
}
TEST_F(SpvBuilderConstructorTest, Type_ZeroInit_Struct) {
- auto* s = Structure("my_struct", utils::Vector{Member("a", ty.f32())});
+ auto* s = Structure("my_struct", Vector{Member("a", ty.f32())});
auto* t = Call(ty.Of(s));
WrapInFunction(t);
@@ -4651,7 +4651,7 @@
}
TEST_F(SpvBuilderConstructorTest, IsConstructorConst_Struct) {
- auto* s = Structure("my_struct", utils::Vector{
+ auto* s = Structure("my_struct", Vector{
Member("a", ty.f32()),
Member("b", ty.vec3<f32>()),
});
@@ -4666,7 +4666,7 @@
}
TEST_F(SpvBuilderConstructorTest, IsConstructorConst_Struct_WithIdentSubExpression) {
- auto* s = Structure("my_struct", utils::Vector{
+ auto* s = Structure("my_struct", Vector{
Member("a", ty.f32()),
Member("b", ty.vec3<f32>()),
});
diff --git a/src/tint/lang/spirv/writer/ast_printer/entry_point_test.cc b/src/tint/lang/spirv/writer/ast_printer/entry_point_test.cc
index 45ab6c7..0b350dc 100644
--- a/src/tint/lang/spirv/writer/ast_printer/entry_point_test.cc
+++ b/src/tint/lang/spirv/writer/ast_printer/entry_point_test.cc
@@ -44,17 +44,17 @@
// var col : f32 = (coord.x * loc1);
// }
auto* coord = Param("coord", ty.vec4<f32>(),
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kPosition),
});
auto* loc1 = Param("loc1", ty.f32(),
- utils::Vector{
+ Vector{
Location(1_u),
});
auto* mul = Mul(Expr(MemberAccessor("coord", "x")), Expr("loc1"));
auto* col = Var("col", ty.f32(), mul);
- Func("frag_main", utils::Vector{coord, loc1}, ty.void_(), utils::Vector{WrapInStatement(col)},
- utils::Vector{
+ Func("frag_main", Vector{coord, loc1}, ty.void_(), Vector{WrapInStatement(col)},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -120,21 +120,21 @@
// return 1.0;
// }
auto* loc_in = Param("loc_in", ty.u32(),
- utils::Vector{
+ Vector{
Location(0_a),
Flat(),
});
auto* cond =
create<ast::BinaryExpression>(ast::BinaryOp::kGreaterThan, Expr("loc_in"), Expr(10_u));
- Func("frag_main", utils::Vector{loc_in}, ty.f32(),
- utils::Vector{
+ Func("frag_main", Vector{loc_in}, ty.f32(),
+ Vector{
If(cond, Block(Return(0.5_f))),
Return(1_f),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(0_a),
});
@@ -211,24 +211,24 @@
auto* interface = Structure(
"Interface",
- utils::Vector{
- Member("value", ty.f32(), utils::Vector{Location(1_u)}),
- Member("pos", ty.vec4<f32>(), utils::Vector{Builtin(builtin::BuiltinValue::kPosition)}),
+ Vector{
+ Member("value", ty.f32(), Vector{Location(1_u)}),
+ Member("pos", ty.vec4<f32>(), Vector{Builtin(builtin::BuiltinValue::kPosition)}),
});
auto* vert_retval = Call(ty.Of(interface), 42_f, Call<vec4<f32>>());
- Func("vert_main", utils::Empty, ty.Of(interface), utils::Vector{Return(vert_retval)},
- utils::Vector{
+ Func("vert_main", tint::Empty, ty.Of(interface), Vector{Return(vert_retval)},
+ Vector{
Stage(ast::PipelineStage::kVertex),
});
auto* frag_inputs = Param("inputs", ty.Of(interface));
- Func("frag_main", utils::Vector{frag_inputs}, ty.f32(),
- utils::Vector{
+ Func("frag_main", Vector{frag_inputs}, ty.f32(),
+ Vector{
Return(MemberAccessor(Expr("inputs"), "value")),
},
- utils::Vector{Stage(ast::PipelineStage::kFragment)},
- utils::Vector{
+ Vector{Stage(ast::PipelineStage::kFragment)},
+ Vector{
Builtin(builtin::BuiltinValue::kFragDepth),
});
@@ -322,10 +322,10 @@
TEST_F(SpirvASTPrinterTest, SampleIndex_SampleRateShadingCapability) {
Func("main",
- utils::Vector{Param("sample_index", ty.u32(),
- utils::Vector{Builtin(builtin::BuiltinValue::kSampleIndex)})},
- ty.void_(), utils::Empty,
- utils::Vector{
+ Vector{
+ Param("sample_index", ty.u32(), Vector{Builtin(builtin::BuiltinValue::kSampleIndex)})},
+ ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
diff --git a/src/tint/lang/spirv/writer/ast_printer/format_conversion_test.cc b/src/tint/lang/spirv/writer/ast_printer/format_conversion_test.cc
index 7dddc53..173e3a5 100644
--- a/src/tint/lang/spirv/writer/ast_printer/format_conversion_test.cc
+++ b/src/tint/lang/spirv/writer/ast_printer/format_conversion_test.cc
@@ -24,7 +24,7 @@
bool extended_format = false;
};
inline std::ostream& operator<<(std::ostream& out, TestData data) {
- utils::StringStream str;
+ StringStream str;
str << data.ast_format;
out << str.str();
return out;
diff --git a/src/tint/lang/spirv/writer/ast_printer/function_attribute_test.cc b/src/tint/lang/spirv/writer/ast_printer/function_attribute_test.cc
index 79002af..71182d8 100644
--- a/src/tint/lang/spirv/writer/ast_printer/function_attribute_test.cc
+++ b/src/tint/lang/spirv/writer/ast_printer/function_attribute_test.cc
@@ -28,8 +28,8 @@
using SpirvASTPrinterTest = TestHelper;
TEST_F(SpirvASTPrinterTest, Attribute_Stage) {
- auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ auto* func = Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -46,7 +46,7 @@
SpvExecutionModel model;
};
inline std::ostream& operator<<(std::ostream& out, FunctionStageData data) {
- utils::StringStream str;
+ StringStream str;
str << data.stage;
out << str.str();
return out;
@@ -57,20 +57,20 @@
const ast::Variable* var = nullptr;
ast::Type ret_type;
- utils::Vector<const ast::Attribute*, 2> ret_type_attrs;
- utils::Vector<const ast::Statement*, 2> body;
+ Vector<const ast::Attribute*, 2> ret_type_attrs;
+ Vector<const ast::Statement*, 2> body;
if (params.stage == ast::PipelineStage::kVertex) {
ret_type = ty.vec4<f32>();
ret_type_attrs.Push(Builtin(builtin::BuiltinValue::kPosition));
body.Push(Return(Call<vec4<f32>>()));
}
- utils::Vector<const ast::Attribute*, 2> deco_list{Stage(params.stage)};
+ Vector<const ast::Attribute*, 2> deco_list{Stage(params.stage)};
if (params.stage == ast::PipelineStage::kCompute) {
deco_list.Push(WorkgroupSize(1_i));
}
- auto* func = Func("main", utils::Empty, ret_type, body, deco_list, ret_type_attrs);
+ auto* func = Func("main", tint::Empty, ret_type, body, deco_list, ret_type_attrs);
Builder& b = Build();
@@ -94,8 +94,8 @@
FunctionStageData{ast::PipelineStage::kCompute, SpvExecutionModelGLCompute}));
TEST_F(SpirvASTPrinterTest, Decoration_ExecutionMode_Fragment_OriginUpperLeft) {
- auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ auto* func = Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -108,8 +108,8 @@
}
TEST_F(SpirvASTPrinterTest, Decoration_ExecutionMode_WorkgroupSize_Default) {
- auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)});
+ auto* func = Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)});
Builder& b = Build();
@@ -120,8 +120,8 @@
}
TEST_F(SpirvASTPrinterTest, Decoration_ExecutionMode_WorkgroupSize_Literals) {
- auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ auto* func = Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
WorkgroupSize(2_i, 4_i, 6_i),
Stage(ast::PipelineStage::kCompute),
});
@@ -138,8 +138,8 @@
GlobalConst("width", ty.i32(), Call<i32>(2_i));
GlobalConst("height", ty.i32(), Call<i32>(3_i));
GlobalConst("depth", ty.i32(), Call<i32>(4_i));
- auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ auto* func = Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
WorkgroupSize("width", "height", "depth"),
Stage(ast::PipelineStage::kCompute),
});
@@ -159,8 +159,8 @@
pb.Override("width", pb.ty.i32(), pb.Call<i32>(2_i), pb.Id(7_u));
pb.Override("height", pb.ty.i32(), pb.Call<i32>(3_i), pb.Id(8_u));
pb.Override("depth", pb.ty.i32(), pb.Call<i32>(4_i), pb.Id(9_u));
- auto* func = pb.Func("main", utils::Empty, pb.ty.void_(), utils::Empty,
- utils::Vector{
+ auto* func = pb.Func("main", tint::Empty, pb.ty.void_(), tint::Empty,
+ Vector{
pb.WorkgroupSize("width", "height", "depth"),
pb.Stage(ast::PipelineStage::kCompute),
});
@@ -179,8 +179,8 @@
pb.Override("height", pb.ty.i32(), pb.Call<i32>(2_i), pb.Id(7_u));
pb.GlobalConst("depth", pb.ty.i32(), pb.Call<i32>(3_i));
- auto* func = pb.Func("main", utils::Empty, pb.ty.void_(), utils::Empty,
- utils::Vector{
+ auto* func = pb.Func("main", tint::Empty, pb.ty.void_(), tint::Empty,
+ Vector{
pb.WorkgroupSize(4_i, "height", "depth"),
pb.Stage(ast::PipelineStage::kCompute),
});
@@ -194,13 +194,13 @@
}
TEST_F(SpirvASTPrinterTest, Decoration_ExecutionMode_MultipleFragment) {
- auto* func1 = Func("main1", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ auto* func1 = Func("main1", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
- auto* func2 = Func("main2", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ auto* func2 = Func("main2", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -229,14 +229,14 @@
}
TEST_F(SpirvASTPrinterTest, Decoration_ExecutionMode_FragDepth) {
- Func("main", utils::Empty, ty.f32(),
- utils::Vector{
+ Func("main", tint::Empty, ty.f32(),
+ Vector{
Return(Expr(1_f)),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kFragDepth),
});
diff --git a/src/tint/lang/spirv/writer/ast_printer/global_variable_test.cc b/src/tint/lang/spirv/writer/ast_printer/global_variable_test.cc
index 1e9ce4f..4644e82 100644
--- a/src/tint/lang/spirv/writer/ast_printer/global_variable_test.cc
+++ b/src/tint/lang/spirv/writer/ast_printer/global_variable_test.cc
@@ -257,7 +257,7 @@
SpvBuiltIn result;
};
inline std::ostream& operator<<(std::ostream& out, BuiltinData data) {
- utils::StringStream str;
+ StringStream str;
str << data.builtin;
out << str.str();
return out;
@@ -313,7 +313,7 @@
// };
// var b<storage, read> : A
- auto* A = Structure("A", utils::Vector{
+ auto* A = Structure("A", Vector{
Member("a", ty.i32()),
Member("b", ty.i32()),
});
@@ -358,7 +358,7 @@
// type B = A;
// var b<storage, read> : B
- auto* A = Structure("A", utils::Vector{Member("a", ty.i32())});
+ auto* A = Structure("A", Vector{Member("a", ty.i32())});
auto* B = Alias("B", ty.Of(A));
GlobalVar("b", ty.Of(B), builtin::AddressSpace::kStorage, builtin::Access::kRead, Binding(0_a),
Group(0_a));
@@ -398,7 +398,7 @@
// type B = A;
// var<storage, read> b : B
- auto* A = Structure("A", utils::Vector{Member("a", ty.i32())});
+ auto* A = Structure("A", Vector{Member("a", ty.i32())});
auto* B = Alias("B", ty.Of(A));
GlobalVar("b", ty.Of(B), builtin::AddressSpace::kStorage, builtin::Access::kRead, Binding(0_a),
Group(0_a));
@@ -438,7 +438,7 @@
// var<storage, read> b : A
// var<storage, read_write> c : A
- auto* A = Structure("A", utils::Vector{Member("a", ty.i32())});
+ auto* A = Structure("A", Vector{Member("a", ty.i32())});
GlobalVar("b", ty.Of(A), builtin::AddressSpace::kStorage, builtin::Access::kRead, Group(0_a),
Binding(0_a));
GlobalVar("c", ty.Of(A), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
@@ -507,7 +507,7 @@
auto type_array = ty.array<f32, 16>();
auto* var_array = GlobalVar("b", type_array, builtin::AddressSpace::kWorkgroup);
- auto* type_struct = Structure("C", utils::Vector{
+ auto* type_struct = Structure("C", Vector{
Member("a", ty.i32()),
Member("b", ty.i32()),
});
diff --git a/src/tint/lang/spirv/writer/ast_printer/return_test.cc b/src/tint/lang/spirv/writer/ast_printer/return_test.cc
index da16bb2..eb21478 100644
--- a/src/tint/lang/spirv/writer/ast_printer/return_test.cc
+++ b/src/tint/lang/spirv/writer/ast_printer/return_test.cc
@@ -41,7 +41,7 @@
auto* val = Call<vec3<f32>>(1_f, 1_f, 3_f);
auto* ret = Return(val);
- Func("test", utils::Empty, ty.vec3<f32>(), utils::Vector{ret}, utils::Empty);
+ Func("test", tint::Empty, ty.vec3<f32>(), Vector{ret}, tint::Empty);
Builder& b = Build();
@@ -64,7 +64,7 @@
auto* var = Var("param", ty.f32());
auto* ret = Return(var);
- Func("test", utils::Empty, ty.f32(), utils::Vector{Decl(var), ret}, utils::Empty);
+ Func("test", tint::Empty, ty.f32(), Vector{Decl(var), ret}, tint::Empty);
Builder& b = Build();
diff --git a/src/tint/lang/spirv/writer/ast_printer/scalar_constant.h b/src/tint/lang/spirv/writer/ast_printer/scalar_constant.h
index 12e09d7..40e47a3 100644
--- a/src/tint/lang/spirv/writer/ast_printer/scalar_constant.h
+++ b/src/tint/lang/spirv/writer/ast_printer/scalar_constant.h
@@ -139,7 +139,7 @@
inline std::size_t operator()(const tint::spirv::writer::ScalarConstant& c) const {
uint32_t value = 0;
std::memcpy(&value, &c.value, sizeof(value));
- return tint::utils::Hash(value, c.kind);
+ return tint::Hash(value, c.kind);
}
};
diff --git a/src/tint/lang/spirv/writer/bitcast_test.cc b/src/tint/lang/spirv/writer/bitcast_test.cc
index 5faaa0c..b96f6d6 100644
--- a/src/tint/lang/spirv/writer/bitcast_test.cc
+++ b/src/tint/lang/spirv/writer/bitcast_test.cc
@@ -30,7 +30,7 @@
std::string spirv_type_name;
};
std::string PrintCase(testing::TestParamInfo<BitcastCase> cc) {
- utils::StringStream ss;
+ StringStream ss;
ss << cc.param.in << "_to_" << cc.param.out;
return ss.str();
}
diff --git a/src/tint/lang/spirv/writer/constant_test.cc b/src/tint/lang/spirv/writer/constant_test.cc
index b5e8f2e..3301ef7 100644
--- a/src/tint/lang/spirv/writer/constant_test.cc
+++ b/src/tint/lang/spirv/writer/constant_test.cc
@@ -63,7 +63,7 @@
auto const_bool = [&](bool val) { return mod.constant_values.Get(val); };
auto* v = mod.constant_values.Composite(
ty.vec4(ty.bool_()),
- utils::Vector{const_bool(true), const_bool(false), const_bool(false), const_bool(true)});
+ Vector{const_bool(true), const_bool(false), const_bool(false), const_bool(true)});
writer_.Constant(b.Constant(v));
ASSERT_TRUE(Generate()) << Error() << output_;
@@ -72,8 +72,8 @@
TEST_F(SpirvWriterTest, Constant_Vec2i) {
auto const_i32 = [&](float val) { return mod.constant_values.Get(i32(val)); };
- auto* v = mod.constant_values.Composite(ty.vec2(ty.i32()),
- utils::Vector{const_i32(42), const_i32(-1)});
+ auto* v =
+ mod.constant_values.Composite(ty.vec2(ty.i32()), Vector{const_i32(42), const_i32(-1)});
writer_.Constant(b.Constant(v));
ASSERT_TRUE(Generate()) << Error() << output_;
EXPECT_INST("%1 = OpConstantComposite %v2int %int_42 %int_n1");
@@ -82,7 +82,7 @@
TEST_F(SpirvWriterTest, Constant_Vec3u) {
auto const_u32 = [&](float val) { return mod.constant_values.Get(u32(val)); };
auto* v = mod.constant_values.Composite(
- ty.vec3(ty.u32()), utils::Vector{const_u32(42), const_u32(0), const_u32(4000000000)});
+ ty.vec3(ty.u32()), Vector{const_u32(42), const_u32(0), const_u32(4000000000)});
writer_.Constant(b.Constant(v));
ASSERT_TRUE(Generate()) << Error() << output_;
EXPECT_INST("%1 = OpConstantComposite %v3uint %uint_42 %uint_0 %uint_4000000000");
@@ -91,8 +91,7 @@
TEST_F(SpirvWriterTest, Constant_Vec4f) {
auto const_f32 = [&](float val) { return mod.constant_values.Get(f32(val)); };
auto* v = mod.constant_values.Composite(
- ty.vec4(ty.f32()),
- utils::Vector{const_f32(42), const_f32(0), const_f32(0.25), const_f32(-1)});
+ ty.vec4(ty.f32()), Vector{const_f32(42), const_f32(0), const_f32(0.25), const_f32(-1)});
writer_.Constant(b.Constant(v));
ASSERT_TRUE(Generate()) << Error() << output_;
EXPECT_INST("%1 = OpConstantComposite %v4float %float_42 %float_0 %float_0_25 %float_n1");
@@ -100,8 +99,8 @@
TEST_F(SpirvWriterTest, Constant_Vec2h) {
auto const_f16 = [&](float val) { return mod.constant_values.Get(f16(val)); };
- auto* v = mod.constant_values.Composite(ty.vec2(ty.f16()),
- utils::Vector{const_f16(42), const_f16(0.25)});
+ auto* v =
+ mod.constant_values.Composite(ty.vec2(ty.f16()), Vector{const_f16(42), const_f16(0.25)});
writer_.Constant(b.Constant(v));
ASSERT_TRUE(Generate()) << Error() << output_;
EXPECT_INST("%1 = OpConstantComposite %v2half %half_0x1_5p_5 %half_0x1pn2");
@@ -112,11 +111,11 @@
auto* f32 = ty.f32();
auto* v = mod.constant_values.Composite(
ty.mat2x3(f32),
- utils::Vector{
- mod.constant_values.Composite(
- ty.vec3(f32), utils::Vector{const_f32(42), const_f32(-1), const_f32(0.25)}),
- mod.constant_values.Composite(
- ty.vec3(f32), utils::Vector{const_f32(-42), const_f32(0), const_f32(-0.25)}),
+ Vector{
+ mod.constant_values.Composite(ty.vec3(f32),
+ Vector{const_f32(42), const_f32(-1), const_f32(0.25)}),
+ mod.constant_values.Composite(ty.vec3(f32),
+ Vector{const_f32(-42), const_f32(0), const_f32(-0.25)}),
});
writer_.Constant(b.Constant(v));
ASSERT_TRUE(Generate()) << Error() << output_;
@@ -137,16 +136,13 @@
auto const_f16 = [&](float val) { return mod.constant_values.Get(f16(val)); };
auto* f16 = ty.f16();
auto* v = mod.constant_values.Composite(
- ty.mat4x2(f16), utils::Vector{
- mod.constant_values.Composite(
- ty.vec2(f16), utils::Vector{const_f16(42), const_f16(-1)}),
- mod.constant_values.Composite(
- ty.vec2(f16), utils::Vector{const_f16(0), const_f16(0.25)}),
- mod.constant_values.Composite(
- ty.vec2(f16), utils::Vector{const_f16(-42), const_f16(1)}),
- mod.constant_values.Composite(
- ty.vec2(f16), utils::Vector{const_f16(0.5), const_f16(-0)}),
- });
+ ty.mat4x2(f16),
+ Vector{
+ mod.constant_values.Composite(ty.vec2(f16), Vector{const_f16(42), const_f16(-1)}),
+ mod.constant_values.Composite(ty.vec2(f16), Vector{const_f16(0), const_f16(0.25)}),
+ mod.constant_values.Composite(ty.vec2(f16), Vector{const_f16(-42), const_f16(1)}),
+ mod.constant_values.Composite(ty.vec2(f16), Vector{const_f16(0.5), const_f16(-0)}),
+ });
writer_.Constant(b.Constant(v));
ASSERT_TRUE(Generate()) << Error() << output_;
EXPECT_INST(R"(
@@ -167,7 +163,7 @@
TEST_F(SpirvWriterTest, Constant_Array_I32) {
auto* arr =
- mod.constant_values.Composite(ty.array(ty.i32(), 4), utils::Vector{
+ mod.constant_values.Composite(ty.array(ty.i32(), 4), Vector{
mod.constant_values.Get(1_i),
mod.constant_values.Get(2_i),
mod.constant_values.Get(3_i),
@@ -180,13 +176,13 @@
TEST_F(SpirvWriterTest, Constant_Array_Array_I32) {
auto* inner =
- mod.constant_values.Composite(ty.array(ty.i32(), 4), utils::Vector{
+ mod.constant_values.Composite(ty.array(ty.i32(), 4), Vector{
mod.constant_values.Get(1_i),
mod.constant_values.Get(2_i),
mod.constant_values.Get(3_i),
mod.constant_values.Get(4_i),
});
- auto* arr = mod.constant_values.Composite(ty.array(ty.array(ty.i32(), 4), 4), utils::Vector{
+ auto* arr = mod.constant_values.Composite(ty.array(ty.array(ty.i32(), 4), 4), Vector{
inner,
inner,
inner,
@@ -206,7 +202,7 @@
{mod.symbols.New("b"), ty.u32()},
{mod.symbols.New("c"), ty.f32()},
});
- auto* str = mod.constant_values.Composite(str_ty, utils::Vector{
+ auto* str = mod.constant_values.Composite(str_ty, Vector{
mod.constant_values.Get(1_i),
mod.constant_values.Get(2_u),
mod.constant_values.Get(3_f),
diff --git a/src/tint/lang/spirv/writer/convert_test.cc b/src/tint/lang/spirv/writer/convert_test.cc
index 318cc47..59bfab0 100644
--- a/src/tint/lang/spirv/writer/convert_test.cc
+++ b/src/tint/lang/spirv/writer/convert_test.cc
@@ -32,7 +32,7 @@
std::string spirv_type_name;
};
std::string PrintCase(testing::TestParamInfo<ConvertCase> cc) {
- utils::StringStream ss;
+ StringStream ss;
ss << cc.param.in << "_to_" << cc.param.out;
return ss.str();
}
diff --git a/src/tint/lang/spirv/writer/operand.h b/src/tint/lang/spirv/writer/operand.h
index fda828c..caedc8e 100644
--- a/src/tint/lang/spirv/writer/operand.h
+++ b/src/tint/lang/spirv/writer/operand.h
@@ -39,7 +39,7 @@
/// A list of operands
using OperandList = std::vector<Operand>;
-using OperandListKey = utils::UnorderedKeyWrapper<OperandList>;
+using OperandListKey = tint::UnorderedKeyWrapper<OperandList>;
} // namespace tint::spirv::writer
diff --git a/src/tint/lang/spirv/writer/printer/printer.cc b/src/tint/lang/spirv/writer/printer/printer.cc
index 8eca4e1..9457d67 100644
--- a/src/tint/lang/spirv/writer/printer/printer.cc
+++ b/src/tint/lang/spirv/writer/printer/printer.cc
@@ -1899,7 +1899,7 @@
auto* result = results[index];
auto* ty = result->Type();
- utils::Vector<Branch, 8> branches;
+ Vector<Branch, 8> branches;
branches.Reserve(inst->Exits().Count());
for (auto& exit : inst->Exits()) {
branches.Push(Branch{Label(exit->Block()), exit->Args()[index]});
diff --git a/src/tint/lang/spirv/writer/printer/printer.h b/src/tint/lang/spirv/writer/printer/printer.h
index 76969e7..99efacf 100644
--- a/src/tint/lang/spirv/writer/printer/printer.h
+++ b/src/tint/lang/spirv/writer/printer/printer.h
@@ -277,16 +277,16 @@
/// A function type used for an OpTypeFunction declaration.
struct FunctionType {
uint32_t return_type_id;
- utils::Vector<uint32_t, 4> param_type_ids;
+ Vector<uint32_t, 4> param_type_ids;
/// Hasher provides a hash function for the FunctionType.
struct Hasher {
/// @param ft the FunctionType to create a hash for
/// @return the hash value
inline std::size_t operator()(const FunctionType& ft) const {
- size_t hash = utils::Hash(ft.return_type_id);
+ size_t hash = Hash(ft.return_type_id);
for (auto& p : ft.param_type_ids) {
- hash = utils::HashCombine(hash, p);
+ hash = HashCombine(hash, p);
}
return hash;
}
@@ -300,28 +300,28 @@
};
/// The map of types to their result IDs.
- utils::Hashmap<const type::Type*, uint32_t, 8> types_;
+ Hashmap<const type::Type*, uint32_t, 8> types_;
/// The map of function types to their result IDs.
- utils::Hashmap<FunctionType, uint32_t, 8, FunctionType::Hasher> function_types_;
+ Hashmap<FunctionType, uint32_t, 8, FunctionType::Hasher> function_types_;
/// The map of constants to their result IDs.
- utils::Hashmap<const constant::Value*, uint32_t, 16> constants_;
+ Hashmap<const constant::Value*, uint32_t, 16> constants_;
/// The map of types to the result IDs of their OpConstantNull instructions.
- utils::Hashmap<const type::Type*, uint32_t, 4> constant_nulls_;
+ Hashmap<const type::Type*, uint32_t, 4> constant_nulls_;
/// The map of types to the result IDs of their OpUndef instructions.
- utils::Hashmap<const type::Type*, uint32_t, 4> undef_values_;
+ Hashmap<const type::Type*, uint32_t, 4> undef_values_;
/// The map of non-constant values to their result IDs.
- utils::Hashmap<ir::Value*, uint32_t, 8> values_;
+ Hashmap<ir::Value*, uint32_t, 8> values_;
/// The map of blocks to the IDs of their label instructions.
- utils::Hashmap<ir::Block*, uint32_t, 8> block_labels_;
+ Hashmap<ir::Block*, uint32_t, 8> block_labels_;
/// The map of extended instruction set names to their result IDs.
- utils::Hashmap<std::string_view, uint32_t, 2> imports_;
+ Hashmap<std::string_view, uint32_t, 2> imports_;
/// The current function that is being emitted.
Function current_function_;
diff --git a/src/tint/lang/spirv/writer/switch_test.cc b/src/tint/lang/spirv/writer/switch_test.cc
index 532c6ff..b8cc34f 100644
--- a/src/tint/lang/spirv/writer/switch_test.cc
+++ b/src/tint/lang/spirv/writer/switch_test.cc
@@ -24,7 +24,7 @@
b.Append(func->Block(), [&] {
auto* swtch = b.Switch(42_i);
- auto* def_case = b.Case(swtch, utils::Vector{ir::Switch::CaseSelector()});
+ auto* def_case = b.Case(swtch, Vector{ir::Switch::CaseSelector()});
b.Append(def_case, [&] { //
b.ExitSwitch(swtch);
});
@@ -50,17 +50,17 @@
b.Append(func->Block(), [&] {
auto* swtch = b.Switch(42_i);
- auto* case_a = b.Case(swtch, utils::Vector{ir::Switch::CaseSelector{b.Constant(1_i)}});
+ auto* case_a = b.Case(swtch, Vector{ir::Switch::CaseSelector{b.Constant(1_i)}});
b.Append(case_a, [&] { //
b.ExitSwitch(swtch);
});
- auto* case_b = b.Case(swtch, utils::Vector{ir::Switch::CaseSelector{b.Constant(2_i)}});
+ auto* case_b = b.Case(swtch, Vector{ir::Switch::CaseSelector{b.Constant(2_i)}});
b.Append(case_b, [&] { //
b.ExitSwitch(swtch);
});
- auto* def_case = b.Case(swtch, utils::Vector{ir::Switch::CaseSelector()});
+ auto* def_case = b.Case(swtch, Vector{ir::Switch::CaseSelector()});
b.Append(def_case, [&] { //
b.ExitSwitch(swtch);
});
@@ -90,20 +90,20 @@
b.Append(func->Block(), [&] {
auto* swtch = b.Switch(42_i);
- auto* case_a = b.Case(swtch, utils::Vector{ir::Switch::CaseSelector{b.Constant(1_i)},
- ir::Switch::CaseSelector{b.Constant(3_i)}});
+ auto* case_a = b.Case(swtch, Vector{ir::Switch::CaseSelector{b.Constant(1_i)},
+ ir::Switch::CaseSelector{b.Constant(3_i)}});
b.Append(case_a, [&] { //
b.ExitSwitch(swtch);
});
- auto* case_b = b.Case(swtch, utils::Vector{ir::Switch::CaseSelector{b.Constant(2_i)},
- ir::Switch::CaseSelector{b.Constant(4_i)}});
+ auto* case_b = b.Case(swtch, Vector{ir::Switch::CaseSelector{b.Constant(2_i)},
+ ir::Switch::CaseSelector{b.Constant(4_i)}});
b.Append(case_b, [&] { //
b.ExitSwitch(swtch);
});
- auto* def_case = b.Case(swtch, utils::Vector{ir::Switch::CaseSelector{b.Constant(5_i)},
- ir::Switch::CaseSelector()});
+ auto* def_case = b.Case(
+ swtch, Vector{ir::Switch::CaseSelector{b.Constant(5_i)}, ir::Switch::CaseSelector()});
b.Append(def_case, [&] { //
b.ExitSwitch(swtch);
});
@@ -133,17 +133,17 @@
b.Append(func->Block(), [&] {
auto* swtch = b.Switch(42_i);
- auto* case_a = b.Case(swtch, utils::Vector{ir::Switch::CaseSelector{b.Constant(1_i)}});
+ auto* case_a = b.Case(swtch, Vector{ir::Switch::CaseSelector{b.Constant(1_i)}});
b.Append(case_a, [&] { //
b.Return(func);
});
- auto* case_b = b.Case(swtch, utils::Vector{ir::Switch::CaseSelector{b.Constant(2_i)}});
+ auto* case_b = b.Case(swtch, Vector{ir::Switch::CaseSelector{b.Constant(2_i)}});
b.Append(case_b, [&] { //
b.Return(func);
});
- auto* def_case = b.Case(swtch, utils::Vector{ir::Switch::CaseSelector()});
+ auto* def_case = b.Case(swtch, Vector{ir::Switch::CaseSelector()});
b.Append(def_case, [&] { //
b.Return(func);
});
@@ -173,7 +173,7 @@
b.Append(func->Block(), [&] {
auto* swtch = b.Switch(42_i);
- auto* case_a = b.Case(swtch, utils::Vector{ir::Switch::CaseSelector{b.Constant(1_i)}});
+ auto* case_a = b.Case(swtch, Vector{ir::Switch::CaseSelector{b.Constant(1_i)}});
b.Append(case_a, [&] {
auto* cond_break = b.If(true);
b.Append(cond_break->True(), [&] { //
@@ -186,7 +186,7 @@
b.Return(func);
});
- auto* def_case = b.Case(swtch, utils::Vector{ir::Switch::CaseSelector()});
+ auto* def_case = b.Case(swtch, Vector{ir::Switch::CaseSelector()});
b.Append(def_case, [&] { //
b.ExitSwitch(swtch);
});
@@ -219,13 +219,13 @@
b.Append(func->Block(), [&] {
auto* s = b.Switch(42_i);
s->SetResults(b.InstructionResult(ty.i32()));
- auto* case_a = b.Case(s, utils::Vector{ir::Switch::CaseSelector{b.Constant(1_i)},
- ir::Switch::CaseSelector{nullptr}});
+ auto* case_a = b.Case(s, Vector{ir::Switch::CaseSelector{b.Constant(1_i)},
+ ir::Switch::CaseSelector{nullptr}});
b.Append(case_a, [&] { //
b.ExitSwitch(s, 10_i);
});
- auto* case_b = b.Case(s, utils::Vector{ir::Switch::CaseSelector{b.Constant(2_i)}});
+ auto* case_b = b.Case(s, Vector{ir::Switch::CaseSelector{b.Constant(2_i)}});
b.Append(case_b, [&] { //
b.ExitSwitch(s, 20_i);
});
@@ -254,13 +254,13 @@
b.Append(func->Block(), [&] {
auto* s = b.Switch(42_i);
s->SetResults(b.InstructionResult(ty.i32()));
- auto* case_a = b.Case(s, utils::Vector{ir::Switch::CaseSelector{b.Constant(1_i)},
- ir::Switch::CaseSelector{nullptr}});
+ auto* case_a = b.Case(s, Vector{ir::Switch::CaseSelector{b.Constant(1_i)},
+ ir::Switch::CaseSelector{nullptr}});
b.Append(case_a, [&] { //
b.Return(func, 10_i);
});
- auto* case_b = b.Case(s, utils::Vector{ir::Switch::CaseSelector{b.Constant(2_i)}});
+ auto* case_b = b.Case(s, Vector{ir::Switch::CaseSelector{b.Constant(2_i)}});
b.Append(case_b, [&] { //
b.ExitSwitch(s, 20_i);
});
@@ -302,13 +302,13 @@
b.Append(func->Block(), [&] {
auto* s = b.Switch(42_i);
s->SetResults(b.InstructionResult(ty.i32()), b.InstructionResult(ty.bool_()));
- auto* case_a = b.Case(s, utils::Vector{ir::Switch::CaseSelector{b.Constant(1_i)},
- ir::Switch::CaseSelector{nullptr}});
+ auto* case_a = b.Case(s, Vector{ir::Switch::CaseSelector{b.Constant(1_i)},
+ ir::Switch::CaseSelector{nullptr}});
b.Append(case_a, [&] { //
b.ExitSwitch(s, 10_i, true);
});
- auto* case_b = b.Case(s, utils::Vector{ir::Switch::CaseSelector{b.Constant(2_i)}});
+ auto* case_b = b.Case(s, Vector{ir::Switch::CaseSelector{b.Constant(2_i)}});
b.Append(case_b, [&] { //
b.ExitSwitch(s, 20_i, false);
});
@@ -338,13 +338,13 @@
b.Append(func->Block(), [&] {
auto* s = b.Switch(b.Constant(42_i));
s->SetResults(b.InstructionResult(ty.i32()), b.InstructionResult(ty.bool_()));
- auto* case_a = b.Case(s, utils::Vector{ir::Switch::CaseSelector{b.Constant(1_i)},
- ir::Switch::CaseSelector{nullptr}});
+ auto* case_a = b.Case(s, Vector{ir::Switch::CaseSelector{b.Constant(1_i)},
+ ir::Switch::CaseSelector{nullptr}});
b.Append(case_a, [&] { //
b.ExitSwitch(s, 10_i, true);
});
- auto* case_b = b.Case(s, utils::Vector{ir::Switch::CaseSelector{b.Constant(2_i)}});
+ auto* case_b = b.Case(s, Vector{ir::Switch::CaseSelector{b.Constant(2_i)}});
b.Append(case_b, [&] { //
b.ExitSwitch(s, 20_i, false);
});
diff --git a/src/tint/lang/spirv/writer/test_helper.h b/src/tint/lang/spirv/writer/test_helper.h
index 616bcb5..d4d6ae9 100644
--- a/src/tint/lang/spirv/writer/test_helper.h
+++ b/src/tint/lang/spirv/writer/test_helper.h
@@ -47,7 +47,7 @@
kF32,
kF16,
};
-inline utils::StringStream& operator<<(utils::StringStream& out, TestElementType type) {
+inline StringStream& operator<<(StringStream& out, TestElementType type) {
switch (type) {
case kBool:
out << "bool";
@@ -208,28 +208,28 @@
case kBool:
return b.Constant(mod.constant_values.Composite(
MakeVectorType(type),
- utils::Vector<const constant::Value*, 2>{mod.constant_values.Get(true),
- mod.constant_values.Get(false)}));
+ Vector<const constant::Value*, 2>{mod.constant_values.Get(true),
+ mod.constant_values.Get(false)}));
case kI32:
return b.Constant(mod.constant_values.Composite(
MakeVectorType(type),
- utils::Vector<const constant::Value*, 2>{mod.constant_values.Get(i32(42)),
- mod.constant_values.Get(i32(-10))}));
+ Vector<const constant::Value*, 2>{mod.constant_values.Get(i32(42)),
+ mod.constant_values.Get(i32(-10))}));
case kU32:
return b.Constant(mod.constant_values.Composite(
MakeVectorType(type),
- utils::Vector<const constant::Value*, 2>{mod.constant_values.Get(u32(42)),
- mod.constant_values.Get(u32(10))}));
+ Vector<const constant::Value*, 2>{mod.constant_values.Get(u32(42)),
+ mod.constant_values.Get(u32(10))}));
case kF32:
return b.Constant(mod.constant_values.Composite(
MakeVectorType(type),
- utils::Vector<const constant::Value*, 2>{mod.constant_values.Get(f32(42)),
- mod.constant_values.Get(f32(-0.5))}));
+ Vector<const constant::Value*, 2>{mod.constant_values.Get(f32(42)),
+ mod.constant_values.Get(f32(-0.5))}));
case kF16:
return b.Constant(mod.constant_values.Composite(
MakeVectorType(type),
- utils::Vector<const constant::Value*, 2>{mod.constant_values.Get(f16(42)),
- mod.constant_values.Get(f16(-0.5))}));
+ Vector<const constant::Value*, 2>{mod.constant_values.Get(f16(42)),
+ mod.constant_values.Get(f16(-0.5))}));
}
return nullptr;
}
diff --git a/src/tint/lang/spirv/writer/texture_builtin_test.cc b/src/tint/lang/spirv/writer/texture_builtin_test.cc
index c5b6906..3df9f72 100644
--- a/src/tint/lang/spirv/writer/texture_builtin_test.cc
+++ b/src/tint/lang/spirv/writer/texture_builtin_test.cc
@@ -55,14 +55,14 @@
/// The texel type of the texture.
TestElementType texel_type;
/// The builtin function arguments.
- utils::Vector<NameAndType, 4> args;
+ Vector<NameAndType, 4> args;
/// The result type.
NameAndType result;
/// The expected SPIR-V instruction strings.
- utils::Vector<const char*, 2> instructions;
+ Vector<const char*, 2> instructions;
};
-inline utils::StringStream& operator<<(utils::StringStream& out, TextureType type) {
+inline StringStream& operator<<(StringStream& out, TextureType type) {
switch (type) {
case kSampledTexture:
out << "SampleTexture";
@@ -84,7 +84,7 @@
}
std::string PrintCase(testing::TestParamInfo<TextureBuiltinTestCase> cc) {
- utils::StringStream ss;
+ StringStream ss;
ss << cc.param.texture_type << cc.param.dim << "_" << cc.param.texel_type;
for (const auto& arg : cc.param.args) {
ss << "_" << arg.name;
@@ -138,7 +138,7 @@
result_ty = ty.vec(result_ty, params.result.width);
}
- utils::Vector<ir::FunctionParam*, 4> func_params;
+ Vector<ir::FunctionParam*, 4> func_params;
auto* t = b.FunctionParam(
"t", MakeTextureType(params.texture_type, params.dim, params.texel_type));
@@ -158,7 +158,7 @@
b.Append(func->Block(), [&] {
uint32_t arg_value = 1;
- utils::Vector<ir::Value*, 4> args;
+ Vector<ir::Value*, 4> args;
if (function == builtin::Function::kTextureGather &&
params.texture_type != kDepthTexture) {
// Special case for textureGather, which has a component argument first.
diff --git a/src/tint/lang/wgsl/ast/accessor_expression.h b/src/tint/lang/wgsl/ast/accessor_expression.h
index 92f5cb10..ae10d94 100644
--- a/src/tint/lang/wgsl/ast/accessor_expression.h
+++ b/src/tint/lang/wgsl/ast/accessor_expression.h
@@ -20,7 +20,7 @@
namespace tint::ast {
/// Base class for IndexAccessorExpression and MemberAccessorExpression
-class AccessorExpression : public utils::Castable<AccessorExpression, Expression> {
+class AccessorExpression : public Castable<AccessorExpression, Expression> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/alias.h b/src/tint/lang/wgsl/ast/alias.h
index 66db7c9..73ebdc7 100644
--- a/src/tint/lang/wgsl/ast/alias.h
+++ b/src/tint/lang/wgsl/ast/alias.h
@@ -23,7 +23,7 @@
namespace tint::ast {
/// A type alias type. Holds a name and pointer to another type.
-class Alias final : public utils::Castable<Alias, TypeDecl> {
+class Alias final : public Castable<Alias, TypeDecl> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/assignment_statement.h b/src/tint/lang/wgsl/ast/assignment_statement.h
index e984d83..7b2c865 100644
--- a/src/tint/lang/wgsl/ast/assignment_statement.h
+++ b/src/tint/lang/wgsl/ast/assignment_statement.h
@@ -21,7 +21,7 @@
namespace tint::ast {
/// An assignment statement
-class AssignmentStatement final : public utils::Castable<AssignmentStatement, Statement> {
+class AssignmentStatement final : public Castable<AssignmentStatement, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/attribute.h b/src/tint/lang/wgsl/ast/attribute.h
index a3d1599..91d4e64 100644
--- a/src/tint/lang/wgsl/ast/attribute.h
+++ b/src/tint/lang/wgsl/ast/attribute.h
@@ -23,7 +23,7 @@
namespace tint::ast {
/// The base class for all attributes
-class Attribute : public utils::Castable<Attribute, Node> {
+class Attribute : public Castable<Attribute, Node> {
public:
~Attribute() override;
@@ -41,7 +41,7 @@
/// @param attributes the list of attributes to search
/// @returns true if `attributes` includes a attribute of type `T`
template <typename... Ts>
-bool HasAttribute(utils::VectorRef<const Attribute*> attributes) {
+bool HasAttribute(VectorRef<const Attribute*> attributes) {
for (auto* attr : attributes) {
if (attr->IsAnyOf<Ts...>()) {
return true;
@@ -53,7 +53,7 @@
/// @param attributes the list of attributes to search
/// @returns a pointer to `T` from `attributes` if found, otherwise nullptr.
template <typename T>
-const T* GetAttribute(utils::VectorRef<const Attribute*> attributes) {
+const T* GetAttribute(VectorRef<const Attribute*> attributes) {
for (auto* attr : attributes) {
if (attr->Is<T>()) {
return attr->As<T>();
diff --git a/src/tint/lang/wgsl/ast/binary_expression.h b/src/tint/lang/wgsl/ast/binary_expression.h
index 2a96e3d..7f90d6f 100644
--- a/src/tint/lang/wgsl/ast/binary_expression.h
+++ b/src/tint/lang/wgsl/ast/binary_expression.h
@@ -43,7 +43,7 @@
};
/// An binary expression
-class BinaryExpression final : public utils::Castable<BinaryExpression, Expression> {
+class BinaryExpression final : public Castable<BinaryExpression, Expression> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
@@ -300,7 +300,7 @@
/// @param out the stream to write to
/// @param op the BinaryOp
/// @return the stream so calls can be chained
-inline utils::StringStream& operator<<(utils::StringStream& out, BinaryOp op) {
+inline StringStream& operator<<(StringStream& out, BinaryOp op) {
out << FriendlyName(op);
return out;
}
diff --git a/src/tint/lang/wgsl/ast/binding_attribute.h b/src/tint/lang/wgsl/ast/binding_attribute.h
index 6dd616a..76f16bc 100644
--- a/src/tint/lang/wgsl/ast/binding_attribute.h
+++ b/src/tint/lang/wgsl/ast/binding_attribute.h
@@ -23,7 +23,7 @@
namespace tint::ast {
/// A binding attribute
-class BindingAttribute final : public utils::Castable<BindingAttribute, Attribute> {
+class BindingAttribute final : public Castable<BindingAttribute, Attribute> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/bitcast_expression.h b/src/tint/lang/wgsl/ast/bitcast_expression.h
index 3d56bf9..c13addf 100644
--- a/src/tint/lang/wgsl/ast/bitcast_expression.h
+++ b/src/tint/lang/wgsl/ast/bitcast_expression.h
@@ -21,7 +21,7 @@
namespace tint::ast {
/// A bitcast expression
-class BitcastExpression final : public utils::Castable<BitcastExpression, Expression> {
+class BitcastExpression final : public Castable<BitcastExpression, Expression> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/block_statement.cc b/src/tint/lang/wgsl/ast/block_statement.cc
index 29b7912..7bbec98 100644
--- a/src/tint/lang/wgsl/ast/block_statement.cc
+++ b/src/tint/lang/wgsl/ast/block_statement.cc
@@ -23,8 +23,8 @@
BlockStatement::BlockStatement(GenerationID pid,
NodeID nid,
const Source& src,
- utils::VectorRef<const Statement*> stmts,
- utils::VectorRef<const Attribute*> attrs)
+ VectorRef<const Statement*> stmts,
+ VectorRef<const Attribute*> attrs)
: Base(pid, nid, src), statements(std::move(stmts)), attributes(attrs) {
for (auto* stmt : statements) {
TINT_ASSERT(AST, stmt);
diff --git a/src/tint/lang/wgsl/ast/block_statement.h b/src/tint/lang/wgsl/ast/block_statement.h
index cbc6b6c..6a0449f 100644
--- a/src/tint/lang/wgsl/ast/block_statement.h
+++ b/src/tint/lang/wgsl/ast/block_statement.h
@@ -27,7 +27,7 @@
namespace tint::ast {
/// A block statement
-class BlockStatement final : public utils::Castable<BlockStatement, Statement> {
+class BlockStatement final : public Castable<BlockStatement, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
@@ -38,8 +38,8 @@
BlockStatement(GenerationID pid,
NodeID nid,
const Source& source,
- utils::VectorRef<const Statement*> statements,
- utils::VectorRef<const Attribute*> attributes);
+ VectorRef<const Statement*> statements,
+ VectorRef<const Attribute*> attributes);
/// Destructor
~BlockStatement() override;
@@ -57,10 +57,10 @@
const BlockStatement* Clone(CloneContext* ctx) const override;
/// the statement list
- const utils::Vector<const Statement*, 8> statements;
+ const tint::Vector<const Statement*, 8> statements;
/// the attribute list
- const utils::Vector<const Attribute*, 4> attributes;
+ const tint::Vector<const Attribute*, 4> attributes;
};
} // namespace tint::ast
diff --git a/src/tint/lang/wgsl/ast/block_statement_test.cc b/src/tint/lang/wgsl/ast/block_statement_test.cc
index 599e266..8fd9c61 100644
--- a/src/tint/lang/wgsl/ast/block_statement_test.cc
+++ b/src/tint/lang/wgsl/ast/block_statement_test.cc
@@ -27,7 +27,7 @@
auto* d = create<DiscardStatement>();
auto* ptr = d;
- auto* b = create<BlockStatement>(utils::Vector{d}, utils::Empty);
+ auto* b = create<BlockStatement>(tint::Vector{d}, tint::Empty);
ASSERT_EQ(b->statements.Length(), 1u);
EXPECT_EQ(b->statements[0], ptr);
@@ -35,7 +35,7 @@
}
TEST_F(BlockStatementTest, Creation_WithSource) {
- auto* b = create<BlockStatement>(Source{Source::Location{20, 2}}, utils::Empty, utils::Empty);
+ auto* b = create<BlockStatement>(Source{Source::Location{20, 2}}, tint::Empty, tint::Empty);
auto src = b->source;
EXPECT_EQ(src.range.begin.line, 20u);
EXPECT_EQ(src.range.begin.column, 2u);
@@ -47,7 +47,7 @@
auto* attr1 = DiagnosticAttribute(builtin::DiagnosticSeverity::kOff, "foo");
auto* attr2 = DiagnosticAttribute(builtin::DiagnosticSeverity::kOff, "bar");
- auto* b = create<BlockStatement>(utils::Vector{d}, utils::Vector{attr1, attr2});
+ auto* b = create<BlockStatement>(tint::Vector{d}, tint::Vector{attr1, attr2});
ASSERT_EQ(b->statements.Length(), 1u);
EXPECT_EQ(b->statements[0], ptr);
@@ -55,7 +55,7 @@
}
TEST_F(BlockStatementTest, IsBlock) {
- auto* b = create<BlockStatement>(utils::Empty, utils::Empty);
+ auto* b = create<BlockStatement>(tint::Empty, tint::Empty);
EXPECT_TRUE(b->Is<BlockStatement>());
}
@@ -63,7 +63,7 @@
EXPECT_FATAL_FAILURE(
{
ProgramBuilder b;
- b.create<BlockStatement>(utils::Vector<const Statement*, 1>{nullptr}, utils::Empty);
+ b.create<BlockStatement>(tint::Vector<const Statement*, 1>{nullptr}, tint::Empty);
},
"internal compiler error");
}
@@ -73,7 +73,7 @@
{
ProgramBuilder b1;
ProgramBuilder b2;
- b1.create<BlockStatement>(utils::Vector{b2.create<DiscardStatement>()}, utils::Empty);
+ b1.create<BlockStatement>(tint::Vector{b2.create<DiscardStatement>()}, tint::Empty);
},
"internal compiler error");
}
diff --git a/src/tint/lang/wgsl/ast/bool_literal_expression.h b/src/tint/lang/wgsl/ast/bool_literal_expression.h
index cb74b26..ec9ca98 100644
--- a/src/tint/lang/wgsl/ast/bool_literal_expression.h
+++ b/src/tint/lang/wgsl/ast/bool_literal_expression.h
@@ -22,8 +22,7 @@
namespace tint::ast {
/// A boolean literal
-class BoolLiteralExpression final
- : public utils::Castable<BoolLiteralExpression, LiteralExpression> {
+class BoolLiteralExpression final : public Castable<BoolLiteralExpression, LiteralExpression> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/break_if_statement.h b/src/tint/lang/wgsl/ast/break_if_statement.h
index bc5fae7..7be1806 100644
--- a/src/tint/lang/wgsl/ast/break_if_statement.h
+++ b/src/tint/lang/wgsl/ast/break_if_statement.h
@@ -23,7 +23,7 @@
namespace tint::ast {
/// A break-if statement
-class BreakIfStatement final : public utils::Castable<BreakIfStatement, Statement> {
+class BreakIfStatement final : public Castable<BreakIfStatement, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/break_statement.h b/src/tint/lang/wgsl/ast/break_statement.h
index b56dc97..12a71df 100644
--- a/src/tint/lang/wgsl/ast/break_statement.h
+++ b/src/tint/lang/wgsl/ast/break_statement.h
@@ -20,7 +20,7 @@
namespace tint::ast {
/// An break statement
-class BreakStatement final : public utils::Castable<BreakStatement, Statement> {
+class BreakStatement final : public Castable<BreakStatement, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/builtin_attribute.h b/src/tint/lang/wgsl/ast/builtin_attribute.h
index ef5e26e..28e72d0 100644
--- a/src/tint/lang/wgsl/ast/builtin_attribute.h
+++ b/src/tint/lang/wgsl/ast/builtin_attribute.h
@@ -27,7 +27,7 @@
namespace tint::ast {
/// A builtin attribute
-class BuiltinAttribute final : public utils::Castable<BuiltinAttribute, Attribute> {
+class BuiltinAttribute final : public Castable<BuiltinAttribute, Attribute> {
public:
/// constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/builtin_texture_helper_test.cc b/src/tint/lang/wgsl/ast/builtin_texture_helper_test.cc
index f89ffec..1536b14 100644
--- a/src/tint/lang/wgsl/ast/builtin_texture_helper_test.cc
+++ b/src/tint/lang/wgsl/ast/builtin_texture_helper_test.cc
@@ -26,7 +26,7 @@
using namespace tint::builtin::fluent_types; // NOLINT
using namespace tint::number_suffixes; // NOLINT
-utils::StringStream& operator<<(utils::StringStream& out, const TextureKind& kind) {
+StringStream& operator<<(StringStream& out, const TextureKind& kind) {
switch (kind) {
case TextureKind::kRegular:
out << "regular";
@@ -47,7 +47,7 @@
return out;
}
-utils::StringStream& operator<<(utils::StringStream& out, const TextureDataType& ty) {
+StringStream& operator<<(StringStream& out, const TextureDataType& ty) {
switch (ty) {
case TextureDataType::kF32:
out << "f32";
@@ -121,7 +121,7 @@
TextureOverloadCase::~TextureOverloadCase() = default;
std::ostream& operator<<(std::ostream& out, const TextureOverloadCase& data) {
- utils::StringStream str;
+ StringStream str;
str << "TextureOverloadCase " << static_cast<int>(data.overload) << "\n";
str << data.description << "\n";
str << "texture_kind: " << data.texture_kind << "\n";
@@ -156,7 +156,7 @@
}
const Variable* TextureOverloadCase::BuildTextureVariable(ProgramBuilder* b) const {
- utils::Vector attrs{
+ tint::Vector attrs{
b->Group(0_u),
b->Binding(0_a),
};
@@ -190,7 +190,7 @@
}
const Variable* TextureOverloadCase::BuildSamplerVariable(ProgramBuilder* b) const {
- utils::Vector attrs = {b->Group(0_a), b->Binding(1_a)};
+ tint::Vector attrs = {b->Group(0_a), b->Binding(1_a)};
return b->GlobalVar(kSamplerName, b->ty.sampler(sampler_kind), attrs);
}
diff --git a/src/tint/lang/wgsl/ast/builtin_texture_helper_test.h b/src/tint/lang/wgsl/ast/builtin_texture_helper_test.h
index 9c10445..1c17867 100644
--- a/src/tint/lang/wgsl/ast/builtin_texture_helper_test.h
+++ b/src/tint/lang/wgsl/ast/builtin_texture_helper_test.h
@@ -186,7 +186,7 @@
/// Describes a texture builtin overload
struct TextureOverloadCase {
/// Args is a list of Expression used as arguments to the texture overload case.
- using Args = utils::Vector<const Expression*, 8>;
+ using Args = tint::Vector<const Expression*, 8>;
/// Constructor for textureSample...() functions
TextureOverloadCase(ValidTextureOverload,
diff --git a/src/tint/lang/wgsl/ast/call_expression.cc b/src/tint/lang/wgsl/ast/call_expression.cc
index 2e2215b..1eee4f9 100644
--- a/src/tint/lang/wgsl/ast/call_expression.cc
+++ b/src/tint/lang/wgsl/ast/call_expression.cc
@@ -26,7 +26,7 @@
NodeID nid,
const Source& src,
const IdentifierExpression* t,
- utils::VectorRef<const Expression*> a)
+ VectorRef<const Expression*> a)
: Base(pid, nid, src), target(t), args(std::move(a)) {
TINT_ASSERT(AST, target);
TINT_ASSERT_GENERATION_IDS_EQUAL_IF_VALID(AST, target, generation_id);
diff --git a/src/tint/lang/wgsl/ast/call_expression.h b/src/tint/lang/wgsl/ast/call_expression.h
index 275dc71a..ada8dd1 100644
--- a/src/tint/lang/wgsl/ast/call_expression.h
+++ b/src/tint/lang/wgsl/ast/call_expression.h
@@ -29,7 +29,7 @@
/// * sem::Builtin
/// * sem::ValueConstructor
/// * sem::ValueConversion
-class CallExpression final : public utils::Castable<CallExpression, Expression> {
+class CallExpression final : public Castable<CallExpression, Expression> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
@@ -41,7 +41,7 @@
NodeID nid,
const Source& source,
const IdentifierExpression* target,
- utils::VectorRef<const Expression*> args);
+ VectorRef<const Expression*> args);
/// Destructor
~CallExpression() override;
@@ -56,7 +56,7 @@
const IdentifierExpression* target;
/// The arguments
- const utils::Vector<const Expression*, 8> args;
+ const tint::Vector<const Expression*, 8> args;
};
} // namespace tint::ast
diff --git a/src/tint/lang/wgsl/ast/call_expression_test.cc b/src/tint/lang/wgsl/ast/call_expression_test.cc
index b8f60b0..c80e582 100644
--- a/src/tint/lang/wgsl/ast/call_expression_test.cc
+++ b/src/tint/lang/wgsl/ast/call_expression_test.cc
@@ -22,7 +22,7 @@
TEST_F(CallExpressionTest, CreationIdentifier) {
auto* func = Expr("func");
- utils::Vector params{
+ tint::Vector params{
Expr("param1"),
Expr("param2"),
};
@@ -48,7 +48,7 @@
TEST_F(CallExpressionTest, CreationType) {
auto* type = Expr(ty.f32());
- utils::Vector params{
+ tint::Vector params{
Expr("param1"),
Expr("param2"),
};
@@ -91,7 +91,7 @@
EXPECT_FATAL_FAILURE(
{
ProgramBuilder b;
- b.Call(b.Ident("func"), utils::Vector{
+ b.Call(b.Ident("func"), tint::Vector{
b.Expr("param1"),
nullptr,
b.Expr("param2"),
diff --git a/src/tint/lang/wgsl/ast/call_statement.h b/src/tint/lang/wgsl/ast/call_statement.h
index 10bdaed..e74cb93 100644
--- a/src/tint/lang/wgsl/ast/call_statement.h
+++ b/src/tint/lang/wgsl/ast/call_statement.h
@@ -21,7 +21,7 @@
namespace tint::ast {
/// A call expression
-class CallStatement final : public utils::Castable<CallStatement, Statement> {
+class CallStatement final : public Castable<CallStatement, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/case_selector.h b/src/tint/lang/wgsl/ast/case_selector.h
index 2eaba09..8019ff1 100644
--- a/src/tint/lang/wgsl/ast/case_selector.h
+++ b/src/tint/lang/wgsl/ast/case_selector.h
@@ -23,7 +23,7 @@
namespace tint::ast {
/// A case selector
-class CaseSelector final : public utils::Castable<CaseSelector, Node> {
+class CaseSelector final : public Castable<CaseSelector, Node> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/case_statement.cc b/src/tint/lang/wgsl/ast/case_statement.cc
index bd89686..0a4e3c2 100644
--- a/src/tint/lang/wgsl/ast/case_statement.cc
+++ b/src/tint/lang/wgsl/ast/case_statement.cc
@@ -25,7 +25,7 @@
CaseStatement::CaseStatement(GenerationID pid,
NodeID nid,
const Source& src,
- utils::VectorRef<const CaseSelector*> s,
+ VectorRef<const CaseSelector*> s,
const BlockStatement* b)
: Base(pid, nid, src), selectors(std::move(s)), body(b) {
TINT_ASSERT(AST, body);
diff --git a/src/tint/lang/wgsl/ast/case_statement.h b/src/tint/lang/wgsl/ast/case_statement.h
index 9579214..2f50f67 100644
--- a/src/tint/lang/wgsl/ast/case_statement.h
+++ b/src/tint/lang/wgsl/ast/case_statement.h
@@ -23,7 +23,7 @@
namespace tint::ast {
/// A case statement
-class CaseStatement final : public utils::Castable<CaseStatement, Statement> {
+class CaseStatement final : public Castable<CaseStatement, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
@@ -34,7 +34,7 @@
CaseStatement(GenerationID pid,
NodeID nid,
const Source& src,
- utils::VectorRef<const CaseSelector*> selectors,
+ VectorRef<const CaseSelector*> selectors,
const BlockStatement* body);
/// Destructor
@@ -50,7 +50,7 @@
bool ContainsDefault() const;
/// The case selectors, empty if none set
- const utils::Vector<const CaseSelector*, 4> selectors;
+ const tint::Vector<const CaseSelector*, 4> selectors;
/// The case body
const BlockStatement* const body;
diff --git a/src/tint/lang/wgsl/ast/case_statement_test.cc b/src/tint/lang/wgsl/ast/case_statement_test.cc
index 07c2c83..3a6aad7 100644
--- a/src/tint/lang/wgsl/ast/case_statement_test.cc
+++ b/src/tint/lang/wgsl/ast/case_statement_test.cc
@@ -28,10 +28,10 @@
TEST_F(CaseStatementTest, Creation_i32) {
auto* selector = CaseSelector(2_i);
- utils::Vector b{selector};
+ tint::Vector b{selector};
auto* discard = create<DiscardStatement>();
- auto* body = create<BlockStatement>(utils::Vector{discard}, utils::Empty);
+ auto* body = create<BlockStatement>(tint::Vector{discard}, tint::Empty);
auto* c = create<CaseStatement>(b, body);
ASSERT_EQ(c->selectors.Length(), 1u);
@@ -42,10 +42,10 @@
TEST_F(CaseStatementTest, Creation_u32) {
auto* selector = CaseSelector(2_u);
- utils::Vector b{selector};
+ tint::Vector b{selector};
auto* discard = create<DiscardStatement>();
- auto* body = create<BlockStatement>(utils::Vector{discard}, utils::Empty);
+ auto* body = create<BlockStatement>(tint::Vector{discard}, tint::Empty);
auto* c = create<CaseStatement>(b, body);
ASSERT_EQ(c->selectors.Length(), 1u);
@@ -55,25 +55,25 @@
}
TEST_F(CaseStatementTest, ContainsDefault_WithDefault) {
- utils::Vector b{CaseSelector(2_u), DefaultCaseSelector()};
- auto* c = create<CaseStatement>(b, create<BlockStatement>(utils::Empty, utils::Empty));
+ tint::Vector b{CaseSelector(2_u), DefaultCaseSelector()};
+ auto* c = create<CaseStatement>(b, create<BlockStatement>(tint::Empty, tint::Empty));
EXPECT_TRUE(c->ContainsDefault());
}
TEST_F(CaseStatementTest, ContainsDefault_WithOutDefault) {
- utils::Vector b{CaseSelector(2_u), CaseSelector(3_u)};
- auto* c = create<CaseStatement>(b, create<BlockStatement>(utils::Empty, utils::Empty));
+ tint::Vector b{CaseSelector(2_u), CaseSelector(3_u)};
+ auto* c = create<CaseStatement>(b, create<BlockStatement>(tint::Empty, tint::Empty));
EXPECT_FALSE(c->ContainsDefault());
}
TEST_F(CaseStatementTest, Creation_WithSource) {
- utils::Vector b{CaseSelector(2_i)};
+ tint::Vector b{CaseSelector(2_i)};
auto* body = create<BlockStatement>(
- utils::Vector{
+ tint::Vector{
create<DiscardStatement>(),
},
- utils::Empty);
+ tint::Empty);
auto* c = create<CaseStatement>(Source{Source::Location{20, 2}}, b, body);
auto src = c->source;
EXPECT_EQ(src.range.begin.line, 20u);
@@ -81,8 +81,8 @@
}
TEST_F(CaseStatementTest, IsCase) {
- auto* c = create<CaseStatement>(utils::Vector{DefaultCaseSelector()},
- create<BlockStatement>(utils::Empty, utils::Empty));
+ auto* c = create<CaseStatement>(tint::Vector{DefaultCaseSelector()},
+ create<BlockStatement>(tint::Empty, tint::Empty));
EXPECT_TRUE(c->Is<CaseStatement>());
}
@@ -90,7 +90,7 @@
EXPECT_FATAL_FAILURE(
{
ProgramBuilder b;
- b.create<CaseStatement>(utils::Vector{b.DefaultCaseSelector()}, nullptr);
+ b.create<CaseStatement>(tint::Vector{b.DefaultCaseSelector()}, nullptr);
},
"internal compiler error");
}
@@ -99,8 +99,8 @@
EXPECT_FATAL_FAILURE(
{
ProgramBuilder b;
- b.create<CaseStatement>(utils::Vector<const ast::CaseSelector*, 1>{nullptr},
- b.create<BlockStatement>(utils::Empty, utils::Empty));
+ b.create<CaseStatement>(tint::Vector<const ast::CaseSelector*, 1>{nullptr},
+ b.create<BlockStatement>(tint::Empty, tint::Empty));
},
"internal compiler error");
}
@@ -110,8 +110,8 @@
{
ProgramBuilder b1;
ProgramBuilder b2;
- b1.create<CaseStatement>(utils::Vector{b1.DefaultCaseSelector()},
- b2.create<BlockStatement>(utils::Empty, utils::Empty));
+ b1.create<CaseStatement>(tint::Vector{b1.DefaultCaseSelector()},
+ b2.create<BlockStatement>(tint::Empty, tint::Empty));
},
"internal compiler error");
}
@@ -121,8 +121,8 @@
{
ProgramBuilder b1;
ProgramBuilder b2;
- b1.create<CaseStatement>(utils::Vector{b2.CaseSelector(b2.Expr(2_i))},
- b1.create<BlockStatement>(utils::Empty, utils::Empty));
+ b1.create<CaseStatement>(tint::Vector{b2.CaseSelector(b2.Expr(2_i))},
+ b1.create<BlockStatement>(tint::Empty, tint::Empty));
},
"internal compiler error");
}
diff --git a/src/tint/lang/wgsl/ast/clone_context.cc b/src/tint/lang/wgsl/ast/clone_context.cc
index 0735b0d..b25a56e 100644
--- a/src/tint/lang/wgsl/ast/clone_context.cc
+++ b/src/tint/lang/wgsl/ast/clone_context.cc
@@ -97,7 +97,7 @@
return object->Clone(this);
}
-void CloneContext::CheckedCastFailure(const Cloneable* got, const utils::TypeInfo& expected) {
+void CloneContext::CheckedCastFailure(const Cloneable* got, const tint::TypeInfo& expected) {
TINT_ICE(Clone, Diagnostics()) << "Cloned object was not of the expected type\n"
<< "got: " << got->TypeInfo().name << "\n"
<< "expected: " << expected.name;
diff --git a/src/tint/lang/wgsl/ast/clone_context.h b/src/tint/lang/wgsl/ast/clone_context.h
index 60471e5..a4850de 100644
--- a/src/tint/lang/wgsl/ast/clone_context.h
+++ b/src/tint/lang/wgsl/ast/clone_context.h
@@ -49,7 +49,7 @@
GenerationID GenerationIDOf(const ProgramBuilder*);
/// Cloneable is the base class for all objects that can be cloned
-class Cloneable : public utils::Castable<Cloneable> {
+class Cloneable : public Castable<Cloneable> {
public:
/// Constructor
Cloneable();
@@ -74,8 +74,8 @@
/// ParamTypeIsPtrOf<F, T> is true iff the first parameter of
/// F is a pointer of (or derives from) type T.
template <typename F, typename T>
- static constexpr bool ParamTypeIsPtrOf = utils::traits::
- IsTypeOrDerived<typename std::remove_pointer<utils::traits::ParameterType<F, 0>>::type, T>;
+ static constexpr bool ParamTypeIsPtrOf = tint::traits::
+ IsTypeOrDerived<typename std::remove_pointer<tint::traits::ParameterType<F, 0>>::type, T>;
public:
/// SymbolTransform is a function that takes a symbol and returns a new
@@ -172,8 +172,8 @@
/// @param v the vector to clone
/// @return the cloned vector
template <typename T, size_t N>
- utils::Vector<T, N> Clone(const utils::Vector<T, N>& v) {
- utils::Vector<T, N> out;
+ tint::Vector<T, N> Clone(const tint::Vector<T, N>& v) {
+ tint::Vector<T, N> out;
out.reserve(v.size());
for (auto& el : v) {
out.Push(Clone(el));
@@ -190,8 +190,8 @@
/// @param v the vector to clone
/// @return the cloned vector
template <typename T, size_t N>
- utils::Vector<T*, N> Clone(const utils::Vector<T*, N>& v) {
- utils::Vector<T*, N> out;
+ tint::Vector<T*, N> Clone(const tint::Vector<T*, N>& v) {
+ tint::Vector<T*, N> out;
Clone(out, v);
return out;
}
@@ -205,7 +205,7 @@
/// @param from the vector to clone
/// @param to the cloned result
template <typename T, size_t N>
- void Clone(utils::Vector<T*, N>& to, const utils::Vector<T*, N>& from) {
+ void Clone(tint::Vector<T*, N>& to, const tint::Vector<T*, N>& from) {
to.Reserve(from.Length());
auto transforms = list_transforms_.Find(&from);
@@ -303,23 +303,22 @@
/// `T* (T*)`, where `T` derives from Cloneable
/// @returns this CloneContext so calls can be chained
template <typename F>
- utils::traits::EnableIf<ParamTypeIsPtrOf<F, Cloneable>, CloneContext>& ReplaceAll(
- F&& replacer) {
- using TPtr = utils::traits::ParameterType<F, 0>;
+ tint::traits::EnableIf<ParamTypeIsPtrOf<F, Cloneable>, CloneContext>& ReplaceAll(F&& replacer) {
+ using TPtr = tint::traits::ParameterType<F, 0>;
using T = typename std::remove_pointer<TPtr>::type;
for (auto& transform : transforms_) {
- bool already_registered = transform.typeinfo->Is(&utils::TypeInfo::Of<T>()) ||
- utils::TypeInfo::Of<T>().Is(transform.typeinfo);
+ bool already_registered = transform.typeinfo->Is(&tint::TypeInfo::Of<T>()) ||
+ tint::TypeInfo::Of<T>().Is(transform.typeinfo);
if (TINT_UNLIKELY(already_registered)) {
TINT_ICE(Clone, Diagnostics()) << "ReplaceAll() called with a handler for type "
- << utils::TypeInfo::Of<T>().name
+ << tint::TypeInfo::Of<T>().name
<< " that is already handled by a handler for type "
<< transform.typeinfo->name;
return *this;
}
}
CloneableTransform transform;
- transform.typeinfo = &utils::TypeInfo::Of<T>();
+ transform.typeinfo = &tint::TypeInfo::Of<T>();
transform.function = [=](const Cloneable* in) { return replacer(in->As<T>()); };
transforms_.Push(std::move(transform));
return *this;
@@ -358,7 +357,7 @@
/// @returns this CloneContext so calls can be chained
template <typename WHAT,
typename WITH,
- typename = utils::traits::EnableIfIsType<WITH, Cloneable>>
+ typename = tint::traits::EnableIfIsType<WITH, Cloneable>>
CloneContext& Replace(const WHAT* what, const WITH* with) {
TINT_ASSERT_GENERATION_IDS_EQUAL_IF_VALID(Clone, src, what);
TINT_ASSERT_GENERATION_IDS_EQUAL_IF_VALID(Clone, dst, with);
@@ -392,7 +391,7 @@
/// the cloned vector.
/// @returns this CloneContext so calls can be chained
template <typename T, size_t N, typename OBJECT>
- CloneContext& Remove(const utils::Vector<T, N>& vector, OBJECT* object) {
+ CloneContext& Remove(const tint::Vector<T, N>& vector, OBJECT* object) {
TINT_ASSERT_GENERATION_IDS_EQUAL_IF_VALID(Clone, src, object);
if (TINT_UNLIKELY((std::find(vector.begin(), vector.end(), object) == vector.end()))) {
TINT_ICE(Clone, Diagnostics())
@@ -410,7 +409,7 @@
/// front of the vector
/// @returns this CloneContext so calls can be chained
template <typename T, size_t N, typename OBJECT>
- CloneContext& InsertFront(const utils::Vector<T, N>& vector, OBJECT* object) {
+ CloneContext& InsertFront(const tint::Vector<T, N>& vector, OBJECT* object) {
TINT_ASSERT_GENERATION_IDS_EQUAL_IF_VALID(Clone, dst, object);
return InsertFront(vector, [object] { return object; });
}
@@ -421,7 +420,7 @@
/// @param builder a builder of the object that will be inserted at the front of the vector.
/// @returns this CloneContext so calls can be chained
template <typename T, size_t N, typename BUILDER>
- CloneContext& InsertFront(const utils::Vector<T, N>& vector, BUILDER&& builder) {
+ CloneContext& InsertFront(const tint::Vector<T, N>& vector, BUILDER&& builder) {
list_transforms_.GetOrZero(&vector)->insert_front_.Push(std::forward<BUILDER>(builder));
return *this;
}
@@ -432,7 +431,7 @@
/// end of the vector
/// @returns this CloneContext so calls can be chained
template <typename T, size_t N, typename OBJECT>
- CloneContext& InsertBack(const utils::Vector<T, N>& vector, OBJECT* object) {
+ CloneContext& InsertBack(const tint::Vector<T, N>& vector, OBJECT* object) {
TINT_ASSERT_GENERATION_IDS_EQUAL_IF_VALID(Clone, dst, object);
return InsertBack(vector, [object] { return object; });
}
@@ -444,7 +443,7 @@
/// vector.
/// @returns this CloneContext so calls can be chained
template <typename T, size_t N, typename BUILDER>
- CloneContext& InsertBack(const utils::Vector<T, N>& vector, BUILDER&& builder) {
+ CloneContext& InsertBack(const tint::Vector<T, N>& vector, BUILDER&& builder) {
list_transforms_.GetOrZero(&vector)->insert_back_.Push(std::forward<BUILDER>(builder));
return *this;
}
@@ -456,7 +455,7 @@
/// any occurrence of the clone of @p before
/// @returns this CloneContext so calls can be chained
template <typename T, size_t N, typename BEFORE, typename OBJECT>
- CloneContext& InsertBefore(const utils::Vector<T, N>& vector,
+ CloneContext& InsertBefore(const tint::Vector<T, N>& vector,
const BEFORE* before,
const OBJECT* object) {
TINT_ASSERT_GENERATION_IDS_EQUAL_IF_VALID(Clone, src, before);
@@ -483,7 +482,7 @@
typename BEFORE,
typename BUILDER,
typename _ = std::enable_if_t<!std::is_pointer_v<std::decay_t<BUILDER>>>>
- CloneContext& InsertBefore(const utils::Vector<T, N>& vector,
+ CloneContext& InsertBefore(const tint::Vector<T, N>& vector,
const BEFORE* before,
BUILDER&& builder) {
list_transforms_.GetOrZero(&vector)->insert_before_.GetOrZero(before)->Push(
@@ -498,7 +497,7 @@
/// any occurrence of the clone of @p after
/// @returns this CloneContext so calls can be chained
template <typename T, size_t N, typename AFTER, typename OBJECT>
- CloneContext& InsertAfter(const utils::Vector<T, N>& vector,
+ CloneContext& InsertAfter(const tint::Vector<T, N>& vector,
const AFTER* after,
const OBJECT* object) {
TINT_ASSERT_GENERATION_IDS_EQUAL_IF_VALID(Clone, src, after);
@@ -525,7 +524,7 @@
typename AFTER,
typename BUILDER,
typename _ = std::enable_if_t<!std::is_pointer_v<std::decay_t<BUILDER>>>>
- CloneContext& InsertAfter(const utils::Vector<T, N>& vector,
+ CloneContext& InsertAfter(const tint::Vector<T, N>& vector,
const AFTER* after,
BUILDER&& builder) {
list_transforms_.GetOrZero(&vector)->insert_after_.GetOrZero(after)->Push(
@@ -554,18 +553,18 @@
/// Destructor
~CloneableTransform();
- // utils::TypeInfo of the Cloneable that the transform operates on
- const utils::TypeInfo* typeinfo;
+ // tint::TypeInfo of the Cloneable that the transform operates on
+ const tint::TypeInfo* typeinfo;
std::function<const Cloneable*(const Cloneable*)> function;
};
/// A vector of const Cloneable*
- using CloneableBuilderList = utils::Vector<std::function<const Cloneable*()>, 4>;
+ using CloneableBuilderList = tint::Vector<std::function<const Cloneable*()>, 4>;
/// Transformations to be applied to a list (vector)
struct ListTransforms {
/// A map of object in #src to omit when cloned into #dst.
- utils::Hashset<const Cloneable*, 4> remove_;
+ Hashset<const Cloneable*, 4> remove_;
/// A list of objects in #dst to insert before any others when the vector is cloned.
CloneableBuilderList insert_front_;
@@ -574,14 +573,14 @@
CloneableBuilderList insert_back_;
/// A map of object in #src to the list of cloned objects in #dst.
- /// Clone(const utils::Vector<T*>& v) will use this to insert the map-value
+ /// Clone(const tint::Vector<T*>& v) will use this to insert the map-value
/// list into the target vector before cloning and inserting the map-key.
- utils::Hashmap<const Cloneable*, CloneableBuilderList, 4> insert_before_;
+ Hashmap<const Cloneable*, CloneableBuilderList, 4> insert_before_;
/// A map of object in #src to the list of cloned objects in #dst.
- /// Clone(const utils::Vector<T*>& v) will use this to insert the map-value
+ /// Clone(const tint::Vector<T*>& v) will use this to insert the map-value
/// list into the target vector after cloning and inserting the map-key.
- utils::Hashmap<const Cloneable*, CloneableBuilderList, 4> insert_after_;
+ Hashmap<const Cloneable*, CloneableBuilderList, 4> insert_after_;
};
CloneContext(const CloneContext&) = delete;
@@ -598,7 +597,7 @@
if (TINT_LIKELY(cast)) {
return cast;
}
- CheckedCastFailure(obj, utils::TypeInfo::Of<TO>());
+ CheckedCastFailure(obj, tint::TypeInfo::Of<TO>());
return nullptr;
}
@@ -608,22 +607,22 @@
/// Adds an error diagnostic to Diagnostics() that the cloned object was not
/// of the expected type.
- void CheckedCastFailure(const Cloneable* got, const utils::TypeInfo& expected);
+ void CheckedCastFailure(const Cloneable* got, const tint::TypeInfo& expected);
/// @returns the diagnostic list of #dst
diag::List& Diagnostics() const;
/// A map of object in #src to functions that create their replacement in #dst
- utils::Hashmap<const Cloneable*, std::function<const Cloneable*()>, 8> replacements_;
+ Hashmap<const Cloneable*, std::function<const Cloneable*()>, 8> replacements_;
/// A map of symbol in #src to their cloned equivalent in #dst
- utils::Hashmap<Symbol, Symbol, 32> cloned_symbols_;
+ Hashmap<Symbol, Symbol, 32> cloned_symbols_;
/// Cloneable transform functions registered with ReplaceAll()
- utils::Vector<CloneableTransform, 8> transforms_;
+ tint::Vector<CloneableTransform, 8> transforms_;
/// Transformations to apply to vectors
- utils::Hashmap<const void*, ListTransforms, 4> list_transforms_;
+ Hashmap<const void*, ListTransforms, 4> list_transforms_;
/// Symbol transform registered with ReplaceAll()
SymbolTransform symbol_transform_;
diff --git a/src/tint/lang/wgsl/ast/clone_context_test.cc b/src/tint/lang/wgsl/ast/clone_context_test.cc
index ecdbe9d..936ca00 100644
--- a/src/tint/lang/wgsl/ast/clone_context_test.cc
+++ b/src/tint/lang/wgsl/ast/clone_context_test.cc
@@ -27,10 +27,10 @@
}
private:
- utils::BlockAllocator<Cloneable> alloc;
+ BlockAllocator<Cloneable> alloc;
};
-struct Node : public utils::Castable<Node, Cloneable> {
+struct Node : public Castable<Node, Cloneable> {
Node(Allocator* alloc,
Symbol n,
const Node* node_a = nullptr,
@@ -43,7 +43,7 @@
const Node* a = nullptr;
const Node* b = nullptr;
const Node* c = nullptr;
- utils::Vector<const Node*, 8> vec;
+ tint::Vector<const Node*, 8> vec;
Node* Clone(CloneContext* ctx) const override {
auto* out = allocator->Create<Node>(ctx->Clone(name));
@@ -55,7 +55,7 @@
}
};
-struct Replaceable : public utils::Castable<Replaceable, Node> {
+struct Replaceable : public Castable<Replaceable, Node> {
Replaceable(Allocator* alloc,
Symbol n,
const Node* node_a = nullptr,
@@ -64,18 +64,18 @@
: Base(alloc, n, node_a, node_b, node_c) {}
};
-struct Replacement : public utils::Castable<Replacement, Replaceable> {
+struct Replacement : public Castable<Replacement, Replaceable> {
Replacement(Allocator* alloc, Symbol n) : Base(alloc, n) {}
};
-struct NotANode : public utils::Castable<NotANode, Cloneable> {
+struct NotANode : public Castable<NotANode, Cloneable> {
explicit NotANode(Allocator* alloc) : allocator(alloc) {}
Allocator* const allocator;
NotANode* Clone(CloneContext*) const override { return allocator->Create<NotANode>(); }
};
-struct ProgramNode : public utils::Castable<ProgramNode, Cloneable> {
+struct ProgramNode : public Castable<ProgramNode, Cloneable> {
ProgramNode(Allocator* alloc, GenerationID id, GenerationID cloned_id)
: allocator(alloc), generation_id(id), cloned_generation_id(cloned_id) {}
@@ -1051,7 +1051,7 @@
}
TEST_F(CloneContextNodeTest, CloneWithReplaceAll_SameTypeTwice) {
- std::string node_name = utils::TypeInfo::Of<Node>().name;
+ std::string node_name = tint::TypeInfo::Of<Node>().name;
EXPECT_FATAL_FAILURE(
{
@@ -1066,8 +1066,8 @@
}
TEST_F(CloneContextNodeTest, CloneWithReplaceAll_BaseThenDerived) {
- std::string node_name = utils::TypeInfo::Of<Node>().name;
- std::string replaceable_name = utils::TypeInfo::Of<Replaceable>().name;
+ std::string node_name = tint::TypeInfo::Of<Node>().name;
+ std::string replaceable_name = tint::TypeInfo::Of<Replaceable>().name;
EXPECT_FATAL_FAILURE(
{
@@ -1082,8 +1082,8 @@
}
TEST_F(CloneContextNodeTest, CloneWithReplaceAll_DerivedThenBase) {
- std::string node_name = utils::TypeInfo::Of<Node>().name;
- std::string replaceable_name = utils::TypeInfo::Of<Replaceable>().name;
+ std::string node_name = tint::TypeInfo::Of<Node>().name;
+ std::string replaceable_name = tint::TypeInfo::Of<Replaceable>().name;
EXPECT_FATAL_FAILURE(
{
diff --git a/src/tint/lang/wgsl/ast/compound_assignment_statement.h b/src/tint/lang/wgsl/ast/compound_assignment_statement.h
index bd7fa79..12ac67f 100644
--- a/src/tint/lang/wgsl/ast/compound_assignment_statement.h
+++ b/src/tint/lang/wgsl/ast/compound_assignment_statement.h
@@ -22,8 +22,7 @@
namespace tint::ast {
/// A compound assignment statement
-class CompoundAssignmentStatement final
- : public utils::Castable<CompoundAssignmentStatement, Statement> {
+class CompoundAssignmentStatement final : public Castable<CompoundAssignmentStatement, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/const.cc b/src/tint/lang/wgsl/ast/const.cc
index 02439d6..7a7c7e9 100644
--- a/src/tint/lang/wgsl/ast/const.cc
+++ b/src/tint/lang/wgsl/ast/const.cc
@@ -28,7 +28,7 @@
const Identifier* n,
Type ty,
const Expression* init,
- utils::VectorRef<const Attribute*> attrs)
+ VectorRef<const Attribute*> attrs)
: Base(pid, nid, src, n, ty, init, std::move(attrs)) {
TINT_ASSERT(AST, init != nullptr);
}
diff --git a/src/tint/lang/wgsl/ast/const.h b/src/tint/lang/wgsl/ast/const.h
index 1a50e14..751c1c5 100644
--- a/src/tint/lang/wgsl/ast/const.h
+++ b/src/tint/lang/wgsl/ast/const.h
@@ -30,7 +30,7 @@
/// const max_f32 : f32 = 0x1.fffffep+127; // f32 typed constant
/// ```
/// @see https://www.w3.org/TR/WGSL/#creation-time-consts
-class Const final : public utils::Castable<Const, Variable> {
+class Const final : public Castable<Const, Variable> {
public:
/// Create a 'const' creation-time value variable.
/// @param pid the identifier of the program that owns this node
@@ -46,7 +46,7 @@
const Identifier* name,
Type type,
const Expression* initializer,
- utils::VectorRef<const Attribute*> attributes);
+ VectorRef<const Attribute*> attributes);
/// Destructor
~Const() override;
diff --git a/src/tint/lang/wgsl/ast/const_assert.h b/src/tint/lang/wgsl/ast/const_assert.h
index 13ed7d6..d2f02f0 100644
--- a/src/tint/lang/wgsl/ast/const_assert.h
+++ b/src/tint/lang/wgsl/ast/const_assert.h
@@ -21,7 +21,7 @@
namespace tint::ast {
/// A `const_assert` statement
-class ConstAssert final : public utils::Castable<ConstAssert, Statement> {
+class ConstAssert final : public Castable<ConstAssert, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/continue_statement.h b/src/tint/lang/wgsl/ast/continue_statement.h
index 2805204..7cce4c3 100644
--- a/src/tint/lang/wgsl/ast/continue_statement.h
+++ b/src/tint/lang/wgsl/ast/continue_statement.h
@@ -20,7 +20,7 @@
namespace tint::ast {
/// An continue statement
-class ContinueStatement final : public utils::Castable<ContinueStatement, Statement> {
+class ContinueStatement final : public Castable<ContinueStatement, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/diagnostic_attribute.h b/src/tint/lang/wgsl/ast/diagnostic_attribute.h
index 319a476..a5846df 100644
--- a/src/tint/lang/wgsl/ast/diagnostic_attribute.h
+++ b/src/tint/lang/wgsl/ast/diagnostic_attribute.h
@@ -23,7 +23,7 @@
namespace tint::ast {
/// A diagnostic attribute
-class DiagnosticAttribute final : public utils::Castable<DiagnosticAttribute, Attribute> {
+class DiagnosticAttribute final : public Castable<DiagnosticAttribute, Attribute> {
public:
/// constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/diagnostic_directive.h b/src/tint/lang/wgsl/ast/diagnostic_directive.h
index a048782..802576e 100644
--- a/src/tint/lang/wgsl/ast/diagnostic_directive.h
+++ b/src/tint/lang/wgsl/ast/diagnostic_directive.h
@@ -29,7 +29,7 @@
/// // Turn off diagnostics for derivative uniformity violations.
/// diagnostic(off, derivative_uniformity);
/// ```
-class DiagnosticDirective final : public utils::Castable<DiagnosticDirective, Node> {
+class DiagnosticDirective final : public Castable<DiagnosticDirective, Node> {
public:
/// Create a extension
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/diagnostic_rule_name.h b/src/tint/lang/wgsl/ast/diagnostic_rule_name.h
index c601d08..bad739a 100644
--- a/src/tint/lang/wgsl/ast/diagnostic_rule_name.h
+++ b/src/tint/lang/wgsl/ast/diagnostic_rule_name.h
@@ -27,7 +27,7 @@
namespace tint::ast {
/// A diagnostic rule name used for diagnostic directives and attributes.
-class DiagnosticRuleName final : public utils::Castable<DiagnosticRuleName, Node> {
+class DiagnosticRuleName final : public Castable<DiagnosticRuleName, Node> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/disable_validation_attribute.cc b/src/tint/lang/wgsl/ast/disable_validation_attribute.cc
index f374ef7..4c908f6 100644
--- a/src/tint/lang/wgsl/ast/disable_validation_attribute.cc
+++ b/src/tint/lang/wgsl/ast/disable_validation_attribute.cc
@@ -23,7 +23,7 @@
DisableValidationAttribute::DisableValidationAttribute(GenerationID pid,
NodeID nid,
DisabledValidation val)
- : Base(pid, nid, utils::Empty), validation(val) {}
+ : Base(pid, nid, tint::Empty), validation(val) {}
DisableValidationAttribute::~DisableValidationAttribute() = default;
diff --git a/src/tint/lang/wgsl/ast/disable_validation_attribute.h b/src/tint/lang/wgsl/ast/disable_validation_attribute.h
index 0226659..e523084 100644
--- a/src/tint/lang/wgsl/ast/disable_validation_attribute.h
+++ b/src/tint/lang/wgsl/ast/disable_validation_attribute.h
@@ -53,7 +53,7 @@
/// violations. Typically generated by transforms that need to produce ASTs that
/// would otherwise cause validation errors.
class DisableValidationAttribute final
- : public utils::Castable<DisableValidationAttribute, InternalAttribute> {
+ : public Castable<DisableValidationAttribute, InternalAttribute> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/discard_statement.h b/src/tint/lang/wgsl/ast/discard_statement.h
index b75163d..4886db7 100644
--- a/src/tint/lang/wgsl/ast/discard_statement.h
+++ b/src/tint/lang/wgsl/ast/discard_statement.h
@@ -20,7 +20,7 @@
namespace tint::ast {
/// A discard statement
-class DiscardStatement final : public utils::Castable<DiscardStatement, Statement> {
+class DiscardStatement final : public Castable<DiscardStatement, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/enable.cc b/src/tint/lang/wgsl/ast/enable.cc
index b230428..8bd4b82 100644
--- a/src/tint/lang/wgsl/ast/enable.cc
+++ b/src/tint/lang/wgsl/ast/enable.cc
@@ -20,10 +20,7 @@
namespace tint::ast {
-Enable::Enable(GenerationID pid,
- NodeID nid,
- const Source& src,
- utils::VectorRef<const Extension*> exts)
+Enable::Enable(GenerationID pid, NodeID nid, const Source& src, VectorRef<const Extension*> exts)
: Base(pid, nid, src), extensions(std::move(exts)) {}
Enable::~Enable() = default;
diff --git a/src/tint/lang/wgsl/ast/enable.h b/src/tint/lang/wgsl/ast/enable.h
index e0017a0..95c6c12 100644
--- a/src/tint/lang/wgsl/ast/enable.h
+++ b/src/tint/lang/wgsl/ast/enable.h
@@ -28,17 +28,14 @@
/// // Enable an extension named "f16"
/// enable f16;
/// ```
-class Enable final : public utils::Castable<Enable, Node> {
+class Enable final : public Castable<Enable, Node> {
public:
/// Create a extension
/// @param pid the identifier of the program that owns this node
/// @param nid the unique node identifier
/// @param src the source of this node
/// @param exts the extensions being enabled by this directive
- Enable(GenerationID pid,
- NodeID nid,
- const Source& src,
- utils::VectorRef<const Extension*> exts);
+ Enable(GenerationID pid, NodeID nid, const Source& src, VectorRef<const Extension*> exts);
/// Destructor
~Enable() override;
@@ -53,7 +50,7 @@
const Enable* Clone(CloneContext* ctx) const override;
/// The extensions being enabled by this directive
- const utils::Vector<const Extension*, 4> extensions;
+ const tint::Vector<const Extension*, 4> extensions;
};
} // namespace tint::ast
diff --git a/src/tint/lang/wgsl/ast/expression.h b/src/tint/lang/wgsl/ast/expression.h
index b4297b4..b3870dd 100644
--- a/src/tint/lang/wgsl/ast/expression.h
+++ b/src/tint/lang/wgsl/ast/expression.h
@@ -23,7 +23,7 @@
namespace tint::ast {
/// Base expression class
-class Expression : public utils::Castable<Expression, Node> {
+class Expression : public Castable<Expression, Node> {
public:
~Expression() override;
diff --git a/src/tint/lang/wgsl/ast/extension.h b/src/tint/lang/wgsl/ast/extension.h
index 60b1e48..65c5bf3 100644
--- a/src/tint/lang/wgsl/ast/extension.h
+++ b/src/tint/lang/wgsl/ast/extension.h
@@ -24,7 +24,7 @@
/// ```
/// enable f16;
/// ```
-class Extension final : public utils::Castable<Extension, Node> {
+class Extension final : public Castable<Extension, Node> {
public:
/// Create a extension
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/float_literal_expression.cc b/src/tint/lang/wgsl/ast/float_literal_expression.cc
index 0487b3a..36dd37c 100644
--- a/src/tint/lang/wgsl/ast/float_literal_expression.cc
+++ b/src/tint/lang/wgsl/ast/float_literal_expression.cc
@@ -37,7 +37,7 @@
return ctx->dst->create<FloatLiteralExpression>(src, value, suffix);
}
-utils::StringStream& operator<<(utils::StringStream& out, FloatLiteralExpression::Suffix suffix) {
+StringStream& operator<<(StringStream& out, FloatLiteralExpression::Suffix suffix) {
switch (suffix) {
default:
return out;
diff --git a/src/tint/lang/wgsl/ast/float_literal_expression.h b/src/tint/lang/wgsl/ast/float_literal_expression.h
index 70ef60b..964106a 100644
--- a/src/tint/lang/wgsl/ast/float_literal_expression.h
+++ b/src/tint/lang/wgsl/ast/float_literal_expression.h
@@ -22,8 +22,7 @@
namespace tint::ast {
/// A float literal
-class FloatLiteralExpression final
- : public utils::Castable<FloatLiteralExpression, LiteralExpression> {
+class FloatLiteralExpression final : public Castable<FloatLiteralExpression, LiteralExpression> {
public:
/// Literal suffix
enum class Suffix {
@@ -61,7 +60,7 @@
/// @param out the stream to write to
/// @param suffix the suffix to write
/// @returns out so calls can be chained
-utils::StringStream& operator<<(utils::StringStream& out, FloatLiteralExpression::Suffix suffix);
+StringStream& operator<<(StringStream& out, FloatLiteralExpression::Suffix suffix);
} // namespace tint::ast
diff --git a/src/tint/lang/wgsl/ast/float_literal_expression_test.cc b/src/tint/lang/wgsl/ast/float_literal_expression_test.cc
index fd9d118..bdd5a4f 100644
--- a/src/tint/lang/wgsl/ast/float_literal_expression_test.cc
+++ b/src/tint/lang/wgsl/ast/float_literal_expression_test.cc
@@ -44,7 +44,7 @@
TEST_F(FloatLiteralExpressionTest, SuffixStringStream) {
auto to_str = [](FloatLiteralExpression::Suffix suffix) {
- utils::StringStream ss;
+ StringStream ss;
ss << suffix;
return ss.str();
};
diff --git a/src/tint/lang/wgsl/ast/for_loop_statement.cc b/src/tint/lang/wgsl/ast/for_loop_statement.cc
index 72282df..474c749 100644
--- a/src/tint/lang/wgsl/ast/for_loop_statement.cc
+++ b/src/tint/lang/wgsl/ast/for_loop_statement.cc
@@ -29,7 +29,7 @@
const Expression* cond,
const Statement* cont,
const BlockStatement* b,
- utils::VectorRef<const ast::Attribute*> attrs)
+ VectorRef<const ast::Attribute*> attrs)
: Base(pid, nid, src),
initializer(init),
condition(cond),
diff --git a/src/tint/lang/wgsl/ast/for_loop_statement.h b/src/tint/lang/wgsl/ast/for_loop_statement.h
index e389c41..6135b90 100644
--- a/src/tint/lang/wgsl/ast/for_loop_statement.h
+++ b/src/tint/lang/wgsl/ast/for_loop_statement.h
@@ -22,7 +22,7 @@
class Expression;
/// A for loop statement
-class ForLoopStatement final : public utils::Castable<ForLoopStatement, Statement> {
+class ForLoopStatement final : public Castable<ForLoopStatement, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
@@ -40,7 +40,7 @@
const Expression* condition,
const Statement* continuing,
const BlockStatement* body,
- utils::VectorRef<const ast::Attribute*> attributes);
+ VectorRef<const ast::Attribute*> attributes);
/// Destructor
~ForLoopStatement() override;
@@ -64,7 +64,7 @@
const BlockStatement* const body;
/// The attribute list
- const utils::Vector<const Attribute*, 1> attributes;
+ const tint::Vector<const Attribute*, 1> attributes;
};
} // namespace tint::ast
diff --git a/src/tint/lang/wgsl/ast/for_loop_statement_test.cc b/src/tint/lang/wgsl/ast/for_loop_statement_test.cc
index e1e03e2..fc54053 100644
--- a/src/tint/lang/wgsl/ast/for_loop_statement_test.cc
+++ b/src/tint/lang/wgsl/ast/for_loop_statement_test.cc
@@ -55,7 +55,7 @@
auto* attr1 = DiagnosticAttribute(builtin::DiagnosticSeverity::kOff, "foo");
auto* attr2 = DiagnosticAttribute(builtin::DiagnosticSeverity::kOff, "bar");
auto* body = Block(Return());
- auto* l = For(nullptr, nullptr, nullptr, body, utils::Vector{attr1, attr2});
+ auto* l = For(nullptr, nullptr, nullptr, body, tint::Vector{attr1, attr2});
EXPECT_THAT(l->attributes, testing::ElementsAre(attr1, attr2));
}
diff --git a/src/tint/lang/wgsl/ast/function.cc b/src/tint/lang/wgsl/ast/function.cc
index db445bd..103f247 100644
--- a/src/tint/lang/wgsl/ast/function.cc
+++ b/src/tint/lang/wgsl/ast/function.cc
@@ -26,11 +26,11 @@
NodeID nid,
const Source& src,
const Identifier* n,
- utils::VectorRef<const Parameter*> parameters,
+ VectorRef<const Parameter*> parameters,
Type return_ty,
const BlockStatement* b,
- utils::VectorRef<const Attribute*> attrs,
- utils::VectorRef<const Attribute*> return_type_attrs)
+ VectorRef<const Attribute*> attrs,
+ VectorRef<const Attribute*> return_type_attrs)
: Base(pid, nid, src),
name(n),
params(std::move(parameters)),
diff --git a/src/tint/lang/wgsl/ast/function.h b/src/tint/lang/wgsl/ast/function.h
index 2a8efc4..42489ed 100644
--- a/src/tint/lang/wgsl/ast/function.h
+++ b/src/tint/lang/wgsl/ast/function.h
@@ -38,7 +38,7 @@
namespace tint::ast {
/// A Function statement.
-class Function final : public utils::Castable<Function, Node> {
+class Function final : public Castable<Function, Node> {
public:
/// Create a function
/// @param pid the identifier of the program that owns this node
@@ -54,11 +54,11 @@
NodeID nid,
const Source& source,
const Identifier* name,
- utils::VectorRef<const Parameter*> params,
+ VectorRef<const Parameter*> params,
Type return_type,
const BlockStatement* body,
- utils::VectorRef<const Attribute*> attributes,
- utils::VectorRef<const Attribute*> return_type_attributes);
+ VectorRef<const Attribute*> attributes,
+ VectorRef<const Attribute*> return_type_attributes);
/// Destructor
~Function() override;
@@ -79,7 +79,7 @@
const Identifier* const name;
/// The function params
- const utils::Vector<const Parameter*, 8> params;
+ const tint::Vector<const Parameter*, 8> params;
/// The function return type
const Type return_type;
@@ -88,14 +88,14 @@
const BlockStatement* const body;
/// The attributes attached to this function
- const utils::Vector<const Attribute*, 2> attributes;
+ const tint::Vector<const Attribute*, 2> attributes;
/// The attributes attached to the function return type.
- const utils::Vector<const Attribute*, 2> return_type_attributes;
+ const tint::Vector<const Attribute*, 2> return_type_attributes;
};
/// A list of functions
-class FunctionList : public utils::Vector<const Function*, 8> {
+class FunctionList : public tint::Vector<const Function*, 8> {
public:
/// Appends f to the end of the list
/// @param f the function to append to this list
diff --git a/src/tint/lang/wgsl/ast/function_test.cc b/src/tint/lang/wgsl/ast/function_test.cc
index 65aefc1..c8d8864 100644
--- a/src/tint/lang/wgsl/ast/function_test.cc
+++ b/src/tint/lang/wgsl/ast/function_test.cc
@@ -26,11 +26,11 @@
using FunctionTest = TestHelper;
TEST_F(FunctionTest, Creation_i32ReturnType) {
- utils::Vector params{Param("var", ty.i32())};
+ tint::Vector params{Param("var", ty.i32())};
auto i32 = ty.i32();
auto* var = params[0];
- auto* f = Func("func", params, i32, utils::Empty);
+ auto* f = Func("func", params, i32, tint::Empty);
EXPECT_EQ(f->name->symbol, Symbols().Get("func"));
ASSERT_EQ(f->params.Length(), 1u);
CheckIdentifier(f->return_type, "i32");
@@ -38,10 +38,10 @@
}
TEST_F(FunctionTest, Creation_NoReturnType) {
- utils::Vector params{Param("var", ty.i32())};
+ tint::Vector params{Param("var", ty.i32())};
auto* var = params[0];
- auto* f = Func("func", params, ty.void_(), utils::Empty);
+ auto* f = Func("func", params, ty.void_(), tint::Empty);
EXPECT_EQ(f->name->symbol, Symbols().Get("func"));
ASSERT_EQ(f->params.Length(), 1u);
EXPECT_EQ(f->return_type, nullptr);
@@ -49,10 +49,10 @@
}
TEST_F(FunctionTest, Creation_SingleParam) {
- utils::Vector params{Param("var", ty.i32())};
+ tint::Vector params{Param("var", ty.i32())};
auto* var = params[0];
- auto* f = Func("func", params, ty.void_(), utils::Empty);
+ auto* f = Func("func", params, ty.void_(), tint::Empty);
EXPECT_EQ(f->name->symbol, Symbols().Get("func"));
ASSERT_EQ(f->params.Length(), 1u);
EXPECT_EQ(f->return_type, nullptr);
@@ -62,7 +62,7 @@
}
TEST_F(FunctionTest, Creation_Body_Vector) {
- auto* f = Func("func", utils::Empty, ty.void_(), utils::Vector{Discard(), Return()});
+ auto* f = Func("func", tint::Empty, ty.void_(), tint::Vector{Discard(), Return()});
ASSERT_NE(f->body, nullptr);
ASSERT_EQ(f->body->statements.Length(), 2u);
EXPECT_TRUE(f->body->statements[0]->Is<DiscardStatement>());
@@ -70,7 +70,7 @@
}
TEST_F(FunctionTest, Creation_Body_Block) {
- auto* f = Func("func", utils::Empty, ty.void_(), Block(Discard(), Return()));
+ auto* f = Func("func", tint::Empty, ty.void_(), Block(Discard(), Return()));
ASSERT_NE(f->body, nullptr);
ASSERT_EQ(f->body->statements.Length(), 2u);
EXPECT_TRUE(f->body->statements[0]->Is<DiscardStatement>());
@@ -78,21 +78,21 @@
}
TEST_F(FunctionTest, Creation_Body_Stmt) {
- auto* f = Func("func", utils::Empty, ty.void_(), Return());
+ auto* f = Func("func", tint::Empty, ty.void_(), Return());
ASSERT_NE(f->body, nullptr);
ASSERT_EQ(f->body->statements.Length(), 1u);
EXPECT_TRUE(f->body->statements[0]->Is<ReturnStatement>());
}
TEST_F(FunctionTest, Creation_Body_Nullptr) {
- auto* f = Func("func", utils::Empty, ty.void_(), nullptr);
+ auto* f = Func("func", tint::Empty, ty.void_(), nullptr);
EXPECT_EQ(f->body, nullptr);
}
TEST_F(FunctionTest, Creation_WithSource) {
- utils::Vector params{Param("var", ty.i32())};
+ tint::Vector params{Param("var", ty.i32())};
- auto* f = Func(Source{Source::Location{20, 2}}, "func", params, ty.void_(), utils::Empty);
+ auto* f = Func(Source{Source::Location{20, 2}}, "func", params, ty.void_(), tint::Empty);
auto src = f->source;
EXPECT_EQ(src.range.begin.line, 20u);
EXPECT_EQ(src.range.begin.column, 2u);
@@ -102,7 +102,7 @@
EXPECT_FATAL_FAILURE(
{
ProgramBuilder b;
- b.Func(static_cast<Identifier*>(nullptr), utils::Empty, b.ty.void_(), utils::Empty);
+ b.Func(static_cast<Identifier*>(nullptr), tint::Empty, b.ty.void_(), tint::Empty);
},
"internal compiler error");
}
@@ -111,20 +111,20 @@
EXPECT_FATAL_FAILURE(
{
ProgramBuilder b;
- b.Func(b.Ident("a", "b"), utils::Empty, b.ty.void_(), utils::Empty);
+ b.Func(b.Ident("a", "b"), tint::Empty, b.ty.void_(), tint::Empty);
},
"internal compiler error");
}
TEST_F(FunctionTest, Assert_NullParam) {
- using ParamList = utils::Vector<const Parameter*, 2>;
+ using ParamList = tint::Vector<const Parameter*, 2>;
EXPECT_FATAL_FAILURE(
{
ProgramBuilder b;
ParamList params;
params.Push(b.Param("var", b.ty.i32()));
params.Push(nullptr);
- b.Func("f", params, b.ty.void_(), utils::Empty);
+ b.Func("f", params, b.ty.void_(), tint::Empty);
},
"internal compiler error");
}
@@ -134,7 +134,7 @@
{
ProgramBuilder b1;
ProgramBuilder b2;
- b1.Func(b2.Sym("func"), utils::Empty, b1.ty.void_(), utils::Empty);
+ b1.Func(b2.Sym("func"), tint::Empty, b1.ty.void_(), tint::Empty);
},
"internal compiler error");
}
@@ -145,10 +145,10 @@
ProgramBuilder b1;
ProgramBuilder b2;
b1.Func("func",
- utils::Vector{
+ tint::Vector{
b2.Param("var", b2.ty.i32()),
},
- b1.ty.void_(), utils::Empty);
+ b1.ty.void_(), tint::Empty);
},
"internal compiler error");
}
@@ -158,8 +158,8 @@
{
ProgramBuilder b1;
ProgramBuilder b2;
- b1.Func("func", utils::Empty, b1.ty.void_(), utils::Empty,
- utils::Vector{
+ b1.Func("func", tint::Empty, b1.ty.void_(), tint::Empty,
+ tint::Vector{
b2.WorkgroupSize(2_i, 4_i, 6_i),
});
},
@@ -171,7 +171,7 @@
{
ProgramBuilder b1;
ProgramBuilder b2;
- b1.Func("func", utils::Empty, b2.ty.i32(), utils::Empty);
+ b1.Func("func", tint::Empty, b2.ty.i32(), tint::Empty);
},
"internal compiler error");
}
@@ -181,8 +181,8 @@
{
ProgramBuilder b1;
ProgramBuilder b2;
- b1.Func("func", utils::Empty, b1.ty.void_(), utils::Empty, utils::Empty,
- utils::Vector{
+ b1.Func("func", tint::Empty, b1.ty.void_(), tint::Empty, tint::Empty,
+ tint::Vector{
b2.WorkgroupSize(2_i, 4_i, 6_i),
});
},
@@ -192,7 +192,7 @@
using FunctionListTest = TestHelper;
TEST_F(FunctionListTest, FindSymbol) {
- auto* func = Func("main", utils::Empty, ty.f32(), utils::Empty);
+ auto* func = Func("main", tint::Empty, ty.f32(), tint::Empty);
FunctionList list;
list.Add(func);
EXPECT_EQ(func, list.Find(Symbols().Register("main")));
@@ -204,12 +204,12 @@
}
TEST_F(FunctionListTest, FindSymbolStage) {
- auto* fs = Func("main", utils::Empty, ty.f32(), utils::Empty,
- utils::Vector{
+ auto* fs = Func("main", tint::Empty, ty.f32(), tint::Empty,
+ tint::Vector{
Stage(PipelineStage::kFragment),
});
- auto* vs = Func("main", utils::Empty, ty.f32(), utils::Empty,
- utils::Vector{
+ auto* vs = Func("main", tint::Empty, ty.f32(), tint::Empty,
+ tint::Vector{
Stage(PipelineStage::kVertex),
});
FunctionList list;
@@ -221,8 +221,8 @@
TEST_F(FunctionListTest, FindSymbolStageMissing) {
FunctionList list;
- list.Add(Func("main", utils::Empty, ty.f32(), utils::Empty,
- utils::Vector{
+ list.Add(Func("main", tint::Empty, ty.f32(), tint::Empty,
+ tint::Vector{
Stage(PipelineStage::kFragment),
}));
EXPECT_EQ(nullptr, list.Find(Symbols().Register("main"), PipelineStage::kVertex));
@@ -230,8 +230,8 @@
TEST_F(FunctionListTest, HasStage) {
FunctionList list;
- list.Add(Func("main", utils::Empty, ty.f32(), utils::Empty,
- utils::Vector{
+ list.Add(Func("main", tint::Empty, ty.f32(), tint::Empty,
+ tint::Vector{
Stage(PipelineStage::kFragment),
}));
EXPECT_TRUE(list.HasStage(PipelineStage::kFragment));
diff --git a/src/tint/lang/wgsl/ast/group_attribute.h b/src/tint/lang/wgsl/ast/group_attribute.h
index 9f96824..f8e6ebf 100644
--- a/src/tint/lang/wgsl/ast/group_attribute.h
+++ b/src/tint/lang/wgsl/ast/group_attribute.h
@@ -23,7 +23,7 @@
namespace tint::ast {
/// A group attribute
-class GroupAttribute final : public utils::Castable<GroupAttribute, Attribute> {
+class GroupAttribute final : public Castable<GroupAttribute, Attribute> {
public:
/// constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/id_attribute.h b/src/tint/lang/wgsl/ast/id_attribute.h
index 939ecd9..cc593aa 100644
--- a/src/tint/lang/wgsl/ast/id_attribute.h
+++ b/src/tint/lang/wgsl/ast/id_attribute.h
@@ -23,7 +23,7 @@
namespace tint::ast {
/// An id attribute for pipeline-overridable constants
-class IdAttribute final : public utils::Castable<IdAttribute, Attribute> {
+class IdAttribute final : public Castable<IdAttribute, Attribute> {
public:
/// Create an id attribute.
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/identifier.h b/src/tint/lang/wgsl/ast/identifier.h
index 54eff33..995c6f2 100644
--- a/src/tint/lang/wgsl/ast/identifier.h
+++ b/src/tint/lang/wgsl/ast/identifier.h
@@ -20,7 +20,7 @@
namespace tint::ast {
/// An identifier
-class Identifier : public utils::Castable<Identifier, Node> {
+class Identifier : public Castable<Identifier, Node> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/identifier_expression.h b/src/tint/lang/wgsl/ast/identifier_expression.h
index 2666961..f7b4385 100644
--- a/src/tint/lang/wgsl/ast/identifier_expression.h
+++ b/src/tint/lang/wgsl/ast/identifier_expression.h
@@ -25,7 +25,7 @@
namespace tint::ast {
/// An identifier expression
-class IdentifierExpression final : public utils::Castable<IdentifierExpression, Expression> {
+class IdentifierExpression final : public Castable<IdentifierExpression, Expression> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/if_statement.cc b/src/tint/lang/wgsl/ast/if_statement.cc
index dae50c4..006c0dc 100644
--- a/src/tint/lang/wgsl/ast/if_statement.cc
+++ b/src/tint/lang/wgsl/ast/if_statement.cc
@@ -26,7 +26,7 @@
const Expression* cond,
const BlockStatement* b,
const Statement* else_stmt,
- utils::VectorRef<const Attribute*> attrs)
+ VectorRef<const Attribute*> attrs)
: Base(pid, nid, src),
condition(cond),
body(b),
diff --git a/src/tint/lang/wgsl/ast/if_statement.h b/src/tint/lang/wgsl/ast/if_statement.h
index 1f5c678..27cd333 100644
--- a/src/tint/lang/wgsl/ast/if_statement.h
+++ b/src/tint/lang/wgsl/ast/if_statement.h
@@ -23,7 +23,7 @@
namespace tint::ast {
/// An if statement
-class IfStatement final : public utils::Castable<IfStatement, Statement> {
+class IfStatement final : public Castable<IfStatement, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
@@ -39,7 +39,7 @@
const Expression* condition,
const BlockStatement* body,
const Statement* else_stmt,
- utils::VectorRef<const Attribute*> attributes);
+ VectorRef<const Attribute*> attributes);
/// Destructor
~IfStatement() override;
@@ -60,7 +60,7 @@
const Statement* const else_statement;
/// The attribute list
- const utils::Vector<const Attribute*, 1> attributes;
+ const tint::Vector<const Attribute*, 1> attributes;
};
} // namespace tint::ast
diff --git a/src/tint/lang/wgsl/ast/if_statement_test.cc b/src/tint/lang/wgsl/ast/if_statement_test.cc
index 957ae7f..7790e04 100644
--- a/src/tint/lang/wgsl/ast/if_statement_test.cc
+++ b/src/tint/lang/wgsl/ast/if_statement_test.cc
@@ -36,7 +36,7 @@
auto* attr1 = DiagnosticAttribute(builtin::DiagnosticSeverity::kOff, "foo");
auto* attr2 = DiagnosticAttribute(builtin::DiagnosticSeverity::kOff, "bar");
auto* cond = Expr("cond");
- auto* stmt = If(cond, Block(), ElseStmt(), utils::Vector{attr1, attr2});
+ auto* stmt = If(cond, Block(), ElseStmt(), tint::Vector{attr1, attr2});
EXPECT_THAT(stmt->attributes, testing::ElementsAre(attr1, attr2));
}
diff --git a/src/tint/lang/wgsl/ast/increment_decrement_statement.h b/src/tint/lang/wgsl/ast/increment_decrement_statement.h
index b1b4d66..3b5f6cb 100644
--- a/src/tint/lang/wgsl/ast/increment_decrement_statement.h
+++ b/src/tint/lang/wgsl/ast/increment_decrement_statement.h
@@ -21,8 +21,7 @@
namespace tint::ast {
/// An increment or decrement statement
-class IncrementDecrementStatement final
- : public utils::Castable<IncrementDecrementStatement, Statement> {
+class IncrementDecrementStatement final : public Castable<IncrementDecrementStatement, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/index_accessor_expression.h b/src/tint/lang/wgsl/ast/index_accessor_expression.h
index f1d58e0..7ee9ac4 100644
--- a/src/tint/lang/wgsl/ast/index_accessor_expression.h
+++ b/src/tint/lang/wgsl/ast/index_accessor_expression.h
@@ -20,8 +20,7 @@
namespace tint::ast {
/// An index accessor expression
-class IndexAccessorExpression final
- : public utils::Castable<IndexAccessorExpression, AccessorExpression> {
+class IndexAccessorExpression final : public Castable<IndexAccessorExpression, AccessorExpression> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/index_attribute.h b/src/tint/lang/wgsl/ast/index_attribute.h
index 5e5b8d0..42d5b4e 100644
--- a/src/tint/lang/wgsl/ast/index_attribute.h
+++ b/src/tint/lang/wgsl/ast/index_attribute.h
@@ -23,7 +23,7 @@
namespace tint::ast {
/// An id attribute for pipeline-overridable constants
-class IndexAttribute final : public utils::Castable<IndexAttribute, Attribute> {
+class IndexAttribute final : public Castable<IndexAttribute, Attribute> {
public:
/// Create an index attribute.
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/int_literal_expression.cc b/src/tint/lang/wgsl/ast/int_literal_expression.cc
index 40100f2..74e99db 100644
--- a/src/tint/lang/wgsl/ast/int_literal_expression.cc
+++ b/src/tint/lang/wgsl/ast/int_literal_expression.cc
@@ -35,7 +35,7 @@
return ctx->dst->create<IntLiteralExpression>(src, value, suffix);
}
-utils::StringStream& operator<<(utils::StringStream& out, IntLiteralExpression::Suffix suffix) {
+StringStream& operator<<(StringStream& out, IntLiteralExpression::Suffix suffix) {
switch (suffix) {
default:
return out;
diff --git a/src/tint/lang/wgsl/ast/int_literal_expression.h b/src/tint/lang/wgsl/ast/int_literal_expression.h
index c694305..c0ae78d 100644
--- a/src/tint/lang/wgsl/ast/int_literal_expression.h
+++ b/src/tint/lang/wgsl/ast/int_literal_expression.h
@@ -20,7 +20,7 @@
namespace tint::ast {
/// An integer literal. The literal may have an 'i', 'u' or no suffix.
-class IntLiteralExpression final : public utils::Castable<IntLiteralExpression, LiteralExpression> {
+class IntLiteralExpression final : public Castable<IntLiteralExpression, LiteralExpression> {
public:
/// Literal suffix
enum class Suffix {
@@ -59,7 +59,7 @@
/// @param out the stream to write to
/// @param suffix the suffix to write
/// @returns out so calls can be chained
-utils::StringStream& operator<<(utils::StringStream& out, IntLiteralExpression::Suffix suffix);
+StringStream& operator<<(StringStream& out, IntLiteralExpression::Suffix suffix);
} // namespace tint::ast
diff --git a/src/tint/lang/wgsl/ast/int_literal_expression_test.cc b/src/tint/lang/wgsl/ast/int_literal_expression_test.cc
index fb8cd2f..a5a5214 100644
--- a/src/tint/lang/wgsl/ast/int_literal_expression_test.cc
+++ b/src/tint/lang/wgsl/ast/int_literal_expression_test.cc
@@ -44,7 +44,7 @@
TEST_F(IntLiteralExpressionTest, SuffixStringStream) {
auto to_str = [](IntLiteralExpression::Suffix suffix) {
- utils::StringStream ss;
+ StringStream ss;
ss << suffix;
return ss.str();
};
diff --git a/src/tint/lang/wgsl/ast/internal_attribute.cc b/src/tint/lang/wgsl/ast/internal_attribute.cc
index 785d883..9d81216 100644
--- a/src/tint/lang/wgsl/ast/internal_attribute.cc
+++ b/src/tint/lang/wgsl/ast/internal_attribute.cc
@@ -22,7 +22,7 @@
InternalAttribute::InternalAttribute(GenerationID pid,
NodeID nid,
- utils::VectorRef<const IdentifierExpression*> deps)
+ VectorRef<const IdentifierExpression*> deps)
: Base(pid, nid, Source{}), dependencies(std::move(deps)) {}
InternalAttribute::~InternalAttribute() = default;
diff --git a/src/tint/lang/wgsl/ast/internal_attribute.h b/src/tint/lang/wgsl/ast/internal_attribute.h
index 5005714..ed3a9b7 100644
--- a/src/tint/lang/wgsl/ast/internal_attribute.h
+++ b/src/tint/lang/wgsl/ast/internal_attribute.h
@@ -30,7 +30,7 @@
/// An attribute used to indicate that a function is tint-internal.
/// These attributes are not produced by generators, but instead are usually
/// created by transforms for consumption by a particular backend.
-class InternalAttribute : public utils::Castable<InternalAttribute, Attribute> {
+class InternalAttribute : public Castable<InternalAttribute, Attribute> {
public:
/// Constructor
/// @param generation_id the identifier of the program that owns this node
@@ -38,7 +38,7 @@
/// @param deps a list of identifiers that this attribute is dependent on
InternalAttribute(GenerationID generation_id,
NodeID nid,
- utils::VectorRef<const IdentifierExpression*> deps);
+ VectorRef<const IdentifierExpression*> deps);
/// Destructor
~InternalAttribute() override;
@@ -51,7 +51,7 @@
std::string Name() const override;
/// A list of identifiers that this attribute is dependent on
- const utils::Vector<const IdentifierExpression*, 1> dependencies;
+ const tint::Vector<const IdentifierExpression*, 1> dependencies;
};
} // namespace tint::ast
diff --git a/src/tint/lang/wgsl/ast/interpolate_attribute.h b/src/tint/lang/wgsl/ast/interpolate_attribute.h
index e7ad97d..290c078 100644
--- a/src/tint/lang/wgsl/ast/interpolate_attribute.h
+++ b/src/tint/lang/wgsl/ast/interpolate_attribute.h
@@ -27,7 +27,7 @@
namespace tint::ast {
/// An interpolate attribute
-class InterpolateAttribute final : public utils::Castable<InterpolateAttribute, Attribute> {
+class InterpolateAttribute final : public Castable<InterpolateAttribute, Attribute> {
public:
/// Create an interpolate attribute.
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/invariant_attribute.h b/src/tint/lang/wgsl/ast/invariant_attribute.h
index b893f65..97e5798 100644
--- a/src/tint/lang/wgsl/ast/invariant_attribute.h
+++ b/src/tint/lang/wgsl/ast/invariant_attribute.h
@@ -22,7 +22,7 @@
namespace tint::ast {
/// The invariant attribute
-class InvariantAttribute final : public utils::Castable<InvariantAttribute, Attribute> {
+class InvariantAttribute final : public Castable<InvariantAttribute, Attribute> {
public:
/// constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/let.cc b/src/tint/lang/wgsl/ast/let.cc
index ab2becf..f7f5e56 100644
--- a/src/tint/lang/wgsl/ast/let.cc
+++ b/src/tint/lang/wgsl/ast/let.cc
@@ -28,7 +28,7 @@
const Identifier* n,
Type ty,
const Expression* init,
- utils::VectorRef<const Attribute*> attrs)
+ VectorRef<const Attribute*> attrs)
: Base(pid, nid, src, n, ty, init, std::move(attrs)) {
TINT_ASSERT(AST, init != nullptr);
}
diff --git a/src/tint/lang/wgsl/ast/let.h b/src/tint/lang/wgsl/ast/let.h
index 45c0f35..bcf0901 100644
--- a/src/tint/lang/wgsl/ast/let.h
+++ b/src/tint/lang/wgsl/ast/let.h
@@ -27,7 +27,7 @@
/// let twice_depth : i32 = width + width; // Must have initializer
/// ```
/// @see https://www.w3.org/TR/WGSL/#let-decls
-class Let final : public utils::Castable<Let, Variable> {
+class Let final : public Castable<Let, Variable> {
public:
/// Create a 'let' variable
/// @param pid the identifier of the program that owns this node
@@ -43,7 +43,7 @@
const Identifier* name,
Type type,
const Expression* initializer,
- utils::VectorRef<const Attribute*> attributes);
+ VectorRef<const Attribute*> attributes);
/// Destructor
~Let() override;
diff --git a/src/tint/lang/wgsl/ast/literal_expression.h b/src/tint/lang/wgsl/ast/literal_expression.h
index 03dbcc2..51f3a47 100644
--- a/src/tint/lang/wgsl/ast/literal_expression.h
+++ b/src/tint/lang/wgsl/ast/literal_expression.h
@@ -22,7 +22,7 @@
namespace tint::ast {
/// Base class for a literal value expressions
-class LiteralExpression : public utils::Castable<LiteralExpression, Expression> {
+class LiteralExpression : public Castable<LiteralExpression, Expression> {
public:
~LiteralExpression() override;
diff --git a/src/tint/lang/wgsl/ast/location_attribute.h b/src/tint/lang/wgsl/ast/location_attribute.h
index 5316b8a..d08f823 100644
--- a/src/tint/lang/wgsl/ast/location_attribute.h
+++ b/src/tint/lang/wgsl/ast/location_attribute.h
@@ -23,7 +23,7 @@
namespace tint::ast {
/// A location attribute
-class LocationAttribute final : public utils::Castable<LocationAttribute, Attribute> {
+class LocationAttribute final : public Castable<LocationAttribute, Attribute> {
public:
/// constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/loop_statement.cc b/src/tint/lang/wgsl/ast/loop_statement.cc
index 4928eb9..feebce2 100644
--- a/src/tint/lang/wgsl/ast/loop_statement.cc
+++ b/src/tint/lang/wgsl/ast/loop_statement.cc
@@ -27,7 +27,7 @@
const Source& src,
const BlockStatement* b,
const BlockStatement* cont,
- utils::VectorRef<const ast::Attribute*> attrs)
+ VectorRef<const ast::Attribute*> attrs)
: Base(pid, nid, src), body(b), continuing(cont), attributes(std::move(attrs)) {
TINT_ASSERT(AST, body);
TINT_ASSERT_GENERATION_IDS_EQUAL_IF_VALID(AST, body, generation_id);
diff --git a/src/tint/lang/wgsl/ast/loop_statement.h b/src/tint/lang/wgsl/ast/loop_statement.h
index 491b14e..32aab61 100644
--- a/src/tint/lang/wgsl/ast/loop_statement.h
+++ b/src/tint/lang/wgsl/ast/loop_statement.h
@@ -20,7 +20,7 @@
namespace tint::ast {
/// A loop statement
-class LoopStatement final : public utils::Castable<LoopStatement, Statement> {
+class LoopStatement final : public Castable<LoopStatement, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
@@ -34,7 +34,7 @@
const Source& source,
const BlockStatement* body,
const BlockStatement* continuing,
- utils::VectorRef<const ast::Attribute*> attributes);
+ VectorRef<const ast::Attribute*> attributes);
/// Destructor
~LoopStatement() override;
@@ -51,7 +51,7 @@
const BlockStatement* const continuing;
/// The attribute list
- const utils::Vector<const Attribute*, 1> attributes;
+ const tint::Vector<const Attribute*, 1> attributes;
};
} // namespace tint::ast
diff --git a/src/tint/lang/wgsl/ast/loop_statement_test.cc b/src/tint/lang/wgsl/ast/loop_statement_test.cc
index 2fc6c51..786c86c 100644
--- a/src/tint/lang/wgsl/ast/loop_statement_test.cc
+++ b/src/tint/lang/wgsl/ast/loop_statement_test.cc
@@ -31,7 +31,7 @@
auto* continuing = Block(create<DiscardStatement>());
- auto* l = create<LoopStatement>(body, continuing, utils::Empty);
+ auto* l = create<LoopStatement>(body, continuing, tint::Empty);
ASSERT_EQ(l->body->statements.Length(), 1u);
EXPECT_EQ(l->body->statements[0], b);
ASSERT_EQ(l->continuing->statements.Length(), 1u);
@@ -43,8 +43,7 @@
auto* continuing = Block(create<DiscardStatement>());
- auto* l =
- create<LoopStatement>(Source{Source::Location{20, 2}}, body, continuing, utils::Empty);
+ auto* l = create<LoopStatement>(Source{Source::Location{20, 2}}, body, continuing, tint::Empty);
auto src = l->source;
EXPECT_EQ(src.range.begin.line, 20u);
EXPECT_EQ(src.range.begin.column, 2u);
@@ -55,20 +54,20 @@
auto* attr2 = DiagnosticAttribute(builtin::DiagnosticSeverity::kOff, "bar");
auto* body = Block(Return());
- auto* l = create<LoopStatement>(body, nullptr, utils::Vector{attr1, attr2});
+ auto* l = create<LoopStatement>(body, nullptr, tint::Vector{attr1, attr2});
EXPECT_THAT(l->attributes, testing::ElementsAre(attr1, attr2));
}
TEST_F(LoopStatementTest, IsLoop) {
- auto* l = create<LoopStatement>(Block(), Block(), utils::Empty);
+ auto* l = create<LoopStatement>(Block(), Block(), tint::Empty);
EXPECT_TRUE(l->Is<LoopStatement>());
}
TEST_F(LoopStatementTest, HasContinuing_WithoutContinuing) {
auto* body = Block(create<DiscardStatement>());
- auto* l = create<LoopStatement>(body, nullptr, utils::Empty);
+ auto* l = create<LoopStatement>(body, nullptr, tint::Empty);
EXPECT_FALSE(l->continuing);
}
@@ -77,7 +76,7 @@
auto* continuing = Block(create<DiscardStatement>());
- auto* l = create<LoopStatement>(body, continuing, utils::Empty);
+ auto* l = create<LoopStatement>(body, continuing, tint::Empty);
EXPECT_TRUE(l->continuing);
}
@@ -85,7 +84,7 @@
EXPECT_FATAL_FAILURE(
{
ProgramBuilder b;
- b.create<LoopStatement>(nullptr, nullptr, utils::Empty);
+ b.create<LoopStatement>(nullptr, nullptr, tint::Empty);
},
"internal compiler error");
}
@@ -95,7 +94,7 @@
{
ProgramBuilder b1;
ProgramBuilder b2;
- b1.create<LoopStatement>(b2.Block(), b1.Block(), utils::Empty);
+ b1.create<LoopStatement>(b2.Block(), b1.Block(), tint::Empty);
},
"internal compiler error");
}
@@ -105,7 +104,7 @@
{
ProgramBuilder b1;
ProgramBuilder b2;
- b1.create<LoopStatement>(b1.Block(), b2.Block(), utils::Empty);
+ b1.create<LoopStatement>(b1.Block(), b2.Block(), tint::Empty);
},
"internal compiler error");
}
diff --git a/src/tint/lang/wgsl/ast/member_accessor_expression.h b/src/tint/lang/wgsl/ast/member_accessor_expression.h
index 75bf153..8c14b48 100644
--- a/src/tint/lang/wgsl/ast/member_accessor_expression.h
+++ b/src/tint/lang/wgsl/ast/member_accessor_expression.h
@@ -22,7 +22,7 @@
/// A member accessor expression
class MemberAccessorExpression final
- : public utils::Castable<MemberAccessorExpression, AccessorExpression> {
+ : public Castable<MemberAccessorExpression, AccessorExpression> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/module.cc b/src/tint/lang/wgsl/ast/module.cc
index 1a51b59..edc1771 100644
--- a/src/tint/lang/wgsl/ast/module.cc
+++ b/src/tint/lang/wgsl/ast/module.cc
@@ -26,10 +26,7 @@
Module::Module(GenerationID pid, NodeID nid, const Source& src) : Base(pid, nid, src) {}
-Module::Module(GenerationID pid,
- NodeID nid,
- const Source& src,
- utils::VectorRef<const Node*> global_decls)
+Module::Module(GenerationID pid, NodeID nid, const Source& src, VectorRef<const Node*> global_decls)
: Base(pid, nid, src), global_declarations_(std::move(global_decls)) {
for (auto* decl : global_declarations_) {
if (decl == nullptr) {
diff --git a/src/tint/lang/wgsl/ast/module.h b/src/tint/lang/wgsl/ast/module.h
index 09633df..23e33e6 100644
--- a/src/tint/lang/wgsl/ast/module.h
+++ b/src/tint/lang/wgsl/ast/module.h
@@ -29,7 +29,7 @@
/// Module holds the top-level AST types, functions and global variables used by
/// a Program.
-class Module final : public utils::Castable<Module, Node> {
+class Module final : public Castable<Module, Node> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
@@ -43,10 +43,7 @@
/// @param src the source of this node
/// @param global_decls the list of global types, functions, and variables, in
/// the order they were declared in the source program
- Module(GenerationID pid,
- NodeID nid,
- const Source& src,
- utils::VectorRef<const Node*> global_decls);
+ Module(GenerationID pid, NodeID nid, const Source& src, VectorRef<const Node*> global_decls);
/// Destructor
~Module() override;
@@ -80,9 +77,9 @@
auto& GlobalVariables() { return global_variables_; }
/// @returns the global variable declarations of kind 'T' for the module
- template <typename T, typename = utils::traits::EnableIfIsType<T, Variable>>
+ template <typename T, typename = tint::traits::EnableIfIsType<T, Variable>>
auto Globals() const {
- utils::Vector<const T*, 32> out;
+ tint::Vector<const T*, 32> out;
out.Reserve(global_variables_.Length());
for (auto* global : global_variables_) {
if (auto* var = global->As<T>()) {
@@ -149,13 +146,13 @@
/// * #functions_
void BinGlobalDeclaration(const tint::ast::Node* decl, diag::List& diags);
- utils::Vector<const Node*, 64> global_declarations_;
- utils::Vector<const TypeDecl*, 16> type_decls_;
+ tint::Vector<const Node*, 64> global_declarations_;
+ tint::Vector<const TypeDecl*, 16> type_decls_;
FunctionList functions_;
- utils::Vector<const Variable*, 32> global_variables_;
- utils::Vector<const DiagnosticDirective*, 8> diagnostic_directives_;
- utils::Vector<const Enable*, 8> enables_;
- utils::Vector<const ConstAssert*, 8> const_asserts_;
+ tint::Vector<const Variable*, 32> global_variables_;
+ tint::Vector<const DiagnosticDirective*, 8> diagnostic_directives_;
+ tint::Vector<const Enable*, 8> enables_;
+ tint::Vector<const ConstAssert*, 8> const_asserts_;
};
} // namespace tint::ast
diff --git a/src/tint/lang/wgsl/ast/module_test.cc b/src/tint/lang/wgsl/ast/module_test.cc
index 6bf3b7d..85f7c78 100644
--- a/src/tint/lang/wgsl/ast/module_test.cc
+++ b/src/tint/lang/wgsl/ast/module_test.cc
@@ -61,8 +61,8 @@
{
ProgramBuilder b1;
ProgramBuilder b2;
- b1.AST().AddFunction(b2.create<Function>(b2.Ident("func"), utils::Empty, b2.ty.f32(),
- b2.Block(), utils::Empty, utils::Empty));
+ b1.AST().AddFunction(b2.create<Function>(b2.Ident("func"), tint::Empty, b2.ty.f32(),
+ b2.Block(), tint::Empty, tint::Empty));
},
"internal compiler error");
}
@@ -138,17 +138,17 @@
this->SetResolveOnBuild(false);
Program program(std::move(*this));
- EXPECT_THAT(program.AST().GlobalDeclarations(), ::testing::ContainerEq(utils::Vector{
+ EXPECT_THAT(program.AST().GlobalDeclarations(), ::testing::ContainerEq(tint::Vector{
enable_1,
diagnostic_1,
enable_2,
diagnostic_2,
}));
- EXPECT_THAT(program.AST().Enables(), ::testing::ContainerEq(utils::Vector{
+ EXPECT_THAT(program.AST().Enables(), ::testing::ContainerEq(tint::Vector{
enable_1,
enable_2,
}));
- EXPECT_THAT(program.AST().DiagnosticDirectives(), ::testing::ContainerEq(utils::Vector{
+ EXPECT_THAT(program.AST().DiagnosticDirectives(), ::testing::ContainerEq(tint::Vector{
diagnostic_1,
diagnostic_2,
}));
diff --git a/src/tint/lang/wgsl/ast/must_use_attribute.h b/src/tint/lang/wgsl/ast/must_use_attribute.h
index 6a2bbd2..e882bd6 100644
--- a/src/tint/lang/wgsl/ast/must_use_attribute.h
+++ b/src/tint/lang/wgsl/ast/must_use_attribute.h
@@ -22,7 +22,7 @@
namespace tint::ast {
/// The must_use attribute
-class MustUseAttribute final : public utils::Castable<MustUseAttribute, Attribute> {
+class MustUseAttribute final : public Castable<MustUseAttribute, Attribute> {
public:
/// constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/node.h b/src/tint/lang/wgsl/ast/node.h
index e281a07..75f84bf 100644
--- a/src/tint/lang/wgsl/ast/node.h
+++ b/src/tint/lang/wgsl/ast/node.h
@@ -23,7 +23,7 @@
namespace tint::ast {
/// AST base class node
-class Node : public utils::Castable<Node, Cloneable> {
+class Node : public Castable<Node, Cloneable> {
public:
~Node() override;
diff --git a/src/tint/lang/wgsl/ast/override.cc b/src/tint/lang/wgsl/ast/override.cc
index 89dd165..f7d8291 100644
--- a/src/tint/lang/wgsl/ast/override.cc
+++ b/src/tint/lang/wgsl/ast/override.cc
@@ -28,7 +28,7 @@
const Identifier* n,
Type ty,
const Expression* init,
- utils::VectorRef<const Attribute*> attrs)
+ VectorRef<const Attribute*> attrs)
: Base(pid, nid, src, n, ty, init, std::move(attrs)) {}
Override::~Override() = default;
diff --git a/src/tint/lang/wgsl/ast/override.h b/src/tint/lang/wgsl/ast/override.h
index 04b2213..c7fe24c 100644
--- a/src/tint/lang/wgsl/ast/override.h
+++ b/src/tint/lang/wgsl/ast/override.h
@@ -30,7 +30,7 @@
/// override scale : f32; // No default - must be overridden.
/// ```
/// @see https://www.w3.org/TR/WGSL/#override-decls
-class Override final : public utils::Castable<Override, Variable> {
+class Override final : public Castable<Override, Variable> {
public:
/// Create an 'override' pipeline-overridable constant.
/// @param pid the identifier of the program that owns this node
@@ -46,7 +46,7 @@
const Identifier* name,
Type type,
const Expression* initializer,
- utils::VectorRef<const Attribute*> attributes);
+ VectorRef<const Attribute*> attributes);
/// Destructor
~Override() override;
diff --git a/src/tint/lang/wgsl/ast/parameter.cc b/src/tint/lang/wgsl/ast/parameter.cc
index 0307de6..d366835 100644
--- a/src/tint/lang/wgsl/ast/parameter.cc
+++ b/src/tint/lang/wgsl/ast/parameter.cc
@@ -27,7 +27,7 @@
const Source& src,
const Identifier* n,
Type ty,
- utils::VectorRef<const Attribute*> attrs)
+ VectorRef<const Attribute*> attrs)
: Base(pid, nid, src, n, ty, nullptr, std::move(attrs)) {}
Parameter::~Parameter() = default;
diff --git a/src/tint/lang/wgsl/ast/parameter.h b/src/tint/lang/wgsl/ast/parameter.h
index f64ad4a..e6618db 100644
--- a/src/tint/lang/wgsl/ast/parameter.h
+++ b/src/tint/lang/wgsl/ast/parameter.h
@@ -31,7 +31,7 @@
/// ```
///
/// @see https://www.w3.org/TR/WGSL/#creation-time-consts
-class Parameter final : public utils::Castable<Parameter, Variable> {
+class Parameter final : public Castable<Parameter, Variable> {
public:
/// Create a 'parameter' creation-time value variable.
/// @param pid the identifier of the program that owns this node
@@ -45,7 +45,7 @@
const Source& source,
const Identifier* name,
Type type,
- utils::VectorRef<const Attribute*> attributes);
+ VectorRef<const Attribute*> attributes);
/// Destructor
~Parameter() override;
diff --git a/src/tint/lang/wgsl/ast/phony_expression.h b/src/tint/lang/wgsl/ast/phony_expression.h
index 6fc140d..e03ca34 100644
--- a/src/tint/lang/wgsl/ast/phony_expression.h
+++ b/src/tint/lang/wgsl/ast/phony_expression.h
@@ -21,7 +21,7 @@
/// Represents the `_` of a phony assignment `_ = <expr>`
/// @see https://www.w3.org/TR/WGSL/#phony-assignment-section
-class PhonyExpression final : public utils::Castable<PhonyExpression, Expression> {
+class PhonyExpression final : public Castable<PhonyExpression, Expression> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/pipeline_stage.cc b/src/tint/lang/wgsl/ast/pipeline_stage.cc
index 5cf1f05..4d00143 100644
--- a/src/tint/lang/wgsl/ast/pipeline_stage.cc
+++ b/src/tint/lang/wgsl/ast/pipeline_stage.cc
@@ -16,7 +16,7 @@
namespace tint::ast {
-utils::StringStream& operator<<(utils::StringStream& out, PipelineStage stage) {
+StringStream& operator<<(StringStream& out, PipelineStage stage) {
switch (stage) {
case PipelineStage::kNone: {
out << "none";
diff --git a/src/tint/lang/wgsl/ast/pipeline_stage.h b/src/tint/lang/wgsl/ast/pipeline_stage.h
index c0ae132..456a8b3 100644
--- a/src/tint/lang/wgsl/ast/pipeline_stage.h
+++ b/src/tint/lang/wgsl/ast/pipeline_stage.h
@@ -25,7 +25,7 @@
/// @param out the stream to write to
/// @param stage the PipelineStage
/// @return the stream so calls can be chained
-utils::StringStream& operator<<(utils::StringStream& out, PipelineStage stage);
+StringStream& operator<<(StringStream& out, PipelineStage stage);
} // namespace tint::ast
diff --git a/src/tint/lang/wgsl/ast/return_statement.h b/src/tint/lang/wgsl/ast/return_statement.h
index 05f19f8..3f68526 100644
--- a/src/tint/lang/wgsl/ast/return_statement.h
+++ b/src/tint/lang/wgsl/ast/return_statement.h
@@ -21,7 +21,7 @@
namespace tint::ast {
/// A return statement
-class ReturnStatement final : public utils::Castable<ReturnStatement, Statement> {
+class ReturnStatement final : public Castable<ReturnStatement, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/stage_attribute.h b/src/tint/lang/wgsl/ast/stage_attribute.h
index 2f3d96b..c1385a9 100644
--- a/src/tint/lang/wgsl/ast/stage_attribute.h
+++ b/src/tint/lang/wgsl/ast/stage_attribute.h
@@ -23,7 +23,7 @@
namespace tint::ast {
/// A workgroup attribute
-class StageAttribute final : public utils::Castable<StageAttribute, Attribute> {
+class StageAttribute final : public Castable<StageAttribute, Attribute> {
public:
/// constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/statement.h b/src/tint/lang/wgsl/ast/statement.h
index d121469..2fa97f3 100644
--- a/src/tint/lang/wgsl/ast/statement.h
+++ b/src/tint/lang/wgsl/ast/statement.h
@@ -22,7 +22,7 @@
namespace tint::ast {
/// Base statement class
-class Statement : public utils::Castable<Statement, Node> {
+class Statement : public Castable<Statement, Node> {
public:
~Statement() override;
diff --git a/src/tint/lang/wgsl/ast/stride_attribute.h b/src/tint/lang/wgsl/ast/stride_attribute.h
index 27ff92c..8a51961 100644
--- a/src/tint/lang/wgsl/ast/stride_attribute.h
+++ b/src/tint/lang/wgsl/ast/stride_attribute.h
@@ -24,7 +24,7 @@
/// A stride attribute used by the SPIR-V reader for strided arrays and
/// matrices.
-class StrideAttribute final : public utils::Castable<StrideAttribute, Attribute> {
+class StrideAttribute final : public Castable<StrideAttribute, Attribute> {
public:
/// constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/struct.cc b/src/tint/lang/wgsl/ast/struct.cc
index 88b6b43..a471a83 100644
--- a/src/tint/lang/wgsl/ast/struct.cc
+++ b/src/tint/lang/wgsl/ast/struct.cc
@@ -26,8 +26,8 @@
NodeID nid,
const Source& src,
const Identifier* n,
- utils::VectorRef<const StructMember*> m,
- utils::VectorRef<const Attribute*> attrs)
+ VectorRef<const StructMember*> m,
+ VectorRef<const Attribute*> attrs)
: Base(pid, nid, src, n), members(std::move(m)), attributes(std::move(attrs)) {
for (auto* mem : members) {
TINT_ASSERT(AST, mem);
diff --git a/src/tint/lang/wgsl/ast/struct.h b/src/tint/lang/wgsl/ast/struct.h
index 74c0c31..c91be45 100644
--- a/src/tint/lang/wgsl/ast/struct.h
+++ b/src/tint/lang/wgsl/ast/struct.h
@@ -26,7 +26,7 @@
namespace tint::ast {
/// A struct statement.
-class Struct final : public utils::Castable<Struct, TypeDecl> {
+class Struct final : public Castable<Struct, TypeDecl> {
public:
/// Create a new struct statement
/// @param pid the identifier of the program that owns this node
@@ -39,8 +39,8 @@
NodeID nid,
const Source& src,
const Identifier* name,
- utils::VectorRef<const StructMember*> members,
- utils::VectorRef<const Attribute*> attributes);
+ VectorRef<const StructMember*> members,
+ VectorRef<const Attribute*> attributes);
/// Destructor
~Struct() override;
@@ -52,10 +52,10 @@
const Struct* Clone(CloneContext* ctx) const override;
/// The members
- const utils::Vector<const StructMember*, 8> members;
+ const tint::Vector<const StructMember*, 8> members;
/// The struct attributes
- const utils::Vector<const Attribute*, 4> attributes;
+ const tint::Vector<const Attribute*, 4> attributes;
};
} // namespace tint::ast
diff --git a/src/tint/lang/wgsl/ast/struct_member.cc b/src/tint/lang/wgsl/ast/struct_member.cc
index 72fa6d2..1c1c3b1 100644
--- a/src/tint/lang/wgsl/ast/struct_member.cc
+++ b/src/tint/lang/wgsl/ast/struct_member.cc
@@ -25,7 +25,7 @@
const Source& src,
const Identifier* n,
Type ty,
- utils::VectorRef<const Attribute*> attrs)
+ VectorRef<const Attribute*> attrs)
: Base(pid, nid, src), name(n), type(ty), attributes(std::move(attrs)) {
TINT_ASSERT(AST, name);
diff --git a/src/tint/lang/wgsl/ast/struct_member.h b/src/tint/lang/wgsl/ast/struct_member.h
index 5248219..f7cf496 100644
--- a/src/tint/lang/wgsl/ast/struct_member.h
+++ b/src/tint/lang/wgsl/ast/struct_member.h
@@ -28,7 +28,7 @@
namespace tint::ast {
/// A struct member statement.
-class StructMember final : public utils::Castable<StructMember, Node> {
+class StructMember final : public Castable<StructMember, Node> {
public:
/// Create a new struct member statement
/// @param pid the identifier of the program that owns this node
@@ -42,7 +42,7 @@
const Source& src,
const Identifier* name,
Type type,
- utils::VectorRef<const Attribute*> attributes);
+ VectorRef<const Attribute*> attributes);
/// Destructor
~StructMember() override;
@@ -60,7 +60,7 @@
const Type type;
/// The attributes
- const utils::Vector<const Attribute*, 4> attributes;
+ const tint::Vector<const Attribute*, 4> attributes;
};
} // namespace tint::ast
diff --git a/src/tint/lang/wgsl/ast/struct_member_align_attribute.h b/src/tint/lang/wgsl/ast/struct_member_align_attribute.h
index c396124..33931bb 100644
--- a/src/tint/lang/wgsl/ast/struct_member_align_attribute.h
+++ b/src/tint/lang/wgsl/ast/struct_member_align_attribute.h
@@ -24,8 +24,7 @@
namespace tint::ast {
/// A struct member align attribute
-class StructMemberAlignAttribute final
- : public utils::Castable<StructMemberAlignAttribute, Attribute> {
+class StructMemberAlignAttribute final : public Castable<StructMemberAlignAttribute, Attribute> {
public:
/// constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/struct_member_offset_attribute.h b/src/tint/lang/wgsl/ast/struct_member_offset_attribute.h
index 8635cda..f69a838 100644
--- a/src/tint/lang/wgsl/ast/struct_member_offset_attribute.h
+++ b/src/tint/lang/wgsl/ast/struct_member_offset_attribute.h
@@ -32,8 +32,7 @@
/// trivial for the Resolver to handle `@offset(n)` or `@size(n)` /
/// `@align(n)` attributes, so this is what we do, keeping all the layout
/// logic in one place.
-class StructMemberOffsetAttribute final
- : public utils::Castable<StructMemberOffsetAttribute, Attribute> {
+class StructMemberOffsetAttribute final : public Castable<StructMemberOffsetAttribute, Attribute> {
public:
/// constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/struct_member_size_attribute.h b/src/tint/lang/wgsl/ast/struct_member_size_attribute.h
index ea23701..7f10f3a 100644
--- a/src/tint/lang/wgsl/ast/struct_member_size_attribute.h
+++ b/src/tint/lang/wgsl/ast/struct_member_size_attribute.h
@@ -24,8 +24,7 @@
namespace tint::ast {
/// A struct member size attribute
-class StructMemberSizeAttribute final
- : public utils::Castable<StructMemberSizeAttribute, Attribute> {
+class StructMemberSizeAttribute final : public Castable<StructMemberSizeAttribute, Attribute> {
public:
/// constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/struct_member_test.cc b/src/tint/lang/wgsl/ast/struct_member_test.cc
index 564bb5a..80c1bf5 100644
--- a/src/tint/lang/wgsl/ast/struct_member_test.cc
+++ b/src/tint/lang/wgsl/ast/struct_member_test.cc
@@ -22,7 +22,7 @@
using StructMemberTest = TestHelper;
TEST_F(StructMemberTest, Creation) {
- auto* st = Member("a", ty.i32(), utils::Vector{MemberSize(4_a)});
+ auto* st = Member("a", ty.i32(), tint::Vector{MemberSize(4_a)});
CheckIdentifier(st->name, "a");
CheckIdentifier(st->type, "i32");
EXPECT_EQ(st->attributes.Length(), 1u);
@@ -67,7 +67,7 @@
EXPECT_FATAL_FAILURE(
{
ProgramBuilder b;
- b.Member("a", b.ty.i32(), utils::Vector{b.MemberSize(4_a), nullptr});
+ b.Member("a", b.ty.i32(), tint::Vector{b.MemberSize(4_a), nullptr});
},
"internal compiler error");
}
@@ -77,7 +77,7 @@
{
ProgramBuilder b1;
ProgramBuilder b2;
- b1.Member(b2.Sym("a"), b1.ty.i32(), utils::Vector{b1.MemberSize(4_a)});
+ b1.Member(b2.Sym("a"), b1.ty.i32(), tint::Vector{b1.MemberSize(4_a)});
},
"internal compiler error");
}
@@ -87,7 +87,7 @@
{
ProgramBuilder b1;
ProgramBuilder b2;
- b1.Member("a", b1.ty.i32(), utils::Vector{b2.MemberSize(4_a)});
+ b1.Member("a", b1.ty.i32(), tint::Vector{b2.MemberSize(4_a)});
},
"internal compiler error");
}
diff --git a/src/tint/lang/wgsl/ast/struct_test.cc b/src/tint/lang/wgsl/ast/struct_test.cc
index 9e3472f..edf66ac 100644
--- a/src/tint/lang/wgsl/ast/struct_test.cc
+++ b/src/tint/lang/wgsl/ast/struct_test.cc
@@ -26,7 +26,7 @@
TEST_F(AstStructTest, Creation) {
auto name = Sym("s");
- auto* s = Structure(name, utils::Vector{Member("a", ty.i32())});
+ auto* s = Structure(name, tint::Vector{Member("a", ty.i32())});
EXPECT_EQ(s->name->symbol, name);
EXPECT_EQ(s->members.Length(), 1u);
EXPECT_TRUE(s->attributes.IsEmpty());
@@ -39,8 +39,8 @@
TEST_F(AstStructTest, Creation_WithAttributes) {
auto name = Sym("s");
- auto* s = Structure(name, utils::Vector{Member("a", ty.i32())},
- utils::Vector{
+ auto* s = Structure(name, tint::Vector{Member("a", ty.i32())},
+ tint::Vector{
ASTNodes().Create<BlockAttribute>(ID(), AllocateNodeID()),
});
EXPECT_EQ(s->name->symbol, name);
@@ -56,8 +56,8 @@
TEST_F(AstStructTest, CreationWithSourceAndAttributes) {
auto name = Sym("s");
auto* s = Structure(Source{Source::Range{Source::Location{27, 4}, Source::Location{27, 8}}},
- name, utils::Vector{Member("a", ty.i32())},
- utils::Vector{ASTNodes().Create<BlockAttribute>(ID(), AllocateNodeID())});
+ name, tint::Vector{Member("a", ty.i32())},
+ tint::Vector{ASTNodes().Create<BlockAttribute>(ID(), AllocateNodeID())});
EXPECT_EQ(s->name->symbol, name);
EXPECT_EQ(s->members.Length(), 1u);
ASSERT_EQ(s->attributes.Length(), 1u);
@@ -72,8 +72,7 @@
EXPECT_FATAL_FAILURE(
{
ProgramBuilder b;
- b.Structure(b.Sym("S"), utils::Vector{b.Member("a", b.ty.i32()), nullptr},
- utils::Empty);
+ b.Structure(b.Sym("S"), tint::Vector{b.Member("a", b.ty.i32()), nullptr}, tint::Empty);
},
"internal compiler error");
}
@@ -82,8 +81,8 @@
EXPECT_FATAL_FAILURE(
{
ProgramBuilder b;
- b.Structure(b.Sym("S"), utils::Vector{b.Member("a", b.ty.i32())},
- utils::Vector<const Attribute*, 1>{nullptr});
+ b.Structure(b.Sym("S"), tint::Vector{b.Member("a", b.ty.i32())},
+ tint::Vector<const Attribute*, 1>{nullptr});
},
"internal compiler error");
}
@@ -93,7 +92,7 @@
{
ProgramBuilder b1;
ProgramBuilder b2;
- b1.Structure(b1.Sym("S"), utils::Vector{b2.Member("a", b2.ty.i32())});
+ b1.Structure(b1.Sym("S"), tint::Vector{b2.Member("a", b2.ty.i32())});
},
"internal compiler error");
}
@@ -104,8 +103,8 @@
ProgramBuilder b1;
ProgramBuilder b2;
b1.Structure(
- b1.Sym("S"), utils::Vector{b1.Member("a", b1.ty.i32())},
- utils::Vector{b2.ASTNodes().Create<BlockAttribute>(b2.ID(), b2.AllocateNodeID())});
+ b1.Sym("S"), tint::Vector{b1.Member("a", b1.ty.i32())},
+ tint::Vector{b2.ASTNodes().Create<BlockAttribute>(b2.ID(), b2.AllocateNodeID())});
},
"internal compiler error");
}
diff --git a/src/tint/lang/wgsl/ast/switch_statement.cc b/src/tint/lang/wgsl/ast/switch_statement.cc
index 8646509..a8b9f65 100644
--- a/src/tint/lang/wgsl/ast/switch_statement.cc
+++ b/src/tint/lang/wgsl/ast/switch_statement.cc
@@ -26,9 +26,9 @@
NodeID nid,
const Source& src,
const Expression* cond,
- utils::VectorRef<const CaseStatement*> b,
- utils::VectorRef<const Attribute*> stmt_attrs,
- utils::VectorRef<const Attribute*> body_attrs)
+ VectorRef<const CaseStatement*> b,
+ VectorRef<const Attribute*> stmt_attrs,
+ VectorRef<const Attribute*> body_attrs)
: Base(pid, nid, src),
condition(cond),
body(std::move(b)),
diff --git a/src/tint/lang/wgsl/ast/switch_statement.h b/src/tint/lang/wgsl/ast/switch_statement.h
index c412cd2..5eba1b7 100644
--- a/src/tint/lang/wgsl/ast/switch_statement.h
+++ b/src/tint/lang/wgsl/ast/switch_statement.h
@@ -21,7 +21,7 @@
namespace tint::ast {
/// A switch statement
-class SwitchStatement final : public utils::Castable<SwitchStatement, Statement> {
+class SwitchStatement final : public Castable<SwitchStatement, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
@@ -35,9 +35,9 @@
NodeID nid,
const Source& src,
const Expression* condition,
- utils::VectorRef<const CaseStatement*> body,
- utils::VectorRef<const Attribute*> stmt_attributes,
- utils::VectorRef<const Attribute*> body_attributes);
+ VectorRef<const CaseStatement*> body,
+ VectorRef<const Attribute*> stmt_attributes,
+ VectorRef<const Attribute*> body_attributes);
/// Destructor
~SwitchStatement() override;
@@ -52,14 +52,14 @@
const Expression* const condition;
/// The Switch body
- const utils::Vector<const CaseStatement*, 4> body;
+ const tint::Vector<const CaseStatement*, 4> body;
SwitchStatement(const SwitchStatement&) = delete;
/// The attribute list for the statement
- const utils::Vector<const Attribute*, 1> attributes;
+ const tint::Vector<const Attribute*, 1> attributes;
/// The attribute list for the body
- const utils::Vector<const Attribute*, 1> body_attributes;
+ const tint::Vector<const Attribute*, 1> body_attributes;
};
} // namespace tint::ast
diff --git a/src/tint/lang/wgsl/ast/switch_statement_test.cc b/src/tint/lang/wgsl/ast/switch_statement_test.cc
index 5acf7c3..eeb1b10 100644
--- a/src/tint/lang/wgsl/ast/switch_statement_test.cc
+++ b/src/tint/lang/wgsl/ast/switch_statement_test.cc
@@ -26,11 +26,11 @@
using SwitchStatementTest = TestHelper;
TEST_F(SwitchStatementTest, Creation) {
- auto* case_stmt = create<CaseStatement>(utils::Vector{CaseSelector(1_u)}, Block());
+ auto* case_stmt = create<CaseStatement>(tint::Vector{CaseSelector(1_u)}, Block());
auto* ident = Expr("ident");
- utils::Vector body{case_stmt};
+ tint::Vector body{case_stmt};
- auto* stmt = create<SwitchStatement>(ident, body, utils::Empty, utils::Empty);
+ auto* stmt = create<SwitchStatement>(ident, body, tint::Empty, tint::Empty);
EXPECT_EQ(stmt->condition, ident);
ASSERT_EQ(stmt->body.Length(), 1u);
EXPECT_EQ(stmt->body[0], case_stmt);
@@ -38,8 +38,8 @@
TEST_F(SwitchStatementTest, Creation_WithSource) {
auto* ident = Expr("ident");
- auto* stmt = create<SwitchStatement>(Source{Source::Location{20, 2}}, ident, utils::Empty,
- utils::Empty, utils::Empty);
+ auto* stmt = create<SwitchStatement>(Source{Source::Location{20, 2}}, ident, tint::Empty,
+ tint::Empty, tint::Empty);
auto src = stmt->source;
EXPECT_EQ(src.range.begin.line, 20u);
EXPECT_EQ(src.range.begin.column, 2u);
@@ -50,7 +50,7 @@
auto* attr2 = DiagnosticAttribute(builtin::DiagnosticSeverity::kOff, "bar");
auto* ident = Expr("ident");
auto* stmt =
- create<SwitchStatement>(ident, utils::Empty, utils::Vector{attr1, attr2}, utils::Empty);
+ create<SwitchStatement>(ident, tint::Empty, tint::Vector{attr1, attr2}, tint::Empty);
EXPECT_THAT(stmt->attributes, testing::ElementsAre(attr1, attr2));
}
@@ -60,40 +60,40 @@
auto* attr2 = DiagnosticAttribute(builtin::DiagnosticSeverity::kOff, "bar");
auto* ident = Expr("ident");
auto* stmt =
- create<SwitchStatement>(ident, utils::Empty, utils::Empty, utils::Vector{attr1, attr2});
+ create<SwitchStatement>(ident, tint::Empty, tint::Empty, tint::Vector{attr1, attr2});
EXPECT_THAT(stmt->body_attributes, testing::ElementsAre(attr1, attr2));
}
TEST_F(SwitchStatementTest, IsSwitch) {
- utils::Vector lit{CaseSelector(2_i)};
+ tint::Vector lit{CaseSelector(2_i)};
auto* ident = Expr("ident");
- utils::Vector body{create<CaseStatement>(lit, Block())};
+ tint::Vector body{create<CaseStatement>(lit, Block())};
- auto* stmt = create<SwitchStatement>(ident, body, utils::Empty, utils::Empty);
+ auto* stmt = create<SwitchStatement>(ident, body, tint::Empty, tint::Empty);
EXPECT_TRUE(stmt->Is<SwitchStatement>());
}
TEST_F(SwitchStatementTest, Assert_Null_Condition) {
- using CaseStatementList = utils::Vector<const CaseStatement*, 2>;
+ using CaseStatementList = tint::Vector<const CaseStatement*, 2>;
EXPECT_FATAL_FAILURE(
{
ProgramBuilder b;
CaseStatementList cases;
cases.Push(
- b.create<CaseStatement>(utils::Vector{b.CaseSelector(b.Expr(1_i))}, b.Block()));
- b.create<SwitchStatement>(nullptr, cases, utils::Empty, utils::Empty);
+ b.create<CaseStatement>(tint::Vector{b.CaseSelector(b.Expr(1_i))}, b.Block()));
+ b.create<SwitchStatement>(nullptr, cases, tint::Empty, tint::Empty);
},
"internal compiler error");
}
TEST_F(SwitchStatementTest, Assert_Null_CaseStatement) {
- using CaseStatementList = utils::Vector<const CaseStatement*, 2>;
+ using CaseStatementList = tint::Vector<const CaseStatement*, 2>;
EXPECT_FATAL_FAILURE(
{
ProgramBuilder b;
- b.create<SwitchStatement>(b.Expr(true), CaseStatementList{nullptr}, utils::Empty,
- utils::Empty);
+ b.create<SwitchStatement>(b.Expr(true), CaseStatementList{nullptr}, tint::Empty,
+ tint::Empty);
},
"internal compiler error");
}
@@ -104,14 +104,14 @@
ProgramBuilder b1;
ProgramBuilder b2;
b1.create<SwitchStatement>(b2.Expr(true),
- utils::Vector{
+ tint::Vector{
b1.create<CaseStatement>(
- utils::Vector{
+ tint::Vector{
b1.CaseSelector(b1.Expr(1_i)),
},
b1.Block()),
},
- utils::Empty, utils::Empty);
+ tint::Empty, tint::Empty);
},
"internal compiler error");
}
@@ -122,14 +122,14 @@
ProgramBuilder b1;
ProgramBuilder b2;
b1.create<SwitchStatement>(b1.Expr(true),
- utils::Vector{
+ tint::Vector{
b2.create<CaseStatement>(
- utils::Vector{
+ tint::Vector{
b2.CaseSelector(b2.Expr(1_i)),
},
b2.Block()),
},
- utils::Empty, utils::Empty);
+ tint::Empty, tint::Empty);
},
"internal compiler error");
}
diff --git a/src/tint/lang/wgsl/ast/templated_identifier.cc b/src/tint/lang/wgsl/ast/templated_identifier.cc
index 5f25b3f..8d9bf5a 100644
--- a/src/tint/lang/wgsl/ast/templated_identifier.cc
+++ b/src/tint/lang/wgsl/ast/templated_identifier.cc
@@ -26,8 +26,8 @@
NodeID nid,
const Source& src,
const Symbol& sym,
- utils::VectorRef<const Expression*> args,
- utils::VectorRef<const Attribute*> attrs)
+ VectorRef<const Expression*> args,
+ VectorRef<const Attribute*> attrs)
: Base(pid, nid, src, sym), arguments(std::move(args)), attributes(std::move(attrs)) {
TINT_ASSERT(AST, !arguments.IsEmpty()); // Should have been an Identifier if this fires.
for (auto* arg : arguments) {
diff --git a/src/tint/lang/wgsl/ast/templated_identifier.h b/src/tint/lang/wgsl/ast/templated_identifier.h
index b29cea6..34d96fe 100644
--- a/src/tint/lang/wgsl/ast/templated_identifier.h
+++ b/src/tint/lang/wgsl/ast/templated_identifier.h
@@ -26,7 +26,7 @@
namespace tint::ast {
/// A templated identifier expression
-class TemplatedIdentifier final : public utils::Castable<TemplatedIdentifier, Identifier> {
+class TemplatedIdentifier final : public Castable<TemplatedIdentifier, Identifier> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
@@ -39,8 +39,8 @@
NodeID nid,
const Source& src,
const Symbol& sym,
- utils::VectorRef<const Expression*> args,
- utils::VectorRef<const Attribute*> attrs);
+ VectorRef<const Expression*> args,
+ VectorRef<const Attribute*> attrs);
/// Destructor
~TemplatedIdentifier() override;
@@ -51,10 +51,10 @@
const TemplatedIdentifier* Clone(CloneContext* ctx) const override;
/// The templated arguments
- const utils::Vector<const Expression*, 3> arguments;
+ const tint::Vector<const Expression*, 3> arguments;
/// Attributes on the identifier
- const utils::Vector<const Attribute*, 0> attributes;
+ const tint::Vector<const Attribute*, 0> attributes;
};
} // namespace tint::ast
diff --git a/src/tint/lang/wgsl/ast/test_helper.h b/src/tint/lang/wgsl/ast/test_helper.h
index 614be4c..315b19c 100644
--- a/src/tint/lang/wgsl/ast/test_helper.h
+++ b/src/tint/lang/wgsl/ast/test_helper.h
@@ -96,7 +96,7 @@
const auto* got_arg = got->arguments[arg_idx++];
using T = std::decay_t<decltype(expected_arg)>;
- if constexpr (utils::traits::IsStringLike<T>) {
+ if constexpr (tint::traits::IsStringLike<T>) {
ASSERT_TRUE(got_arg->Is<IdentifierExpression>());
CheckIdentifier(got_arg->As<IdentifierExpression>()->identifier, expected_arg);
} else if constexpr (IsTemplatedIdentifierMatcher<T>::value) {
diff --git a/src/tint/lang/wgsl/ast/transform/add_block_attribute.cc b/src/tint/lang/wgsl/ast/transform/add_block_attribute.cc
index 39a04f6..4c8cef0 100644
--- a/src/tint/lang/wgsl/ast/transform/add_block_attribute.cc
+++ b/src/tint/lang/wgsl/ast/transform/add_block_attribute.cc
@@ -41,7 +41,7 @@
// A map from a type in the source program to a block-decorated wrapper that contains it in the
// destination program.
- utils::Hashmap<const type::Type*, const Struct*, 8> wrapper_structs;
+ Hashmap<const type::Type*, const Struct*, 8> wrapper_structs;
// Process global 'var' declarations that are buffers.
bool made_changes = false;
@@ -71,10 +71,10 @@
auto* wrapper = wrapper_structs.GetOrCreate(ty, [&] {
auto* block = b.ASTNodes().Create<BlockAttribute>(b.ID(), b.AllocateNodeID());
auto wrapper_name = global->name->symbol.Name() + "_block";
- auto* ret = b.create<Struct>(
- b.Ident(b.Symbols().New(wrapper_name)),
- utils::Vector{b.Member(kMemberName, CreateASTTypeFor(ctx, ty))},
- utils::Vector{block});
+ auto* ret =
+ b.create<Struct>(b.Ident(b.Symbols().New(wrapper_name)),
+ tint::Vector{b.Member(kMemberName, CreateASTTypeFor(ctx, ty))},
+ tint::Vector{block});
ctx.InsertBefore(src->AST().GlobalDeclarations(), global, ret);
return ret;
});
@@ -102,7 +102,7 @@
}
AddBlockAttribute::BlockAttribute::BlockAttribute(GenerationID pid, NodeID nid)
- : Base(pid, nid, utils::Empty) {}
+ : Base(pid, nid, tint::Empty) {}
AddBlockAttribute::BlockAttribute::~BlockAttribute() = default;
std::string AddBlockAttribute::BlockAttribute::InternalName() const {
return "block";
diff --git a/src/tint/lang/wgsl/ast/transform/add_block_attribute.h b/src/tint/lang/wgsl/ast/transform/add_block_attribute.h
index 13708d4..dc981ef 100644
--- a/src/tint/lang/wgsl/ast/transform/add_block_attribute.h
+++ b/src/tint/lang/wgsl/ast/transform/add_block_attribute.h
@@ -24,11 +24,11 @@
/// AddBlockAttribute is a transform that wrap the store type of a buffer into a struct if possible,
/// then adds an `@internal(block)` attribute to the wrapper struct.
-class AddBlockAttribute final : public utils::Castable<AddBlockAttribute, Transform> {
+class AddBlockAttribute final : public Castable<AddBlockAttribute, Transform> {
public:
/// BlockAttribute is an InternalAttribute that is used to decorate a
// structure that is used as a buffer in SPIR-V or GLSL.
- class BlockAttribute final : public utils::Castable<BlockAttribute, InternalAttribute> {
+ class BlockAttribute final : public Castable<BlockAttribute, InternalAttribute> {
public:
/// Constructor
/// @param generation_id the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/transform/add_empty_entry_point.cc b/src/tint/lang/wgsl/ast/transform/add_empty_entry_point.cc
index b026bf9..4231905 100644
--- a/src/tint/lang/wgsl/ast/transform/add_empty_entry_point.cc
+++ b/src/tint/lang/wgsl/ast/transform/add_empty_entry_point.cc
@@ -51,7 +51,7 @@
CloneContext ctx{&b, src, /* auto_clone_symbols */ true};
b.Func(b.Symbols().New("unused_entry_point"), {}, b.ty.void_(), {},
- utils::Vector{
+ tint::Vector{
b.Stage(PipelineStage::kCompute),
b.WorkgroupSize(1_i),
});
diff --git a/src/tint/lang/wgsl/ast/transform/add_empty_entry_point.h b/src/tint/lang/wgsl/ast/transform/add_empty_entry_point.h
index 572faba..f282d82 100644
--- a/src/tint/lang/wgsl/ast/transform/add_empty_entry_point.h
+++ b/src/tint/lang/wgsl/ast/transform/add_empty_entry_point.h
@@ -20,7 +20,7 @@
namespace tint::ast::transform {
/// Add an empty entry point to the module, if no other entry points exist.
-class AddEmptyEntryPoint final : public utils::Castable<AddEmptyEntryPoint, Transform> {
+class AddEmptyEntryPoint final : public Castable<AddEmptyEntryPoint, Transform> {
public:
/// Constructor
AddEmptyEntryPoint();
diff --git a/src/tint/lang/wgsl/ast/transform/array_length_from_uniform.cc b/src/tint/lang/wgsl/ast/transform/array_length_from_uniform.cc
index 2a88fee..53ef521 100644
--- a/src/tint/lang/wgsl/ast/transform/array_length_from_uniform.cc
+++ b/src/tint/lang/wgsl/ast/transform/array_length_from_uniform.cc
@@ -68,7 +68,7 @@
b.Diagnostics().add_error(
diag::System::Transform,
"missing transform data for " +
- std::string(utils::TypeInfo::Of<ArrayLengthFromUniform>().name));
+ std::string(tint::TypeInfo::Of<ArrayLengthFromUniform>().name));
return Program(std::move(b));
}
@@ -103,7 +103,7 @@
// We do this because UBOs require an element stride that is 16-byte
// aligned.
auto* buffer_size_struct = b.Structure(
- b.Sym(), utils::Vector{
+ b.Sym(), tint::Vector{
b.Member(kBufferSizeMemberName,
b.ty.array(b.ty.vec4(b.ty.u32()),
u32((max_buffer_size_index / 4) + 1))),
diff --git a/src/tint/lang/wgsl/ast/transform/array_length_from_uniform.h b/src/tint/lang/wgsl/ast/transform/array_length_from_uniform.h
index cc0c8bd..e4b1698 100644
--- a/src/tint/lang/wgsl/ast/transform/array_length_from_uniform.h
+++ b/src/tint/lang/wgsl/ast/transform/array_length_from_uniform.h
@@ -52,7 +52,7 @@
///
/// @note Depends on the following transforms to have been run first:
/// * SimplifyPointers
-class ArrayLengthFromUniform final : public utils::Castable<ArrayLengthFromUniform, Transform> {
+class ArrayLengthFromUniform final : public Castable<ArrayLengthFromUniform, Transform> {
public:
/// Constructor
ArrayLengthFromUniform();
@@ -60,7 +60,7 @@
~ArrayLengthFromUniform() override;
/// Configuration options for the ArrayLengthFromUniform transform.
- struct Config final : public utils::Castable<Config, Data> {
+ struct Config final : public Castable<Config, Data> {
/// Constructor
/// @param ubo_bp the binding point to use for the generated uniform buffer.
explicit Config(BindingPoint ubo_bp);
@@ -85,7 +85,7 @@
/// Information produced about what the transform did.
/// If there were no calls to the arrayLength() builtin, then no Result will
/// be emitted.
- struct Result final : public utils::Castable<Result, Data> {
+ struct Result final : public Castable<Result, Data> {
/// Constructor
/// @param used_size_indices Indices into the UBO that are statically used.
explicit Result(std::unordered_set<uint32_t> used_size_indices);
diff --git a/src/tint/lang/wgsl/ast/transform/binding_remapper.cc b/src/tint/lang/wgsl/ast/transform/binding_remapper.cc
index f96ed6c..dd9e643 100644
--- a/src/tint/lang/wgsl/ast/transform/binding_remapper.cc
+++ b/src/tint/lang/wgsl/ast/transform/binding_remapper.cc
@@ -133,7 +133,7 @@
b.Diagnostics().add_error(
diag::System::Transform,
"cannot apply access control to variable with address space " +
- std::string(utils::ToString(sem->AddressSpace())));
+ std::string(tint::ToString(sem->AddressSpace())));
return Program(std::move(b));
}
auto* ty = sem->Type()->UnwrapRef();
diff --git a/src/tint/lang/wgsl/ast/transform/binding_remapper.h b/src/tint/lang/wgsl/ast/transform/binding_remapper.h
index 17d5fe6..067ebc5 100644
--- a/src/tint/lang/wgsl/ast/transform/binding_remapper.h
+++ b/src/tint/lang/wgsl/ast/transform/binding_remapper.h
@@ -28,7 +28,7 @@
/// BindingRemapper is a transform used to remap resource binding points and
/// access controls.
-class BindingRemapper final : public utils::Castable<BindingRemapper, Transform> {
+class BindingRemapper final : public Castable<BindingRemapper, Transform> {
public:
/// BindingPoints is a map of old binding point to new binding point
using BindingPoints = std::unordered_map<BindingPoint, BindingPoint>;
@@ -38,7 +38,7 @@
/// Remappings is consumed by the BindingRemapper transform.
/// Data holds information about shader usage and constant buffer offsets.
- struct Remappings final : public utils::Castable<Remappings, Data> {
+ struct Remappings final : public Castable<Remappings, Data> {
/// Constructor
/// @param bp a map of new binding points
/// @param ac a map of new access controls
diff --git a/src/tint/lang/wgsl/ast/transform/builtin_polyfill.cc b/src/tint/lang/wgsl/ast/transform/builtin_polyfill.cc
index edb1c72..839fbf2 100644
--- a/src/tint/lang/wgsl/ast/transform/builtin_polyfill.cc
+++ b/src/tint/lang/wgsl/ast/transform/builtin_polyfill.cc
@@ -150,11 +150,11 @@
/// The source clone context
const sem::Info& sem = src->Sem();
/// Polyfill functions for binary operators.
- utils::Hashmap<BinaryOpSignature, Symbol, 8> binary_op_polyfills;
+ Hashmap<BinaryOpSignature, Symbol, 8> binary_op_polyfills;
/// Polyfill builtins.
- utils::Hashmap<const sem::Builtin*, Symbol, 8> builtin_polyfills;
+ Hashmap<const sem::Builtin*, Symbol, 8> builtin_polyfills;
/// Polyfill f32 conversion to i32 or u32 (or vectors of)
- utils::Hashmap<const type::Type*, Symbol, 2> f32_conv_polyfills;
+ Hashmap<const type::Type*, Symbol, 2> f32_conv_polyfills;
// Tracks whether the chromium_experimental_full_ptr_parameters extension has been enabled.
bool has_full_ptr_params = false;
/// True if the transform has made changes (i.e. the program needs cloning)
@@ -179,7 +179,7 @@
return b.Call(T(ty), expr);
};
- utils::Vector<const Statement*, 4> body;
+ tint::Vector<const Statement*, 4> body;
switch (cfg.builtins.acosh) {
case Level::kFull:
// return log(x + sqrt(x*x - 1));
@@ -198,7 +198,7 @@
return {};
}
- b.Func(name, utils::Vector{b.Param("x", T(ty))}, T(ty), body);
+ b.Func(name, tint::Vector{b.Param("x", T(ty))}, T(ty), body);
return name;
}
@@ -210,8 +210,8 @@
auto name = b.Symbols().New("tint_sinh");
// return log(x + sqrt(x*x + 1));
- b.Func(name, utils::Vector{b.Param("x", T(ty))}, T(ty),
- utils::Vector{
+ b.Func(name, tint::Vector{b.Param("x", T(ty))}, T(ty),
+ tint::Vector{
b.Return(b.Call("log", b.Add("x", b.Call("sqrt", b.Add(b.Mul("x", "x"), 1_a))))),
});
@@ -233,7 +233,7 @@
return b.Call(T(ty), expr);
};
- utils::Vector<const Statement*, 1> body;
+ tint::Vector<const Statement*, 1> body;
switch (cfg.builtins.atanh) {
case Level::kFull:
// return log((1+x) / (1-x)) * 0.5
@@ -251,7 +251,7 @@
return {};
}
- b.Func(name, utils::Vector{b.Param("x", T(ty))}, T(ty), body);
+ b.Func(name, tint::Vector{b.Param("x", T(ty))}, T(ty), body);
return name;
}
@@ -264,13 +264,13 @@
auto name = b.Symbols().New("tint_clamp");
b.Func(name,
- utils::Vector{
+ tint::Vector{
b.Param("e", T(ty)),
b.Param("low", T(ty)),
b.Param("high", T(ty)),
},
T(ty),
- utils::Vector{
+ tint::Vector{
// return min(max(e, low), high);
b.Return(b.Call("min", b.Call("max", "e", "low"), "high")),
});
@@ -296,11 +296,11 @@
};
b.Func(
name,
- utils::Vector{
+ tint::Vector{
b.Param("v", T(ty)),
},
T(ty),
- utils::Vector{
+ tint::Vector{
// var x = U(v);
b.Decl(b.Var("x", b.Call(U(), b.Expr("v")))),
// let b16 = select(0, 16, x <= 0x0000ffff);
@@ -360,11 +360,11 @@
};
b.Func(
name,
- utils::Vector{
+ tint::Vector{
b.Param("v", T(ty)),
},
T(ty),
- utils::Vector{
+ tint::Vector{
// var x = U(v);
b.Decl(b.Var("x", b.Call(U(), b.Expr("v")))),
// let b16 = select(16, 0, bool(x & 0x0000ffff));
@@ -410,7 +410,7 @@
return b.Call(b.ty.vec<u32>(width), value);
};
- utils::Vector<const Statement*, 8> body{
+ tint::Vector<const Statement*, 8> body{
b.Decl(b.Let("s", b.Call("min", "offset", u32(W)))),
b.Decl(b.Let("e", b.Call("min", u32(W), b.Add("s", "count")))),
};
@@ -442,7 +442,7 @@
}
b.Func(name,
- utils::Vector{
+ tint::Vector{
b.Param("v", T(ty)),
b.Param("offset", b.ty.u32()),
b.Param("count", b.ty.u32()),
@@ -489,11 +489,11 @@
b.Func(
name,
- utils::Vector{
+ tint::Vector{
b.Param("v", T(ty)),
},
T(ty),
- utils::Vector{
+ tint::Vector{
// var x = v; (unsigned)
// var x = select(U(v), ~U(v), v < 0); (signed)
b.Decl(b.Var("x", x)),
@@ -549,11 +549,11 @@
};
b.Func(
name,
- utils::Vector{
+ tint::Vector{
b.Param("v", T(ty)),
},
T(ty),
- utils::Vector{
+ tint::Vector{
// var x = U(v);
b.Decl(b.Var("x", b.Call(U(), b.Expr("v")))),
// let b16 = select(16, 0, bool(x & 0x0000ffff));
@@ -639,7 +639,7 @@
// return ((select(T(), n << offset, offset < 32u) & mask) | (v & ~(mask)));
// }
- utils::Vector<const Statement*, 8> body;
+ tint::Vector<const Statement*, 8> body;
switch (cfg.builtins.insert_bits) {
case Level::kFull:
@@ -680,7 +680,7 @@
}
b.Func(name,
- utils::Vector{
+ tint::Vector{
b.Param("v", T(ty)),
b.Param("n", T(ty)),
b.Param("offset", b.ty.u32()),
@@ -704,12 +704,12 @@
// }
// Using -2.0 instead of 2.0 in factor to prevent the optimization that cause wrong result.
// See https://crbug.com/tint/1798 for more details.
- auto body = utils::Vector{
+ auto body = tint::Vector{
b.Decl(b.Let("factor", b.Mul(-2.0_a, b.Call("dot", "e1", "e2")))),
b.Return(b.Add("e1", b.Mul("factor", "e2"))),
};
b.Func(name,
- utils::Vector{
+ tint::Vector{
b.Param("e1", T(ty)),
b.Param("e2", T(ty)),
},
@@ -723,11 +723,11 @@
/// @return the polyfill function name
Symbol saturate(const type::Type* ty) {
auto name = b.Symbols().New("tint_saturate");
- auto body = utils::Vector{
+ auto body = tint::Vector{
b.Return(b.Call("clamp", "v", b.Call(T(ty), 0_a), b.Call(T(ty), 1_a))),
};
b.Func(name,
- utils::Vector{
+ tint::Vector{
b.Param("v", T(ty)),
},
T(ty), body);
@@ -750,11 +750,11 @@
auto name = b.Symbols().New("tint_sign");
b.Func(name,
- utils::Vector{
+ tint::Vector{
b.Param("v", T(ty)),
},
T(ty),
- utils::Vector{
+ tint::Vector{
b.Return(b.Call("select", pos_or_neg_one, zero(), b.Equal("v", zero()))),
});
@@ -766,7 +766,7 @@
/// @return the polyfill function name
Symbol textureSampleBaseClampToEdge_2d_f32() {
auto name = b.Symbols().New("tint_textureSampleBaseClampToEdge");
- auto body = utils::Vector{
+ auto body = tint::Vector{
b.Decl(b.Let("dims", b.Call(b.ty.vec2<f32>(), b.Call("textureDimensions", "t", 0_a)))),
b.Decl(b.Let("half_texel", b.Div(b.Call<vec2<f32>>(0.5_a), "dims"))),
b.Decl(
@@ -774,7 +774,7 @@
b.Return(b.Call("textureSampleLevel", "t", "s", "clamped", 0_a)),
};
b.Func(name,
- utils::Vector{
+ tint::Vector{
b.Param("t", b.ty.sampled_texture(type::TextureDimension::k2d, b.ty.f32())),
b.Param("s", b.ty.sampler(type::SamplerKind::kSampler)),
b.Param("coord", b.ty.vec2<f32>()),
@@ -789,16 +789,16 @@
/// @return the polyfill function name
Symbol quantizeToF16(const type::Vector* vec) {
auto name = b.Symbols().New("tint_quantizeToF16");
- utils::Vector<const Expression*, 4> args;
+ tint::Vector<const Expression*, 4> args;
for (uint32_t i = 0; i < vec->Width(); i++) {
args.Push(b.Call("quantizeToF16", b.IndexAccessor("v", u32(i))));
}
b.Func(name,
- utils::Vector{
+ tint::Vector{
b.Param("v", T(vec)),
},
T(vec),
- utils::Vector{
+ tint::Vector{
b.Return(b.Call(T(vec), std::move(args))),
});
return name;
@@ -814,11 +814,11 @@
}
auto name = b.Symbols().New("tint_workgroupUniformLoad");
b.Func(name,
- utils::Vector{
+ tint::Vector{
b.Param("p", b.ty.ptr<workgroup>(T(type))),
},
T(type),
- utils::Vector{
+ tint::Vector{
b.CallStmt(b.Call("workgroupBarrier")),
b.Decl(b.Let("result", b.Deref("p"))),
b.CallStmt(b.Call("workgroupBarrier")),
@@ -868,8 +868,8 @@
b.LessThan("v", ScalarOrVector(width, limits.high_condition)));
auto name = b.Symbols().New(is_signed ? "tint_ftoi" : "tint_ftou");
- b.Func(name, utils::Vector{b.Param("v", T(source))}, T(target),
- utils::Vector{b.Return(select_high)});
+ b.Func(name, tint::Vector{b.Param("v", T(source))}, T(target),
+ tint::Vector{b.Return(select_high)});
return name;
}
@@ -913,7 +913,7 @@
const char* lhs = "lhs";
const char* rhs = "rhs";
- utils::Vector<const Statement*, 4> body;
+ tint::Vector<const Statement*, 4> body;
if (lhs_width < width) {
// lhs is scalar, rhs is vector. Convert lhs to vector.
@@ -974,7 +974,7 @@
}
b.Func(name,
- utils::Vector{
+ tint::Vector{
b.Param("lhs", T(lhs_ty)),
b.Param("rhs", T(rhs_ty)),
},
@@ -1004,7 +1004,7 @@
const char* lhs = "lhs";
const char* rhs = "rhs";
- utils::Vector<const Statement*, 4> body;
+ tint::Vector<const Statement*, 4> body;
if (lhs_width < width) {
// lhs is scalar, rhs is vector. Convert lhs to vector.
@@ -1024,7 +1024,7 @@
body.Push(b.Return(precise_mod));
b.Func(name,
- utils::Vector{
+ tint::Vector{
b.Param("lhs", T(lhs_ty)),
b.Param("rhs", T(rhs_ty)),
},
@@ -1204,7 +1204,7 @@
size_t value_idx = static_cast<size_t>(
sig.IndexOf(sem::ParameterUsage::kValue));
ctx.Replace(expr, [this, expr, value_idx] {
- utils::Vector<const Expression*, 3> args;
+ tint::Vector<const Expression*, 3> args;
for (auto* arg : expr->args) {
arg = ctx.Clone(arg);
if (args.Length() == value_idx) { // value
@@ -1213,7 +1213,7 @@
args.Push(arg);
}
return ctx.dst->Call(
- utils::ToString(builtin::Function::kTextureStore),
+ tint::ToString(builtin::Function::kTextureStore),
std::move(args));
});
made_changes = true;
@@ -1248,8 +1248,7 @@
auto* src_ty = conv->Source();
if (tint::Is<type::F32>(src_ty->Elements(src_ty).type)) {
auto* dst_ty = conv->Target();
- if (tint::utils::IsAnyOf<type::I32, type::U32>(
- dst_ty->Elements(dst_ty).type)) {
+ if (tint::IsAnyOf<type::I32, type::U32>(dst_ty->Elements(dst_ty).type)) {
return f32_conv_polyfills.GetOrCreate(dst_ty, [&] { //
return ConvF32ToIU32(src_ty, dst_ty);
});
diff --git a/src/tint/lang/wgsl/ast/transform/builtin_polyfill.h b/src/tint/lang/wgsl/ast/transform/builtin_polyfill.h
index 0bdf89f..8805996 100644
--- a/src/tint/lang/wgsl/ast/transform/builtin_polyfill.h
+++ b/src/tint/lang/wgsl/ast/transform/builtin_polyfill.h
@@ -20,7 +20,7 @@
namespace tint::ast::transform {
/// Implements builtins for backends that do not have a native implementation.
-class BuiltinPolyfill final : public utils::Castable<BuiltinPolyfill, Transform> {
+class BuiltinPolyfill final : public Castable<BuiltinPolyfill, Transform> {
public:
/// Constructor
BuiltinPolyfill();
@@ -89,7 +89,7 @@
/// Config is consumed by the BuiltinPolyfill transform.
/// Config specifies the builtins that should be polyfilled.
- struct Config final : public utils::Castable<Config, Data> {
+ struct Config final : public Castable<Config, Data> {
/// Constructor
/// @param b the list of builtins to polyfill
explicit Config(const Builtins& b);
diff --git a/src/tint/lang/wgsl/ast/transform/calculate_array_length.cc b/src/tint/lang/wgsl/ast/transform/calculate_array_length.cc
index e3e3e65..01abe0d 100644
--- a/src/tint/lang/wgsl/ast/transform/calculate_array_length.cc
+++ b/src/tint/lang/wgsl/ast/transform/calculate_array_length.cc
@@ -63,16 +63,14 @@
return block == rhs.block && buffer == rhs.buffer;
}
struct Hasher {
- inline std::size_t operator()(const ArrayUsage& u) const {
- return utils::Hash(u.block, u.buffer);
- }
+ inline std::size_t operator()(const ArrayUsage& u) const { return Hash(u.block, u.buffer); }
};
};
} // namespace
CalculateArrayLength::BufferSizeIntrinsic::BufferSizeIntrinsic(GenerationID pid, NodeID nid)
- : Base(pid, nid, utils::Empty) {}
+ : Base(pid, nid, tint::Empty) {}
CalculateArrayLength::BufferSizeIntrinsic::~BufferSizeIntrinsic() = default;
std::string CalculateArrayLength::BufferSizeIntrinsic::InternalName() const {
return "intrinsic_buffer_size";
@@ -103,19 +101,19 @@
// [RW]ByteAddressBuffer.GetDimensions().
std::unordered_map<const type::Reference*, Symbol> buffer_size_intrinsics;
auto get_buffer_size_intrinsic = [&](const type::Reference* buffer_type) {
- return utils::GetOrCreate(buffer_size_intrinsics, buffer_type, [&] {
+ return tint::GetOrCreate(buffer_size_intrinsics, buffer_type, [&] {
auto name = b.Sym();
auto type = CreateASTTypeFor(ctx, buffer_type);
auto* disable_validation = b.Disable(DisabledValidation::kFunctionParameter);
b.Func(name,
- utils::Vector{
+ tint::Vector{
b.Param("buffer",
b.ty.ptr(buffer_type->AddressSpace(), type, buffer_type->Access()),
- utils::Vector{disable_validation}),
+ tint::Vector{disable_validation}),
b.Param("result", b.ty.ptr<function, u32>()),
},
b.ty.void_(), nullptr,
- utils::Vector{
+ tint::Vector{
b.ASTNodes().Create<BufferSizeIntrinsic>(b.ID(), b.AllocateNodeID()),
});
@@ -176,7 +174,7 @@
auto* block = call->Stmt()->Block()->Declaration();
auto array_length =
- utils::GetOrCreate(array_length_by_usage, {block, storage_buffer_var}, [&] {
+ tint::GetOrCreate(array_length_by_usage, {block, storage_buffer_var}, [&] {
// First time this array length is used for this block.
// Let's calculate it.
diff --git a/src/tint/lang/wgsl/ast/transform/calculate_array_length.h b/src/tint/lang/wgsl/ast/transform/calculate_array_length.h
index 3e4819b..d9af32d 100644
--- a/src/tint/lang/wgsl/ast/transform/calculate_array_length.h
+++ b/src/tint/lang/wgsl/ast/transform/calculate_array_length.h
@@ -32,12 +32,11 @@
///
/// @note Depends on the following transforms to have been run first:
/// * SimplifyPointers
-class CalculateArrayLength final : public utils::Castable<CalculateArrayLength, Transform> {
+class CalculateArrayLength final : public Castable<CalculateArrayLength, Transform> {
public:
/// BufferSizeIntrinsic is an InternalAttribute that's applied to intrinsic
/// functions used to obtain the runtime size of a storage buffer.
- class BufferSizeIntrinsic final
- : public utils::Castable<BufferSizeIntrinsic, InternalAttribute> {
+ class BufferSizeIntrinsic final : public Castable<BufferSizeIntrinsic, InternalAttribute> {
public:
/// Constructor
/// @param generation_id the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/transform/canonicalize_entry_point_io.cc b/src/tint/lang/wgsl/ast/transform/canonicalize_entry_point_io.cc
index 7683b11..f7dd53f 100644
--- a/src/tint/lang/wgsl/ast/transform/canonicalize_entry_point_io.cc
+++ b/src/tint/lang/wgsl/ast/transform/canonicalize_entry_point_io.cc
@@ -101,7 +101,7 @@
/// The type of the output value.
Type type;
/// The shader IO attributes.
- utils::Vector<const Attribute*, 8> attributes;
+ tint::Vector<const Attribute*, 8> attributes;
/// The value itself.
const Expression* value;
/// The output location.
@@ -120,24 +120,24 @@
const sem::Function* func_sem;
/// The new entry point wrapper function's parameters.
- utils::Vector<const Parameter*, 8> wrapper_ep_parameters;
+ tint::Vector<const Parameter*, 8> wrapper_ep_parameters;
/// The members of the wrapper function's struct parameter.
- utils::Vector<MemberInfo, 8> wrapper_struct_param_members;
+ tint::Vector<MemberInfo, 8> wrapper_struct_param_members;
/// The name of the wrapper function's struct parameter.
Symbol wrapper_struct_param_name;
/// The parameters that will be passed to the original function.
- utils::Vector<const Expression*, 8> inner_call_parameters;
+ tint::Vector<const Expression*, 8> inner_call_parameters;
/// The members of the wrapper function's struct return type.
- utils::Vector<MemberInfo, 8> wrapper_struct_output_members;
+ tint::Vector<MemberInfo, 8> wrapper_struct_output_members;
/// The wrapper function output values.
- utils::Vector<OutputValue, 8> wrapper_output_values;
+ tint::Vector<OutputValue, 8> wrapper_output_values;
/// The body of the wrapper function.
- utils::Vector<const Statement*, 8> wrapper_body;
+ tint::Vector<const Statement*, 8> wrapper_body;
/// Input names used by the entrypoint
std::unordered_set<std::string> input_names;
/// A map of cloned attribute to builtin value
- utils::Hashmap<const BuiltinAttribute*, builtin::BuiltinValue, 16> builtin_attrs;
+ Hashmap<const BuiltinAttribute*, builtin::BuiltinValue, 16> builtin_attrs;
/// Constructor
/// @param context the clone context
@@ -153,7 +153,7 @@
/// @param in the attribute to clone
/// @param out the output Attributes
template <size_t N>
- void CloneAttribute(const Attribute* in, utils::Vector<const Attribute*, N>& out) {
+ void CloneAttribute(const Attribute* in, tint::Vector<const Attribute*, N>& out) {
auto* cloned = ctx.Clone(in);
out.Push(cloned);
if (auto* builtin = in->As<BuiltinAttribute>()) {
@@ -166,8 +166,8 @@
/// @param do_interpolate whether to clone InterpolateAttribute
/// @return the cloned attributes
template <size_t N>
- auto CloneShaderIOAttributes(const utils::Vector<const Attribute*, N> in, bool do_interpolate) {
- utils::Vector<const Attribute*, N> out;
+ auto CloneShaderIOAttributes(const tint::Vector<const Attribute*, N> in, bool do_interpolate) {
+ tint::Vector<const Attribute*, N> out;
for (auto* attr : in) {
if (IsShaderIOAttribute(attr) &&
(do_interpolate || !attr->template Is<InterpolateAttribute>())) {
@@ -199,7 +199,7 @@
/// @param attrs the input attribute list
/// @returns the builtin value if any of the attributes in @p attrs is a builtin attribute,
/// otherwise builtin::BuiltinValue::kUndefined
- builtin::BuiltinValue BuiltinOf(utils::VectorRef<const Attribute*> attrs) {
+ builtin::BuiltinValue BuiltinOf(VectorRef<const Attribute*> attrs) {
if (auto* builtin = GetAttribute<BuiltinAttribute>(attrs)) {
return BuiltinOf(builtin);
}
@@ -224,7 +224,7 @@
const Expression* AddInput(std::string name,
const type::Type* type,
std::optional<uint32_t> location,
- utils::Vector<const Attribute*, 8> attrs) {
+ tint::Vector<const Attribute*, 8> attrs) {
auto ast_type = CreateASTTypeFor(ctx, type);
auto builtin_attr = BuiltinOf(attrs);
@@ -299,7 +299,7 @@
const type::Type* type,
std::optional<uint32_t> location,
std::optional<uint32_t> index,
- utils::Vector<const Attribute*, 8> attrs,
+ tint::Vector<const Attribute*, 8> attrs,
const Expression* value) {
auto builtin_attr = BuiltinOf(attrs);
// Vulkan requires that integer user-defined vertex outputs are always decorated with
@@ -344,7 +344,7 @@
bool do_interpolate = func_ast->PipelineStage() != PipelineStage::kVertex;
// Remove the shader IO attributes from the inner function parameter, and attach them to the
// new object instead.
- utils::Vector<const Attribute*, 8> attributes;
+ tint::Vector<const Attribute*, 8> attributes;
for (auto* attr : param->Declaration()->attributes) {
if (IsShaderIOAttribute(attr)) {
ctx.Remove(param->Declaration()->attributes, attr);
@@ -372,7 +372,7 @@
// Recreate struct members in the outer entry point and build an initializer
// list to pass them through to the inner function.
- utils::Vector<const Expression*, 8> inner_struct_values;
+ tint::Vector<const Expression*, 8> inner_struct_values;
for (auto* member : str->Members()) {
if (TINT_UNLIKELY(member->Type()->Is<type::Struct>())) {
TINT_ICE(Transform, ctx.dst->Diagnostics()) << "nested IO struct";
@@ -502,7 +502,7 @@
std::sort(wrapper_struct_param_members.begin(), wrapper_struct_param_members.end(),
[&](auto& a, auto& b) { return StructMemberComparator(a, b); });
- utils::Vector<const StructMember*, 8> members;
+ tint::Vector<const StructMember*, 8> members;
for (auto& mem : wrapper_struct_param_members) {
members.Push(mem.member);
}
@@ -510,7 +510,7 @@
// Create the new struct type.
auto struct_name = ctx.dst->Sym();
auto* in_struct =
- ctx.dst->create<Struct>(ctx.dst->Ident(struct_name), std::move(members), utils::Empty);
+ ctx.dst->create<Struct>(ctx.dst->Ident(struct_name), std::move(members), tint::Empty);
ctx.InsertBefore(ctx.src->AST().GlobalDeclarations(), func_ast, in_struct);
// Create a new function parameter using this struct type.
@@ -521,7 +521,7 @@
/// Create and return the wrapper function's struct result object.
/// @returns the struct type
Struct* CreateOutputStruct() {
- utils::Vector<const Statement*, 8> assignments;
+ tint::Vector<const Statement*, 8> assignments;
auto wrapper_result = ctx.dst->Symbols().New("wrapper_result");
@@ -548,14 +548,14 @@
std::sort(wrapper_struct_output_members.begin(), wrapper_struct_output_members.end(),
[&](auto& a, auto& b) { return StructMemberComparator(a, b); });
- utils::Vector<const StructMember*, 8> members;
+ tint::Vector<const StructMember*, 8> members;
for (auto& mem : wrapper_struct_output_members) {
members.Push(mem.member);
}
// Create the new struct type.
auto* out_struct = ctx.dst->create<Struct>(ctx.dst->Ident(ctx.dst->Sym()),
- std::move(members), utils::Empty);
+ std::move(members), tint::Empty);
ctx.InsertBefore(ctx.src->AST().GlobalDeclarations(), func_ast, out_struct);
// Create the output struct object, assign its members, and return it.
@@ -609,10 +609,9 @@
// Clone everything, dropping the function and return type attributes.
// The parameter attributes will have already been stripped during
// processing.
- auto* inner_function =
- ctx.dst->create<Function>(ctx.dst->Ident(inner_name), ctx.Clone(func_ast->params),
- ctx.Clone(func_ast->return_type), ctx.Clone(func_ast->body),
- utils::Empty, utils::Empty);
+ auto* inner_function = ctx.dst->create<Function>(
+ ctx.dst->Ident(inner_name), ctx.Clone(func_ast->params),
+ ctx.Clone(func_ast->return_type), ctx.Clone(func_ast->body), tint::Empty, tint::Empty);
ctx.Replace(func_ast, inner_function);
// Call the function.
@@ -719,7 +718,7 @@
auto* wrapper_func = ctx.dst->create<Function>(
ctx.dst->Ident(name), wrapper_ep_parameters, ctx.dst->ty(wrapper_ret_type()),
- ctx.dst->Block(wrapper_body), ctx.Clone(func_ast->attributes), utils::Empty);
+ ctx.dst->Block(wrapper_body), ctx.Clone(func_ast->attributes), tint::Empty);
ctx.InsertAfter(ctx.src->AST().GlobalDeclarations(), func_ast, wrapper_func);
}
diff --git a/src/tint/lang/wgsl/ast/transform/canonicalize_entry_point_io.h b/src/tint/lang/wgsl/ast/transform/canonicalize_entry_point_io.h
index 02d4acf..d543de0 100644
--- a/src/tint/lang/wgsl/ast/transform/canonicalize_entry_point_io.h
+++ b/src/tint/lang/wgsl/ast/transform/canonicalize_entry_point_io.h
@@ -82,7 +82,7 @@
///
/// @note Depends on the following transforms to have been run first:
/// * Unshadow
-class CanonicalizeEntryPointIO final : public utils::Castable<CanonicalizeEntryPointIO, Transform> {
+class CanonicalizeEntryPointIO final : public Castable<CanonicalizeEntryPointIO, Transform> {
public:
/// ShaderStyle is an enumerator of different ways to emit shader IO.
enum class ShaderStyle {
@@ -97,7 +97,7 @@
};
/// Configuration options for the transform.
- struct Config final : public utils::Castable<Config, Data> {
+ struct Config final : public Castable<Config, Data> {
/// Constructor
/// @param style the approach to use for emitting shader IO.
/// @param sample_mask an optional sample mask to combine with shader masks
diff --git a/src/tint/lang/wgsl/ast/transform/clamp_frag_depth.cc b/src/tint/lang/wgsl/ast/transform/clamp_frag_depth.cc
index 731f881..9374f71 100644
--- a/src/tint/lang/wgsl/ast/transform/clamp_frag_depth.cc
+++ b/src/tint/lang/wgsl/ast/transform/clamp_frag_depth.cc
@@ -82,15 +82,15 @@
b.Enable(builtin::Extension::kChromiumExperimentalPushConstant);
b.Structure(b.Symbols().New("FragDepthClampArgs"),
- utils::Vector{b.Member("min", b.ty.f32()), b.Member("max", b.ty.f32())});
+ tint::Vector{b.Member("min", b.ty.f32()), b.Member("max", b.ty.f32())});
auto args_sym = b.Symbols().New("frag_depth_clamp_args");
b.GlobalVar(args_sym, b.ty("FragDepthClampArgs"), builtin::AddressSpace::kPushConstant);
auto base_fn_sym = b.Symbols().New("clamp_frag_depth");
- b.Func(base_fn_sym, utils::Vector{b.Param("v", b.ty.f32())}, b.ty.f32(),
- utils::Vector{b.Return(b.Call("clamp", "v", b.MemberAccessor(args_sym, "min"),
- b.MemberAccessor(args_sym, "max")))});
+ b.Func(base_fn_sym, tint::Vector{b.Param("v", b.ty.f32())}, b.ty.f32(),
+ tint::Vector{b.Return(b.Call("clamp", "v", b.MemberAccessor(args_sym, "min"),
+ b.MemberAccessor(args_sym, "max")))});
// If true, the currently cloned function returns frag depth directly as a scalar
bool returns_frag_depth_as_value = false;
@@ -101,7 +101,7 @@
// Map of io struct to helper function to return the structure with the depth clamping
// applied.
- utils::Hashmap<const Struct*, Symbol, 4u> io_structs_clamp_helpers;
+ Hashmap<const Struct*, Symbol, 4u> io_structs_clamp_helpers;
// Register a callback that will be called for each visted AST function.
// This call wraps the cloning of the function's statements, and will assign to
@@ -129,7 +129,7 @@
auto fn_sym =
b.Symbols().New("clamp_frag_depth_" + struct_ty->name->symbol.Name());
- utils::Vector<const Expression*, 8u> initializer_args;
+ tint::Vector<const Expression*, 8u> initializer_args;
for (auto* member : struct_ty->members) {
const Expression* arg =
b.MemberAccessor("s", ctx.Clone(member->name->symbol));
@@ -138,8 +138,8 @@
}
initializer_args.Push(arg);
}
- utils::Vector params{b.Param("s", ctx.Clone(return_ty))};
- utils::Vector body{
+ tint::Vector params{b.Param("s", ctx.Clone(return_ty))};
+ tint::Vector body{
b.Return(b.Call(ctx.Clone(return_ty), std::move(initializer_args))),
};
b.Func(fn_sym, params, ctx.Clone(return_ty), body);
@@ -183,7 +183,7 @@
}
/// @param attrs the attributes to examine
/// @returns true if @p attrs contains a `@builtin(frag_depth)` attribute
- bool ContainsFragDepth(utils::VectorRef<const Attribute*> attrs) {
+ bool ContainsFragDepth(VectorRef<const Attribute*> attrs) {
for (auto* attribute : attrs) {
if (auto* builtin_attr = attribute->As<BuiltinAttribute>()) {
auto builtin = sem.Get(builtin_attr)->Value();
diff --git a/src/tint/lang/wgsl/ast/transform/clamp_frag_depth.h b/src/tint/lang/wgsl/ast/transform/clamp_frag_depth.h
index 0338dbd..710c72b 100644
--- a/src/tint/lang/wgsl/ast/transform/clamp_frag_depth.h
+++ b/src/tint/lang/wgsl/ast/transform/clamp_frag_depth.h
@@ -54,7 +54,7 @@
/// return clamp_frag_depth(0.0);
/// }
/// ```
-class ClampFragDepth final : public utils::Castable<ClampFragDepth, Transform> {
+class ClampFragDepth final : public Castable<ClampFragDepth, Transform> {
public:
/// Constructor
ClampFragDepth();
diff --git a/src/tint/lang/wgsl/ast/transform/combine_samplers.cc b/src/tint/lang/wgsl/ast/transform/combine_samplers.cc
index 0c3cab0..f4b9fa3 100644
--- a/src/tint/lang/wgsl/ast/transform/combine_samplers.cc
+++ b/src/tint/lang/wgsl/ast/transform/combine_samplers.cc
@@ -81,7 +81,7 @@
/// Group 0 and binding 0 are used, with collisions disabled.
/// @returns the newly-created attribute list
auto Attributes() const {
- utils::Vector<const Attribute*, 3> attributes{ctx.dst->Group(0_a), ctx.dst->Binding(0_a)};
+ tint::Vector<const Attribute*, 3> attributes{ctx.dst->Group(0_a), ctx.dst->Binding(0_a)};
attributes.Push(ctx.dst->Disable(DisabledValidation::kBindingPointCollision));
return attributes;
}
@@ -153,7 +153,7 @@
for (auto* global : ctx.src->AST().GlobalVariables()) {
auto* global_sem = sem.Get(global)->As<sem::GlobalVariable>();
auto* type = ctx.src->TypeOf(global->type);
- if (tint::utils::IsAnyOf<type::Texture, type::Sampler>(type) &&
+ if (tint::IsAnyOf<type::Texture, type::Sampler>(type) &&
!type->Is<type::StorageTexture>()) {
ctx.Remove(ctx.src->AST().GlobalDeclarations(), global);
} else if (auto binding_point = global_sem->BindingPoint()) {
@@ -172,7 +172,7 @@
if (pairs.IsEmpty()) {
return nullptr;
}
- utils::Vector<const Parameter*, 8> params;
+ tint::Vector<const Parameter*, 8> params;
for (auto pair : fn->TextureSamplerPairs()) {
const sem::Variable* texture_var = pair.first;
const sem::Variable* sampler_var = pair.second;
@@ -183,7 +183,7 @@
if (IsGlobal(pair)) {
// Both texture and sampler are global; add a new global variable
// to represent the combined sampler (if not already created).
- utils::GetOrCreate(global_combined_texture_samplers_, pair, [&] {
+ tint::GetOrCreate(global_combined_texture_samplers_, pair, [&] {
return CreateCombinedGlobal(texture_var, sampler_var, name);
});
} else {
@@ -221,7 +221,7 @@
// the combined global samplers, as appropriate.
ctx.ReplaceAll([&](const CallExpression* expr) -> const Expression* {
if (auto* call = sem.Get(expr)->UnwrapMaterialize()->As<sem::Call>()) {
- utils::Vector<const Expression*, 8> args;
+ tint::Vector<const Expression*, 8> args;
// Replace all texture builtin calls.
if (auto* builtin = call->Target()->As<sem::Builtin>()) {
const auto& signature = builtin->Signature();
diff --git a/src/tint/lang/wgsl/ast/transform/combine_samplers.h b/src/tint/lang/wgsl/ast/transform/combine_samplers.h
index 43437b8..67fbcb5 100644
--- a/src/tint/lang/wgsl/ast/transform/combine_samplers.h
+++ b/src/tint/lang/wgsl/ast/transform/combine_samplers.h
@@ -52,7 +52,7 @@
/// information needed to represent a combined sampler in GLSL
/// (dimensionality, component type, etc). The GLSL writer outputs such
/// (Tint) Textures as (GLSL) Samplers.
-class CombineSamplers final : public utils::Castable<CombineSamplers, Transform> {
+class CombineSamplers final : public Castable<CombineSamplers, Transform> {
public:
/// A pair of binding points.
using SamplerTexturePair = sem::SamplerTexturePair;
@@ -62,7 +62,7 @@
/// The client-provided mapping from separate texture and sampler binding
/// points to combined sampler binding point.
- struct BindingInfo final : public utils::Castable<BindingInfo, Data> {
+ struct BindingInfo final : public Castable<BindingInfo, Data> {
/// Constructor
/// @param map the map of all (texture, sampler) -> (combined) pairs
/// @param placeholder the binding point to use for placeholder samplers.
diff --git a/src/tint/lang/wgsl/ast/transform/data.h b/src/tint/lang/wgsl/ast/transform/data.h
index 3031893..3fe0398 100644
--- a/src/tint/lang/wgsl/ast/transform/data.h
+++ b/src/tint/lang/wgsl/ast/transform/data.h
@@ -24,7 +24,7 @@
namespace tint::ast::transform {
/// Data is the base class for transforms that accept extra input or emit extra output information.
-class Data : public utils::Castable<Data> {
+class Data : public Castable<Data> {
public:
/// Constructor
Data();
@@ -70,7 +70,7 @@
template <typename T>
void Put(std::unique_ptr<T>&& data) {
static_assert(std::is_base_of<Data, T>::value, "T does not derive from Data");
- map_[&utils::TypeInfo::Of<T>()] = std::move(data);
+ map_[&tint::TypeInfo::Of<T>()] = std::move(data);
}
/// Creates the data of type `T` with the provided arguments and adds it into DataMap keyed by
@@ -90,7 +90,7 @@
/// @returns a pointer to the Data placed into the DataMap with a call to Put()
template <typename T>
T* Get() {
- auto it = map_.find(&utils::TypeInfo::Of<T>());
+ auto it = map_.find(&tint::TypeInfo::Of<T>());
if (it == map_.end()) {
return nullptr;
}
@@ -118,7 +118,7 @@
PutAll(std::forward<Tn>(remainder)...);
}
- std::unordered_map<const utils::TypeInfo*, std::unique_ptr<Data>> map_;
+ std::unordered_map<const tint::TypeInfo*, std::unique_ptr<Data>> map_;
};
} // namespace tint::ast::transform
diff --git a/src/tint/lang/wgsl/ast/transform/decompose_memory_access.cc b/src/tint/lang/wgsl/ast/transform/decompose_memory_access.cc
index 2f8ff1b..f74656f 100644
--- a/src/tint/lang/wgsl/ast/transform/decompose_memory_access.cc
+++ b/src/tint/lang/wgsl/ast/transform/decompose_memory_access.cc
@@ -62,7 +62,7 @@
/// Offset is a simple Expression builder interface, used to build byte
/// offsets for storage and uniform buffer accesses.
-struct Offset : utils::Castable<Offset> {
+struct Offset : Castable<Offset> {
/// @returns builds and returns the Expression in `ctx.dst`
virtual const Expression* Build(CloneContext& ctx) const = 0;
};
@@ -86,7 +86,7 @@
/// OffsetLiteral is an implementation of Offset that constructs a u32 literal
/// value.
-struct OffsetLiteral final : utils::Castable<OffsetLiteral, Offset> {
+struct OffsetLiteral final : Castable<OffsetLiteral, Offset> {
uint32_t const literal = 0;
explicit OffsetLiteral(uint32_t lit) : literal(lit) {}
@@ -117,7 +117,7 @@
}
struct Hasher {
inline std::size_t operator()(const LoadStoreKey& u) const {
- return utils::Hash(u.el_ty, u.buffer);
+ return Hash(u.el_ty, u.buffer);
}
};
};
@@ -132,7 +132,7 @@
}
struct Hasher {
inline std::size_t operator()(const AtomicKey& u) const {
- return utils::Hash(u.el_ty, u.op, u.buffer);
+ return Hash(u.el_ty, u.op, u.buffer);
}
};
};
@@ -342,7 +342,7 @@
/// List of storage or uniform buffer writes
std::vector<Store> stores;
/// Allocations for offsets
- utils::BlockAllocator<Offset> offsets_;
+ BlockAllocator<Offset> offsets_;
/// Constructor
/// @param context the CloneContext
@@ -465,15 +465,15 @@
Symbol LoadFunc(const type::Type* el_ty,
builtin::AddressSpace address_space,
const Symbol& buffer) {
- return utils::GetOrCreate(load_funcs, LoadStoreKey{el_ty, buffer}, [&] {
- utils::Vector params{b.Param("offset", b.ty.u32())};
+ return tint::GetOrCreate(load_funcs, LoadStoreKey{el_ty, buffer}, [&] {
+ tint::Vector params{b.Param("offset", b.ty.u32())};
auto name = b.Symbols().New(buffer.Name() + "_load");
if (auto* intrinsic = IntrinsicLoadFor(ctx.dst, el_ty, address_space, buffer)) {
auto el_ast_ty = CreateASTTypeFor(ctx, el_ty);
b.Func(name, params, el_ast_ty, nullptr,
- utils::Vector{
+ tint::Vector{
intrinsic,
b.Disable(DisabledValidation::kFunctionHasNoBody),
});
@@ -508,13 +508,13 @@
b.For(for_init, for_cond, for_cont, b.Block(b.Assign(arr_el, el_val)));
b.Func(name, params, CreateASTTypeFor(ctx, arr_ty),
- utils::Vector{
+ tint::Vector{
b.Decl(arr),
for_loop,
b.Return(arr),
});
} else {
- utils::Vector<const Expression*, 8> values;
+ tint::Vector<const Expression*, 8> values;
if (auto* mat_ty = el_ty->As<type::Matrix>()) {
auto* vec_ty = mat_ty->ColumnType();
Symbol load = LoadFunc(vec_ty, address_space, buffer);
@@ -530,7 +530,7 @@
}
}
b.Func(name, params, CreateASTTypeFor(ctx, el_ty),
- utils::Vector{
+ tint::Vector{
b.Return(b.Call(CreateASTTypeFor(ctx, el_ty), values)),
});
}
@@ -545,8 +545,8 @@
/// @param buffer the symbol of the storage buffer variable, owned by the target ProgramBuilder.
/// @return the name of the function that performs the store
Symbol StoreFunc(const type::Type* el_ty, const Symbol& buffer) {
- return utils::GetOrCreate(store_funcs, LoadStoreKey{el_ty, buffer}, [&] {
- utils::Vector params{
+ return tint::GetOrCreate(store_funcs, LoadStoreKey{el_ty, buffer}, [&] {
+ tint::Vector params{
b.Param("offset", b.ty.u32()),
b.Param("value", CreateASTTypeFor(ctx, el_ty)),
};
@@ -555,12 +555,12 @@
if (auto* intrinsic = IntrinsicStoreFor(ctx.dst, el_ty, buffer)) {
b.Func(name, params, b.ty.void_(), nullptr,
- utils::Vector{
+ tint::Vector{
intrinsic,
b.Disable(DisabledValidation::kFunctionHasNoBody),
});
} else {
- auto body = Switch<utils::Vector<const Statement*, 8>>(
+ auto body = Switch<tint::Vector<const Statement*, 8>>(
el_ty, //
[&](const type::Array* arr_ty) {
// fn store_func(buffer : buf_ty, offset : u32, value : el_ty) {
@@ -593,12 +593,12 @@
auto* store_stmt = b.CallStmt(b.Call(store, el_offset, arr_el));
auto* for_loop = b.For(for_init, for_cond, for_cont, b.Block(store_stmt));
- return utils::Vector{b.Decl(array), for_loop};
+ return tint::Vector{b.Decl(array), for_loop};
},
[&](const type::Matrix* mat_ty) {
auto* vec_ty = mat_ty->ColumnType();
Symbol store = StoreFunc(vec_ty, buffer);
- utils::Vector<const Statement*, 4> stmts;
+ tint::Vector<const Statement*, 4> stmts;
for (uint32_t i = 0; i < mat_ty->columns(); i++) {
auto* offset = b.Add("offset", u32(i * mat_ty->ColumnStride()));
auto* element = b.IndexAccessor("value", u32(i));
@@ -608,7 +608,7 @@
return stmts;
},
[&](const type::Struct* str) {
- utils::Vector<const Statement*, 8> stmts;
+ tint::Vector<const Statement*, 8> stmts;
for (auto* member : str->Members()) {
auto* offset = b.Add("offset", u32(member->Offset()));
auto* element = b.MemberAccessor("value", ctx.Clone(member->Name()));
@@ -637,10 +637,10 @@
const sem::Builtin* intrinsic,
const Symbol& buffer) {
auto op = intrinsic->Type();
- return utils::GetOrCreate(atomic_funcs, AtomicKey{el_ty, op, buffer}, [&] {
+ return tint::GetOrCreate(atomic_funcs, AtomicKey{el_ty, op, buffer}, [&] {
// The first parameter to all WGSL atomics is the expression to the
// atomic. This is replaced with two parameters: the buffer and offset.
- utils::Vector params{b.Param("offset", b.ty.u32())};
+ tint::Vector params{b.Param("offset", b.ty.u32())};
// Other parameters are copied as-is:
for (size_t i = 1; i < intrinsic->Parameters().Length(); i++) {
@@ -660,7 +660,7 @@
auto name = b.Symbols().New(buffer.Name() + intrinsic->str());
b.Func(name, std::move(params), ret_ty, nullptr,
- utils::Vector{
+ tint::Vector{
atomic,
b.Disable(DisabledValidation::kFunctionHasNoBody),
});
@@ -675,10 +675,10 @@
DataType ty,
builtin::AddressSpace as,
const IdentifierExpression* buf)
- : Base(pid, nid, utils::Vector{buf}), op(o), type(ty), address_space(as) {}
+ : Base(pid, nid, tint::Vector{buf}), op(o), type(ty), address_space(as) {}
DecomposeMemoryAccess::Intrinsic::~Intrinsic() = default;
std::string DecomposeMemoryAccess::Intrinsic::InternalName() const {
- utils::StringStream ss;
+ StringStream ss;
switch (op) {
case Op::kLoad:
ss << "intrinsic_load_";
@@ -934,7 +934,7 @@
auto buffer = ctx.Clone(access.var->Declaration()->name->symbol);
Symbol func = state.AtomicFunc(el_ty, builtin, buffer);
- utils::Vector<const Expression*, 8> args{offset};
+ tint::Vector<const Expression*, 8> args{offset};
for (size_t i = 1; i < call_expr->args.Length(); i++) {
auto* arg = call_expr->args[i];
args.Push(ctx.Clone(arg));
diff --git a/src/tint/lang/wgsl/ast/transform/decompose_memory_access.h b/src/tint/lang/wgsl/ast/transform/decompose_memory_access.h
index 0b5b940..bc9f39c 100644
--- a/src/tint/lang/wgsl/ast/transform/decompose_memory_access.h
+++ b/src/tint/lang/wgsl/ast/transform/decompose_memory_access.h
@@ -29,13 +29,13 @@
/// DecomposeMemoryAccess is a transform used to replace storage and uniform buffer accesses with a
/// combination of load, store or atomic functions on primitive types.
-class DecomposeMemoryAccess final : public utils::Castable<DecomposeMemoryAccess, Transform> {
+class DecomposeMemoryAccess final : public Castable<DecomposeMemoryAccess, Transform> {
public:
/// Intrinsic is an InternalAttribute that's used to decorate a stub function so that the HLSL
/// transforms this into calls to
/// `[RW]ByteAddressBuffer.Load[N]()` or `[RW]ByteAddressBuffer.Store[N]()`,
/// with a possible cast.
- class Intrinsic final : public utils::Castable<Intrinsic, InternalAttribute> {
+ class Intrinsic final : public Castable<Intrinsic, InternalAttribute> {
public:
/// Intrinsic op
enum class Op {
diff --git a/src/tint/lang/wgsl/ast/transform/decompose_strided_array.cc b/src/tint/lang/wgsl/ast/transform/decompose_strided_array.cc
index ee9ffe6..b477646 100644
--- a/src/tint/lang/wgsl/ast/transform/decompose_strided_array.cc
+++ b/src/tint/lang/wgsl/ast/transform/decompose_strided_array.cc
@@ -88,14 +88,14 @@
return nullptr;
}
if (!arr->IsStrideImplicit()) {
- auto el_ty = utils::GetOrCreate(decomposed, arr, [&] {
+ auto el_ty = tint::GetOrCreate(decomposed, arr, [&] {
auto name = b.Symbols().New("strided_arr");
auto* member_ty = ctx.Clone(ident->arguments[0]->As<IdentifierExpression>());
auto* member = b.Member(kMemberName, Type{member_ty},
- utils::Vector{
+ tint::Vector{
b.MemberSize(AInt(arr->Stride())),
});
- b.Structure(name, utils::Vector{member});
+ b.Structure(name, tint::Vector{member});
return name;
});
if (ident->arguments.Length() > 1) {
@@ -153,7 +153,7 @@
auto* target = ctx.Clone(expr->target);
- utils::Vector<const Expression*, 8> args;
+ tint::Vector<const Expression*, 8> args;
if (auto it = decomposed.find(arr); it != decomposed.end()) {
args.Reserve(expr->args.Length());
for (auto* arg : expr->args) {
diff --git a/src/tint/lang/wgsl/ast/transform/decompose_strided_array.h b/src/tint/lang/wgsl/ast/transform/decompose_strided_array.h
index 2839672..29c7d37 100644
--- a/src/tint/lang/wgsl/ast/transform/decompose_strided_array.h
+++ b/src/tint/lang/wgsl/ast/transform/decompose_strided_array.h
@@ -27,7 +27,7 @@
///
/// @note Depends on the following transforms to have been run first:
/// * SimplifyPointers
-class DecomposeStridedArray final : public utils::Castable<DecomposeStridedArray, Transform> {
+class DecomposeStridedArray final : public Castable<DecomposeStridedArray, Transform> {
public:
/// Constructor
DecomposeStridedArray();
diff --git a/src/tint/lang/wgsl/ast/transform/decompose_strided_array_test.cc b/src/tint/lang/wgsl/ast/transform/decompose_strided_array_test.cc
index a8a0dce..e6f129e 100644
--- a/src/tint/lang/wgsl/ast/transform/decompose_strided_array_test.cc
+++ b/src/tint/lang/wgsl/ast/transform/decompose_strided_array_test.cc
@@ -48,7 +48,7 @@
ProgramBuilder b;
b.GlobalVar("arr",
- b.ty.array<f32, 4u>(utils::Vector{
+ b.ty.array<f32, 4u>(tint::Vector{
b.Stride(4),
}),
builtin::AddressSpace::kPrivate);
@@ -60,7 +60,7 @@
ProgramBuilder b;
b.GlobalVar("arr",
- b.ty.array<f32, 4u>(utils::Vector{
+ b.ty.array<f32, 4u>(tint::Vector{
b.Stride(16),
}),
builtin::AddressSpace::kPrivate);
@@ -87,20 +87,20 @@
ProgramBuilder b;
b.GlobalVar("arr",
- b.ty.array<f32, 4u>(utils::Vector{
+ b.ty.array<f32, 4u>(tint::Vector{
b.Stride(4),
}),
builtin::AddressSpace::kPrivate);
- b.Func("f", utils::Empty, b.ty.void_(),
- utils::Vector{
+ b.Func("f", tint::Empty, b.ty.void_(),
+ tint::Vector{
b.Decl(b.Let("a",
- b.ty.array<f32, 4u>(utils::Vector{
+ b.ty.array<f32, 4u>(tint::Vector{
b.Stride(4),
}),
b.Expr("arr"))),
b.Decl(b.Let("b", b.ty.f32(), b.IndexAccessor("arr", 1_i))),
},
- utils::Vector{
+ tint::Vector{
b.Stage(PipelineStage::kCompute),
b.WorkgroupSize(1_i),
});
@@ -131,20 +131,20 @@
ProgramBuilder b;
b.GlobalVar("arr",
- b.ty.array<f32, 4u>(utils::Vector{
+ b.ty.array<f32, 4u>(tint::Vector{
b.Stride(32),
}),
builtin::AddressSpace::kPrivate);
- b.Func("f", utils::Empty, b.ty.void_(),
- utils::Vector{
+ b.Func("f", tint::Empty, b.ty.void_(),
+ tint::Vector{
b.Decl(b.Let("a",
- b.ty.array<f32, 4u>(utils::Vector{
+ b.ty.array<f32, 4u>(tint::Vector{
b.Stride(32),
}),
b.Expr("arr"))),
b.Decl(b.Let("b", b.ty.f32(), b.IndexAccessor("arr", 1_i))),
},
- utils::Vector{
+ tint::Vector{
b.Stage(PipelineStage::kCompute),
b.WorkgroupSize(1_i),
});
@@ -181,20 +181,20 @@
// let b : f32 = s.a[1];
// }
ProgramBuilder b;
- auto* S = b.Structure("S", utils::Vector{b.Member("a", b.ty.array<f32, 4u>(utils::Vector{
- b.Stride(32),
- }))});
+ auto* S = b.Structure("S", tint::Vector{b.Member("a", b.ty.array<f32, 4u>(tint::Vector{
+ b.Stride(32),
+ }))});
b.GlobalVar("s", b.ty.Of(S), builtin::AddressSpace::kUniform, b.Group(0_a), b.Binding(0_a));
- b.Func("f", utils::Empty, b.ty.void_(),
- utils::Vector{
+ b.Func("f", tint::Empty, b.ty.void_(),
+ tint::Vector{
b.Decl(b.Let("a",
- b.ty.array<f32, 4u>(utils::Vector{
+ b.ty.array<f32, 4u>(tint::Vector{
b.Stride(32),
}),
b.MemberAccessor("s", "a"))),
b.Decl(b.Let("b", b.ty.f32(), b.IndexAccessor(b.MemberAccessor("s", "a"), 1_i))),
},
- utils::Vector{
+ tint::Vector{
b.Stage(PipelineStage::kCompute),
b.WorkgroupSize(1_i),
});
@@ -235,24 +235,24 @@
// let b : f32 = s.a[1][2];
// }
ProgramBuilder b;
- auto* S = b.Structure("S", utils::Vector{b.Member("a", b.ty.array(b.ty.vec4<f32>(), 4_u,
- utils::Vector{
- b.Stride(16),
- }))});
+ auto* S = b.Structure("S", tint::Vector{b.Member("a", b.ty.array(b.ty.vec4<f32>(), 4_u,
+ tint::Vector{
+ b.Stride(16),
+ }))});
b.GlobalVar("s", b.ty.Of(S), builtin::AddressSpace::kUniform, b.Group(0_a), b.Binding(0_a));
b.Func(
- "f", utils::Empty, b.ty.void_(),
- utils::Vector{
+ "f", tint::Empty, b.ty.void_(),
+ tint::Vector{
b.Decl(b.Let("a",
b.ty.array(b.ty.vec4<f32>(), 4_u,
- utils::Vector{
+ tint::Vector{
b.Stride(16),
}),
b.MemberAccessor("s", "a"))),
b.Decl(b.Let("b", b.ty.f32(),
b.IndexAccessor(b.IndexAccessor(b.MemberAccessor("s", "a"), 1_i), 2_i))),
},
- utils::Vector{
+ tint::Vector{
b.Stage(PipelineStage::kCompute),
b.WorkgroupSize(1_i),
});
@@ -289,20 +289,20 @@
// let b : f32 = s.a[1];
// }
ProgramBuilder b;
- auto* S = b.Structure("S", utils::Vector{b.Member("a", b.ty.array<f32, 4u>(utils::Vector{
- b.Stride(32),
- }))});
+ auto* S = b.Structure("S", tint::Vector{b.Member("a", b.ty.array<f32, 4u>(tint::Vector{
+ b.Stride(32),
+ }))});
b.GlobalVar("s", b.ty.Of(S), builtin::AddressSpace::kStorage, b.Group(0_a), b.Binding(0_a));
- b.Func("f", utils::Empty, b.ty.void_(),
- utils::Vector{
+ b.Func("f", tint::Empty, b.ty.void_(),
+ tint::Vector{
b.Decl(b.Let("a",
- b.ty.array<f32, 4u>(utils::Vector{
+ b.ty.array<f32, 4u>(tint::Vector{
b.Stride(32),
}),
b.MemberAccessor("s", "a"))),
b.Decl(b.Let("b", b.ty.f32(), b.IndexAccessor(b.MemberAccessor("s", "a"), 1_i))),
},
- utils::Vector{
+ tint::Vector{
b.Stage(PipelineStage::kCompute),
b.WorkgroupSize(1_i),
});
@@ -343,20 +343,20 @@
// let b : f32 = s.a[1];
// }
ProgramBuilder b;
- auto* S = b.Structure("S", utils::Vector{b.Member("a", b.ty.array<f32, 4u>(utils::Vector{
- b.Stride(4),
- }))});
+ auto* S = b.Structure("S", tint::Vector{b.Member("a", b.ty.array<f32, 4u>(tint::Vector{
+ b.Stride(4),
+ }))});
b.GlobalVar("s", b.ty.Of(S), builtin::AddressSpace::kStorage, b.Group(0_a), b.Binding(0_a));
- b.Func("f", utils::Empty, b.ty.void_(),
- utils::Vector{
+ b.Func("f", tint::Empty, b.ty.void_(),
+ tint::Vector{
b.Decl(b.Let("a",
- b.ty.array<f32, 4u>(utils::Vector{
+ b.ty.array<f32, 4u>(tint::Vector{
b.Stride(4),
}),
b.MemberAccessor("s", "a"))),
b.Decl(b.Let("b", b.ty.f32(), b.IndexAccessor(b.MemberAccessor("s", "a"), 1_i))),
},
- utils::Vector{
+ tint::Vector{
b.Stage(PipelineStage::kCompute),
b.WorkgroupSize(1_i),
});
@@ -393,23 +393,23 @@
// s.a[1i] = 5.0;
// }
ProgramBuilder b;
- auto* S = b.Structure("S", utils::Vector{b.Member("a", b.ty.array<f32, 4u>(utils::Vector{
- b.Stride(32),
- }))});
+ auto* S = b.Structure("S", tint::Vector{b.Member("a", b.ty.array<f32, 4u>(tint::Vector{
+ b.Stride(32),
+ }))});
b.GlobalVar("s", b.ty.Of(S), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
b.Group(0_a), b.Binding(0_a));
- b.Func("f", utils::Empty, b.ty.void_(),
- utils::Vector{
- b.Assign(b.MemberAccessor("s", "a"), b.Call(b.ty.array<f32, 4u>(utils::Vector{
+ b.Func("f", tint::Empty, b.ty.void_(),
+ tint::Vector{
+ b.Assign(b.MemberAccessor("s", "a"), b.Call(b.ty.array<f32, 4u>(tint::Vector{
b.Stride(32),
}))),
- b.Assign(b.MemberAccessor("s", "a"), b.Call(b.ty.array<f32, 4u>(utils::Vector{
+ b.Assign(b.MemberAccessor("s", "a"), b.Call(b.ty.array<f32, 4u>(tint::Vector{
b.Stride(32),
}),
1_f, 2_f, 3_f, 4_f)),
b.Assign(b.IndexAccessor(b.MemberAccessor("s", "a"), 1_i), 5_f),
},
- utils::Vector{
+ tint::Vector{
b.Stage(PipelineStage::kCompute),
b.WorkgroupSize(1_i),
});
@@ -453,25 +453,25 @@
// s.a[1] = 5.0;
// }
ProgramBuilder b;
- auto* S = b.Structure("S", utils::Vector{
- b.Member("a", b.ty.array<f32, 4u>(utils::Vector{
+ auto* S = b.Structure("S", tint::Vector{
+ b.Member("a", b.ty.array<f32, 4u>(tint::Vector{
b.Stride(4),
})),
});
b.GlobalVar("s", b.ty.Of(S), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
b.Group(0_a), b.Binding(0_a));
- b.Func("f", utils::Empty, b.ty.void_(),
- utils::Vector{
- b.Assign(b.MemberAccessor("s", "a"), b.Call(b.ty.array<f32, 4u>(utils::Vector{
+ b.Func("f", tint::Empty, b.ty.void_(),
+ tint::Vector{
+ b.Assign(b.MemberAccessor("s", "a"), b.Call(b.ty.array<f32, 4u>(tint::Vector{
b.Stride(4),
}))),
- b.Assign(b.MemberAccessor("s", "a"), b.Call(b.ty.array<f32, 4u>(utils::Vector{
+ b.Assign(b.MemberAccessor("s", "a"), b.Call(b.ty.array<f32, 4u>(tint::Vector{
b.Stride(4),
}),
1_f, 2_f, 3_f, 4_f)),
b.Assign(b.IndexAccessor(b.MemberAccessor("s", "a"), 1_i), 5_f),
},
- utils::Vector{
+ tint::Vector{
b.Stage(PipelineStage::kCompute),
b.WorkgroupSize(1_i),
});
@@ -513,24 +513,24 @@
// (*b)[1] = 5.0;
// }
ProgramBuilder b;
- auto* S = b.Structure("S", utils::Vector{b.Member("a", b.ty.array<f32, 4u>(utils::Vector{
- b.Stride(32),
- }))});
+ auto* S = b.Structure("S", tint::Vector{b.Member("a", b.ty.array<f32, 4u>(tint::Vector{
+ b.Stride(32),
+ }))});
b.GlobalVar("s", b.ty.Of(S), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
b.Group(0_a), b.Binding(0_a));
- b.Func("f", utils::Empty, b.ty.void_(),
- utils::Vector{
+ b.Func("f", tint::Empty, b.ty.void_(),
+ tint::Vector{
b.Decl(b.Let("a", b.AddressOf(b.MemberAccessor("s", "a")))),
b.Decl(b.Let("b", b.AddressOf(b.Deref(b.AddressOf(b.Deref("a")))))),
b.Decl(b.Let("c", b.Deref("b"))),
b.Decl(b.Let("d", b.IndexAccessor(b.Deref("b"), 1_i))),
- b.Assign(b.Deref("b"), b.Call(b.ty.array<f32, 4u>(utils::Vector{
+ b.Assign(b.Deref("b"), b.Call(b.ty.array<f32, 4u>(tint::Vector{
b.Stride(32),
}),
1_f, 2_f, 3_f, 4_f)),
b.Assign(b.IndexAccessor(b.Deref("b"), 1_i), 5_f),
},
- utils::Vector{
+ tint::Vector{
b.Stage(PipelineStage::kCompute),
b.WorkgroupSize(1_i),
});
@@ -578,21 +578,21 @@
// s.a[1] = 5.0;
// }
ProgramBuilder b;
- b.Alias("ARR", b.ty.array<f32, 4u>(utils::Vector{
+ b.Alias("ARR", b.ty.array<f32, 4u>(tint::Vector{
b.Stride(32),
}));
- auto* S = b.Structure("S", utils::Vector{b.Member("a", b.ty("ARR"))});
+ auto* S = b.Structure("S", tint::Vector{b.Member("a", b.ty("ARR"))});
b.GlobalVar("s", b.ty.Of(S), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
b.Group(0_a), b.Binding(0_a));
- b.Func("f", utils::Empty, b.ty.void_(),
- utils::Vector{
+ b.Func("f", tint::Empty, b.ty.void_(),
+ tint::Vector{
b.Decl(b.Let("a", b.ty("ARR"), b.MemberAccessor("s", "a"))),
b.Decl(b.Let("b", b.ty.f32(), b.IndexAccessor(b.MemberAccessor("s", "a"), 1_i))),
b.Assign(b.MemberAccessor("s", "a"), b.Call("ARR")),
b.Assign(b.MemberAccessor("s", "a"), b.Call("ARR", 1_f, 2_f, 3_f, 4_f)),
b.Assign(b.IndexAccessor(b.MemberAccessor("s", "a"), 1_i), 5_f),
},
- utils::Vector{
+ tint::Vector{
b.Stage(PipelineStage::kCompute),
b.WorkgroupSize(1_i),
});
@@ -645,27 +645,27 @@
// }
ProgramBuilder b;
- b.Alias("ARR_A", b.ty.array<f32, 2>(utils::Vector{
+ b.Alias("ARR_A", b.ty.array<f32, 2>(tint::Vector{
b.Stride(8),
}));
b.Alias("ARR_B", b.ty.array( //
b.ty.array(b.ty("ARR_A"), 3_u,
- utils::Vector{
+ tint::Vector{
b.Stride(16),
}),
4_u,
- utils::Vector{
+ tint::Vector{
b.Stride(128),
}));
- auto* S = b.Structure("S", utils::Vector{b.Member("a", b.ty("ARR_B"))});
+ auto* S = b.Structure("S", tint::Vector{b.Member("a", b.ty("ARR_B"))});
b.GlobalVar("s", b.ty.Of(S), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
b.Group(0_a), b.Binding(0_a));
- b.Func("f", utils::Empty, b.ty.void_(),
- utils::Vector{
+ b.Func("f", tint::Empty, b.ty.void_(),
+ tint::Vector{
b.Decl(b.Let("a", b.ty("ARR_B"), b.MemberAccessor("s", "a"))),
b.Decl(b.Let("b",
b.ty.array(b.ty("ARR_A"), 3_u,
- utils::Vector{
+ tint::Vector{
b.Stride(16),
}),
b.IndexAccessor( //
@@ -695,7 +695,7 @@
1_i),
5_f),
},
- utils::Vector{
+ tint::Vector{
b.Stage(PipelineStage::kCompute),
b.WorkgroupSize(1_i),
});
diff --git a/src/tint/lang/wgsl/ast/transform/decompose_strided_matrix.cc b/src/tint/lang/wgsl/ast/transform/decompose_strided_matrix.cc
index 75d4ed7..b17c0ee 100644
--- a/src/tint/lang/wgsl/ast/transform/decompose_strided_matrix.cc
+++ b/src/tint/lang/wgsl/ast/transform/decompose_strided_matrix.cc
@@ -40,7 +40,7 @@
/// @returns the identifier of an array that holds an vector column for each row of the matrix.
Type array(ProgramBuilder* b) const {
return b->ty.array(b->ty.vec<f32>(matrix->rows()), u32(matrix->columns()),
- utils::Vector{
+ tint::Vector{
b->Stride(stride),
});
}
@@ -51,7 +51,7 @@
}
/// Hash function
struct Hasher {
- size_t operator()(const MatrixInfo& t) const { return utils::Hash(t.stride, t.matrix); }
+ size_t operator()(const MatrixInfo& t) const { return Hash(t.stride, t.matrix); }
};
};
@@ -70,7 +70,7 @@
// Scan the program for all storage and uniform structure matrix members with
// a custom stride attribute. Replace these matrices with an equivalent array,
// and populate the `decomposed` map with the members that have been replaced.
- utils::Hashmap<const type::StructMember*, MatrixInfo, 8> decomposed;
+ Hashmap<const type::StructMember*, MatrixInfo, 8> decomposed;
for (auto* node : src->ASTNodes().Objects()) {
if (auto* str = node->As<Struct>()) {
auto* str_ty = src->Sem().Get(str);
@@ -130,7 +130,7 @@
ctx.ReplaceAll([&](const AssignmentStatement* stmt) -> const Statement* {
if (auto* access = src->Sem().Get<sem::StructMemberAccess>(stmt->lhs)) {
if (auto info = decomposed.Find(access->Member())) {
- auto fn = utils::GetOrCreate(mat_to_arr, *info, [&] {
+ auto fn = tint::GetOrCreate(mat_to_arr, *info, [&] {
auto name =
b.Symbols().New("mat" + std::to_string(info->matrix->columns()) + "x" +
std::to_string(info->matrix->rows()) + "_stride_" +
@@ -140,16 +140,16 @@
auto array = [&] { return info->array(ctx.dst); };
auto mat = b.Sym("m");
- utils::Vector<const Expression*, 4> columns;
+ tint::Vector<const Expression*, 4> columns;
for (uint32_t i = 0; i < static_cast<uint32_t>(info->matrix->columns()); i++) {
columns.Push(b.IndexAccessor(mat, u32(i)));
}
b.Func(name,
- utils::Vector{
+ tint::Vector{
b.Param(mat, matrix()),
},
array(),
- utils::Vector{
+ tint::Vector{
b.Return(b.Call(array(), columns)),
});
return name;
@@ -169,7 +169,7 @@
ctx.ReplaceAll([&](const MemberAccessorExpression* expr) -> const Expression* {
if (auto* access = src->Sem().Get(expr)->UnwrapLoad()->As<sem::StructMemberAccess>()) {
if (auto info = decomposed.Find(access->Member())) {
- auto fn = utils::GetOrCreate(arr_to_mat, *info, [&] {
+ auto fn = tint::GetOrCreate(arr_to_mat, *info, [&] {
auto name =
b.Symbols().New("arr_to_mat" + std::to_string(info->matrix->columns()) +
"x" + std::to_string(info->matrix->rows()) + "_stride_" +
@@ -179,16 +179,16 @@
auto array = [&] { return info->array(ctx.dst); };
auto arr = b.Sym("arr");
- utils::Vector<const Expression*, 4> columns;
+ tint::Vector<const Expression*, 4> columns;
for (uint32_t i = 0; i < static_cast<uint32_t>(info->matrix->columns()); i++) {
columns.Push(b.IndexAccessor(arr, u32(i)));
}
b.Func(name,
- utils::Vector{
+ tint::Vector{
b.Param(arr, array()),
},
matrix(),
- utils::Vector{
+ tint::Vector{
b.Return(b.Call(matrix(), columns)),
});
return name;
diff --git a/src/tint/lang/wgsl/ast/transform/decompose_strided_matrix.h b/src/tint/lang/wgsl/ast/transform/decompose_strided_matrix.h
index 5036313..5da4fc0 100644
--- a/src/tint/lang/wgsl/ast/transform/decompose_strided_matrix.h
+++ b/src/tint/lang/wgsl/ast/transform/decompose_strided_matrix.h
@@ -27,7 +27,7 @@
///
/// @note Depends on the following transforms to have been run first:
/// * SimplifyPointers
-class DecomposeStridedMatrix final : public utils::Castable<DecomposeStridedMatrix, Transform> {
+class DecomposeStridedMatrix final : public Castable<DecomposeStridedMatrix, Transform> {
public:
/// Constructor
DecomposeStridedMatrix();
diff --git a/src/tint/lang/wgsl/ast/transform/decompose_strided_matrix_test.cc b/src/tint/lang/wgsl/ast/transform/decompose_strided_matrix_test.cc
index d4326e9..d939a8e 100644
--- a/src/tint/lang/wgsl/ast/transform/decompose_strided_matrix_test.cc
+++ b/src/tint/lang/wgsl/ast/transform/decompose_strided_matrix_test.cc
@@ -69,20 +69,20 @@
// }
ProgramBuilder b;
auto* S =
- b.Structure("S", utils::Vector{
+ b.Structure("S", tint::Vector{
b.Member("m", b.ty.mat2x2<f32>(),
- utils::Vector{
+ tint::Vector{
b.MemberOffset(16_u),
b.create<StrideAttribute>(32u),
b.Disable(DisabledValidation::kIgnoreStrideAttribute),
}),
});
b.GlobalVar("s", b.ty.Of(S), builtin::AddressSpace::kUniform, b.Group(0_a), b.Binding(0_a));
- b.Func("f", utils::Empty, b.ty.void_(),
- utils::Vector{
+ b.Func("f", tint::Empty, b.ty.void_(),
+ tint::Vector{
b.Decl(b.Let("x", b.ty.mat2x2<f32>(), b.MemberAccessor("s", "m"))),
},
- utils::Vector{
+ tint::Vector{
b.Stage(PipelineStage::kCompute),
b.WorkgroupSize(1_i),
});
@@ -126,9 +126,9 @@
// }
ProgramBuilder b;
auto* S =
- b.Structure("S", utils::Vector{
+ b.Structure("S", tint::Vector{
b.Member("m", b.ty.mat2x2<f32>(),
- utils::Vector{
+ tint::Vector{
b.MemberOffset(16_u),
b.create<StrideAttribute>(32u),
b.Disable(DisabledValidation::kIgnoreStrideAttribute),
@@ -136,11 +136,11 @@
});
b.GlobalVar("s", b.ty.Of(S), builtin::AddressSpace::kUniform, b.Group(0_a), b.Binding(0_a));
b.Func(
- "f", utils::Empty, b.ty.void_(),
- utils::Vector{
+ "f", tint::Empty, b.ty.void_(),
+ tint::Vector{
b.Decl(b.Let("x", b.ty.vec2<f32>(), b.IndexAccessor(b.MemberAccessor("s", "m"), 1_i))),
},
- utils::Vector{
+ tint::Vector{
b.Stage(PipelineStage::kCompute),
b.WorkgroupSize(1_i),
});
@@ -180,20 +180,20 @@
// }
ProgramBuilder b;
auto* S =
- b.Structure("S", utils::Vector{
+ b.Structure("S", tint::Vector{
b.Member("m", b.ty.mat2x2<f32>(),
- utils::Vector{
+ tint::Vector{
b.MemberOffset(16_u),
b.create<StrideAttribute>(8u),
b.Disable(DisabledValidation::kIgnoreStrideAttribute),
}),
});
b.GlobalVar("s", b.ty.Of(S), builtin::AddressSpace::kUniform, b.Group(0_a), b.Binding(0_a));
- b.Func("f", utils::Empty, b.ty.void_(),
- utils::Vector{
+ b.Func("f", tint::Empty, b.ty.void_(),
+ tint::Vector{
b.Decl(b.Let("x", b.ty.mat2x2<f32>(), b.MemberAccessor("s", "m"))),
},
- utils::Vector{
+ tint::Vector{
b.Stage(PipelineStage::kCompute),
b.WorkgroupSize(1_i),
});
@@ -234,9 +234,9 @@
// }
ProgramBuilder b;
auto* S =
- b.Structure("S", utils::Vector{
+ b.Structure("S", tint::Vector{
b.Member("m", b.ty.mat2x2<f32>(),
- utils::Vector{
+ tint::Vector{
b.MemberOffset(8_u),
b.create<StrideAttribute>(32u),
b.Disable(DisabledValidation::kIgnoreStrideAttribute),
@@ -244,11 +244,11 @@
});
b.GlobalVar("s", b.ty.Of(S), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
b.Group(0_a), b.Binding(0_a));
- b.Func("f", utils::Empty, b.ty.void_(),
- utils::Vector{
+ b.Func("f", tint::Empty, b.ty.void_(),
+ tint::Vector{
b.Decl(b.Let("x", b.ty.mat2x2<f32>(), b.MemberAccessor("s", "m"))),
},
- utils::Vector{
+ tint::Vector{
b.Stage(PipelineStage::kCompute),
b.WorkgroupSize(1_i),
});
@@ -292,9 +292,9 @@
// }
ProgramBuilder b;
auto* S =
- b.Structure("S", utils::Vector{
+ b.Structure("S", tint::Vector{
b.Member("m", b.ty.mat2x2<f32>(),
- utils::Vector{
+ tint::Vector{
b.MemberOffset(16_u),
b.create<StrideAttribute>(32u),
b.Disable(DisabledValidation::kIgnoreStrideAttribute),
@@ -303,11 +303,11 @@
b.GlobalVar("s", b.ty.Of(S), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
b.Group(0_a), b.Binding(0_a));
b.Func(
- "f", utils::Empty, b.ty.void_(),
- utils::Vector{
+ "f", tint::Empty, b.ty.void_(),
+ tint::Vector{
b.Decl(b.Let("x", b.ty.vec2<f32>(), b.IndexAccessor(b.MemberAccessor("s", "m"), 1_i))),
},
- utils::Vector{
+ tint::Vector{
b.Stage(PipelineStage::kCompute),
b.WorkgroupSize(1_i),
});
@@ -347,9 +347,9 @@
// }
ProgramBuilder b;
auto* S =
- b.Structure("S", utils::Vector{
+ b.Structure("S", tint::Vector{
b.Member("m", b.ty.mat2x2<f32>(),
- utils::Vector{
+ tint::Vector{
b.MemberOffset(8_u),
b.create<StrideAttribute>(32u),
b.Disable(DisabledValidation::kIgnoreStrideAttribute),
@@ -358,12 +358,12 @@
b.GlobalVar("s", b.ty.Of(S), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
b.Group(0_a), b.Binding(0_a));
b.Func(
- "f", utils::Empty, b.ty.void_(),
- utils::Vector{
+ "f", tint::Empty, b.ty.void_(),
+ tint::Vector{
b.Assign(b.MemberAccessor("s", "m"),
b.Call<mat2x2<f32>>(b.Call<vec2<f32>>(1_f, 2_f), b.Call<vec2<f32>>(3_f, 4_f))),
},
- utils::Vector{
+ tint::Vector{
b.Stage(PipelineStage::kCompute),
b.WorkgroupSize(1_i),
});
@@ -407,9 +407,9 @@
// }
ProgramBuilder b;
auto* S =
- b.Structure("S", utils::Vector{
+ b.Structure("S", tint::Vector{
b.Member("m", b.ty.mat2x2<f32>(),
- utils::Vector{
+ tint::Vector{
b.MemberOffset(8_u),
b.create<StrideAttribute>(32u),
b.Disable(DisabledValidation::kIgnoreStrideAttribute),
@@ -418,11 +418,11 @@
b.GlobalVar("s", b.ty.Of(S), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
b.Group(0_a), b.Binding(0_a));
b.Func(
- "f", utils::Empty, b.ty.void_(),
- utils::Vector{
+ "f", tint::Empty, b.ty.void_(),
+ tint::Vector{
b.Assign(b.IndexAccessor(b.MemberAccessor("s", "m"), 1_i), b.Call<vec2<f32>>(1_f, 2_f)),
},
- utils::Vector{
+ tint::Vector{
b.Stage(PipelineStage::kCompute),
b.WorkgroupSize(1_i),
});
@@ -468,9 +468,9 @@
// }
ProgramBuilder b;
auto* S =
- b.Structure("S", utils::Vector{
+ b.Structure("S", tint::Vector{
b.Member("m", b.ty.mat2x2<f32>(),
- utils::Vector{
+ tint::Vector{
b.MemberOffset(8_u),
b.create<StrideAttribute>(32u),
b.Disable(DisabledValidation::kIgnoreStrideAttribute),
@@ -478,8 +478,8 @@
});
b.GlobalVar("s", b.ty.Of(S), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
b.Group(0_a), b.Binding(0_a));
- b.Func("f", utils::Empty, b.ty.void_(),
- utils::Vector{
+ b.Func("f", tint::Empty, b.ty.void_(),
+ tint::Vector{
b.Decl(b.Let("a", b.AddressOf(b.MemberAccessor("s", "m")))),
b.Decl(b.Let("b", b.AddressOf(b.Deref(b.AddressOf(b.Deref("a")))))),
b.Decl(b.Let("x", b.Deref("b"))),
@@ -489,7 +489,7 @@
b.Call<vec2<f32>>(3_f, 4_f))),
b.Assign(b.IndexAccessor(b.Deref("b"), 1_i), b.Call<vec2<f32>>(5_f, 6_f)),
},
- utils::Vector{
+ tint::Vector{
b.Stage(PipelineStage::kCompute),
b.WorkgroupSize(1_i),
});
@@ -541,20 +541,20 @@
// }
ProgramBuilder b;
auto* S =
- b.Structure("S", utils::Vector{
+ b.Structure("S", tint::Vector{
b.Member("m", b.ty.mat2x2<f32>(),
- utils::Vector{
+ tint::Vector{
b.MemberOffset(8_u),
b.create<StrideAttribute>(32u),
b.Disable(DisabledValidation::kIgnoreStrideAttribute),
}),
});
b.GlobalVar("s", b.ty.Of(S), builtin::AddressSpace::kPrivate);
- b.Func("f", utils::Empty, b.ty.void_(),
- utils::Vector{
+ b.Func("f", tint::Empty, b.ty.void_(),
+ tint::Vector{
b.Decl(b.Let("x", b.ty.mat2x2<f32>(), b.MemberAccessor("s", "m"))),
},
- utils::Vector{
+ tint::Vector{
b.Stage(PipelineStage::kCompute),
b.WorkgroupSize(1_i),
});
@@ -595,9 +595,9 @@
// }
ProgramBuilder b;
auto* S =
- b.Structure("S", utils::Vector{
+ b.Structure("S", tint::Vector{
b.Member("m", b.ty.mat2x2<f32>(),
- utils::Vector{
+ tint::Vector{
b.MemberOffset(8_u),
b.create<StrideAttribute>(32u),
b.Disable(DisabledValidation::kIgnoreStrideAttribute),
@@ -605,12 +605,12 @@
});
b.GlobalVar("s", b.ty.Of(S), builtin::AddressSpace::kPrivate);
b.Func(
- "f", utils::Empty, b.ty.void_(),
- utils::Vector{
+ "f", tint::Empty, b.ty.void_(),
+ tint::Vector{
b.Assign(b.MemberAccessor("s", "m"),
b.Call<mat2x2<f32>>(b.Call<vec2<f32>>(1_f, 2_f), b.Call<vec2<f32>>(3_f, 4_f))),
},
- utils::Vector{
+ tint::Vector{
b.Stage(PipelineStage::kCompute),
b.WorkgroupSize(1_i),
});
diff --git a/src/tint/lang/wgsl/ast/transform/demote_to_helper.cc b/src/tint/lang/wgsl/ast/transform/demote_to_helper.cc
index 04f530c..0caacab 100644
--- a/src/tint/lang/wgsl/ast/transform/demote_to_helper.cc
+++ b/src/tint/lang/wgsl/ast/transform/demote_to_helper.cc
@@ -187,12 +187,12 @@
// Declare a struct to hold the result values.
auto* result_struct = sem_call->Type()->As<type::Struct>();
auto* atomic_ty = result_struct->Members()[0]->Type();
- result_ty = b.ty(
- utils::GetOrCreate(atomic_cmpxchg_result_types, atomic_ty, [&] {
+ result_ty =
+ b.ty(tint::GetOrCreate(atomic_cmpxchg_result_types, atomic_ty, [&] {
auto name = b.Sym();
b.Structure(
name,
- utils::Vector{
+ tint::Vector{
b.Member("old_value", CreateASTTypeFor(ctx, atomic_ty)),
b.Member("exchanged", b.ty.bool_()),
});
@@ -208,7 +208,7 @@
auto tmp_result = b.Sym();
masked_call =
b.If(b.Not(flag),
- b.Block(utils::Vector{
+ b.Block(tint::Vector{
b.Decl(b.Let(tmp_result, ctx.CloneWithoutTransform(call))),
b.Assign(b.MemberAccessor(result, "old_value"),
b.MemberAccessor(tmp_result, "old_value")),
diff --git a/src/tint/lang/wgsl/ast/transform/demote_to_helper.h b/src/tint/lang/wgsl/ast/transform/demote_to_helper.h
index 3f1463f..1fe3c59 100644
--- a/src/tint/lang/wgsl/ast/transform/demote_to_helper.h
+++ b/src/tint/lang/wgsl/ast/transform/demote_to_helper.h
@@ -29,7 +29,7 @@
/// @note Depends on the following transforms to have been run first:
/// * PromoteSideEffectsToDecl
/// * ExpandCompoundAssignment
-class DemoteToHelper final : public utils::Castable<DemoteToHelper, Transform> {
+class DemoteToHelper final : public Castable<DemoteToHelper, Transform> {
public:
/// Constructor
DemoteToHelper();
diff --git a/src/tint/lang/wgsl/ast/transform/direct_variable_access.cc b/src/tint/lang/wgsl/ast/transform/direct_variable_access.cc
index 08cd127..9e651fa 100644
--- a/src/tint/lang/wgsl/ast/transform/direct_variable_access.cc
+++ b/src/tint/lang/wgsl/ast/transform/direct_variable_access.cc
@@ -124,7 +124,7 @@
// The originating variable.
AccessRoot root;
/// The chain of access ops.
- tint::utils::Vector<AccessOp, 8> ops;
+ tint::Vector<AccessOp, 8> ops;
/// @returns the number of DynamicIndex operations in #ops.
uint32_t NumDynamicIndices() const {
@@ -152,14 +152,14 @@
struct AccessChain : AccessShape {
/// The array accessor index expressions. This vector is indexed by the `DynamicIndex`s in
/// #indices.
- tint::utils::Vector<const tint::sem::ValueExpression*, 8> dynamic_indices;
+ tint::Vector<const tint::sem::ValueExpression*, 8> dynamic_indices;
/// If true, then this access chain is used as an argument to call a variant.
bool used_in_call = false;
};
} // namespace
-namespace tint::utils {
+namespace tint {
/// Hasher specialization for AccessRoot
template <>
@@ -167,7 +167,7 @@
/// The hash function for the AccessRoot
/// @param d the AccessRoot to hash
/// @return the hash for the given AccessRoot
- size_t operator()(const AccessRoot& d) const { return utils::Hash(d.type, d.variable); }
+ size_t operator()(const AccessRoot& d) const { return Hash(d.type, d.variable); }
};
/// Hasher specialization for DynamicIndex
@@ -176,7 +176,7 @@
/// The hash function for the DynamicIndex
/// @param d the DynamicIndex to hash
/// @return the hash for the given DynamicIndex
- size_t operator()(const DynamicIndex& d) const { return utils::Hash(d.slot); }
+ size_t operator()(const DynamicIndex& d) const { return Hash(d.slot); }
};
/// Hasher specialization for AccessShape
@@ -185,10 +185,10 @@
/// The hash function for the AccessShape
/// @param s the AccessShape to hash
/// @return the hash for the given AccessShape
- size_t operator()(const AccessShape& s) const { return utils::Hash(s.root, s.ops); }
+ size_t operator()(const AccessShape& s) const { return Hash(s.root, s.ops); }
};
-} // namespace tint::utils
+} // namespace tint
namespace tint::ast::transform {
@@ -230,7 +230,7 @@
// pointer indexing in the variant.
// Function call pointer arguments are replaced with an array of these dynamic indices.
auto decls = sem.Module()->DependencyOrderedDeclarations();
- for (auto* decl : utils::Reverse(decls)) {
+ for (auto* decl : tint::Reverse(decls)) {
if (auto* fn = sem.Get<sem::Function>(decl)) {
auto* fn_info = FnInfoFor(fn);
ProcessFunction(fn, fn_info);
@@ -339,17 +339,17 @@
struct FnVariant {
/// The signature of the variant is a map of each of the function's 'uniform', 'storage' and
/// 'workgroup' pointer parameters to the caller's AccessShape.
- using Signature = utils::Hashmap<const sem::Parameter*, AccessShape, 4>;
+ using Signature = Hashmap<const sem::Parameter*, AccessShape, 4>;
/// The unique name of the variant.
/// The symbol is in the `ctx.dst` program namespace.
Symbol name;
/// A map of direct calls made by this variant to the name of other function variants.
- utils::Hashmap<const sem::Call*, Symbol, 4> calls;
+ Hashmap<const sem::Call*, Symbol, 4> calls;
/// A map of input program parameter to output parameter symbols.
- utils::Hashmap<const sem::Parameter*, PtrParamSymbols, 4> ptr_param_symbols;
+ Hashmap<const sem::Parameter*, PtrParamSymbols, 4> ptr_param_symbols;
/// The declaration order of the variant, in relation to other variants of the same
/// function. Used to ensure deterministic ordering of the transform, as map iteration is
@@ -360,13 +360,13 @@
/// FnInfo holds information about a function in the input program.
struct FnInfo {
/// A map of variant signature to the variant data.
- utils::Hashmap<FnVariant::Signature, FnVariant, 8> variants;
+ Hashmap<FnVariant::Signature, FnVariant, 8> variants;
/// A map of expressions that have been hoisted to a 'let' declaration in the function.
- utils::Hashmap<const sem::ValueExpression*, Symbol, 8> hoisted_exprs;
+ Hashmap<const sem::ValueExpression*, Symbol, 8> hoisted_exprs;
/// @returns the variants of the function in a deterministically ordered vector.
- utils::Vector<std::pair<const FnVariant::Signature*, FnVariant*>, 8> SortedVariants() {
- utils::Vector<std::pair<const FnVariant::Signature*, FnVariant*>, 8> out;
+ tint::Vector<std::pair<const FnVariant::Signature*, FnVariant*>, 8> SortedVariants() {
+ tint::Vector<std::pair<const FnVariant::Signature*, FnVariant*>, 8> out;
out.Reserve(variants.Count());
for (auto it : variants) {
out.Push({&it.key, &it.value});
@@ -387,21 +387,21 @@
/// Alias to the symbols in ctx.src
const SymbolTable& sym = ctx.src->Symbols();
/// Map of semantic function to the function info
- utils::Hashmap<const sem::Function*, FnInfo*, 8> fns;
+ Hashmap<const sem::Function*, FnInfo*, 8> fns;
/// Map of AccessShape to the name of a type alias for the an array<u32, N> used for the
/// dynamic indices of an access chain, passed down as the transformed type of a variant's
/// pointer parameter.
- utils::Hashmap<AccessShape, Symbol, 8> dynamic_index_array_aliases;
+ Hashmap<AccessShape, Symbol, 8> dynamic_index_array_aliases;
/// Map of semantic expression to AccessChain
- utils::Hashmap<const sem::ValueExpression*, AccessChain*, 32> access_chains;
+ Hashmap<const sem::ValueExpression*, AccessChain*, 32> access_chains;
/// Allocator for FnInfo
- utils::BlockAllocator<FnInfo> fn_info_allocator;
+ BlockAllocator<FnInfo> fn_info_allocator;
/// Allocator for AccessChain
- utils::BlockAllocator<AccessChain> access_chain_allocator;
+ BlockAllocator<AccessChain> access_chain_allocator;
/// Helper used for hoisting expressions to lets
HoistToDeclBefore hoist{ctx};
/// Map of string to unique symbol (no collisions in output program).
- utils::Hashmap<std::string, Symbol, 8> unique_symbols;
+ Hashmap<std::string, Symbol, 8> unique_symbols;
/// CloneState holds pointers to the current function, variant and variant's parameters.
struct CloneState {
@@ -687,7 +687,7 @@
// Build an appropriate variant function name.
// This is derived from the original function name and the pointer parameter
// chains.
- utils::StringStream ss;
+ StringStream ss;
ss << target->Declaration()->name->symbol.Name();
for (auto* param : target->Parameters()) {
if (auto indices = target_signature.Find(param)) {
@@ -696,7 +696,7 @@
}
// Build the pointer parameter symbols.
- utils::Hashmap<const sem::Parameter*, PtrParamSymbols, 4> ptr_param_symbols;
+ Hashmap<const sem::Parameter*, PtrParamSymbols, 4> ptr_param_symbols;
for (auto param_it : target_signature) {
auto* param = param_it.key;
auto& shape = param_it.value;
@@ -826,7 +826,7 @@
// Pointer parameters in the 'uniform', 'storage' or 'workgroup' address space are
// either replaced with an array of dynamic indices, or are dropped (if there are no
// dynamic indices).
- utils::Vector<const Parameter*, 8> params;
+ tint::Vector<const Parameter*, 8> params;
for (auto* param : fn->Parameters()) {
if (auto incoming_shape = variant_sig.Find(param)) {
auto& symbols = *variant.ptr_param_symbols.Find(param);
@@ -876,7 +876,7 @@
}
// Build the new call expressions's arguments.
- utils::Vector<const Expression*, 8> new_args;
+ tint::Vector<const Expression*, 8> new_args;
for (size_t arg_idx = 0; arg_idx < call->Arguments().Length(); arg_idx++) {
auto* arg = call->Arguments()[arg_idx];
auto* param = call->Target()->Parameters()[arg_idx];
@@ -914,7 +914,7 @@
// Get or create the dynamic indices array.
if (auto dyn_idx_arr_ty = DynamicIndexArrayType(full_indices)) {
// Build an array of dynamic indices to pass as the replacement for the pointer.
- utils::Vector<const Expression*, 8> dyn_idx_args;
+ tint::Vector<const Expression*, 8> dyn_idx_args;
if (auto* root_param = chain->root.variable->As<sem::Parameter>()) {
// Access chain originates from a pointer parameter.
if (auto incoming_chain =
@@ -1080,7 +1080,7 @@
/// @returns a name describing the given shape
std::string AccessShapeName(const AccessShape& shape) {
- utils::StringStream ss;
+ StringStream ss;
if (IsPrivateOrFunction(shape.root.address_space)) {
ss << "F";
diff --git a/src/tint/lang/wgsl/ast/transform/direct_variable_access.h b/src/tint/lang/wgsl/ast/transform/direct_variable_access.h
index eb9dbc6..2866383 100644
--- a/src/tint/lang/wgsl/ast/transform/direct_variable_access.h
+++ b/src/tint/lang/wgsl/ast/transform/direct_variable_access.h
@@ -32,7 +32,7 @@
/// comments in src/tint/lang/wgsl/ast/transform/direct_variable_access.cc.
///
/// @note DirectVariableAccess requires the transform::Unshadow transform to have been run first.
-class DirectVariableAccess final : public utils::Castable<DirectVariableAccess, Transform> {
+class DirectVariableAccess final : public Castable<DirectVariableAccess, Transform> {
public:
/// Constructor
DirectVariableAccess();
@@ -49,7 +49,7 @@
/// Config is consumed by the DirectVariableAccess transform.
/// Config specifies the behavior of the transform.
- struct Config final : public utils::Castable<Config, Data> {
+ struct Config final : public Castable<Config, Data> {
/// Constructor
/// @param options behavior of the transform
explicit Config(const Options& options);
diff --git a/src/tint/lang/wgsl/ast/transform/disable_uniformity_analysis.h b/src/tint/lang/wgsl/ast/transform/disable_uniformity_analysis.h
index 4205acd..6bf6dc1 100644
--- a/src/tint/lang/wgsl/ast/transform/disable_uniformity_analysis.h
+++ b/src/tint/lang/wgsl/ast/transform/disable_uniformity_analysis.h
@@ -20,8 +20,7 @@
namespace tint::ast::transform {
/// Disable uniformity analysis for the program.
-class DisableUniformityAnalysis final
- : public utils::Castable<DisableUniformityAnalysis, Transform> {
+class DisableUniformityAnalysis final : public Castable<DisableUniformityAnalysis, Transform> {
public:
/// Constructor
DisableUniformityAnalysis();
diff --git a/src/tint/lang/wgsl/ast/transform/expand_compound_assignment.h b/src/tint/lang/wgsl/ast/transform/expand_compound_assignment.h
index ff43727..33da512 100644
--- a/src/tint/lang/wgsl/ast/transform/expand_compound_assignment.h
+++ b/src/tint/lang/wgsl/ast/transform/expand_compound_assignment.h
@@ -38,7 +38,7 @@
///
/// This transform also handles increment and decrement statements in the same
/// manner, by replacing `i++` with `i = i + 1`.
-class ExpandCompoundAssignment final : public utils::Castable<ExpandCompoundAssignment, Transform> {
+class ExpandCompoundAssignment final : public Castable<ExpandCompoundAssignment, Transform> {
public:
/// Constructor
ExpandCompoundAssignment();
diff --git a/src/tint/lang/wgsl/ast/transform/first_index_offset.cc b/src/tint/lang/wgsl/ast/transform/first_index_offset.cc
index cfc1c85..541f26f 100644
--- a/src/tint/lang/wgsl/ast/transform/first_index_offset.cc
+++ b/src/tint/lang/wgsl/ast/transform/first_index_offset.cc
@@ -125,7 +125,7 @@
if (has_vertex_index || has_instance_index) {
// Add uniform buffer members and calculate byte offsets
- utils::Vector<const StructMember*, 8> members;
+ tint::Vector<const StructMember*, 8> members;
members.Push(b.Member(kFirstVertexName, b.ty.u32()));
members.Push(b.Member(kFirstInstanceName, b.ty.u32()));
auto* struct_ = b.Structure(b.Sym(), std::move(members));
@@ -133,7 +133,7 @@
// Create a global to hold the uniform buffer
Symbol buffer_name = b.Sym();
b.GlobalVar(buffer_name, b.ty.Of(struct_), builtin::AddressSpace::kUniform,
- utils::Vector{
+ tint::Vector{
b.Binding(AInt(ub_binding)),
b.Group(AInt(ub_group)),
});
diff --git a/src/tint/lang/wgsl/ast/transform/first_index_offset.h b/src/tint/lang/wgsl/ast/transform/first_index_offset.h
index a2504b9..d59713d 100644
--- a/src/tint/lang/wgsl/ast/transform/first_index_offset.h
+++ b/src/tint/lang/wgsl/ast/transform/first_index_offset.h
@@ -57,12 +57,12 @@
/// }
/// ```
///
-class FirstIndexOffset final : public utils::Castable<FirstIndexOffset, Transform> {
+class FirstIndexOffset final : public Castable<FirstIndexOffset, Transform> {
public:
/// BindingPoint is consumed by the FirstIndexOffset transform.
/// BindingPoint specifies the binding point of the first index uniform
/// buffer.
- struct BindingPoint final : public utils::Castable<BindingPoint, Data> {
+ struct BindingPoint final : public Castable<BindingPoint, Data> {
/// Constructor
BindingPoint();
@@ -82,7 +82,7 @@
/// Data is outputted by the FirstIndexOffset transform.
/// Data holds information about shader usage and constant buffer offsets.
- struct Data final : public utils::Castable<Data, transform::Data> {
+ struct Data final : public Castable<Data, transform::Data> {
/// Constructor
/// @param has_vtx_index True if the shader uses vertex_index
/// @param has_inst_index True if the shader uses instance_index
diff --git a/src/tint/lang/wgsl/ast/transform/fold_trivial_lets.cc b/src/tint/lang/wgsl/ast/transform/fold_trivial_lets.cc
index 7c517af..a7cbd26 100644
--- a/src/tint/lang/wgsl/ast/transform/fold_trivial_lets.cc
+++ b/src/tint/lang/wgsl/ast/transform/fold_trivial_lets.cc
@@ -52,7 +52,7 @@
};
// A map from semantic variables to their PendingLet descriptors.
- utils::Hashmap<const sem::Variable*, PendingLet, 16> pending_lets;
+ Hashmap<const sem::Variable*, PendingLet, 16> pending_lets;
// Helper that folds pending let declarations into `expr` if possible.
auto fold_lets = [&](const Expression* expr) {
diff --git a/src/tint/lang/wgsl/ast/transform/fold_trivial_lets.h b/src/tint/lang/wgsl/ast/transform/fold_trivial_lets.h
index 2ce8f12..913922d 100644
--- a/src/tint/lang/wgsl/ast/transform/fold_trivial_lets.h
+++ b/src/tint/lang/wgsl/ast/transform/fold_trivial_lets.h
@@ -22,7 +22,7 @@
/// FoldTrivialLets is a transform that inlines the initializers of let declarations whose
/// initializers are just identifier expressions, or lets that are only used once. This is used to
/// clean up unnecessary let declarations created by the SPIR-V reader.
-class FoldTrivialLets final : public utils::Castable<FoldTrivialLets, Transform> {
+class FoldTrivialLets final : public Castable<FoldTrivialLets, Transform> {
public:
/// Constructor
FoldTrivialLets();
diff --git a/src/tint/lang/wgsl/ast/transform/for_loop_to_loop.cc b/src/tint/lang/wgsl/ast/transform/for_loop_to_loop.cc
index 6ccf159..aac4039 100644
--- a/src/tint/lang/wgsl/ast/transform/for_loop_to_loop.cc
+++ b/src/tint/lang/wgsl/ast/transform/for_loop_to_loop.cc
@@ -48,7 +48,7 @@
CloneContext ctx{&b, src, /* auto_clone_symbols */ true};
ctx.ReplaceAll([&](const ForLoopStatement* for_loop) -> const Statement* {
- utils::Vector<const Statement*, 8> stmts;
+ tint::Vector<const Statement*, 8> stmts;
if (auto* cond = for_loop->condition) {
// !condition
auto* not_cond = b.Not(ctx.Clone(cond));
diff --git a/src/tint/lang/wgsl/ast/transform/for_loop_to_loop.h b/src/tint/lang/wgsl/ast/transform/for_loop_to_loop.h
index 8d2ff51..2b5c5fa 100644
--- a/src/tint/lang/wgsl/ast/transform/for_loop_to_loop.h
+++ b/src/tint/lang/wgsl/ast/transform/for_loop_to_loop.h
@@ -21,7 +21,7 @@
/// ForLoopToLoop is a Transform that converts a for-loop statement into a loop
/// statement. This is required by the SPIR-V writer.
-class ForLoopToLoop final : public utils::Castable<ForLoopToLoop, Transform> {
+class ForLoopToLoop final : public Castable<ForLoopToLoop, Transform> {
public:
/// Constructor
ForLoopToLoop();
diff --git a/src/tint/lang/wgsl/ast/transform/localize_struct_array_assignment.cc b/src/tint/lang/wgsl/ast/transform/localize_struct_array_assignment.cc
index 9dfe4ae..1e7160e 100644
--- a/src/tint/lang/wgsl/ast/transform/localize_struct_array_assignment.cc
+++ b/src/tint/lang/wgsl/ast/transform/localize_struct_array_assignment.cc
@@ -43,8 +43,8 @@
ApplyResult Run() {
struct Shared {
bool process_nested_nodes = false;
- utils::Vector<const Statement*, 4> insert_before_stmts;
- utils::Vector<const Statement*, 4> insert_after_stmts;
+ tint::Vector<const Statement*, 4> insert_before_stmts;
+ tint::Vector<const Statement*, 4> insert_after_stmts;
} s;
bool made_changes = false;
@@ -135,7 +135,7 @@
// e.g. *(tint_symbol) = tint_symbol_1;
auto* assign_rhs_to_temp = b.Assign(b.Deref(mem_access_ptr), tmp_var);
{
- utils::Vector<const Statement*, 8> stmts{assign_rhs_to_temp};
+ tint::Vector<const Statement*, 8> stmts{assign_rhs_to_temp};
for (auto* stmt : s.insert_after_stmts) {
stmts.Push(stmt);
}
diff --git a/src/tint/lang/wgsl/ast/transform/localize_struct_array_assignment.h b/src/tint/lang/wgsl/ast/transform/localize_struct_array_assignment.h
index 0b62934..32cf93e 100644
--- a/src/tint/lang/wgsl/ast/transform/localize_struct_array_assignment.h
+++ b/src/tint/lang/wgsl/ast/transform/localize_struct_array_assignment.h
@@ -28,7 +28,7 @@
/// @note Depends on the following transforms to have been run first:
/// * SimplifyPointers
class LocalizeStructArrayAssignment final
- : public utils::Castable<LocalizeStructArrayAssignment, Transform> {
+ : public Castable<LocalizeStructArrayAssignment, Transform> {
public:
/// Constructor
LocalizeStructArrayAssignment();
diff --git a/src/tint/lang/wgsl/ast/transform/merge_return.cc b/src/tint/lang/wgsl/ast/transform/merge_return.cc
index 7b397fc..478d09e 100644
--- a/src/tint/lang/wgsl/ast/transform/merge_return.cc
+++ b/src/tint/lang/wgsl/ast/transform/merge_return.cc
@@ -117,7 +117,7 @@
ProcessStatement(l->body);
},
[&](const ReturnStatement* r) {
- utils::Vector<const Statement*, 3> stmts;
+ tint::Vector<const Statement*, 3> stmts;
// Set the return flag to signal that we have hit a return.
stmts.Push(b.Assign(b.Expr(flag), true));
if (r->value) {
@@ -148,7 +148,7 @@
// We may introduce conditionals around statements that follow a statement with the
// `Return` behavior, so build a stack of statement lists that represent the new
// (potentially nested) conditional blocks.
- utils::Vector<utils::Vector<const Statement*, 8>, 8> new_stmts({{}});
+ tint::Vector<tint::Vector<const Statement*, 8>, 8> new_stmts({{}});
// Insert variables for the return flag and return value at the top of the function.
if (block == function->body) {
@@ -178,7 +178,7 @@
// break. Otherwise check the return flag.
if (HasBehavior(ctx.src, s, sem::Behavior::kNext)) {
new_stmts.Back().Push(
- b.If(b.Expr(flag), b.Block(utils::Vector{b.Break()})));
+ b.If(b.Expr(flag), b.Block(tint::Vector{b.Break()})));
} else {
new_stmts.Back().Push(b.Break());
}
diff --git a/src/tint/lang/wgsl/ast/transform/merge_return.h b/src/tint/lang/wgsl/ast/transform/merge_return.h
index 3d295b9..07e085d 100644
--- a/src/tint/lang/wgsl/ast/transform/merge_return.h
+++ b/src/tint/lang/wgsl/ast/transform/merge_return.h
@@ -20,7 +20,7 @@
namespace tint::ast::transform {
/// Merge return statements into a single return at the end of the function.
-class MergeReturn final : public utils::Castable<MergeReturn, Transform> {
+class MergeReturn final : public Castable<MergeReturn, Transform> {
public:
/// Constructor
MergeReturn();
diff --git a/src/tint/lang/wgsl/ast/transform/module_scope_var_to_entry_point_param.cc b/src/tint/lang/wgsl/ast/transform/module_scope_var_to_entry_point_param.cc
index dde947d..4b3eb50 100644
--- a/src/tint/lang/wgsl/ast/transform/module_scope_var_to_entry_point_param.cc
+++ b/src/tint/lang/wgsl/ast/transform/module_scope_var_to_entry_point_param.cc
@@ -35,7 +35,7 @@
namespace tint::ast::transform {
namespace {
-using StructMemberList = utils::Vector<const StructMember*, 8>;
+using StructMemberList = tint::Vector<const StructMember*, 8>;
// The name of the struct member for arrays that are wrapped in structures.
const char* kWrappedArrayMemberName = "arr";
@@ -154,7 +154,7 @@
// representable in Tint's AST.
CloneStructTypes(ty);
auto* wrapper = ctx.dst->Structure(
- ctx.dst->Sym(), utils::Vector{
+ ctx.dst->Sym(), tint::Vector{
ctx.dst->Member(kWrappedArrayMemberName, param_type),
});
param_type = ctx.dst->ty.Of(wrapper);
@@ -193,7 +193,7 @@
ctx.dst->Disable(DisabledValidation::kIgnoreAddressSpace);
auto* initializer = ctx.Clone(var->Declaration()->initializer);
auto* local_var = ctx.dst->Var(new_var_symbol, store_type(), sc, initializer,
- utils::Vector{disable_validation});
+ tint::Vector{disable_validation});
ctx.InsertFront(func->body->statements, ctx.dst->Decl(local_var));
}
break;
@@ -201,7 +201,7 @@
case builtin::AddressSpace::kPushConstant: {
ctx.dst->Diagnostics().add_error(
diag::System::Transform,
- "unhandled module-scope address space (" + utils::ToString(sc) + ")");
+ "unhandled module-scope address space (" + tint::ToString(sc) + ")");
break;
}
default: {
@@ -237,7 +237,7 @@
case builtin::AddressSpace::kPushConstant: {
ctx.dst->Diagnostics().add_error(
diag::System::Transform,
- "unhandled module-scope address space (" + utils::ToString(sc) + ")");
+ "unhandled module-scope address space (" + tint::ToString(sc) + ")");
break;
}
default: {
@@ -247,7 +247,7 @@
}
// Use a pointer for non-handle types.
- utils::Vector<const Attribute*, 2> attributes;
+ tint::Vector<const Attribute*, 2> attributes;
if (!ty->is_handle()) {
param_type = sc == builtin::AddressSpace::kStorage
? ctx.dst->ty.ptr(sc, param_type, var->Access())
@@ -301,14 +301,14 @@
/// Process the module.
void Process() {
// Predetermine the list of function calls that need to be replaced.
- using CallList = utils::Vector<const CallExpression*, 8>;
+ using CallList = tint::Vector<const CallExpression*, 8>;
std::unordered_map<const Function*, CallList> calls_to_replace;
- utils::Vector<const Function*, 8> functions_to_process;
+ tint::Vector<const Function*, 8> functions_to_process;
// Collect private variables into a single structure.
StructMemberList private_struct_members;
- utils::Vector<std::function<const AssignmentStatement*()>, 4> private_initializers;
+ tint::Vector<std::function<const AssignmentStatement*()>, 4> private_initializers;
std::unordered_set<const Function*> uses_privates;
// Build a list of functions that transitively reference any module-scope variables.
@@ -416,7 +416,7 @@
auto* var =
ctx.dst->Var(PrivateStructVariableName(), ctx.dst->ty(PrivateStructName()),
builtin::AddressSpace::kPrivate,
- utils::Vector{
+ tint::Vector{
ctx.dst->Disable(DisabledValidation::kIgnoreAddressSpace),
});
ctx.InsertFront(func_ast->body->statements, ctx.dst->Decl(var));
@@ -491,7 +491,7 @@
auto param_type = ctx.dst->ty.ptr(workgroup, ctx.dst->ty.Of(str));
auto* param =
ctx.dst->Param(workgroup_param(), param_type,
- utils::Vector{
+ tint::Vector{
ctx.dst->Disable(DisabledValidation::kEntryPointParameter),
ctx.dst->Disable(DisabledValidation::kIgnoreAddressSpace),
});
diff --git a/src/tint/lang/wgsl/ast/transform/module_scope_var_to_entry_point_param.h b/src/tint/lang/wgsl/ast/transform/module_scope_var_to_entry_point_param.h
index 4136aa6..f4f4491 100644
--- a/src/tint/lang/wgsl/ast/transform/module_scope_var_to_entry_point_param.h
+++ b/src/tint/lang/wgsl/ast/transform/module_scope_var_to_entry_point_param.h
@@ -62,7 +62,7 @@
/// }
/// ```
class ModuleScopeVarToEntryPointParam final
- : public utils::Castable<ModuleScopeVarToEntryPointParam, Transform> {
+ : public Castable<ModuleScopeVarToEntryPointParam, Transform> {
public:
/// Constructor
ModuleScopeVarToEntryPointParam();
diff --git a/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture.cc b/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture.cc
index 667de6c..e059ba1 100644
--- a/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture.cc
+++ b/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture.cc
@@ -66,7 +66,7 @@
Symbol params_struct_sym;
/// Symbol for the textureLoadExternal functions
- utils::Hashmap<const sem::CallTarget*, Symbol, 2> texture_load_external_fns;
+ Hashmap<const sem::CallTarget*, Symbol, 2> texture_load_external_fns;
/// Symbol for the textureSampleExternal function
Symbol texture_sample_external_sym;
@@ -241,7 +241,7 @@
/// Creates the parameter structs associated with the transform.
void createExtTexParamsStructs() {
// Create GammaTransferParams struct.
- utils::Vector gamma_transfer_member_list{
+ tint::Vector gamma_transfer_member_list{
b.Member("G", b.ty.f32()), b.Member("A", b.ty.f32()), b.Member("B", b.ty.f32()),
b.Member("C", b.ty.f32()), b.Member("D", b.ty.f32()), b.Member("E", b.ty.f32()),
b.Member("F", b.ty.f32()), b.Member("padding", b.ty.u32())};
@@ -251,7 +251,7 @@
b.Structure(gamma_transfer_struct_sym, gamma_transfer_member_list);
// Create ExternalTextureParams struct.
- utils::Vector ext_tex_params_member_list{
+ tint::Vector ext_tex_params_member_list{
b.Member("numPlanes", b.ty.u32()),
b.Member("doYuvToRgbConversionOnly", b.ty.u32()),
b.Member("yuvToRgbConversionMatrix", b.ty.mat3x4<f32>()),
@@ -272,12 +272,12 @@
gamma_correction_sym = b.Symbols().New("gammaCorrection");
b.Func(gamma_correction_sym,
- utils::Vector{
+ tint::Vector{
b.Param("v", b.ty.vec3<f32>()),
b.Param("params", b.ty(gamma_transfer_struct_sym)),
},
b.ty.vec3<f32>(),
- utils::Vector{
+ tint::Vector{
// let cond = abs(v) < vec3(params.D);
b.Decl(b.Let("cond",
b.LessThan(b.Call("abs", "v"),
@@ -307,7 +307,7 @@
/// @param call_type determines which function body to generate
/// @returns a statement list that makes of the body of the chosen function
auto buildTextureBuiltinBody(builtin::Function call_type) {
- utils::Vector<const Statement*, 16> stmts;
+ tint::Vector<const Statement*, 16> stmts;
const CallExpression* single_plane_call = nullptr;
const CallExpression* plane_0_call = nullptr;
const CallExpression* plane_1_call = nullptr;
@@ -419,7 +419,7 @@
// Emit the textureSampleExternal function.
b.Func(texture_sample_external_sym,
- utils::Vector{
+ tint::Vector{
b.Param("plane0",
b.ty.sampled_texture(type::TextureDimension::k2d, b.ty.f32())),
b.Param("plane1",
@@ -432,7 +432,7 @@
buildTextureBuiltinBody(builtin::Function::kTextureSampleBaseClampToEdge));
}
- return b.Call(texture_sample_external_sym, utils::Vector{
+ return b.Call(texture_sample_external_sym, tint::Vector{
plane_0_binding_param,
b.Expr(syms.plane_1),
ctx.Clone(expr->args[1]),
@@ -467,7 +467,7 @@
// Emit the textureLoadExternal() function.
b.Func(name,
- utils::Vector{
+ tint::Vector{
b.Param("plane0",
b.ty.sampled_texture(type::TextureDimension::k2d, b.ty.f32())),
b.Param("plane1",
diff --git a/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture.h b/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture.h
index 963555b..4270af3 100644
--- a/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture.h
+++ b/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture.h
@@ -37,8 +37,7 @@
/// decoding, gamut conversion, and gamma encoding steps. Specifically
// for BT.709 to SRGB conversion, it takes the fast path only doing the yuv->rgb
// step and skipping all other steps.
-class MultiplanarExternalTexture final
- : public utils::Castable<MultiplanarExternalTexture, Transform> {
+class MultiplanarExternalTexture final : public Castable<MultiplanarExternalTexture, Transform> {
public:
/// This struct identifies the binding groups and locations for new bindings to
/// use when transforming a texture_external instance.
@@ -52,7 +51,7 @@
/// NewBindingPoints is consumed by the MultiplanarExternalTexture transform.
/// Data holds information about location of each texture_external binding and
/// which binding slots it should expand into.
- struct NewBindingPoints final : public utils::Castable<NewBindingPoints, Data> {
+ struct NewBindingPoints final : public Castable<NewBindingPoints, Data> {
/// Constructor
/// @param bm a map to the new binding slots to use.
explicit NewBindingPoints(BindingsMap bm);
diff --git a/src/tint/lang/wgsl/ast/transform/num_workgroups_from_uniform.cc b/src/tint/lang/wgsl/ast/transform/num_workgroups_from_uniform.cc
index bf81993..f6d1766 100644
--- a/src/tint/lang/wgsl/ast/transform/num_workgroups_from_uniform.cc
+++ b/src/tint/lang/wgsl/ast/transform/num_workgroups_from_uniform.cc
@@ -54,7 +54,7 @@
}
/// Hash function
struct Hasher {
- size_t operator()(const Accessor& a) const { return utils::Hash(a.param, a.member); }
+ size_t operator()(const Accessor& a) const { return Hash(a.param, a.member); }
};
};
@@ -130,7 +130,7 @@
auto get_ubo = [&] {
if (!num_workgroups_ubo) {
auto* num_workgroups_struct =
- b.Structure(b.Sym(), utils::Vector{
+ b.Structure(b.Sym(), tint::Vector{
b.Member(kNumWorkgroupsMemberName, b.ty.vec3(b.ty.u32())),
});
diff --git a/src/tint/lang/wgsl/ast/transform/num_workgroups_from_uniform.h b/src/tint/lang/wgsl/ast/transform/num_workgroups_from_uniform.h
index 92331d5..bb86bfc 100644
--- a/src/tint/lang/wgsl/ast/transform/num_workgroups_from_uniform.h
+++ b/src/tint/lang/wgsl/ast/transform/num_workgroups_from_uniform.h
@@ -44,7 +44,7 @@
///
/// @note Depends on the following transforms to have been run first:
/// * CanonicalizeEntryPointIO
-class NumWorkgroupsFromUniform final : public utils::Castable<NumWorkgroupsFromUniform, Transform> {
+class NumWorkgroupsFromUniform final : public Castable<NumWorkgroupsFromUniform, Transform> {
public:
/// Constructor
NumWorkgroupsFromUniform();
@@ -52,7 +52,7 @@
~NumWorkgroupsFromUniform() override;
/// Configuration options for the NumWorkgroupsFromUniform transform.
- struct Config final : public utils::Castable<Config, Data> {
+ struct Config final : public Castable<Config, Data> {
/// Constructor
/// @param ubo_bp the binding point to use for the generated uniform buffer. If ubo_bp
/// contains no value, a free binding point will be used to ensure the generated program is
diff --git a/src/tint/lang/wgsl/ast/transform/packed_vec3.cc b/src/tint/lang/wgsl/ast/transform/packed_vec3.cc
index 0f13d97..3042898 100644
--- a/src/tint/lang/wgsl/ast/transform/packed_vec3.cc
+++ b/src/tint/lang/wgsl/ast/transform/packed_vec3.cc
@@ -51,16 +51,16 @@
static constexpr const char* kStructMemberName = "elements";
/// The names of the structures used to wrap packed vec3 types.
- utils::Hashmap<const type::Type*, Symbol, 4> packed_vec3_wrapper_struct_names;
+ Hashmap<const type::Type*, Symbol, 4> packed_vec3_wrapper_struct_names;
/// A cache of host-shareable structures that have been rewritten.
- utils::Hashmap<const type::Type*, Symbol, 4> rewritten_structs;
+ Hashmap<const type::Type*, Symbol, 4> rewritten_structs;
/// A map from type to the name of a helper function used to pack that type.
- utils::Hashmap<const type::Type*, Symbol, 4> pack_helpers;
+ Hashmap<const type::Type*, Symbol, 4> pack_helpers;
/// A map from type to the name of a helper function used to unpack that type.
- utils::Hashmap<const type::Type*, Symbol, 4> unpack_helpers;
+ Hashmap<const type::Type*, Symbol, 4> unpack_helpers;
/// @param ty the type to test
/// @returns true if `ty` is a vec3, false otherwise
@@ -124,8 +124,8 @@
(array_element ? "_array_element" : "_struct_member"));
auto* member =
b.Member(kStructMemberName, MakePackedVec3(vec),
- utils::Vector{b.MemberAlign(AInt(vec->Align()))});
- b.Structure(b.Ident(name), utils::Vector{member}, utils::Empty);
+ tint::Vector{b.MemberAlign(AInt(vec->Align()))});
+ b.Structure(b.Ident(name), tint::Vector{member}, tint::Empty);
return name;
}));
} else {
@@ -146,7 +146,7 @@
// Rewrite the array with the modified element type.
auto new_type = RewriteType(arr->ElemType(), /* array_element */ true);
if (new_type) {
- utils::Vector<const Attribute*, 1> attrs;
+ tint::Vector<const Attribute*, 1> attrs;
if (arr->Count()->Is<type::RuntimeArrayCount>()) {
return b.ty.array(new_type, std::move(attrs));
} else if (auto count = arr->ConstantCount()) {
@@ -162,14 +162,14 @@
[&](const type::Struct* str) -> Type {
if (ContainsVec3(str)) {
auto name = rewritten_structs.GetOrCreate(str, [&] {
- utils::Vector<const StructMember*, 4> members;
+ tint::Vector<const StructMember*, 4> members;
for (auto* member : str->Members()) {
// If the member type contains a vec3, rewrite it.
auto new_type = RewriteType(member->Type());
if (new_type) {
// Copy the member attributes.
bool needs_align = true;
- utils::Vector<const Attribute*, 4> attributes;
+ tint::Vector<const Attribute*, 4> attributes;
if (auto* sem_mem = member->As<sem::StructMember>()) {
for (auto* attr : sem_mem->Declaration()->attributes) {
if (attr->IsAnyOf<StructMemberAlignAttribute,
@@ -192,8 +192,8 @@
if (auto* sem_mem = member->As<sem::StructMember>()) {
members.Push(ctx.Clone(sem_mem->Declaration()));
} else {
- members.Push(b.Member(ctx.Clone(member->Name()), new_type,
- utils::Empty));
+ members.Push(
+ b.Member(ctx.Clone(member->Name()), new_type, tint::Empty));
}
}
}
@@ -224,7 +224,7 @@
const std::function<Type()>& in_type,
const std::function<Type()>& out_type) {
// Allocate a variable to hold the return value of the function.
- utils::Vector<const Statement*, 4> statements;
+ tint::Vector<const Statement*, 4> statements;
statements.Push(b.Decl(b.Var("result", out_type())));
// Helper that generates a loop to copy and pack/unpack elements of an array to the result:
@@ -238,7 +238,7 @@
b.Decl(b.Var("i", b.ty.u32())), //
b.LessThan("i", u32(num_elements)), //
b.Assign("i", b.Add("i", 1_a)), //
- b.Block(utils::Vector{
+ b.Block(tint::Vector{
b.Assign(b.IndexAccessor("result", "i"), element),
})));
};
@@ -271,7 +271,7 @@
// Create the function and return its name.
auto name = b.Symbols().New(name_prefix);
- b.Func(name, utils::Vector{b.Param("in", in_type())}, out_type(), std::move(statements));
+ b.Func(name, tint::Vector{b.Param("in", in_type())}, out_type(), std::move(statements));
return name;
}
@@ -363,8 +363,8 @@
b.Enable(builtin::Extension::kChromiumInternalRelaxedUniformLayout);
// Track expressions that need to be packed or unpacked.
- utils::Hashset<const sem::ValueExpression*, 8> to_pack;
- utils::Hashset<const sem::ValueExpression*, 8> to_unpack;
+ Hashset<const sem::ValueExpression*, 8> to_pack;
+ Hashset<const sem::ValueExpression*, 8> to_unpack;
// Replace vec3 types in host-shareable address spaces with `__packed_vec3` types, and
// collect expressions that need to be converted to or from values that use the
diff --git a/src/tint/lang/wgsl/ast/transform/packed_vec3.h b/src/tint/lang/wgsl/ast/transform/packed_vec3.h
index e03f2c7..52b1ddb 100644
--- a/src/tint/lang/wgsl/ast/transform/packed_vec3.h
+++ b/src/tint/lang/wgsl/ast/transform/packed_vec3.h
@@ -38,7 +38,7 @@
///
/// @note Depends on the following transforms to have been run first:
/// * ExpandCompoundAssignment
-class PackedVec3 final : public utils::Castable<PackedVec3, Transform> {
+class PackedVec3 final : public Castable<PackedVec3, Transform> {
public:
/// Constructor
PackedVec3();
diff --git a/src/tint/lang/wgsl/ast/transform/packed_vec3_test.cc b/src/tint/lang/wgsl/ast/transform/packed_vec3_test.cc
index 391cd8d..3280edc 100644
--- a/src/tint/lang/wgsl/ast/transform/packed_vec3_test.cc
+++ b/src/tint/lang/wgsl/ast/transform/packed_vec3_test.cc
@@ -4162,15 +4162,15 @@
//
// @group(0) @binding(0) var<uniform> P : S;
ProgramBuilder b;
- b.Structure("S", utils::Vector{
+ b.Structure("S", tint::Vector{
b.Member("a", b.ty.u32()),
- b.Member("v", b.ty.vec3<f32>(), utils::Vector{b.MemberOffset(AInt(32))}),
+ b.Member("v", b.ty.vec3<f32>(), tint::Vector{b.MemberOffset(AInt(32))}),
b.Member("b", b.ty.u32()),
b.Member("arr", b.ty.array(b.ty.vec3<f32>(), b.Expr(AInt(4))),
- utils::Vector{b.MemberOffset(AInt(128))}),
+ tint::Vector{b.MemberOffset(AInt(128))}),
});
b.GlobalVar("P", builtin::AddressSpace::kStorage, b.ty("S"),
- utils::Vector{b.Group(AInt(0)), b.Binding(AInt(0))});
+ tint::Vector{b.Group(AInt(0)), b.Binding(AInt(0))});
Program src(std::move(b));
auto* expect =
diff --git a/src/tint/lang/wgsl/ast/transform/pad_structs.cc b/src/tint/lang/wgsl/ast/transform/pad_structs.cc
index d2fc77d..4f2f94f 100644
--- a/src/tint/lang/wgsl/ast/transform/pad_structs.cc
+++ b/src/tint/lang/wgsl/ast/transform/pad_structs.cc
@@ -33,8 +33,8 @@
namespace {
-void CreatePadding(utils::Vector<const StructMember*, 8>* new_members,
- utils::Hashset<const StructMember*, 8>* padding_members,
+void CreatePadding(tint::Vector<const StructMember*, 8>* new_members,
+ Hashset<const StructMember*, 8>* padding_members,
ProgramBuilder* b,
uint32_t bytes) {
const size_t count = bytes / 4u;
@@ -60,7 +60,7 @@
auto& sem = src->Sem();
std::unordered_map<const Struct*, const Struct*> replaced_structs;
- utils::Hashset<const StructMember*, 8> padding_members;
+ Hashset<const StructMember*, 8> padding_members;
ctx.ReplaceAll([&](const Struct* ast_str) -> const Struct* {
auto* str = sem.Get(ast_str);
@@ -69,7 +69,7 @@
}
uint32_t offset = 0;
bool has_runtime_sized_array = false;
- utils::Vector<const StructMember*, 8> new_members;
+ tint::Vector<const StructMember*, 8> new_members;
for (auto* mem : str->Members()) {
auto name = mem->Name().Name();
@@ -86,7 +86,7 @@
uint32_t size = ty->Size();
if (ty->Is<type::Struct>() && str->UsedAs(builtin::AddressSpace::kUniform)) {
// std140 structs should be padded out to 16 bytes.
- size = utils::RoundUp(16u, size);
+ size = tint::RoundUp(16u, size);
} else if (auto* array_ty = ty->As<type::Array>()) {
if (array_ty->Count()->Is<type::RuntimeArrayCount>()) {
has_runtime_sized_array = true;
@@ -98,15 +98,15 @@
// Add any required padding after the last member, if it's not a runtime-sized array.
uint32_t struct_size = str->Size();
if (str->UsedAs(builtin::AddressSpace::kUniform)) {
- struct_size = utils::RoundUp(16u, struct_size);
+ struct_size = tint::RoundUp(16u, struct_size);
}
if (offset < struct_size && !has_runtime_sized_array) {
CreatePadding(&new_members, &padding_members, ctx.dst, struct_size - offset);
}
- utils::Vector<const Attribute*, 1> struct_attribs;
+ tint::Vector<const Attribute*, 1> struct_attribs;
if (!padding_members.IsEmpty()) {
- struct_attribs = utils::Vector{b.Disable(DisabledValidation::kIgnoreStructMemberLimit)};
+ struct_attribs = tint::Vector{b.Disable(DisabledValidation::kIgnoreStructMemberLimit)};
}
auto* new_struct = b.create<Struct>(ctx.Clone(ast_str->name), std::move(new_members),
@@ -138,7 +138,7 @@
return nullptr;
}
- utils::Vector<const Expression*, 8> new_args;
+ tint::Vector<const Expression*, 8> new_args;
auto* arg = ast_call->args.begin();
for (auto* member : new_struct->members) {
diff --git a/src/tint/lang/wgsl/ast/transform/pad_structs.h b/src/tint/lang/wgsl/ast/transform/pad_structs.h
index 64d42d1..f8f50f4 100644
--- a/src/tint/lang/wgsl/ast/transform/pad_structs.h
+++ b/src/tint/lang/wgsl/ast/transform/pad_structs.h
@@ -24,7 +24,7 @@
/// the offset= decoration.
///
/// @note This transform requires the CanonicalizeEntryPointIO transform to have been run first.
-class PadStructs final : public utils::Castable<PadStructs, Transform> {
+class PadStructs final : public Castable<PadStructs, Transform> {
public:
/// Constructor
PadStructs();
diff --git a/src/tint/lang/wgsl/ast/transform/preserve_padding.cc b/src/tint/lang/wgsl/ast/transform/preserve_padding.cc
index 3ae1a68..d4fb411 100644
--- a/src/tint/lang/wgsl/ast/transform/preserve_padding.cc
+++ b/src/tint/lang/wgsl/ast/transform/preserve_padding.cc
@@ -121,7 +121,7 @@
EnableExtension();
auto helper = helpers.GetOrCreate(ty, [&] {
auto helper_name = b.Symbols().New("assign_and_preserve_padding");
- utils::Vector<const Parameter*, 2> params = {
+ tint::Vector<const Parameter*, 2> params = {
b.Param(kDestParamName,
b.ty.ptr<storage, read_write>(CreateASTTypeFor(ctx, ty))),
b.Param(kValueParamName, CreateASTTypeFor(ctx, ty)),
@@ -137,7 +137,7 @@
[&](const type::Array* arr) {
// Call a helper function that uses a loop to assigns each element separately.
return call_helper([&] {
- utils::Vector<const Statement*, 8> body;
+ tint::Vector<const Statement*, 8> body;
auto* idx = b.Var("i", b.Expr(0_u));
body.Push(
b.For(b.Decl(idx), b.LessThan(idx, u32(arr->ConstantCount().value())),
@@ -151,7 +151,7 @@
[&](const type::Matrix* mat) {
// Call a helper function that assigns each column separately.
return call_helper([&] {
- utils::Vector<const Statement*, 4> body;
+ tint::Vector<const Statement*, 4> body;
for (uint32_t i = 0; i < mat->columns(); i++) {
body.Push(MakeAssignment(mat->ColumnType(),
b.IndexAccessor(b.Deref(kDestParamName), u32(i)),
@@ -163,7 +163,7 @@
[&](const type::Struct* str) {
// Call a helper function that assigns each member separately.
return call_helper([&] {
- utils::Vector<const Statement*, 8> body;
+ tint::Vector<const Statement*, 8> body;
for (auto member : str->Members()) {
auto name = member->Name().Name();
body.Push(MakeAssignment(member->Type(),
@@ -235,7 +235,7 @@
/// Flag to track whether we have already enabled the full pointer parameters extension.
bool ext_enabled = false;
/// Map of semantic types to their assignment helper functions.
- utils::Hashmap<const type::Type*, Symbol, 8> helpers;
+ Hashmap<const type::Type*, Symbol, 8> helpers;
};
Transform::ApplyResult PreservePadding::Apply(const Program* program,
diff --git a/src/tint/lang/wgsl/ast/transform/preserve_padding.h b/src/tint/lang/wgsl/ast/transform/preserve_padding.h
index 4100013..21c8131 100644
--- a/src/tint/lang/wgsl/ast/transform/preserve_padding.h
+++ b/src/tint/lang/wgsl/ast/transform/preserve_padding.h
@@ -26,7 +26,7 @@
/// assignments into element-wise assignments via helper functions.
///
/// @note Assumes that the DirectVariableTransform will be run afterwards for backends that need it.
-class PreservePadding final : public utils::Castable<PreservePadding, Transform> {
+class PreservePadding final : public Castable<PreservePadding, Transform> {
public:
/// Constructor
PreservePadding();
diff --git a/src/tint/lang/wgsl/ast/transform/promote_initializers_to_let.cc b/src/tint/lang/wgsl/ast/transform/promote_initializers_to_let.cc
index 7fb47b4..7a520bb 100644
--- a/src/tint/lang/wgsl/ast/transform/promote_initializers_to_let.cc
+++ b/src/tint/lang/wgsl/ast/transform/promote_initializers_to_let.cc
@@ -82,9 +82,9 @@
};
// A list of expressions that should be hoisted.
- utils::Vector<const sem::ValueExpression*, 32> to_hoist;
+ tint::Vector<const sem::ValueExpression*, 32> to_hoist;
// A set of expressions that are constant, which _may_ need to be hoisted.
- utils::Hashset<const Expression*, 32> const_chains;
+ Hashset<const Expression*, 32> const_chains;
// Walk the AST nodes. This order guarantees that leaf-expressions are visited first.
for (auto* node : src->ASTNodes().Objects()) {
diff --git a/src/tint/lang/wgsl/ast/transform/promote_initializers_to_let.h b/src/tint/lang/wgsl/ast/transform/promote_initializers_to_let.h
index bbc473b..cb6ecba 100644
--- a/src/tint/lang/wgsl/ast/transform/promote_initializers_to_let.h
+++ b/src/tint/lang/wgsl/ast/transform/promote_initializers_to_let.h
@@ -25,7 +25,7 @@
/// array or structure. For example, the following is not immediately expressable for HLSL:
/// `array<i32, 2>(1, 2)[0]`
/// @see crbug.com/tint/406
-class PromoteInitializersToLet final : public utils::Castable<PromoteInitializersToLet, Transform> {
+class PromoteInitializersToLet final : public Castable<PromoteInitializersToLet, Transform> {
public:
/// Constructor
PromoteInitializersToLet();
diff --git a/src/tint/lang/wgsl/ast/transform/promote_side_effects_to_decl.cc b/src/tint/lang/wgsl/ast/transform/promote_side_effects_to_decl.cc
index f92eb9c1..2aa2cd0 100644
--- a/src/tint/lang/wgsl/ast/transform/promote_side_effects_to_decl.cc
+++ b/src/tint/lang/wgsl/ast/transform/promote_side_effects_to_decl.cc
@@ -52,7 +52,7 @@
// This first transform converts side-effecting for-loops to loops and else-ifs
// to else {if}s so that the next transform, DecomposeSideEffects, can insert
// hoisted expressions above their current location.
-struct SimplifySideEffectStatements : tint::utils::Castable<PromoteSideEffectsToDecl, Transform> {
+struct SimplifySideEffectStatements : Castable<PromoteSideEffectsToDecl, Transform> {
ApplyResult Apply(const Program* src, const DataMap& inputs, DataMap& outputs) const override;
};
@@ -87,7 +87,7 @@
// Decomposes side-effecting expressions to ensure order of evaluation. This
// handles both breaking down logical binary expressions for short-circuit
// evaluation, as well as hoisting expressions to ensure order of evaluation.
-struct DecomposeSideEffects : tint::utils::Castable<PromoteSideEffectsToDecl, Transform> {
+struct DecomposeSideEffects : Castable<PromoteSideEffectsToDecl, Transform> {
class CollectHoistsState;
class DecomposeState;
ApplyResult Apply(const Program* src, const DataMap& inputs, DataMap& outputs) const override;
@@ -179,7 +179,7 @@
// Hoists any expressions in `maybe_hoist` and clears it
template <size_t N>
- void Flush(tint::utils::Vector<const Expression*, N>& maybe_hoist) {
+ void Flush(tint::Vector<const Expression*, N>& maybe_hoist) {
for (auto* m : maybe_hoist) {
Hoist(m);
}
@@ -198,7 +198,7 @@
// single memory location.
template <size_t N>
bool ProcessExpression(const Expression* expr,
- tint::utils::Vector<const Expression*, N>& maybe_hoist) {
+ tint::Vector<const Expression*, N>& maybe_hoist) {
auto process = [&](const Expression* e) -> bool {
return ProcessExpression(e, maybe_hoist);
};
@@ -339,7 +339,7 @@
return;
}
- tint::utils::Vector<const Expression*, 8> maybe_hoist;
+ tint::Vector<const Expression*, 8> maybe_hoist;
ProcessExpression(expr, maybe_hoist);
}
@@ -358,7 +358,7 @@
Switch(
stmt, //
[&](const AssignmentStatement* s) {
- tint::utils::Vector<const Expression*, 8> maybe_hoist;
+ tint::Vector<const Expression*, 8> maybe_hoist;
ProcessExpression(s->lhs, maybe_hoist);
ProcessExpression(s->rhs, maybe_hoist);
},
@@ -398,7 +398,7 @@
// Recursive function used to decompose an expression for short-circuit eval.
template <size_t N>
const Expression* Decompose(const Expression* expr,
- tint::utils::Vector<const Statement*, N>* curr_stmts) {
+ tint::Vector<const Statement*, N>* curr_stmts) {
// Helper to avoid passing in same args.
auto decompose = [&](auto& e) { return Decompose(e, curr_stmts); };
@@ -467,7 +467,7 @@
const BlockStatement* if_body = nullptr;
{
- tint::utils::Vector<const Statement*, N> stmts;
+ tint::Vector<const Statement*, N> stmts;
TINT_SCOPED_ASSIGNMENT(curr_stmts, &stmts);
auto* new_rhs = decompose(bin_expr->rhs);
curr_stmts->Push(b.Assign(name, new_rhs));
@@ -519,7 +519,7 @@
// Inserts statements in `stmts` before `stmt`
template <size_t N>
- void InsertBefore(tint::utils::Vector<const Statement*, N>& stmts, const Statement* stmt) {
+ void InsertBefore(tint::Vector<const Statement*, N>& stmts, const Statement* stmt) {
if (!stmts.IsEmpty()) {
auto ip = utils::GetInsertionPoint(ctx, stmt);
for (auto* s : stmts) {
@@ -539,7 +539,7 @@
return nullptr;
}
// lhs before rhs
- tint::utils::Vector<const Statement*, 8> stmts;
+ tint::Vector<const Statement*, 8> stmts;
ctx.Replace(s->lhs, Decompose(s->lhs, &stmts));
ctx.Replace(s->rhs, Decompose(s->rhs, &stmts));
InsertBefore(stmts, s);
@@ -549,7 +549,7 @@
if (!sem.Get(s->expr)->HasSideEffects()) {
return nullptr;
}
- tint::utils::Vector<const Statement*, 8> stmts;
+ tint::Vector<const Statement*, 8> stmts;
ctx.Replace(s->expr, Decompose(s->expr, &stmts));
InsertBefore(stmts, s);
return ctx.CloneWithoutTransform(s);
@@ -558,7 +558,7 @@
if (!s->condition || !sem.GetVal(s->condition)->HasSideEffects()) {
return nullptr;
}
- tint::utils::Vector<const Statement*, 8> stmts;
+ tint::Vector<const Statement*, 8> stmts;
ctx.Replace(s->condition, Decompose(s->condition, &stmts));
InsertBefore(stmts, s);
return ctx.CloneWithoutTransform(s);
@@ -567,7 +567,7 @@
if (!sem.GetVal(s->condition)->HasSideEffects()) {
return nullptr;
}
- tint::utils::Vector<const Statement*, 8> stmts;
+ tint::Vector<const Statement*, 8> stmts;
ctx.Replace(s->condition, Decompose(s->condition, &stmts));
InsertBefore(stmts, s);
return ctx.CloneWithoutTransform(s);
@@ -576,7 +576,7 @@
if (!sem.GetVal(s->condition)->HasSideEffects()) {
return nullptr;
}
- tint::utils::Vector<const Statement*, 8> stmts;
+ tint::Vector<const Statement*, 8> stmts;
ctx.Replace(s->condition, Decompose(s->condition, &stmts));
InsertBefore(stmts, s);
return ctx.CloneWithoutTransform(s);
@@ -585,7 +585,7 @@
if (!s->value || !sem.GetVal(s->value)->HasSideEffects()) {
return nullptr;
}
- tint::utils::Vector<const Statement*, 8> stmts;
+ tint::Vector<const Statement*, 8> stmts;
ctx.Replace(s->value, Decompose(s->value, &stmts));
InsertBefore(stmts, s);
return ctx.CloneWithoutTransform(s);
@@ -594,7 +594,7 @@
if (!sem.Get(s->condition)) {
return nullptr;
}
- tint::utils::Vector<const Statement*, 8> stmts;
+ tint::Vector<const Statement*, 8> stmts;
ctx.Replace(s->condition, Decompose(s->condition, &stmts));
InsertBefore(stmts, s);
return ctx.CloneWithoutTransform(s);
@@ -604,7 +604,7 @@
if (!var->initializer || !sem.GetVal(var->initializer)->HasSideEffects()) {
return nullptr;
}
- tint::utils::Vector<const Statement*, 8> stmts;
+ tint::Vector<const Statement*, 8> stmts;
ctx.Replace(var->initializer, Decompose(var->initializer, &stmts));
InsertBefore(stmts, s);
return b.Decl(ctx.CloneWithoutTransform(var));
diff --git a/src/tint/lang/wgsl/ast/transform/promote_side_effects_to_decl.h b/src/tint/lang/wgsl/ast/transform/promote_side_effects_to_decl.h
index 25f48a8..a8c7196 100644
--- a/src/tint/lang/wgsl/ast/transform/promote_side_effects_to_decl.h
+++ b/src/tint/lang/wgsl/ast/transform/promote_side_effects_to_decl.h
@@ -23,7 +23,7 @@
/// declarations before the statement of usage with the goal of ensuring
/// left-to-right order of evaluation, while respecting short-circuit
/// evaluation.
-class PromoteSideEffectsToDecl final : public utils::Castable<PromoteSideEffectsToDecl, Transform> {
+class PromoteSideEffectsToDecl final : public Castable<PromoteSideEffectsToDecl, Transform> {
public:
/// Constructor
PromoteSideEffectsToDecl();
diff --git a/src/tint/lang/wgsl/ast/transform/remove_continue_in_switch.cc b/src/tint/lang/wgsl/ast/transform/remove_continue_in_switch.cc
index 7af152b..65791eb 100644
--- a/src/tint/lang/wgsl/ast/transform/remove_continue_in_switch.cc
+++ b/src/tint/lang/wgsl/ast/transform/remove_continue_in_switch.cc
@@ -58,23 +58,22 @@
made_changes = true;
- auto cont_var_name =
- tint::utils::GetOrCreate(switch_to_cont_var_name, switch_stmt, [&] {
- // Create and insert 'var tint_continue : bool = false;' before the
- // switch.
- auto var_name = b.Symbols().New("tint_continue");
- auto* decl = b.Decl(b.Var(var_name, b.ty.bool_(), b.Expr(false)));
- auto ip = utils::GetInsertionPoint(ctx, switch_stmt);
- ctx.InsertBefore(ip.first->Declaration()->statements, ip.second, decl);
+ auto cont_var_name = tint::GetOrCreate(switch_to_cont_var_name, switch_stmt, [&] {
+ // Create and insert 'var tint_continue : bool = false;' before the
+ // switch.
+ auto var_name = b.Symbols().New("tint_continue");
+ auto* decl = b.Decl(b.Var(var_name, b.ty.bool_(), b.Expr(false)));
+ auto ip = utils::GetInsertionPoint(ctx, switch_stmt);
+ ctx.InsertBefore(ip.first->Declaration()->statements, ip.second, decl);
- // Create and insert 'if (tint_continue) { continue; }' after
- // switch.
- auto* if_stmt = b.If(b.Expr(var_name), b.Block(b.Continue()));
- ctx.InsertAfter(ip.first->Declaration()->statements, ip.second, if_stmt);
+ // Create and insert 'if (tint_continue) { continue; }' after
+ // switch.
+ auto* if_stmt = b.If(b.Expr(var_name), b.Block(b.Continue()));
+ ctx.InsertAfter(ip.first->Declaration()->statements, ip.second, if_stmt);
- // Return the new var name
- return var_name;
- });
+ // Return the new var name
+ return var_name;
+ });
// Replace 'continue;' with '{ tint_continue = true; break; }'
auto* new_stmt = b.Block( //
diff --git a/src/tint/lang/wgsl/ast/transform/remove_continue_in_switch.h b/src/tint/lang/wgsl/ast/transform/remove_continue_in_switch.h
index ad78617..8775c63 100644
--- a/src/tint/lang/wgsl/ast/transform/remove_continue_in_switch.h
+++ b/src/tint/lang/wgsl/ast/transform/remove_continue_in_switch.h
@@ -23,7 +23,7 @@
/// bool variable, and checking if the variable is set after the switch to
/// continue. It is necessary to work around FXC "error X3708: continue cannot
/// be used in a switch". See crbug.com/tint/1080.
-class RemoveContinueInSwitch final : public utils::Castable<RemoveContinueInSwitch, Transform> {
+class RemoveContinueInSwitch final : public Castable<RemoveContinueInSwitch, Transform> {
public:
/// Constructor
RemoveContinueInSwitch();
diff --git a/src/tint/lang/wgsl/ast/transform/remove_phonies.cc b/src/tint/lang/wgsl/ast/transform/remove_phonies.cc
index daac4d1..92e6526 100644
--- a/src/tint/lang/wgsl/ast/transform/remove_phonies.cc
+++ b/src/tint/lang/wgsl/ast/transform/remove_phonies.cc
@@ -47,7 +47,7 @@
auto& sem = src->Sem();
- utils::Hashmap<SinkSignature, Symbol, 8, utils::Hasher<SinkSignature>> sinks;
+ Hashmap<SinkSignature, Symbol, 8, Hasher<SinkSignature>> sinks;
bool made_changes = false;
for (auto* node : src->ASTNodes().Objects()) {
@@ -118,7 +118,7 @@
}
auto sink = sinks.GetOrCreate(sig, [&] {
auto name = b.Symbols().New("phony_sink");
- utils::Vector<const Parameter*, 8> params;
+ tint::Vector<const Parameter*, 8> params;
for (auto* ty : sig) {
auto ast_ty = CreateASTTypeFor(ctx, ty);
params.Push(b.Param("p" + std::to_string(params.Length()), ast_ty));
@@ -126,7 +126,7 @@
b.Func(name, params, b.ty.void_(), {});
return name;
});
- utils::Vector<const Expression*, 8> args;
+ tint::Vector<const Expression*, 8> args;
for (auto* arg : side_effects) {
args.Push(ctx.Clone(arg));
}
diff --git a/src/tint/lang/wgsl/ast/transform/remove_phonies.h b/src/tint/lang/wgsl/ast/transform/remove_phonies.h
index 5b5c0f1..5c3d04c 100644
--- a/src/tint/lang/wgsl/ast/transform/remove_phonies.h
+++ b/src/tint/lang/wgsl/ast/transform/remove_phonies.h
@@ -25,7 +25,7 @@
/// RemovePhonies is a Transform that removes all phony-assignment statements,
/// while preserving function call expressions in the RHS of the assignment that
/// may have side-effects. It also removes calls to builtins that return a constant value.
-class RemovePhonies final : public utils::Castable<RemovePhonies, Transform> {
+class RemovePhonies final : public Castable<RemovePhonies, Transform> {
public:
/// Constructor
RemovePhonies();
diff --git a/src/tint/lang/wgsl/ast/transform/remove_unreachable_statements.h b/src/tint/lang/wgsl/ast/transform/remove_unreachable_statements.h
index c5131df..4469fc7 100644
--- a/src/tint/lang/wgsl/ast/transform/remove_unreachable_statements.h
+++ b/src/tint/lang/wgsl/ast/transform/remove_unreachable_statements.h
@@ -24,8 +24,7 @@
/// RemoveUnreachableStatements is a Transform that removes all statements
/// marked as unreachable.
-class RemoveUnreachableStatements final
- : public utils::Castable<RemoveUnreachableStatements, Transform> {
+class RemoveUnreachableStatements final : public Castable<RemoveUnreachableStatements, Transform> {
public:
/// Constructor
RemoveUnreachableStatements();
diff --git a/src/tint/lang/wgsl/ast/transform/renamer.cc b/src/tint/lang/wgsl/ast/transform/renamer.cc
index 8bd096c..98375df 100644
--- a/src/tint/lang/wgsl/ast/transform/renamer.cc
+++ b/src/tint/lang/wgsl/ast/transform/renamer.cc
@@ -1259,13 +1259,13 @@
Transform::ApplyResult Renamer::Apply(const Program* src,
const DataMap& inputs,
DataMap& outputs) const {
- utils::Hashset<Symbol, 16> global_decls;
+ Hashset<Symbol, 16> global_decls;
for (auto* decl : src->AST().TypeDecls()) {
global_decls.Add(decl->name->symbol);
}
// Identifiers that need to keep their symbols preserved.
- utils::Hashset<const Identifier*, 16> preserved_identifiers;
+ Hashset<const Identifier*, 16> preserved_identifiers;
for (auto* node : src->ASTNodes().Objects()) {
auto preserve_if_builtin_type = [&](const Identifier* ident) {
@@ -1339,7 +1339,7 @@
return true;
}
auto name = symbol.Name();
- if (!utils::utf8::IsASCII(name)) {
+ if (!tint::utf8::IsASCII(name)) {
// name is non-ascii. All of the backend keywords are ascii, so rename if we're not
// preserving unicode symbols.
return !preserve_unicode;
@@ -1367,7 +1367,7 @@
return true;
};
- utils::Hashmap<Symbol, Symbol, 32> remappings;
+ Hashmap<Symbol, Symbol, 32> remappings;
ProgramBuilder b;
CloneContext ctx{&b, src, /* auto_clone_symbols */ false};
@@ -1385,7 +1385,7 @@
if (auto* tmpl_ident = ident->As<TemplatedIdentifier>()) {
auto args = ctx.Clone(tmpl_ident->arguments);
return ctx.dst->create<TemplatedIdentifier>(ctx.Clone(ident->source), replacement,
- std::move(args), utils::Empty);
+ std::move(args), tint::Empty);
}
return ctx.dst->create<Identifier>(ctx.Clone(ident->source), replacement);
});
diff --git a/src/tint/lang/wgsl/ast/transform/renamer.h b/src/tint/lang/wgsl/ast/transform/renamer.h
index 9b19fde..b2520a2 100644
--- a/src/tint/lang/wgsl/ast/transform/renamer.h
+++ b/src/tint/lang/wgsl/ast/transform/renamer.h
@@ -23,11 +23,11 @@
namespace tint::ast::transform {
/// Renamer is a Transform that renames all the symbols in a program.
-class Renamer final : public utils::Castable<Renamer, Transform> {
+class Renamer final : public Castable<Renamer, Transform> {
public:
/// Data is outputted by the Renamer transform.
/// Data holds information about shader usage and constant buffer offsets.
- struct Data final : public utils::Castable<Data, transform::Data> {
+ struct Data final : public Castable<Data, transform::Data> {
/// Remappings is a map of old symbol name to new symbol name
using Remappings = std::unordered_map<std::string, std::string>;
@@ -59,7 +59,7 @@
/// Optional configuration options for the transform.
/// If omitted, then the renamer will use Target::kAll.
- struct Config final : public utils::Castable<Config, transform::Data> {
+ struct Config final : public Castable<Config, transform::Data> {
/// Constructor
/// @param tgt the targets to rename
/// @param keep_unicode if false, symbols with non-ascii code-points are
diff --git a/src/tint/lang/wgsl/ast/transform/renamer_test.cc b/src/tint/lang/wgsl/ast/transform/renamer_test.cc
index 3d5bfaa..d212dd6 100644
--- a/src/tint/lang/wgsl/ast/transform/renamer_test.cc
+++ b/src/tint/lang/wgsl/ast/transform/renamer_test.cc
@@ -1714,8 +1714,8 @@
std::vector<const char*> out;
for (auto* ty : builtin::kBuiltinStrings) {
std::string_view type(ty);
- if (type != "ptr" && type != "atomic" && !utils::HasPrefix(type, "sampler") &&
- !utils::HasPrefix(type, "texture") && !utils::HasPrefix(type, "__")) {
+ if (type != "ptr" && type != "atomic" && !tint::HasPrefix(type, "sampler") &&
+ !tint::HasPrefix(type, "texture") && !tint::HasPrefix(type, "__")) {
out.push_back(ty);
}
}
@@ -1726,7 +1726,7 @@
TEST_P(RenamerBuiltinTypeTest, PreserveTypeUsage) {
auto expand = [&](const char* source) {
- return utils::ReplaceAll(source, "$type", ExpandBuiltinType(GetParam()));
+ return tint::ReplaceAll(source, "$type", ExpandBuiltinType(GetParam()));
};
auto src = expand(R"(
@@ -1765,7 +1765,7 @@
}
TEST_P(RenamerBuiltinTypeTest, PreserveTypeInitializer) {
auto expand = [&](const char* source) {
- return utils::ReplaceAll(source, "$type", ExpandBuiltinType(GetParam()));
+ return tint::ReplaceAll(source, "$type", ExpandBuiltinType(GetParam()));
};
auto src = expand(R"(
@@ -1797,7 +1797,7 @@
}
auto expand = [&](const char* source) {
- return utils::ReplaceAll(source, "$type", ExpandBuiltinType(GetParam()));
+ return tint::ReplaceAll(source, "$type", ExpandBuiltinType(GetParam()));
};
auto src = expand(R"(
@@ -1850,9 +1850,9 @@
TEST_P(RenamerBuiltinTypeTest, RenameShadowedByAlias) {
auto expand = [&](const char* source) {
std::string_view ty = GetParam();
- auto out = utils::ReplaceAll(source, "$name", ty);
- out = utils::ReplaceAll(out, "$type", ExpandBuiltinType(ty));
- out = utils::ReplaceAll(out, "$other_type", ty == "i32" ? "u32" : "i32");
+ auto out = tint::ReplaceAll(source, "$name", ty);
+ out = tint::ReplaceAll(out, "$type", ExpandBuiltinType(ty));
+ out = tint::ReplaceAll(out, "$other_type", ty == "i32" ? "u32" : "i32");
return out;
};
@@ -1882,9 +1882,9 @@
TEST_P(RenamerBuiltinTypeTest, RenameShadowedByStruct) {
auto expand = [&](const char* source) {
std::string_view ty = GetParam();
- auto out = utils::ReplaceAll(source, "$name", ty);
- out = utils::ReplaceAll(out, "$type", ExpandBuiltinType(ty));
- out = utils::ReplaceAll(out, "$other_type", ty == "i32" ? "u32" : "i32");
+ auto out = tint::ReplaceAll(source, "$name", ty);
+ out = tint::ReplaceAll(out, "$type", ExpandBuiltinType(ty));
+ out = tint::ReplaceAll(out, "$other_type", ty == "i32" ? "u32" : "i32");
return out;
};
@@ -1925,12 +1925,12 @@
std::vector<const char*> Identifiers() {
std::vector<const char*> out;
for (auto* ident : builtin::kBuiltinStrings) {
- if (!utils::HasPrefix(ident, "__")) {
+ if (!tint::HasPrefix(ident, "__")) {
out.push_back(ident);
}
}
for (auto* ident : builtin::kAddressSpaceStrings) {
- if (!utils::HasPrefix(ident, "_")) {
+ if (!tint::HasPrefix(ident, "_")) {
out.push_back(ident);
}
}
@@ -1946,9 +1946,7 @@
using RenamerBuiltinIdentifierTest = TransformTestWithParam<const char*>;
TEST_P(RenamerBuiltinIdentifierTest, GlobalConstName) {
- auto expand = [&](const char* source) {
- return utils::ReplaceAll(source, "$name", GetParam());
- };
+ auto expand = [&](const char* source) { return tint::ReplaceAll(source, "$name", GetParam()); };
auto src = expand(R"(
const $name = 42;
@@ -1972,9 +1970,7 @@
}
TEST_P(RenamerBuiltinIdentifierTest, LocalVarName) {
- auto expand = [&](const char* source) {
- return utils::ReplaceAll(source, "$name", GetParam());
- };
+ auto expand = [&](const char* source) { return tint::ReplaceAll(source, "$name", GetParam()); };
auto src = expand(R"(
fn f() {
@@ -1994,9 +1990,7 @@
}
TEST_P(RenamerBuiltinIdentifierTest, FunctionName) {
- auto expand = [&](const char* source) {
- return utils::ReplaceAll(source, "$name", GetParam());
- };
+ auto expand = [&](const char* source) { return tint::ReplaceAll(source, "$name", GetParam()); };
auto src = expand(R"(
fn $name() {
@@ -2024,8 +2018,8 @@
TEST_P(RenamerBuiltinIdentifierTest, StructName) {
auto expand = [&](const char* source) {
std::string_view name = GetParam();
- auto out = utils::ReplaceAll(source, "$name", name);
- return utils::ReplaceAll(out, "$other_type", name == "i32" ? "u32" : "i32");
+ auto out = tint::ReplaceAll(source, "$name", name);
+ return tint::ReplaceAll(out, "$other_type", name == "i32" ? "u32" : "i32");
};
auto src = expand(R"(
diff --git a/src/tint/lang/wgsl/ast/transform/robustness.cc b/src/tint/lang/wgsl/ast/transform/robustness.cc
index 1112031..ecebc7d 100644
--- a/src/tint/lang/wgsl/ast/transform/robustness.cc
+++ b/src/tint/lang/wgsl/ast/transform/robustness.cc
@@ -214,7 +214,7 @@
/// Alias to the source program's semantic info
const sem::Info& sem = ctx.src->Sem();
/// Map of expression to predicate condition
- utils::Hashmap<const Expression*, Symbol, 32> predicates{};
+ Hashmap<const Expression*, Symbol, 32> predicates{};
/// @return the `u32` typed expression that represents the maximum indexable value for the index
/// accessor @p expr, or nullptr if there is no robustness limit for this expression.
@@ -687,7 +687,7 @@
/// TODO(tint:1890): make this function work with unrestricted pointer paramters. Note that this
/// depends on transform::DirectVariableAccess to have been run first.
bool IsIgnoredResourceBinding(const sem::Variable* variable) const {
- auto* globalVariable = utils::As<sem::GlobalVariable>(variable);
+ auto* globalVariable = tint::As<sem::GlobalVariable>(variable);
if (globalVariable == nullptr) {
return false;
}
diff --git a/src/tint/lang/wgsl/ast/transform/robustness.h b/src/tint/lang/wgsl/ast/transform/robustness.h
index 677b452..cfb7595 100644
--- a/src/tint/lang/wgsl/ast/transform/robustness.h
+++ b/src/tint/lang/wgsl/ast/transform/robustness.h
@@ -32,7 +32,7 @@
/// * BuiltinPolyfill as 'clamp' and binary operators may need to be polyfilled.
/// * CanonicalizeEntryPointIO as the transform does not support the 'in' and 'out' address
/// spaces.
-class Robustness final : public utils::Castable<Robustness, Transform> {
+class Robustness final : public Castable<Robustness, Transform> {
public:
/// Robustness action for out-of-bounds indexing.
enum class Action {
@@ -48,7 +48,7 @@
};
/// Configuration options for the transform
- struct Config final : public utils::Castable<Config, Data> {
+ struct Config final : public Castable<Config, Data> {
/// Constructor
Config();
diff --git a/src/tint/lang/wgsl/ast/transform/simplify_pointers.cc b/src/tint/lang/wgsl/ast/transform/simplify_pointers.cc
index daa0a84..9cf933b 100644
--- a/src/tint/lang/wgsl/ast/transform/simplify_pointers.cc
+++ b/src/tint/lang/wgsl/ast/transform/simplify_pointers.cc
@@ -129,7 +129,7 @@
/// @returns the new program or SkipTransform if the transform is not required
ApplyResult Run() {
// A map of saved expressions to their saved variable name
- utils::Hashmap<const Expression*, Symbol, 8> saved_vars;
+ Hashmap<const Expression*, Symbol, 8> saved_vars;
bool needs_transform = false;
for (auto* ty : ctx.src->Types()) {
@@ -160,7 +160,7 @@
// Scan the initializer expression for array index expressions that need
// to be hoist to temporary "saved" variables.
- utils::Vector<const VariableDeclStatement*, 8> saved;
+ tint::Vector<const VariableDeclStatement*, 8> saved;
CollectSavedArrayIndices(
var->Declaration()->initializer, [&](const Expression* idx_expr) {
// We have a sub-expression that needs to be saved.
diff --git a/src/tint/lang/wgsl/ast/transform/simplify_pointers.h b/src/tint/lang/wgsl/ast/transform/simplify_pointers.h
index b44e4a4..df529c2 100644
--- a/src/tint/lang/wgsl/ast/transform/simplify_pointers.h
+++ b/src/tint/lang/wgsl/ast/transform/simplify_pointers.h
@@ -31,7 +31,7 @@
///
/// @note Depends on the following transforms to have been run first:
/// * Unshadow
-class SimplifyPointers final : public utils::Castable<SimplifyPointers, Transform> {
+class SimplifyPointers final : public Castable<SimplifyPointers, Transform> {
public:
/// Constructor
SimplifyPointers();
diff --git a/src/tint/lang/wgsl/ast/transform/single_entry_point.h b/src/tint/lang/wgsl/ast/transform/single_entry_point.h
index 3a130c1..97a99da 100644
--- a/src/tint/lang/wgsl/ast/transform/single_entry_point.h
+++ b/src/tint/lang/wgsl/ast/transform/single_entry_point.h
@@ -25,10 +25,10 @@
///
/// All module-scope variables, types, and functions that are not used by the
/// target entry point will also be removed.
-class SingleEntryPoint final : public utils::Castable<SingleEntryPoint, Transform> {
+class SingleEntryPoint final : public Castable<SingleEntryPoint, Transform> {
public:
/// Configuration options for the transform
- struct Config final : public utils::Castable<Config, Data> {
+ struct Config final : public Castable<Config, Data> {
/// Constructor
/// @param entry_point the name of the entry point to keep
explicit Config(std::string entry_point = "");
diff --git a/src/tint/lang/wgsl/ast/transform/spirv_atomic.cc b/src/tint/lang/wgsl/ast/transform/spirv_atomic.cc
index 3c6601a..d5a64f2 100644
--- a/src/tint/lang/wgsl/ast/transform/spirv_atomic.cc
+++ b/src/tint/lang/wgsl/ast/transform/spirv_atomic.cc
@@ -55,7 +55,7 @@
CloneContext ctx = {&b, src, /* auto_clone_symbols */ true};
std::unordered_map<const type::Struct*, ForkedStruct> forked_structs;
std::unordered_set<const sem::Variable*> atomic_variables;
- utils::UniqueVector<const sem::ValueExpression*, 8> atomic_expressions;
+ UniqueVector<const sem::ValueExpression*, 8> atomic_expressions;
public:
/// Constructor
@@ -128,7 +128,7 @@
const auto& forked = it->second;
// Re-create the structure swapping in the atomic-flavoured members
- utils::Vector<const StructMember*, 8> members;
+ tint::Vector<const StructMember*, 8> members;
members.Reserve(str->members.Length());
for (size_t i = 0; i < str->members.Length(); i++) {
auto* member = str->members[i];
@@ -294,7 +294,7 @@
SpirvAtomic::~SpirvAtomic() = default;
SpirvAtomic::Stub::Stub(GenerationID pid, NodeID nid, builtin::Function b)
- : Base(pid, nid, utils::Empty), builtin(b) {}
+ : Base(pid, nid, tint::Empty), builtin(b) {}
SpirvAtomic::Stub::~Stub() = default;
std::string SpirvAtomic::Stub::InternalName() const {
return "@internal(spirv-atomic " + std::string(builtin::str(builtin)) + ")";
diff --git a/src/tint/lang/wgsl/ast/transform/spirv_atomic.h b/src/tint/lang/wgsl/ast/transform/spirv_atomic.h
index 69d4bcd..7a9ccca 100644
--- a/src/tint/lang/wgsl/ast/transform/spirv_atomic.h
+++ b/src/tint/lang/wgsl/ast/transform/spirv_atomic.h
@@ -32,7 +32,7 @@
/// with calls to the WGSL atomic builtin. It also makes sure to replace variable declarations that
/// are the target of the atomic operations with an atomic declaration of the same type. For
/// structs, it creates a copy of the original struct with atomic members.
-class SpirvAtomic final : public utils::Castable<SpirvAtomic, Transform> {
+class SpirvAtomic final : public Castable<SpirvAtomic, Transform> {
public:
/// Constructor
SpirvAtomic();
@@ -41,7 +41,7 @@
/// Stub is an attribute applied to stub SPIR-V reader generated functions that need to be
/// translated to an atomic builtin.
- class Stub final : public utils::Castable<Stub, InternalAttribute> {
+ class Stub final : public Castable<Stub, InternalAttribute> {
public:
/// @param pid the identifier of the program that owns this node
/// @param nid the unique node identifier
diff --git a/src/tint/lang/wgsl/ast/transform/spirv_atomic_test.cc b/src/tint/lang/wgsl/ast/transform/spirv_atomic_test.cc
index b745cd9..697b7dd 100644
--- a/src/tint/lang/wgsl/ast/transform/spirv_atomic_test.cc
+++ b/src/tint/lang/wgsl/ast/transform/spirv_atomic_test.cc
@@ -44,99 +44,99 @@
};
for (auto& a : two_params) {
b.Func(std::string{"stub_"} + builtin::str(a) + "_u32",
- utils::Vector{
+ tint::Vector{
b.Param("p0", b.ty.u32()),
b.Param("p1", b.ty.u32()),
},
b.ty.u32(),
- utils::Vector{
+ tint::Vector{
b.Return(0_u),
},
- utils::Vector{
+ tint::Vector{
b.ASTNodes().Create<SpirvAtomic::Stub>(b.ID(), b.AllocateNodeID(), a),
});
b.Func(std::string{"stub_"} + builtin::str(a) + "_i32",
- utils::Vector{
+ tint::Vector{
b.Param("p0", b.ty.i32()),
b.Param("p1", b.ty.i32()),
},
b.ty.i32(),
- utils::Vector{
+ tint::Vector{
b.Return(0_i),
},
- utils::Vector{
+ tint::Vector{
b.ASTNodes().Create<SpirvAtomic::Stub>(b.ID(), b.AllocateNodeID(), a),
});
}
b.Func("stub_atomicLoad_u32",
- utils::Vector{
+ tint::Vector{
b.Param("p0", b.ty.u32()),
},
b.ty.u32(),
- utils::Vector{
+ tint::Vector{
b.Return(0_u),
},
- utils::Vector{
+ tint::Vector{
b.ASTNodes().Create<SpirvAtomic::Stub>(b.ID(), b.AllocateNodeID(),
builtin::Function::kAtomicLoad),
});
b.Func("stub_atomicLoad_i32",
- utils::Vector{
+ tint::Vector{
b.Param("p0", b.ty.i32()),
},
b.ty.i32(),
- utils::Vector{
+ tint::Vector{
b.Return(0_i),
},
- utils::Vector{
+ tint::Vector{
b.ASTNodes().Create<SpirvAtomic::Stub>(b.ID(), b.AllocateNodeID(),
builtin::Function::kAtomicLoad),
});
b.Func("stub_atomicStore_u32",
- utils::Vector{
+ tint::Vector{
b.Param("p0", b.ty.u32()),
b.Param("p1", b.ty.u32()),
},
- b.ty.void_(), utils::Empty,
- utils::Vector{
+ b.ty.void_(), tint::Empty,
+ tint::Vector{
b.ASTNodes().Create<SpirvAtomic::Stub>(b.ID(), b.AllocateNodeID(),
builtin::Function::kAtomicStore),
});
b.Func("stub_atomicStore_i32",
- utils::Vector{
+ tint::Vector{
b.Param("p0", b.ty.i32()),
b.Param("p1", b.ty.i32()),
},
- b.ty.void_(), utils::Empty,
- utils::Vector{
+ b.ty.void_(), tint::Empty,
+ tint::Vector{
b.ASTNodes().Create<SpirvAtomic::Stub>(b.ID(), b.AllocateNodeID(),
builtin::Function::kAtomicStore),
});
b.Func("stub_atomic_compare_exchange_weak_u32",
- utils::Vector{
+ tint::Vector{
b.Param("p0", b.ty.u32()),
b.Param("p1", b.ty.u32()),
b.Param("p2", b.ty.u32()),
},
b.ty.u32(),
- utils::Vector{
+ tint::Vector{
b.Return(0_u),
},
- utils::Vector{
+ tint::Vector{
b.ASTNodes().Create<SpirvAtomic::Stub>(
b.ID(), b.AllocateNodeID(), builtin::Function::kAtomicCompareExchangeWeak),
});
b.Func("stub_atomic_compare_exchange_weak_i32",
- utils::Vector{b.Param("p0", b.ty.i32()), b.Param("p1", b.ty.i32()),
- b.Param("p2", b.ty.i32())},
+ tint::Vector{b.Param("p0", b.ty.i32()), b.Param("p1", b.ty.i32()),
+ b.Param("p2", b.ty.i32())},
b.ty.i32(),
- utils::Vector{
+ tint::Vector{
b.Return(0_i),
},
- utils::Vector{
+ tint::Vector{
b.ASTNodes().Create<SpirvAtomic::Stub>(
b.ID(), b.AllocateNodeID(), builtin::Function::kAtomicCompareExchangeWeak),
});
diff --git a/src/tint/lang/wgsl/ast/transform/std140.cc b/src/tint/lang/wgsl/ast/transform/std140.cc
index 2d8d17d..0b7939c 100644
--- a/src/tint/lang/wgsl/ast/transform/std140.cc
+++ b/src/tint/lang/wgsl/ast/transform/std140.cc
@@ -56,7 +56,7 @@
} // namespace
-namespace tint::utils {
+namespace tint {
/// Hasher specialization for UniformVariable
template <>
@@ -72,10 +72,10 @@
/// The hash function for the DynamicIndex
/// @param d the DynamicIndex to hash
/// @return the hash for the given DynamicIndex
- size_t operator()(const DynamicIndex& d) const { return utils::Hash(d.slot); }
+ size_t operator()(const DynamicIndex& d) const { return Hash(d.slot); }
};
-} // namespace tint::utils
+} // namespace tint
namespace tint::ast::transform {
@@ -171,7 +171,7 @@
private:
/// Swizzle describes a vector swizzle
- using Swizzle = utils::Vector<uint32_t, 4>;
+ using Swizzle = tint::Vector<uint32_t, 4>;
/// AccessIndex describes a single access in an access chain.
/// The access is one of:
@@ -182,7 +182,7 @@
using AccessIndex = std::variant<UniformVariable, u32, DynamicIndex, Swizzle>;
/// A vector of AccessIndex.
- using AccessIndices = utils::Vector<AccessIndex, 8>;
+ using AccessIndices = tint::Vector<AccessIndex, 8>;
/// A key used to cache load functions for an access chain.
struct LoadFnKey {
@@ -196,7 +196,7 @@
struct Hasher {
/// @param fn the LoadFnKey to hash
/// @return the hash for the given LoadFnKey
- size_t operator()(const LoadFnKey& fn) const { return utils::Hash(fn.var, fn.indices); }
+ size_t operator()(const LoadFnKey& fn) const { return Hash(fn.var, fn.indices); }
};
/// Equality operator
@@ -217,21 +217,20 @@
const SymbolTable& sym = src->Symbols();
/// Map of load function signature, to the generated function
- utils::Hashmap<LoadFnKey, Symbol, 8, LoadFnKey::Hasher> load_fns;
+ Hashmap<LoadFnKey, Symbol, 8, LoadFnKey::Hasher> load_fns;
/// Map of std140-forked type to converter function name
- utils::Hashmap<const type::Type*, Symbol, 8> conv_fns;
+ Hashmap<const type::Type*, Symbol, 8> conv_fns;
// Uniform variables that have been modified to use a std140 type
- utils::Hashset<const sem::Variable*, 8> std140_uniforms;
+ Hashset<const sem::Variable*, 8> std140_uniforms;
// Map of original structure to 'std140' forked structure
- utils::Hashmap<const type::Struct*, Symbol, 8> std140_structs;
+ Hashmap<const type::Struct*, Symbol, 8> std140_structs;
// Map of structure member in src of a matrix type, to list of decomposed column
// members in ctx.dst.
- utils::Hashmap<const type::StructMember*, utils::Vector<const StructMember*, 4>, 8>
- std140_mat_members;
+ Hashmap<const type::StructMember*, tint::Vector<const StructMember*, 4>, 8> std140_mat_members;
/// Describes a matrix that has been forked to a std140-structure holding the decomposed column
/// vectors of the matrix.
@@ -239,11 +238,11 @@
/// The decomposed structure name (in ctx.dst)
Symbol name;
/// The column vector structure member names (in ctx.dst)
- utils::Vector<Symbol, 4> columns;
+ tint::Vector<Symbol, 4> columns;
};
// Map of matrix type in src, to decomposed column structure in ctx.dst.
- utils::Hashmap<const type::Matrix*, Std140Matrix, 8> std140_mats;
+ Hashmap<const type::Matrix*, Std140Matrix, 8> std140_mats;
/// AccessChain describes a chain of access expressions to uniform buffer variable.
struct AccessChain {
@@ -252,7 +251,7 @@
/// The chain of access indices, starting with the first access on #var.
AccessIndices indices;
/// The runtime-evaluated expressions. This vector is indexed by the DynamicIndex::slot
- utils::Vector<const sem::ValueExpression*, 8> dynamic_indices;
+ tint::Vector<const sem::ValueExpression*, 8> dynamic_indices;
/// The type of the std140-decomposed matrix being accessed.
/// May be nullptr if the chain does not pass through a std140-decomposed matrix.
const type::Matrix* std140_mat_ty = nullptr;
@@ -284,7 +283,7 @@
if (str && str->UsedAs(builtin::AddressSpace::kUniform)) {
// Should this uniform buffer be forked for std140 usage?
bool fork_std140 = false;
- utils::Vector<const StructMember*, 8> members;
+ tint::Vector<const StructMember*, 8> members;
for (auto* member : str->Members()) {
if (auto* mat = member->Type()->As<type::Matrix>()) {
// Is this member a matrix that needs decomposition for std140-layout?
@@ -374,7 +373,7 @@
while (true) {
prefix += "_";
- utils::Hashset<std::string, 4> strings;
+ Hashset<std::string, 4> strings;
for (uint32_t i = 0; i < count; i++) {
strings.Add(prefix + std::to_string(i));
}
@@ -418,8 +417,8 @@
b.Structure(name, members);
return Std140Matrix{
name,
- utils::Transform(members,
- [&](auto* member) { return member->name->symbol; }),
+ tint::Transform(members,
+ [&](auto* member) { return member->name->symbol; }),
};
});
return b.ty(std140_mat.name);
@@ -428,7 +427,7 @@
},
[&](const type::Array* arr) {
if (auto std140 = Std140Type(arr->ElemType())) {
- utils::Vector<const Attribute*, 1> attrs;
+ tint::Vector<const Attribute*, 1> attrs;
if (!arr->IsStrideImplicit()) {
attrs.Push(b.create<StrideAttribute>(arr->Stride()));
}
@@ -453,7 +452,7 @@
/// @param align the alignment in bytes of the matrix.
/// @param size the size in bytes of the matrix.
/// @returns a vector of decomposed matrix column vectors as structure members (in ctx.dst).
- utils::Vector<const StructMember*, 4> DecomposedMatrixStructMembers(
+ tint::Vector<const StructMember*, 4> DecomposedMatrixStructMembers(
const type::Matrix* mat,
const std::string& name_prefix,
uint32_t align,
@@ -461,9 +460,9 @@
// Replace the member with column vectors.
const auto num_columns = mat->columns();
// Build a struct member for each column of the matrix
- utils::Vector<const StructMember*, 4> out;
+ tint::Vector<const StructMember*, 4> out;
for (uint32_t i = 0; i < num_columns; i++) {
- utils::Vector<const Attribute*, 1> attributes;
+ tint::Vector<const Attribute*, 1> attributes;
if ((i == 0) && mat->Align() != align) {
// The matrix was @align() annotated with a larger alignment
// than the natural alignment for the matrix. This extra padding
@@ -688,20 +687,20 @@
// The converter function takes a single argument of the std140 type.
auto* param = b.Param("val", std140_ty);
- utils::Vector<const Statement*, 3> stmts;
+ tint::Vector<const Statement*, 3> stmts;
Switch(
ty, //
[&](const type::Struct* str) {
// Convert each of the structure members using either a converter function
// call, or by reassembling a std140 matrix from column vector members.
- utils::Vector<const Expression*, 8> args;
+ tint::Vector<const Expression*, 8> args;
for (auto* member : str->Members()) {
if (auto col_members = std140_mat_members.Find(member)) {
// std140 decomposed matrix. Reassemble.
auto mat_ty = CreateASTTypeFor(ctx, member->Type());
auto mat_args =
- utils::Transform(*col_members, [&](const StructMember* m) {
+ tint::Transform(*col_members, [&](const StructMember* m) {
return b.MemberAccessor(param, m->name->symbol);
});
args.Push(b.Call(mat_ty, std::move(mat_args)));
@@ -717,10 +716,10 @@
// Reassemble a std140 matrix from the structure of column vector members.
auto std140_mat = std140_mats.Get(mat);
if (TINT_LIKELY(std140_mat)) {
- utils::Vector<const Expression*, 8> args;
+ tint::Vector<const Expression*, 8> args;
// std140 decomposed matrix. Reassemble.
auto mat_ty = CreateASTTypeFor(ctx, mat);
- auto mat_args = utils::Transform(std140_mat->columns, [&](Symbol name) {
+ auto mat_args = tint::Transform(std140_mat->columns, [&](Symbol name) {
return b.MemberAccessor(param, name);
});
stmts.Push(b.Return(b.Call(mat_ty, std::move(mat_args))));
@@ -762,7 +761,7 @@
// Generate the function
auto ret_ty = CreateASTTypeFor(ctx, ty);
auto fn_sym = b.Symbols().New("conv_" + ConvertSuffix(ty));
- b.Func(fn_sym, utils::Vector{param}, ret_ty, std::move(stmts));
+ b.Func(fn_sym, tint::Vector{param}, ret_ty, std::move(stmts));
return fn_sym;
});
@@ -772,7 +771,7 @@
}
// Call the helper
- return b.Call(fn, utils::Vector{expr});
+ return b.Call(fn, tint::Vector{expr});
}
/// Loads a part of, or a whole std140-decomposed matrix from a uniform buffer, using a helper
@@ -794,7 +793,7 @@
});
// Build the arguments
- auto args = utils::Transform(access.dynamic_indices, [&](const sem::ValueExpression* e) {
+ auto args = tint::Transform(access.dynamic_indices, [&](const sem::ValueExpression* e) {
return b.Call<u32>(ctx.Clone(e->Declaration()));
});
@@ -870,7 +869,7 @@
/// @returns the generated function name.
Symbol BuildLoadPartialMatrixFn(const AccessChain& chain) {
// Build the dynamic index parameters
- auto dynamic_index_params = utils::Transform(chain.dynamic_indices, [&](auto*, size_t i) {
+ auto dynamic_index_params = tint::Transform(chain.dynamic_indices, [&](auto*, size_t i) {
return b.Param("p" + std::to_string(i), b.ty.u32());
});
// Method for generating dynamic index expressions.
@@ -889,7 +888,7 @@
std::string name = "load";
// The switch cases
- utils::Vector<const CaseStatement*, 4> cases;
+ tint::Vector<const CaseStatement*, 4> cases;
// The function return type.
const type::Type* ret_ty = nullptr;
@@ -954,7 +953,7 @@
}
auto* case_sel = b.CaseSelector(b.Expr(u32(column_idx)));
- auto* case_body = b.Block(utils::Vector{b.Return(expr)});
+ auto* case_body = b.Block(tint::Vector{b.Return(expr)});
cases.Push(b.Case(case_sel, case_body));
}
@@ -968,7 +967,7 @@
auto fn_sym = b.Symbols().New(name);
b.Func(fn_sym, std::move(dynamic_index_params), CreateASTTypeFor(ctx, ret_ty),
- utils::Vector{stmt});
+ tint::Vector{stmt});
return fn_sym;
}
@@ -980,7 +979,7 @@
/// @returns the generated function name.
Symbol BuildLoadWholeMatrixFn(const AccessChain& chain) {
// Build the dynamic index parameters
- auto dynamic_index_params = utils::Transform(chain.dynamic_indices, [&](auto*, size_t i) {
+ auto dynamic_index_params = tint::Transform(chain.dynamic_indices, [&](auto*, size_t i) {
return b.Param("p" + std::to_string(i), b.ty.u32());
});
// Method for generating dynamic index expressions.
@@ -1003,19 +1002,19 @@
name += "_" + access_name;
}
- utils::Vector<const Statement*, 2> stmts;
+ tint::Vector<const Statement*, 2> stmts;
// Create a temporary pointer to the structure that holds the matrix columns
auto* let = b.Let("s", b.AddressOf(expr));
stmts.Push(b.Decl(let));
- utils::Vector<const MemberAccessorExpression*, 4> columns;
+ tint::Vector<const MemberAccessorExpression*, 4> columns;
if (auto* str = tint::As<type::Struct>(ty)) {
// Structure member matrix. The columns are decomposed into the structure.
auto mat_member_idx = std::get<u32>(chain.indices[std140_mat_idx]);
auto* mat_member = str->Members()[mat_member_idx];
auto mat_columns = *std140_mat_members.Get(mat_member);
- columns = utils::Transform(mat_columns, [&](auto* column_member) {
+ columns = tint::Transform(mat_columns, [&](auto* column_member) {
return b.MemberAccessor(b.Deref(let), column_member->name->symbol);
});
ty = mat_member->Type();
@@ -1028,7 +1027,7 @@
expr = new_expr;
auto* mat = ty->As<type::Matrix>();
auto std140_mat = std140_mats.Get(ty->As<type::Matrix>());
- columns = utils::Transform(std140_mat->columns, [&](auto column_name) {
+ columns = tint::Transform(std140_mat->columns, [&](auto column_name) {
return b.MemberAccessor(b.Deref(let), column_name);
});
ty = mat;
diff --git a/src/tint/lang/wgsl/ast/transform/std140.h b/src/tint/lang/wgsl/ast/transform/std140.h
index 78a7cf0..8b60728 100644
--- a/src/tint/lang/wgsl/ast/transform/std140.h
+++ b/src/tint/lang/wgsl/ast/transform/std140.h
@@ -28,7 +28,7 @@
/// sufficient to have any WGSL structure be std140-layout conformant.
///
/// @note This transform requires the PromoteSideEffectsToDecl transform to have been run first.
-class Std140 final : public utils::Castable<Std140, Transform> {
+class Std140 final : public Castable<Std140, Transform> {
public:
/// Constructor
Std140();
diff --git a/src/tint/lang/wgsl/ast/transform/std140_exhaustive_test.cc b/src/tint/lang/wgsl/ast/transform/std140_exhaustive_test.cc
index 813d679..c9715af 100644
--- a/src/tint/lang/wgsl/ast/transform/std140_exhaustive_test.cc
+++ b/src/tint/lang/wgsl/ast/transform/std140_exhaustive_test.cc
@@ -82,11 +82,11 @@
result += seperator;
}
std::string string_for_current_column =
- utils::ReplaceAll(tmpl, "${col_id_for_tmpl}", std::to_string(c));
+ tint::ReplaceAll(tmpl, "${col_id_for_tmpl}", std::to_string(c));
result += string_for_current_column;
}
result += seperator;
- std::string string_for_last_column = utils::ReplaceAll(
+ std::string string_for_last_column = tint::ReplaceAll(
tmpl_for_last_column, "${col_id_for_tmpl}", std::to_string(columns - 1));
result += string_for_last_column;
return result;
@@ -122,13 +122,13 @@
std::string str,
std::initializer_list<std::pair<std::string, std::string>> replacement_pairs = {}) const {
for (auto& replace : replacement_pairs) {
- str = utils::ReplaceAll(str, replace.first, replace.second);
+ str = tint::ReplaceAll(str, replace.first, replace.second);
}
- str = utils::ReplaceAll(str, "${mat}", Mat());
- str = utils::ReplaceAll(str, "${shape}", Shape());
- str = utils::ReplaceAll(str, "${elem_type}", ElementType());
- str = utils::ReplaceAll(str, "${col_vector_type}", ColumnVector());
- str = utils::ReplaceAll(str, "${swizzle}", ColumnVectorSwizzle());
+ str = tint::ReplaceAll(str, "${mat}", Mat());
+ str = tint::ReplaceAll(str, "${shape}", Shape());
+ str = tint::ReplaceAll(str, "${elem_type}", ElementType());
+ str = tint::ReplaceAll(str, "${col_vector_type}", ColumnVector());
+ str = tint::ReplaceAll(str, "${swizzle}", ColumnVectorSwizzle());
return str;
}
};
@@ -490,8 +490,8 @@
}
for (uint32_t col = 0; col < matrix.columns; col++) {
- std::string src = utils::ReplaceAll(tmpl_src, "${cloumn_index}", std::to_string(col));
- std::string expect = utils::ReplaceAll(tmpl_expect, "${cloumn_index}", std::to_string(col));
+ std::string src = tint::ReplaceAll(tmpl_src, "${cloumn_index}", std::to_string(col));
+ std::string expect = tint::ReplaceAll(tmpl_expect, "${cloumn_index}", std::to_string(col));
auto got = Run<Std140>(src);
@@ -600,8 +600,8 @@
}
for (uint32_t col = 0; col < matrix.columns; col++) {
- std::string src = utils::ReplaceAll(tmpl_src, "${cloumn_index}", std::to_string(col));
- std::string expect = utils::ReplaceAll(tmpl_expect, "${cloumn_index}", std::to_string(col));
+ std::string src = tint::ReplaceAll(tmpl_src, "${cloumn_index}", std::to_string(col));
+ std::string expect = tint::ReplaceAll(tmpl_expect, "${cloumn_index}", std::to_string(col));
auto got = Run<Std140>(src);
@@ -711,11 +711,10 @@
for (uint32_t col = 0; col < matrix.columns; col++) {
for (uint32_t row = 0; row < matrix.rows; row++) {
- std::string src = utils::ReplaceAll(tmpl_src, "${col_index}", std::to_string(col));
- src = utils::ReplaceAll(src, "${row_index}", std::to_string(row));
- std::string expect =
- utils::ReplaceAll(tmpl_expect, "${col_index}", std::to_string(col));
- expect = utils::ReplaceAll(expect, "${row_index}", std::to_string(row));
+ std::string src = tint::ReplaceAll(tmpl_src, "${col_index}", std::to_string(col));
+ src = tint::ReplaceAll(src, "${row_index}", std::to_string(row));
+ std::string expect = tint::ReplaceAll(tmpl_expect, "${col_index}", std::to_string(col));
+ expect = tint::ReplaceAll(expect, "${row_index}", std::to_string(row));
auto got = Run<Std140>(src);
@@ -785,8 +784,8 @@
}
for (uint32_t row = 0; row < matrix.rows; row++) {
- std::string src = utils::ReplaceAll(tmpl_src, "${row_index}", std::to_string(row));
- std::string expect = utils::ReplaceAll(tmpl_expect, "${row_index}", std::to_string(row));
+ std::string src = tint::ReplaceAll(tmpl_src, "${row_index}", std::to_string(row));
+ std::string expect = tint::ReplaceAll(tmpl_expect, "${row_index}", std::to_string(row));
auto got = Run<Std140>(src);
@@ -832,8 +831,8 @@
}
for (uint32_t col = 0; col < matrix.columns; col++) {
- std::string src = utils::ReplaceAll(tmpl_src, "${col_index}", std::to_string(col));
- std::string expect = utils::ReplaceAll(tmpl_expect, "${col_index}", std::to_string(col));
+ std::string src = tint::ReplaceAll(tmpl_src, "${col_index}", std::to_string(col));
+ std::string expect = tint::ReplaceAll(tmpl_expect, "${col_index}", std::to_string(col));
auto got = Run<Std140>(src);
@@ -1103,8 +1102,8 @@
}
for (uint32_t col = 0; col < matrix.columns; col++) {
- std::string src = utils::ReplaceAll(tmpl_src, "${col_index}", std::to_string(col));
- std::string expect = utils::ReplaceAll(tmpl_expect, "${col_index}", std::to_string(col));
+ std::string src = tint::ReplaceAll(tmpl_src, "${col_index}", std::to_string(col));
+ std::string expect = tint::ReplaceAll(tmpl_expect, "${col_index}", std::to_string(col));
auto got = Run<Std140>(src);
@@ -1232,11 +1231,10 @@
for (uint32_t col = 0; col < matrix.columns; col++) {
for (uint32_t row = 0; row < matrix.rows; row++) {
- std::string src = utils::ReplaceAll(tmpl_src, "${col_index}", std::to_string(col));
- src = utils::ReplaceAll(src, "${row_index}", std::to_string(row));
- std::string expect =
- utils::ReplaceAll(tmpl_expect, "${col_index}", std::to_string(col));
- expect = utils::ReplaceAll(expect, "${row_index}", std::to_string(row));
+ std::string src = tint::ReplaceAll(tmpl_src, "${col_index}", std::to_string(col));
+ src = tint::ReplaceAll(src, "${row_index}", std::to_string(row));
+ std::string expect = tint::ReplaceAll(tmpl_expect, "${col_index}", std::to_string(col));
+ expect = tint::ReplaceAll(expect, "${row_index}", std::to_string(row));
auto got = Run<Std140>(src);
@@ -1314,8 +1312,8 @@
}
for (uint32_t row = 0; row < matrix.rows; row++) {
- std::string src = utils::ReplaceAll(tmpl_src, "${row_index}", std::to_string(row));
- std::string expect = utils::ReplaceAll(tmpl_expect, "${row_index}", std::to_string(row));
+ std::string src = tint::ReplaceAll(tmpl_src, "${row_index}", std::to_string(row));
+ std::string expect = tint::ReplaceAll(tmpl_expect, "${row_index}", std::to_string(row));
auto got = Run<Std140>(src);
@@ -1369,8 +1367,8 @@
}
for (uint32_t col = 0; col < matrix.columns; col++) {
- std::string src = utils::ReplaceAll(tmpl_src, "${col_index}", std::to_string(col));
- std::string expect = utils::ReplaceAll(tmpl_expect, "${col_index}", std::to_string(col));
+ std::string src = tint::ReplaceAll(tmpl_src, "${col_index}", std::to_string(col));
+ std::string expect = tint::ReplaceAll(tmpl_expect, "${col_index}", std::to_string(col));
auto got = Run<Std140>(src);
@@ -1572,10 +1570,9 @@
}
for (uint32_t array_index = 0; array_index < 3; array_index++) {
- std::string src =
- utils::ReplaceAll(tmpl_src, "${array_index}", std::to_string(array_index));
+ std::string src = tint::ReplaceAll(tmpl_src, "${array_index}", std::to_string(array_index));
std::string expect =
- utils::ReplaceAll(tmpl_expect, "${array_index}", std::to_string(array_index));
+ tint::ReplaceAll(tmpl_expect, "${array_index}", std::to_string(array_index));
auto got = Run<Std140>(src);
@@ -1698,10 +1695,9 @@
}
for (uint32_t array_index = 0; array_index < 3; array_index++) {
- std::string src =
- utils::ReplaceAll(tmpl_src, "${array_index}", std::to_string(array_index));
+ std::string src = tint::ReplaceAll(tmpl_src, "${array_index}", std::to_string(array_index));
std::string expect =
- utils::ReplaceAll(tmpl_expect, "${array_index}", std::to_string(array_index));
+ tint::ReplaceAll(tmpl_expect, "${array_index}", std::to_string(array_index));
auto got = Run<Std140>(src);
@@ -1821,11 +1817,11 @@
for (uint32_t array_index = 0; array_index < 3; array_index++) {
for (uint32_t col = 0; col < matrix.columns; col++) {
std::string src =
- utils::ReplaceAll(tmpl_src, "${array_index}", std::to_string(array_index));
- src = utils::ReplaceAll(src, "${cloumn_index}", std::to_string(col));
+ tint::ReplaceAll(tmpl_src, "${array_index}", std::to_string(array_index));
+ src = tint::ReplaceAll(src, "${cloumn_index}", std::to_string(col));
std::string expect =
- utils::ReplaceAll(tmpl_expect, "${array_index}", std::to_string(array_index));
- expect = utils::ReplaceAll(expect, "${cloumn_index}", std::to_string(col));
+ tint::ReplaceAll(tmpl_expect, "${array_index}", std::to_string(array_index));
+ expect = tint::ReplaceAll(expect, "${cloumn_index}", std::to_string(col));
auto got = Run<Std140>(src);
@@ -1886,8 +1882,8 @@
}
for (uint32_t col = 0; col < matrix.columns; col++) {
- std::string src = utils::ReplaceAll(tmpl_src, "${cloumn_index}", std::to_string(col));
- std::string expect = utils::ReplaceAll(tmpl_expect, "${cloumn_index}", std::to_string(col));
+ std::string src = tint::ReplaceAll(tmpl_src, "${cloumn_index}", std::to_string(col));
+ std::string expect = tint::ReplaceAll(tmpl_expect, "${cloumn_index}", std::to_string(col));
auto got = Run<Std140>(src);
@@ -1969,10 +1965,9 @@
}
for (uint32_t array_index = 0; array_index < 3; array_index++) {
- std::string src =
- utils::ReplaceAll(tmpl_src, "${array_index}", std::to_string(array_index));
+ std::string src = tint::ReplaceAll(tmpl_src, "${array_index}", std::to_string(array_index));
std::string expect =
- utils::ReplaceAll(tmpl_expect, "${array_index}", std::to_string(array_index));
+ tint::ReplaceAll(tmpl_expect, "${array_index}", std::to_string(array_index));
auto got = Run<Std140>(src);
@@ -2957,10 +2952,9 @@
}
for (uint32_t array_index = 0; array_index < 3; array_index++) {
- std::string src =
- utils::ReplaceAll(tmpl_src, "${array_index}", std::to_string(array_index));
+ std::string src = tint::ReplaceAll(tmpl_src, "${array_index}", std::to_string(array_index));
std::string expect =
- utils::ReplaceAll(tmpl_expect, "${array_index}", std::to_string(array_index));
+ tint::ReplaceAll(tmpl_expect, "${array_index}", std::to_string(array_index));
auto got = Run<Std140>(src);
@@ -3064,11 +3058,11 @@
for (uint32_t array_index = 0; array_index < 3; array_index++) {
for (uint32_t col = 0; col < matrix.columns; col++) {
std::string src =
- utils::ReplaceAll(tmpl_src, "${array_index}", std::to_string(array_index));
- src = utils::ReplaceAll(src, "${cloumn_index}", std::to_string(col));
+ tint::ReplaceAll(tmpl_src, "${array_index}", std::to_string(array_index));
+ src = tint::ReplaceAll(src, "${cloumn_index}", std::to_string(col));
std::string expect =
- utils::ReplaceAll(tmpl_expect, "${array_index}", std::to_string(array_index));
- expect = utils::ReplaceAll(expect, "${cloumn_index}", std::to_string(col));
+ tint::ReplaceAll(tmpl_expect, "${array_index}", std::to_string(array_index));
+ expect = tint::ReplaceAll(expect, "${cloumn_index}", std::to_string(col));
auto got = Run<Std140>(src);
@@ -3121,8 +3115,8 @@
}
for (uint32_t col = 0; col < matrix.columns; col++) {
- std::string src = utils::ReplaceAll(tmpl_src, "${cloumn_index}", std::to_string(col));
- std::string expect = utils::ReplaceAll(tmpl_expect, "${cloumn_index}", std::to_string(col));
+ std::string src = tint::ReplaceAll(tmpl_src, "${cloumn_index}", std::to_string(col));
+ std::string expect = tint::ReplaceAll(tmpl_expect, "${cloumn_index}", std::to_string(col));
auto got = Run<Std140>(src);
@@ -3196,10 +3190,9 @@
}
for (uint32_t array_index = 0; array_index < 3; array_index++) {
- std::string src =
- utils::ReplaceAll(tmpl_src, "${array_index}", std::to_string(array_index));
+ std::string src = tint::ReplaceAll(tmpl_src, "${array_index}", std::to_string(array_index));
std::string expect =
- utils::ReplaceAll(tmpl_expect, "${array_index}", std::to_string(array_index));
+ tint::ReplaceAll(tmpl_expect, "${array_index}", std::to_string(array_index));
auto got = Run<Std140>(src);
@@ -3482,10 +3475,9 @@
}
for (uint32_t array_index = 0; array_index < 3; array_index++) {
- std::string src =
- utils::ReplaceAll(tmpl_src, "${array_index}", std::to_string(array_index));
+ std::string src = tint::ReplaceAll(tmpl_src, "${array_index}", std::to_string(array_index));
std::string expect =
- utils::ReplaceAll(tmpl_expect, "${array_index}", std::to_string(array_index));
+ tint::ReplaceAll(tmpl_expect, "${array_index}", std::to_string(array_index));
auto got = Run<Std140>(src);
@@ -3613,11 +3605,11 @@
for (uint32_t array_index = 0; array_index < 3; array_index++) {
for (uint32_t col = 0; col < matrix.columns; col++) {
std::string src =
- utils::ReplaceAll(tmpl_src, "${array_index}", std::to_string(array_index));
- src = utils::ReplaceAll(src, "${cloumn_index}", std::to_string(col));
+ tint::ReplaceAll(tmpl_src, "${array_index}", std::to_string(array_index));
+ src = tint::ReplaceAll(src, "${cloumn_index}", std::to_string(col));
std::string expect =
- utils::ReplaceAll(tmpl_expect, "${array_index}", std::to_string(array_index));
- expect = utils::ReplaceAll(expect, "${cloumn_index}", std::to_string(col));
+ tint::ReplaceAll(tmpl_expect, "${array_index}", std::to_string(array_index));
+ expect = tint::ReplaceAll(expect, "${cloumn_index}", std::to_string(col));
auto got = Run<Std140>(src);
@@ -3683,8 +3675,8 @@
}
for (uint32_t col = 0; col < matrix.columns; col++) {
- std::string src = utils::ReplaceAll(tmpl_src, "${cloumn_index}", std::to_string(col));
- std::string expect = utils::ReplaceAll(tmpl_expect, "${cloumn_index}", std::to_string(col));
+ std::string src = tint::ReplaceAll(tmpl_src, "${cloumn_index}", std::to_string(col));
+ std::string expect = tint::ReplaceAll(tmpl_expect, "${cloumn_index}", std::to_string(col));
auto got = Run<Std140>(src);
@@ -3771,10 +3763,9 @@
}
for (uint32_t array_index = 0; array_index < 3; array_index++) {
- std::string src =
- utils::ReplaceAll(tmpl_src, "${array_index}", std::to_string(array_index));
+ std::string src = tint::ReplaceAll(tmpl_src, "${array_index}", std::to_string(array_index));
std::string expect =
- utils::ReplaceAll(tmpl_expect, "${array_index}", std::to_string(array_index));
+ tint::ReplaceAll(tmpl_expect, "${array_index}", std::to_string(array_index));
auto got = Run<Std140>(src);
@@ -3987,10 +3978,9 @@
}
for (uint32_t outer = 0; outer < 4; outer++) {
- std::string src =
- utils::ReplaceAll(tmpl_src, "${outer_array_index}", std::to_string(outer));
+ std::string src = tint::ReplaceAll(tmpl_src, "${outer_array_index}", std::to_string(outer));
std::string expect =
- utils::ReplaceAll(tmpl_expect, "${outer_array_index}", std::to_string(outer));
+ tint::ReplaceAll(tmpl_expect, "${outer_array_index}", std::to_string(outer));
auto got = Run<Std140>(src);
@@ -4109,11 +4099,11 @@
for (uint32_t outer = 0; outer < 4; outer++) {
for (uint32_t inner = 0; inner < 3; inner++) {
std::string src =
- utils::ReplaceAll(tmpl_src, "${outer_array_index}", std::to_string(outer));
- src = utils::ReplaceAll(src, "${inner_array_index}", std::to_string(inner));
+ tint::ReplaceAll(tmpl_src, "${outer_array_index}", std::to_string(outer));
+ src = tint::ReplaceAll(src, "${inner_array_index}", std::to_string(inner));
std::string expect =
- utils::ReplaceAll(tmpl_expect, "${outer_array_index}", std::to_string(outer));
- expect = utils::ReplaceAll(expect, "${inner_array_index}", std::to_string(inner));
+ tint::ReplaceAll(tmpl_expect, "${outer_array_index}", std::to_string(outer));
+ expect = tint::ReplaceAll(expect, "${inner_array_index}", std::to_string(inner));
auto got = Run<Std140>(src);
@@ -4173,10 +4163,9 @@
}
for (uint32_t outer = 0; outer < 4; outer++) {
- std::string src =
- utils::ReplaceAll(tmpl_src, "${outer_array_index}", std::to_string(outer));
+ std::string src = tint::ReplaceAll(tmpl_src, "${outer_array_index}", std::to_string(outer));
std::string expect =
- utils::ReplaceAll(tmpl_expect, "${outer_array_index}", std::to_string(outer));
+ tint::ReplaceAll(tmpl_expect, "${outer_array_index}", std::to_string(outer));
auto got = Run<Std140>(src);
@@ -4234,10 +4223,9 @@
}
for (uint32_t inner = 0; inner < 3; inner++) {
- std::string src =
- utils::ReplaceAll(tmpl_src, "${inner_array_index}", std::to_string(inner));
+ std::string src = tint::ReplaceAll(tmpl_src, "${inner_array_index}", std::to_string(inner));
std::string expect =
- utils::ReplaceAll(tmpl_expect, "${inner_array_index}", std::to_string(inner));
+ tint::ReplaceAll(tmpl_expect, "${inner_array_index}", std::to_string(inner));
auto got = Run<Std140>(src);
@@ -4346,13 +4334,13 @@
for (uint32_t inner = 0; inner < 3; inner++) {
for (uint32_t col = 0; col < matrix.columns; col++) {
std::string src =
- utils::ReplaceAll(tmpl_src, "${outer_array_index}", std::to_string(outer));
- src = utils::ReplaceAll(src, "${inner_array_index}", std::to_string(inner));
- src = utils::ReplaceAll(src, "${column_index}", std::to_string(col));
+ tint::ReplaceAll(tmpl_src, "${outer_array_index}", std::to_string(outer));
+ src = tint::ReplaceAll(src, "${inner_array_index}", std::to_string(inner));
+ src = tint::ReplaceAll(src, "${column_index}", std::to_string(col));
std::string expect =
- utils::ReplaceAll(tmpl_expect, "${outer_array_index}", std::to_string(outer));
- expect = utils::ReplaceAll(expect, "${inner_array_index}", std::to_string(inner));
- expect = utils::ReplaceAll(expect, "${column_index}", std::to_string(col));
+ tint::ReplaceAll(tmpl_expect, "${outer_array_index}", std::to_string(outer));
+ expect = tint::ReplaceAll(expect, "${inner_array_index}", std::to_string(inner));
+ expect = tint::ReplaceAll(expect, "${column_index}", std::to_string(col));
auto got = Run<Std140>(src);
@@ -4433,11 +4421,11 @@
for (uint32_t outer = 0; outer < 4; outer++) {
for (uint32_t inner = 0; inner < 3; inner++) {
std::string src =
- utils::ReplaceAll(tmpl_src, "${outer_array_index}", std::to_string(outer));
- src = utils::ReplaceAll(src, "${inner_array_index}", std::to_string(inner));
+ tint::ReplaceAll(tmpl_src, "${outer_array_index}", std::to_string(outer));
+ src = tint::ReplaceAll(src, "${inner_array_index}", std::to_string(inner));
std::string expect =
- utils::ReplaceAll(tmpl_expect, "${outer_array_index}", std::to_string(outer));
- expect = utils::ReplaceAll(expect, "${inner_array_index}", std::to_string(inner));
+ tint::ReplaceAll(tmpl_expect, "${outer_array_index}", std::to_string(outer));
+ expect = tint::ReplaceAll(expect, "${inner_array_index}", std::to_string(inner));
auto got = Run<Std140>(src);
@@ -4494,11 +4482,11 @@
for (uint32_t outer = 0; outer < 4; outer++) {
for (uint32_t col = 0; col < matrix.columns; col++) {
std::string src =
- utils::ReplaceAll(tmpl_src, "${outer_array_index}", std::to_string(outer));
- src = utils::ReplaceAll(src, "${column_index}", std::to_string(col));
+ tint::ReplaceAll(tmpl_src, "${outer_array_index}", std::to_string(outer));
+ src = tint::ReplaceAll(src, "${column_index}", std::to_string(col));
std::string expect =
- utils::ReplaceAll(tmpl_expect, "${outer_array_index}", std::to_string(outer));
- expect = utils::ReplaceAll(expect, "${column_index}", std::to_string(col));
+ tint::ReplaceAll(tmpl_expect, "${outer_array_index}", std::to_string(outer));
+ expect = tint::ReplaceAll(expect, "${column_index}", std::to_string(col));
auto got = Run<Std140>(src);
@@ -4578,10 +4566,9 @@
}
for (uint32_t outer = 0; outer < 4; outer++) {
- std::string src =
- utils::ReplaceAll(tmpl_src, "${outer_array_index}", std::to_string(outer));
+ std::string src = tint::ReplaceAll(tmpl_src, "${outer_array_index}", std::to_string(outer));
std::string expect =
- utils::ReplaceAll(tmpl_expect, "${outer_array_index}", std::to_string(outer));
+ tint::ReplaceAll(tmpl_expect, "${outer_array_index}", std::to_string(outer));
auto got = Run<Std140>(src);
@@ -4636,11 +4623,11 @@
for (uint32_t inner = 0; inner < 3; inner++) {
for (uint32_t col = 0; col < matrix.columns; col++) {
std::string src =
- utils::ReplaceAll(tmpl_src, "${inner_array_index}", std::to_string(inner));
- src = utils::ReplaceAll(src, "${column_index}", std::to_string(col));
+ tint::ReplaceAll(tmpl_src, "${inner_array_index}", std::to_string(inner));
+ src = tint::ReplaceAll(src, "${column_index}", std::to_string(col));
std::string expect =
- utils::ReplaceAll(tmpl_expect, "${inner_array_index}", std::to_string(inner));
- expect = utils::ReplaceAll(expect, "${column_index}", std::to_string(col));
+ tint::ReplaceAll(tmpl_expect, "${inner_array_index}", std::to_string(inner));
+ expect = tint::ReplaceAll(expect, "${column_index}", std::to_string(col));
auto got = Run<Std140>(src);
@@ -4720,10 +4707,9 @@
}
for (uint32_t inner = 0; inner < 3; inner++) {
- std::string src =
- utils::ReplaceAll(tmpl_src, "${inner_array_index}", std::to_string(inner));
+ std::string src = tint::ReplaceAll(tmpl_src, "${inner_array_index}", std::to_string(inner));
std::string expect =
- utils::ReplaceAll(tmpl_expect, "${inner_array_index}", std::to_string(inner));
+ tint::ReplaceAll(tmpl_expect, "${inner_array_index}", std::to_string(inner));
auto got = Run<Std140>(src);
@@ -4778,8 +4764,8 @@
}
for (uint32_t col = 0; col < matrix.columns; col++) {
- std::string src = utils::ReplaceAll(tmpl_src, "${column_index}", std::to_string(col));
- std::string expect = utils::ReplaceAll(tmpl_expect, "${column_index}", std::to_string(col));
+ std::string src = tint::ReplaceAll(tmpl_src, "${column_index}", std::to_string(col));
+ std::string expect = tint::ReplaceAll(tmpl_expect, "${column_index}", std::to_string(col));
auto got = Run<Std140>(src);
diff --git a/src/tint/lang/wgsl/ast/transform/std140_test.cc b/src/tint/lang/wgsl/ast/transform/std140_test.cc
index 7e80d30..2549e97 100644
--- a/src/tint/lang/wgsl/ast/transform/std140_test.cc
+++ b/src/tint/lang/wgsl/ast/transform/std140_test.cc
@@ -89,7 +89,7 @@
// Replace predefined field `${mat}` with the matrix shape. E.g. for a matrix mat4x3<f32>, would
// replace "${mat}" with "mat4x3<f32>".
std::string ReplaceMatInString(std::string str) const {
- str = utils::ReplaceAll(str, "${mat}", Mat());
+ str = tint::ReplaceAll(str, "${mat}", Mat());
return str;
}
};
diff --git a/src/tint/lang/wgsl/ast/transform/substitute_override.h b/src/tint/lang/wgsl/ast/transform/substitute_override.h
index 0319478..8e4b9d5 100644
--- a/src/tint/lang/wgsl/ast/transform/substitute_override.h
+++ b/src/tint/lang/wgsl/ast/transform/substitute_override.h
@@ -43,10 +43,10 @@
/// ```
///
/// @see crbug.com/tint/1582
-class SubstituteOverride final : public utils::Castable<SubstituteOverride, Transform> {
+class SubstituteOverride final : public Castable<SubstituteOverride, Transform> {
public:
/// Configuration options for the transform
- struct Config final : public utils::Castable<Config, Data> {
+ struct Config final : public Castable<Config, Data> {
/// Constructor
Config();
diff --git a/src/tint/lang/wgsl/ast/transform/texture_1d_to_2d.cc b/src/tint/lang/wgsl/ast/transform/texture_1d_to_2d.cc
index f28495d..a8ed07d 100644
--- a/src/tint/lang/wgsl/ast/transform/texture_1d_to_2d.cc
+++ b/src/tint/lang/wgsl/ast/transform/texture_1d_to_2d.cc
@@ -153,7 +153,7 @@
return nullptr;
}
- utils::Vector<const Expression*, 8> args;
+ tint::Vector<const Expression*, 8> args;
int index = 0;
for (auto* arg : c->args) {
if (index == coords_index) {
diff --git a/src/tint/lang/wgsl/ast/transform/texture_1d_to_2d.h b/src/tint/lang/wgsl/ast/transform/texture_1d_to_2d.h
index 32122cf..f7b7cd7 100644
--- a/src/tint/lang/wgsl/ast/transform/texture_1d_to_2d.h
+++ b/src/tint/lang/wgsl/ast/transform/texture_1d_to_2d.h
@@ -21,7 +21,7 @@
/// This transform converts all 1D texture types and accesses to 2D.
/// This is required for GLSL ES, which does not support 1D textures.
-class Texture1DTo2D final : public utils::Castable<Texture1DTo2D, Transform> {
+class Texture1DTo2D final : public Castable<Texture1DTo2D, Transform> {
public:
/// Constructor
Texture1DTo2D();
diff --git a/src/tint/lang/wgsl/ast/transform/transform.cc b/src/tint/lang/wgsl/ast/transform/transform.cc
index bdb552b..ab0bdfb 100644
--- a/src/tint/lang/wgsl/ast/transform/transform.cc
+++ b/src/tint/lang/wgsl/ast/transform/transform.cc
@@ -97,7 +97,7 @@
}
if (auto* a = ty->As<type::Array>()) {
auto el = CreateASTTypeFor(ctx, a->ElemType());
- utils::Vector<const Attribute*, 1> attrs;
+ tint::Vector<const Attribute*, 1> attrs;
if (!a->IsStrideImplicit()) {
attrs.Push(ctx.dst->create<StrideAttribute>(a->Stride()));
}
diff --git a/src/tint/lang/wgsl/ast/transform/transform.h b/src/tint/lang/wgsl/ast/transform/transform.h
index 1cbaa01..38a544f 100644
--- a/src/tint/lang/wgsl/ast/transform/transform.h
+++ b/src/tint/lang/wgsl/ast/transform/transform.h
@@ -49,7 +49,7 @@
};
/// Interface for Program transforms
-class Transform : public utils::Castable<Transform> {
+class Transform : public Castable<Transform> {
public:
/// Constructor
Transform();
diff --git a/src/tint/lang/wgsl/ast/transform/transform_test.cc b/src/tint/lang/wgsl/ast/transform/transform_test.cc
index 1d2a5db..93d190a 100644
--- a/src/tint/lang/wgsl/ast/transform/transform_test.cc
+++ b/src/tint/lang/wgsl/ast/transform/transform_test.cc
@@ -118,7 +118,7 @@
TEST_F(CreateASTTypeForTest, Struct) {
auto str = create([](ProgramBuilder& b) {
auto* decl = b.Structure("S", {});
- return b.create<sem::Struct>(decl, decl->name->symbol, utils::Empty, 4u /* align */,
+ return b.create<sem::Struct>(decl, decl->name->symbol, tint::Empty, 4u /* align */,
4u /* size */, 4u /* size_no_padding */);
});
diff --git a/src/tint/lang/wgsl/ast/transform/truncate_interstage_variables.cc b/src/tint/lang/wgsl/ast/transform/truncate_interstage_variables.cc
index a8a64be..5f076f6 100644
--- a/src/tint/lang/wgsl/ast/transform/truncate_interstage_variables.cc
+++ b/src/tint/lang/wgsl/ast/transform/truncate_interstage_variables.cc
@@ -57,7 +57,7 @@
b.Diagnostics().add_error(
diag::System::Transform,
"missing transform data for " +
- std::string(utils::TypeInfo::Of<TruncateInterstageVariables>().name));
+ std::string(tint::TypeInfo::Of<TruncateInterstageVariables>().name));
return Program(std::move(b));
}
@@ -65,8 +65,8 @@
bool should_run = false;
- utils::Hashmap<const sem::Function*, Symbol, 4u> entry_point_functions_to_truncate_functions;
- utils::Hashmap<const sem::Struct*, TruncatedStructAndConverter, 4u>
+ Hashmap<const sem::Function*, Symbol, 4u> entry_point_functions_to_truncate_functions;
+ Hashmap<const sem::Struct*, TruncatedStructAndConverter, 4u>
old_shader_io_structs_to_new_struct_and_truncate_functions;
for (auto* func_ast : ctx.src->AST().Functions()) {
@@ -95,7 +95,7 @@
// A prepass to check if any interstage variable locations in the entry point needs
// truncating. If not we don't really need to handle this entry point.
- utils::Hashset<const sem::StructMember*, 16u> omit_members;
+ Hashset<const sem::StructMember*, 16u> omit_members;
for (auto* member : str->Members()) {
if (auto location = member->Attributes().location) {
@@ -118,8 +118,8 @@
old_shader_io_structs_to_new_struct_and_truncate_functions.GetOrCreate(str, [&] {
auto new_struct_sym = b.Symbols().New();
- utils::Vector<const StructMember*, 20> truncated_members;
- utils::Vector<const Expression*, 20> initializer_exprs;
+ tint::Vector<const StructMember*, 20> truncated_members;
+ tint::Vector<const Expression*, 20> initializer_exprs;
for (auto* member : str->Members()) {
if (omit_members.Contains(member)) {
@@ -136,9 +136,9 @@
// Create the mapping function to truncate the shader io.
auto mapping_fn_sym = b.Symbols().New("truncate_shader_output");
b.Func(mapping_fn_sym,
- utils::Vector{b.Param("io", ctx.Clone(func_ast->return_type))},
+ tint::Vector{b.Param("io", ctx.Clone(func_ast->return_type))},
b.ty(new_struct_sym),
- utils::Vector{
+ tint::Vector{
b.Return(b.Call(new_struct_sym, std::move(initializer_exprs))),
});
return TruncatedStructAndConverter{new_struct_sym, mapping_fn_sym};
diff --git a/src/tint/lang/wgsl/ast/transform/truncate_interstage_variables.h b/src/tint/lang/wgsl/ast/transform/truncate_interstage_variables.h
index e2dd71e..5afd982 100644
--- a/src/tint/lang/wgsl/ast/transform/truncate_interstage_variables.h
+++ b/src/tint/lang/wgsl/ast/transform/truncate_interstage_variables.h
@@ -88,11 +88,10 @@
/// }
/// ```
///
-class TruncateInterstageVariables final
- : public utils::Castable<TruncateInterstageVariables, Transform> {
+class TruncateInterstageVariables final : public Castable<TruncateInterstageVariables, Transform> {
public:
/// Configuration options for the transform
- struct Config final : public utils::Castable<Config, Data> {
+ struct Config final : public Castable<Config, Data> {
/// Constructor
Config();
diff --git a/src/tint/lang/wgsl/ast/transform/unshadow.cc b/src/tint/lang/wgsl/ast/transform/unshadow.cc
index c313dc2..09ba661 100644
--- a/src/tint/lang/wgsl/ast/transform/unshadow.cc
+++ b/src/tint/lang/wgsl/ast/transform/unshadow.cc
@@ -48,7 +48,7 @@
auto& sem = src->Sem();
// Maps a variable to its new name.
- utils::Hashmap<const sem::Variable*, Symbol, 8> renamed_to;
+ Hashmap<const sem::Variable*, Symbol, 8> renamed_to;
auto rename = [&](const sem::Variable* v) -> const Variable* {
auto* decl = v->Declaration();
diff --git a/src/tint/lang/wgsl/ast/transform/unshadow.h b/src/tint/lang/wgsl/ast/transform/unshadow.h
index 966140d..77640cd 100644
--- a/src/tint/lang/wgsl/ast/transform/unshadow.h
+++ b/src/tint/lang/wgsl/ast/transform/unshadow.h
@@ -20,7 +20,7 @@
namespace tint::ast::transform {
/// Unshadow is a Transform that renames any variables that shadow another variable.
-class Unshadow final : public utils::Castable<Unshadow, Transform> {
+class Unshadow final : public Castable<Unshadow, Transform> {
public:
/// Constructor
Unshadow();
diff --git a/src/tint/lang/wgsl/ast/transform/utils/get_insertion_point_test.cc b/src/tint/lang/wgsl/ast/transform/utils/get_insertion_point_test.cc
index 8fad150..5e8deb4 100644
--- a/src/tint/lang/wgsl/ast/transform/utils/get_insertion_point_test.cc
+++ b/src/tint/lang/wgsl/ast/transform/utils/get_insertion_point_test.cc
@@ -35,7 +35,7 @@
auto* expr = b.Expr(1_i);
auto* var = b.Decl(b.Var("a", expr));
auto* block = b.Block(var);
- b.Func("f", tint::utils::Empty, b.ty.void_(), tint::utils::Vector{block});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{block});
Program original(std::move(b));
ProgramBuilder cloned_b;
@@ -58,7 +58,7 @@
auto* var = b.Decl(b.Var("a", expr));
auto* fl = b.For(var, b.Expr(true), nullptr, b.Block());
auto* func_block = b.Block(fl);
- b.Func("f", tint::utils::Empty, b.ty.void_(), tint::utils::Vector{func_block});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{func_block});
Program original(std::move(b));
ProgramBuilder cloned_b;
@@ -79,7 +79,7 @@
auto* expr = b.Expr(1_i);
auto* var = b.Decl(b.Var("a", expr));
auto* s = b.For({}, b.Expr(true), var, b.Block());
- b.Func("f", tint::utils::Empty, b.ty.void_(), tint::utils::Vector{s});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{s});
Program original(std::move(b));
ProgramBuilder cloned_b;
diff --git a/src/tint/lang/wgsl/ast/transform/utils/hoist_to_decl_before.cc b/src/tint/lang/wgsl/ast/transform/utils/hoist_to_decl_before.cc
index 489b23d..8f81f37 100644
--- a/src/tint/lang/wgsl/ast/transform/utils/hoist_to_decl_before.cc
+++ b/src/tint/lang/wgsl/ast/transform/utils/hoist_to_decl_before.cc
@@ -127,29 +127,29 @@
/// loop, so that declaration statements can be inserted before the
/// condition expression or continuing statement.
struct LoopInfo {
- utils::Vector<StmtBuilder, 8> init_decls;
- utils::Vector<StmtBuilder, 8> cond_decls;
- utils::Vector<StmtBuilder, 8> cont_decls;
+ Vector<StmtBuilder, 8> init_decls;
+ Vector<StmtBuilder, 8> cond_decls;
+ Vector<StmtBuilder, 8> cont_decls;
};
/// Info for each else-if that needs decomposing
struct ElseIfInfo {
/// Decls to insert before condition
- utils::Vector<StmtBuilder, 8> cond_decls;
+ Vector<StmtBuilder, 8> cond_decls;
};
/// For-loops that need to be decomposed to loops.
- utils::Hashmap<const sem::ForLoopStatement*, LoopInfo, 4> for_loops;
+ Hashmap<const sem::ForLoopStatement*, LoopInfo, 4> for_loops;
/// Whiles that need to be decomposed to loops.
- utils::Hashmap<const sem::WhileStatement*, LoopInfo, 4> while_loops;
+ Hashmap<const sem::WhileStatement*, LoopInfo, 4> while_loops;
/// 'else if' statements that need to be decomposed to 'else {if}'
- utils::Hashmap<const IfStatement*, ElseIfInfo, 4> else_ifs;
+ Hashmap<const IfStatement*, ElseIfInfo, 4> else_ifs;
template <size_t N>
- static auto Build(const utils::Vector<StmtBuilder, N>& builders) {
- return utils::Transform(builders, [&](auto& builder) { return builder(); });
+ static auto Build(const Vector<StmtBuilder, N>& builders) {
+ return tint::Transform(builders, [&](auto& builder) { return builder(); });
}
/// @returns a new LoopInfo reference for the given @p for_loop.
@@ -259,8 +259,8 @@
// Build the loop body's statements.
// Start with any let declarations for the conditional
// expression.
- auto body_stmts = utils::Transform(info->cond_decls,
- [&](auto& builder) { return builder(); });
+ auto body_stmts =
+ tint::Transform(info->cond_decls, [&](auto& builder) { return builder(); });
// Emit the condition as:
// if (!cond) { break; }
auto* cond = while_loop->condition;
diff --git a/src/tint/lang/wgsl/ast/transform/utils/hoist_to_decl_before_test.cc b/src/tint/lang/wgsl/ast/transform/utils/hoist_to_decl_before_test.cc
index 3d9bd4a..50e8f76 100644
--- a/src/tint/lang/wgsl/ast/transform/utils/hoist_to_decl_before_test.cc
+++ b/src/tint/lang/wgsl/ast/transform/utils/hoist_to_decl_before_test.cc
@@ -36,7 +36,7 @@
ProgramBuilder b;
auto* expr = b.Expr(1_i);
auto* var = b.Decl(b.Var("a", expr));
- b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{var});
Program original(std::move(b));
ProgramBuilder cloned_b;
@@ -67,7 +67,7 @@
ProgramBuilder b;
auto* expr = b.Expr(1_i);
auto* s = b.For(b.Decl(b.Var("a", expr)), b.Expr(true), nullptr, b.Block());
- b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{s});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{s});
Program original(std::move(b));
ProgramBuilder cloned_b;
@@ -109,7 +109,7 @@
auto* var = b.Decl(b.Const("a", b.Expr(true)));
auto* expr = b.Expr("a");
auto* s = b.For(nullptr, expr, nullptr, b.Block());
- b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var, s});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{var, s});
Program original(std::move(b));
ProgramBuilder cloned_b;
@@ -147,7 +147,7 @@
ProgramBuilder b;
auto* expr = b.Expr(1_i);
auto* s = b.For(nullptr, b.Expr(true), b.Decl(b.Var("a", expr)), b.Block());
- b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{s});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{s});
Program original(std::move(b));
ProgramBuilder cloned_b;
@@ -190,7 +190,7 @@
auto* var = b.Decl(b.Var("a", b.ty.bool_()));
auto* expr = b.Expr("a");
auto* s = b.While(expr, b.Block());
- b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var, s});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{var, s});
Program original(std::move(b));
ProgramBuilder cloned_b;
@@ -234,7 +234,7 @@
auto* s = b.If(b.Expr(true), b.Block(), //
b.Else(b.If(expr, b.Block(), //
b.Else(b.Block()))));
- b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var, s});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{var, s});
Program original(std::move(b));
ProgramBuilder cloned_b;
@@ -272,7 +272,7 @@
auto* var1 = b.Decl(b.Var("a", b.ty.array<i32, 10>()));
auto* expr = b.IndexAccessor("a", 0_i);
auto* var2 = b.Decl(b.Var("b", expr));
- b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var1, var2});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{var1, var2});
Program original(std::move(b));
ProgramBuilder cloned_b;
@@ -306,7 +306,7 @@
auto* var1 = b.Decl(b.Var("a", b.ty.array(b.ty.array<i32, 10>(), 10_i)));
auto* expr = b.IndexAccessor(b.IndexAccessor("a", 0_i), 0_i);
auto* var2 = b.Decl(b.Var("b", expr));
- b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var1, var2});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{var1, var2});
Program original(std::move(b));
ProgramBuilder cloned_b;
@@ -340,7 +340,7 @@
auto* var = b.Decl(b.Var("a", b.ty.bool_()));
auto* expr = b.Expr("a");
auto* s = b.For(nullptr, expr, nullptr, b.Block());
- b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var, s});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{var, s});
Program original(std::move(b));
ProgramBuilder cloned_b;
@@ -377,7 +377,7 @@
ProgramBuilder b;
auto* expr = b.Expr(1_i);
auto* s = b.For(nullptr, b.Expr(true), b.Decl(b.Var("a", expr)), b.Block());
- b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{s});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{s});
Program original(std::move(b));
ProgramBuilder cloned_b;
@@ -423,7 +423,7 @@
auto* s = b.If(b.Expr(true), b.Block(), //
b.Else(b.If(expr, b.Block(), //
b.Else(b.Block()))));
- b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var, s});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{var, s});
Program original(std::move(b));
ProgramBuilder cloned_b;
@@ -458,9 +458,9 @@
// var a = 1i;
// }
ProgramBuilder b;
- b.Func("foo", utils::Empty, b.ty.void_(), utils::Empty);
+ b.Func("foo", tint::Empty, b.ty.void_(), tint::Empty);
auto* var = b.Decl(b.Var("a", b.Expr(1_i)));
- b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{var});
Program original(std::move(b));
ProgramBuilder cloned_b;
@@ -494,9 +494,9 @@
// var a = 1i;
// }
ProgramBuilder b;
- b.Func("foo", utils::Empty, b.ty.void_(), utils::Empty);
+ b.Func("foo", tint::Empty, b.ty.void_(), tint::Empty);
auto* var = b.Decl(b.Var("a", b.Expr(1_i)));
- b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{var});
Program original(std::move(b));
ProgramBuilder cloned_b;
@@ -531,10 +531,10 @@
// }
// }
ProgramBuilder b;
- b.Func("foo", utils::Empty, b.ty.void_(), utils::Empty);
+ b.Func("foo", tint::Empty, b.ty.void_(), tint::Empty);
auto* var = b.Decl(b.Var("a", b.Expr(1_i)));
auto* s = b.For(var, b.Expr(true), nullptr, b.Block());
- b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{s});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{s});
Program original(std::move(b));
ProgramBuilder cloned_b;
@@ -578,10 +578,10 @@
// }
// }
ProgramBuilder b;
- b.Func("foo", utils::Empty, b.ty.void_(), utils::Empty);
+ b.Func("foo", tint::Empty, b.ty.void_(), tint::Empty);
auto* var = b.Decl(b.Var("a", b.Expr(1_i)));
auto* s = b.For(var, b.Expr(true), nullptr, b.Block());
- b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{s});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{s});
Program original(std::move(b));
ProgramBuilder cloned_b;
@@ -626,11 +626,11 @@
// }
// }
ProgramBuilder b;
- b.Func("foo", utils::Empty, b.ty.void_(), utils::Empty);
+ b.Func("foo", tint::Empty, b.ty.void_(), tint::Empty);
auto* var = b.Decl(b.Var("a", b.Expr(1_i)));
auto* cont = b.CompoundAssign("a", b.Expr(1_i), BinaryOp::kAdd);
auto* s = b.For(nullptr, b.Expr(true), cont, b.Block());
- b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var, s});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{var, s});
Program original(std::move(b));
ProgramBuilder cloned_b;
@@ -677,11 +677,11 @@
// }
// }
ProgramBuilder b;
- b.Func("foo", utils::Empty, b.ty.void_(), utils::Empty);
+ b.Func("foo", tint::Empty, b.ty.void_(), tint::Empty);
auto* var = b.Decl(b.Var("a", b.Expr(1_i)));
auto* cont = b.CompoundAssign("a", b.Expr(1_i), BinaryOp::kAdd);
auto* s = b.For(nullptr, b.Expr(true), cont, b.Block());
- b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var, s});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{var, s});
Program original(std::move(b));
ProgramBuilder cloned_b;
@@ -730,12 +730,12 @@
// }
// }
ProgramBuilder b;
- b.Func("foo", utils::Empty, b.ty.void_(), utils::Empty);
+ b.Func("foo", tint::Empty, b.ty.void_(), tint::Empty);
auto* var = b.Decl(b.Var("a", b.ty.bool_()));
auto* elseif = b.If(b.Expr("a"), b.Block(), b.Else(b.Block()));
auto* s = b.If(b.Expr(true), b.Block(), //
b.Else(elseif));
- b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var, s});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{var, s});
Program original(std::move(b));
ProgramBuilder cloned_b;
@@ -779,12 +779,12 @@
// }
// }
ProgramBuilder b;
- b.Func("foo", utils::Empty, b.ty.void_(), utils::Empty);
+ b.Func("foo", tint::Empty, b.ty.void_(), tint::Empty);
auto* var = b.Decl(b.Var("a", b.ty.bool_()));
auto* elseif = b.If(b.Expr("a"), b.Block(), b.Else(b.Block()));
auto* s = b.If(b.Expr(true), b.Block(), //
b.Else(elseif));
- b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var, s});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{var, s});
Program original(std::move(b));
ProgramBuilder cloned_b;
@@ -824,7 +824,7 @@
ProgramBuilder b;
auto* expr = b.Call(b.ty("array"), b.Expr(1_a));
auto* var = b.Decl(b.Var("a", b.ty.array(b.ty.f32(), 1_a), expr));
- b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{var});
Program original(std::move(b));
ProgramBuilder cloned_b;
@@ -854,7 +854,7 @@
ProgramBuilder b;
auto* expr = b.Call(b.ty("array"), b.Expr(1_a));
auto* var = b.Decl(b.Var("a", b.ty.array(b.ty.f32(), 1_a), expr));
- b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{var});
Program original(std::move(b));
ProgramBuilder cloned_b;
@@ -884,9 +884,9 @@
// var a = 1i;
// }
ProgramBuilder b;
- b.Func("foo", utils::Empty, b.ty.void_(), utils::Empty);
+ b.Func("foo", tint::Empty, b.ty.void_(), tint::Empty);
auto* var = b.Decl(b.Var("a", b.Expr(1_i)));
- b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{var});
Program original(std::move(b));
ProgramBuilder cloned_b;
@@ -919,9 +919,9 @@
// var a = 1i;
// }
ProgramBuilder b;
- b.Func("foo", utils::Empty, b.ty.void_(), utils::Empty);
+ b.Func("foo", tint::Empty, b.ty.void_(), tint::Empty);
auto* var = b.Decl(b.Var("a", b.Expr(1_i)));
- b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{var});
Program original(std::move(b));
ProgramBuilder cloned_b;
@@ -954,10 +954,10 @@
// }
// }
ProgramBuilder b;
- b.Func("foo", utils::Empty, b.ty.void_(), utils::Empty);
+ b.Func("foo", tint::Empty, b.ty.void_(), tint::Empty);
auto* var = b.Decl(b.Var("a", b.Expr(1_i)));
auto* s = b.For(var, b.Expr(true), nullptr, b.Block());
- b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{s});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{s});
Program original(std::move(b));
ProgramBuilder cloned_b;
@@ -1000,10 +1000,10 @@
// }
// }
ProgramBuilder b;
- b.Func("foo", utils::Empty, b.ty.void_(), utils::Empty);
+ b.Func("foo", tint::Empty, b.ty.void_(), tint::Empty);
auto* var = b.Decl(b.Var("a", b.Expr(1_i)));
auto* s = b.For(var, b.Expr(true), nullptr, b.Block());
- b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{s});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{s});
Program original(std::move(b));
ProgramBuilder cloned_b;
@@ -1046,11 +1046,11 @@
// }
// }
ProgramBuilder b;
- b.Func("foo", utils::Empty, b.ty.void_(), utils::Empty);
+ b.Func("foo", tint::Empty, b.ty.void_(), tint::Empty);
auto* var = b.Decl(b.Var("a", b.Expr(1_i)));
auto* cont = b.CompoundAssign("a", b.Expr(1_i), BinaryOp::kAdd);
auto* s = b.For(nullptr, b.Expr(true), cont, b.Block());
- b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var, s});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{var, s});
Program original(std::move(b));
ProgramBuilder cloned_b;
@@ -1096,11 +1096,11 @@
// }
// }
ProgramBuilder b;
- b.Func("foo", utils::Empty, b.ty.void_(), utils::Empty);
+ b.Func("foo", tint::Empty, b.ty.void_(), tint::Empty);
auto* var = b.Decl(b.Var("a", b.Expr(1_i)));
auto* cont = b.CompoundAssign("a", b.Expr(1_i), BinaryOp::kAdd);
auto* s = b.For(nullptr, b.Expr(true), cont, b.Block());
- b.Func("f", utils::Empty, b.ty.void_(), utils::Vector{var, s});
+ b.Func("f", tint::Empty, b.ty.void_(), Vector{var, s});
Program original(std::move(b));
ProgramBuilder cloned_b;
diff --git a/src/tint/lang/wgsl/ast/transform/var_for_dynamic_index.h b/src/tint/lang/wgsl/ast/transform/var_for_dynamic_index.h
index 3d66520..fa1d612 100644
--- a/src/tint/lang/wgsl/ast/transform/var_for_dynamic_index.h
+++ b/src/tint/lang/wgsl/ast/transform/var_for_dynamic_index.h
@@ -23,7 +23,7 @@
/// indexed to a temporary `var` local before performing the index. This
/// transform is used by the SPIR-V writer as there is no SPIR-V instruction
/// that can dynamically index a non-pointer composite.
-class VarForDynamicIndex final : public utils::Castable<VarForDynamicIndex, Transform> {
+class VarForDynamicIndex final : public Castable<VarForDynamicIndex, Transform> {
public:
/// Constructor
VarForDynamicIndex();
diff --git a/src/tint/lang/wgsl/ast/transform/vectorize_matrix_conversions.cc b/src/tint/lang/wgsl/ast/transform/vectorize_matrix_conversions.cc
index 9efe4f1..482abfe 100644
--- a/src/tint/lang/wgsl/ast/transform/vectorize_matrix_conversions.cc
+++ b/src/tint/lang/wgsl/ast/transform/vectorize_matrix_conversions.cc
@@ -66,7 +66,7 @@
CloneContext ctx{&b, src, /* auto_clone_symbols */ true};
using HelperFunctionKey =
- utils::UnorderedKeyWrapper<std::tuple<const type::Matrix*, const type::Matrix*>>;
+ tint::UnorderedKeyWrapper<std::tuple<const type::Matrix*, const type::Matrix*>>;
std::unordered_map<HelperFunctionKey, Symbol> matrix_convs;
@@ -102,7 +102,7 @@
}
auto build_vectorized_conversion_expression = [&](auto&& src_expression_builder) {
- utils::Vector<const Expression*, 4> columns;
+ tint::Vector<const Expression*, 4> columns;
for (uint32_t c = 0; c < dst_type->columns(); c++) {
auto* src_matrix_expr = src_expression_builder();
auto* src_column_expr = b.IndexAccessor(src_matrix_expr, b.Expr(tint::AInt(c)));
@@ -120,24 +120,23 @@
});
} else {
// If has side effects, use a helper function.
- auto fn =
- utils::GetOrCreate(matrix_convs, HelperFunctionKey{{src_type, dst_type}}, [&] {
- auto name = b.Symbols().New(
- "convert_mat" + std::to_string(src_type->columns()) + "x" +
- std::to_string(src_type->rows()) + "_" + src_type->type()->FriendlyName() +
- "_" + dst_type->type()->FriendlyName());
- b.Func(name,
- utils::Vector{
- b.Param("value", CreateASTTypeFor(ctx, src_type)),
- },
- CreateASTTypeFor(ctx, dst_type),
- utils::Vector{
- b.Return(build_vectorized_conversion_expression([&] { //
- return b.Expr("value");
- })),
- });
- return name;
- });
+ auto fn = tint::GetOrCreate(matrix_convs, HelperFunctionKey{{src_type, dst_type}}, [&] {
+ auto name = b.Symbols().New("convert_mat" + std::to_string(src_type->columns()) +
+ "x" + std::to_string(src_type->rows()) + "_" +
+ src_type->type()->FriendlyName() + "_" +
+ dst_type->type()->FriendlyName());
+ b.Func(name,
+ tint::Vector{
+ b.Param("value", CreateASTTypeFor(ctx, src_type)),
+ },
+ CreateASTTypeFor(ctx, dst_type),
+ tint::Vector{
+ b.Return(build_vectorized_conversion_expression([&] { //
+ return b.Expr("value");
+ })),
+ });
+ return name;
+ });
return b.Call(fn, ctx.Clone(args[0]->Declaration()));
}
});
diff --git a/src/tint/lang/wgsl/ast/transform/vectorize_matrix_conversions.h b/src/tint/lang/wgsl/ast/transform/vectorize_matrix_conversions.h
index b61777a..d08c0cc 100644
--- a/src/tint/lang/wgsl/ast/transform/vectorize_matrix_conversions.h
+++ b/src/tint/lang/wgsl/ast/transform/vectorize_matrix_conversions.h
@@ -20,8 +20,7 @@
namespace tint::ast::transform {
/// A transform that converts matrix conversions (between f32 and f16 matrices) to the vector form.
-class VectorizeMatrixConversions final
- : public utils::Castable<VectorizeMatrixConversions, Transform> {
+class VectorizeMatrixConversions final : public Castable<VectorizeMatrixConversions, Transform> {
public:
/// Constructor
VectorizeMatrixConversions();
diff --git a/src/tint/lang/wgsl/ast/transform/vectorize_matrix_conversions_test.cc b/src/tint/lang/wgsl/ast/transform/vectorize_matrix_conversions_test.cc
index 065bf2f..ac9d806 100644
--- a/src/tint/lang/wgsl/ast/transform/vectorize_matrix_conversions_test.cc
+++ b/src/tint/lang/wgsl/ast/transform/vectorize_matrix_conversions_test.cc
@@ -93,11 +93,11 @@
let n : ${dst_mat_type} = ${dst_mat_type}(${args});
}
)";
- tmpl = utils::ReplaceAll(tmpl, "${src_mat_type}", src_mat_type);
- tmpl = utils::ReplaceAll(tmpl, "${dst_mat_type}", dst_mat_type);
- tmpl = utils::ReplaceAll(tmpl, "${values}", vector_values);
- auto src = utils::ReplaceAll(tmpl, "${args}", "m");
- auto expect = utils::ReplaceAll(tmpl, "${args}", vectorized_args);
+ tmpl = tint::ReplaceAll(tmpl, "${src_mat_type}", src_mat_type);
+ tmpl = tint::ReplaceAll(tmpl, "${dst_mat_type}", dst_mat_type);
+ tmpl = tint::ReplaceAll(tmpl, "${values}", vector_values);
+ auto src = tint::ReplaceAll(tmpl, "${args}", "m");
+ auto expect = tint::ReplaceAll(tmpl, "${args}", vectorized_args);
EXPECT_TRUE(ShouldRun<VectorizeMatrixConversions>(src));
@@ -168,11 +168,11 @@
let n : ${dst_mat_type} = ${dst_mat_type}(${args});
}
)";
- tmpl = utils::ReplaceAll(tmpl, "${src_mat_type}", src_mat_type);
- tmpl = utils::ReplaceAll(tmpl, "${dst_mat_type}", dst_mat_type);
- tmpl = utils::ReplaceAll(tmpl, "${values}", vector_values);
- auto src = utils::ReplaceAll(tmpl, "${args}", "m");
- auto expect = utils::ReplaceAll(tmpl, "${args}", vectorized_args);
+ tmpl = tint::ReplaceAll(tmpl, "${src_mat_type}", src_mat_type);
+ tmpl = tint::ReplaceAll(tmpl, "${dst_mat_type}", dst_mat_type);
+ tmpl = tint::ReplaceAll(tmpl, "${values}", vector_values);
+ auto src = tint::ReplaceAll(tmpl, "${args}", "m");
+ auto expect = tint::ReplaceAll(tmpl, "${args}", vectorized_args);
EXPECT_TRUE(ShouldRun<VectorizeMatrixConversions>(src));
@@ -296,13 +296,13 @@
let m16 : ${f16_mat_type} = ${f16_matrix_conversion};
}
)";
- tmpl = utils::ReplaceAll(tmpl, "${f32_values}", f32_vector_values);
- tmpl = utils::ReplaceAll(tmpl, "${f16_values}", f16_vector_values);
- auto src = utils::ReplaceAll(tmpl, "${f32_matrix_conversion}", "${f32_mat_type}(mat_f16())");
- src = utils::ReplaceAll(src, "${f16_matrix_conversion}", "${f16_mat_type}(mat_f32())");
- src = utils::ReplaceAll(src, "${helper_function}", "");
- src = utils::ReplaceAll(src, "${f32_mat_type}", f32_mat_type);
- src = utils::ReplaceAll(src, "${f16_mat_type}", f16_mat_type);
+ tmpl = tint::ReplaceAll(tmpl, "${f32_values}", f32_vector_values);
+ tmpl = tint::ReplaceAll(tmpl, "${f16_values}", f16_vector_values);
+ auto src = tint::ReplaceAll(tmpl, "${f32_matrix_conversion}", "${f32_mat_type}(mat_f16())");
+ src = tint::ReplaceAll(src, "${f16_matrix_conversion}", "${f16_mat_type}(mat_f32())");
+ src = tint::ReplaceAll(src, "${helper_function}", "");
+ src = tint::ReplaceAll(src, "${f32_mat_type}", f32_mat_type);
+ src = tint::ReplaceAll(src, "${f16_mat_type}", f16_mat_type);
auto helper_function = std::string(R"(
fn convert_${mat_shape}_f16_f32(value : ${f16_mat_type}) -> ${f32_mat_type} {
@@ -313,16 +313,16 @@
return ${f16_mat_type}(${f16_vectorized_args});
}
)");
- auto expect = utils::ReplaceAll(tmpl, "${helper_function}", helper_function);
- expect = utils::ReplaceAll(expect, "${f32_mat_type}", f32_mat_type);
- expect = utils::ReplaceAll(expect, "${f16_mat_type}", f16_mat_type);
- expect = utils::ReplaceAll(expect, "${f32_matrix_conversion}",
- "convert_${mat_shape}_f16_f32(mat_f16())");
- expect = utils::ReplaceAll(expect, "${f16_matrix_conversion}",
- "convert_${mat_shape}_f32_f16(mat_f32())");
- expect = utils::ReplaceAll(expect, "${mat_shape}", mat_shape);
- expect = utils::ReplaceAll(expect, "${f32_vectorized_args}", f32_vectorized_args);
- expect = utils::ReplaceAll(expect, "${f16_vectorized_args}", f16_vectorized_args);
+ auto expect = tint::ReplaceAll(tmpl, "${helper_function}", helper_function);
+ expect = tint::ReplaceAll(expect, "${f32_mat_type}", f32_mat_type);
+ expect = tint::ReplaceAll(expect, "${f16_mat_type}", f16_mat_type);
+ expect = tint::ReplaceAll(expect, "${f32_matrix_conversion}",
+ "convert_${mat_shape}_f16_f32(mat_f16())");
+ expect = tint::ReplaceAll(expect, "${f16_matrix_conversion}",
+ "convert_${mat_shape}_f32_f16(mat_f32())");
+ expect = tint::ReplaceAll(expect, "${mat_shape}", mat_shape);
+ expect = tint::ReplaceAll(expect, "${f32_vectorized_args}", f32_vectorized_args);
+ expect = tint::ReplaceAll(expect, "${f16_vectorized_args}", f16_vectorized_args);
EXPECT_TRUE(ShouldRun<VectorizeMatrixConversions>(src));
@@ -351,8 +351,8 @@
let m = ${matrix}(${columns});
}
)";
- tmpl = utils::ReplaceAll(tmpl, "${matrix}", mat_type);
- auto src = utils::ReplaceAll(tmpl, "${columns}", columns);
+ tmpl = tint::ReplaceAll(tmpl, "${matrix}", mat_type);
+ auto src = tint::ReplaceAll(tmpl, "${columns}", columns);
auto expect = src;
EXPECT_FALSE(ShouldRun<VectorizeMatrixConversions>(src));
@@ -384,8 +384,8 @@
let n : ${matrix} = ${matrix}(m);
}
)";
- tmpl = utils::ReplaceAll(tmpl, "${matrix}", mat_type);
- auto src = utils::ReplaceAll(tmpl, "${columns}", columns);
+ tmpl = tint::ReplaceAll(tmpl, "${matrix}", mat_type);
+ auto src = tint::ReplaceAll(tmpl, "${columns}", columns);
auto expect = src;
EXPECT_FALSE(ShouldRun<VectorizeMatrixConversions>(src));
diff --git a/src/tint/lang/wgsl/ast/transform/vectorize_scalar_matrix_initializers.cc b/src/tint/lang/wgsl/ast/transform/vectorize_scalar_matrix_initializers.cc
index f8e594c..bb55628 100644
--- a/src/tint/lang/wgsl/ast/transform/vectorize_scalar_matrix_initializers.cc
+++ b/src/tint/lang/wgsl/ast/transform/vectorize_scalar_matrix_initializers.cc
@@ -91,9 +91,9 @@
// Constructs a matrix using vector columns, with the elements constructed using the
// 'element(uint32_t c, uint32_t r)' callback.
auto build_mat = [&](auto&& element) {
- utils::Vector<const Expression*, 4> columns;
+ tint::Vector<const Expression*, 4> columns;
for (uint32_t c = 0; c < mat_type->columns(); c++) {
- utils::Vector<const Expression*, 4> row_values;
+ tint::Vector<const Expression*, 4> row_values;
for (uint32_t r = 0; r < mat_type->rows(); r++) {
row_values.Push(element(c, r));
}
@@ -109,16 +109,16 @@
// Generate a helper function for constructing the matrix.
// This is done to ensure that the single argument value is only evaluated once, and
// with the correct expression evaluation order.
- auto fn = utils::GetOrCreate(scalar_inits, mat_type, [&] {
+ auto fn = tint::GetOrCreate(scalar_inits, mat_type, [&] {
auto name = b.Symbols().New("build_mat" + std::to_string(mat_type->columns()) +
"x" + std::to_string(mat_type->rows()));
b.Func(name,
- utils::Vector{
+ tint::Vector{
// Single scalar parameter
b.Param("value", CreateASTTypeFor(ctx, mat_type->type())),
},
CreateASTTypeFor(ctx, mat_type),
- utils::Vector{
+ tint::Vector{
b.Return(build_mat([&](uint32_t, uint32_t) { //
return b.Expr("value");
})),
diff --git a/src/tint/lang/wgsl/ast/transform/vectorize_scalar_matrix_initializers.h b/src/tint/lang/wgsl/ast/transform/vectorize_scalar_matrix_initializers.h
index 519975d..fc02609 100644
--- a/src/tint/lang/wgsl/ast/transform/vectorize_scalar_matrix_initializers.h
+++ b/src/tint/lang/wgsl/ast/transform/vectorize_scalar_matrix_initializers.h
@@ -21,7 +21,7 @@
/// A transform that converts scalar matrix initializers to the vector form.
class VectorizeScalarMatrixInitializers final
- : public utils::Castable<VectorizeScalarMatrixInitializers, Transform> {
+ : public Castable<VectorizeScalarMatrixInitializers, Transform> {
public:
/// Constructor
VectorizeScalarMatrixInitializers();
diff --git a/src/tint/lang/wgsl/ast/transform/vectorize_scalar_matrix_initializers_test.cc b/src/tint/lang/wgsl/ast/transform/vectorize_scalar_matrix_initializers_test.cc
index 1cdaaef..14dc0d9 100644
--- a/src/tint/lang/wgsl/ast/transform/vectorize_scalar_matrix_initializers_test.cc
+++ b/src/tint/lang/wgsl/ast/transform/vectorize_scalar_matrix_initializers_test.cc
@@ -62,9 +62,9 @@
let m = ${matrix}(${values});
}
)";
- tmpl = utils::ReplaceAll(tmpl, "${matrix}", mat_type);
- auto src = utils::ReplaceAll(tmpl, "${values}", scalar_values);
- auto expect = utils::ReplaceAll(tmpl, "${values}", vector_values);
+ tmpl = tint::ReplaceAll(tmpl, "${matrix}", mat_type);
+ auto src = tint::ReplaceAll(tmpl, "${values}", scalar_values);
+ auto expect = tint::ReplaceAll(tmpl, "${values}", vector_values);
EXPECT_TRUE(ShouldRun<VectorizeScalarMatrixInitializers>(src));
@@ -105,9 +105,9 @@
let m = ${matrix}(${values});
}
)";
- tmpl = utils::ReplaceAll(tmpl, "${matrix}", mat_type);
- auto src = utils::ReplaceAll(tmpl, "${values}", scalar_values);
- auto expect = utils::ReplaceAll(tmpl, "${values}", vector_values);
+ tmpl = tint::ReplaceAll(tmpl, "${matrix}", mat_type);
+ auto src = tint::ReplaceAll(tmpl, "${values}", scalar_values);
+ auto expect = tint::ReplaceAll(tmpl, "${values}", vector_values);
EXPECT_TRUE(ShouldRun<VectorizeScalarMatrixInitializers>(src));
@@ -135,8 +135,8 @@
let m = ${matrix}(${columns});
}
)";
- tmpl = utils::ReplaceAll(tmpl, "${matrix}", mat_type);
- auto src = utils::ReplaceAll(tmpl, "${columns}", columns);
+ tmpl = tint::ReplaceAll(tmpl, "${matrix}", mat_type);
+ auto src = tint::ReplaceAll(tmpl, "${columns}", columns);
auto expect = src;
EXPECT_FALSE(ShouldRun<VectorizeScalarMatrixInitializers>(src));
diff --git a/src/tint/lang/wgsl/ast/transform/vertex_pulling.cc b/src/tint/lang/wgsl/ast/transform/vertex_pulling.cc
index cf3aa2a..17bcf6f 100644
--- a/src/tint/lang/wgsl/ast/transform/vertex_pulling.cc
+++ b/src/tint/lang/wgsl/ast/transform/vertex_pulling.cc
@@ -62,7 +62,7 @@
/// @param out the stream to write to
/// @param format the VertexFormat to write
/// @returns out so calls can be chained
-utils::StringStream& operator<<(utils::StringStream& out, VertexFormat format) {
+StringStream& operator<<(StringStream& out, VertexFormat format) {
switch (format) {
case VertexFormat::kUint8x2:
return out << "uint8x2";
@@ -295,12 +295,12 @@
Symbol pulling_position_name;
Symbol struct_buffer_name;
std::unordered_map<uint32_t, Symbol> vertex_buffer_names;
- utils::Vector<const Parameter*, 8> new_function_parameters;
+ tint::Vector<const Parameter*, 8> new_function_parameters;
/// Generate the vertex buffer binding name
/// @param index index to append to buffer name
Symbol GetVertexBufferName(uint32_t index) {
- return utils::GetOrCreate(vertex_buffer_names, index, [&] {
+ return tint::GetOrCreate(vertex_buffer_names, index, [&] {
static const char kVertexBufferNamePrefix[] = "tint_pulling_vertex_buffer_";
return b.Symbols().New(kVertexBufferNamePrefix + std::to_string(index));
});
@@ -320,7 +320,7 @@
// Creating the struct type
static const char kStructName[] = "TintVertexData";
auto* struct_type = b.Structure(b.Symbols().New(kStructName),
- utils::Vector{
+ tint::Vector{
b.Member(GetStructBufferName(), b.ty.array<u32>()),
});
for (uint32_t i = 0; i < cfg.vertex_state.size(); ++i) {
@@ -336,7 +336,7 @@
// Assign by looking at the vertex descriptor to find attributes with
// matching location.
- utils::Vector<const Statement*, 8> stmts;
+ tint::Vector<const Statement*, 8> stmts;
for (uint32_t buffer_idx = 0; buffer_idx < cfg.vertex_state.size(); ++buffer_idx) {
const VertexBufferLayoutDescriptor& buffer_layout = cfg.vertex_state[buffer_idx];
@@ -382,7 +382,7 @@
// Base types must match between the vertex stream and the WGSL variable
if (!IsTypeCompatible(var_dt, fmt_dt)) {
- utils::StringStream err;
+ StringStream err;
err << "VertexAttributeDescriptor for location "
<< std::to_string(attribute_desc.shader_location) << " has format "
<< attribute_desc.format << " but shader expects "
@@ -434,7 +434,7 @@
// The components of result vector variable, initialized with type-converted
// loaded data vector.
- utils::Vector<const Expression*, 8> values{fetch};
+ tint::Vector<const Expression*, 8> values{fetch};
// Add padding elements. The result must be of vector types of signed/unsigned
// integer or float, so use the abstract integer or abstract float value to do
@@ -742,7 +742,7 @@
Type base_type,
VertexFormat base_format,
uint32_t count) {
- utils::Vector<const Expression*, 8> expr_list;
+ tint::Vector<const Expression*, 8> expr_list;
for (uint32_t i = 0; i < count; ++i) {
// Offset read position by element_stride for each component
uint32_t primitive_offset = offset + element_stride * i;
@@ -812,7 +812,7 @@
// Process the struct members.
bool has_locations = false;
- utils::Vector<const StructMember*, 8> members_to_clone;
+ tint::Vector<const StructMember*, 8> members_to_clone;
for (auto* member : struct_ty->members) {
auto member_sym = ctx.Clone(member->name->symbol);
std::function<const Expression*()> member_expr = [this, param_sym, member_sym] {
@@ -859,7 +859,7 @@
if (!members_to_clone.IsEmpty()) {
// Create a new struct without the location attributes.
- utils::Vector<const StructMember*, 8> new_members;
+ tint::Vector<const StructMember*, 8> new_members;
for (auto* member : members_to_clone) {
auto member_name = ctx.Clone(member->name);
auto member_type = ctx.Clone(member->type);
@@ -906,7 +906,7 @@
auto name = b.Symbols().New("tint_pulling_vertex_index");
new_function_parameters.Push(
b.Param(name, b.ty.u32(),
- utils::Vector{b.Builtin(builtin::BuiltinValue::kVertexIndex)}));
+ tint::Vector{b.Builtin(builtin::BuiltinValue::kVertexIndex)}));
vertex_index_expr = [this, name] { return b.Expr(name); };
break;
}
@@ -918,7 +918,7 @@
auto name = b.Symbols().New("tint_pulling_instance_index");
new_function_parameters.Push(
b.Param(name, b.ty.u32(),
- utils::Vector{b.Builtin(builtin::BuiltinValue::kInstanceIndex)}));
+ tint::Vector{b.Builtin(builtin::BuiltinValue::kInstanceIndex)}));
instance_index_expr = [this, name] { return b.Expr(name); };
break;
}
diff --git a/src/tint/lang/wgsl/ast/transform/vertex_pulling.h b/src/tint/lang/wgsl/ast/transform/vertex_pulling.h
index 101dd21..d18bb0f 100644
--- a/src/tint/lang/wgsl/ast/transform/vertex_pulling.h
+++ b/src/tint/lang/wgsl/ast/transform/vertex_pulling.h
@@ -137,10 +137,10 @@
/// shader to use.
///
/// The SingleEntryPoint transform must have run before VertexPulling.
-class VertexPulling final : public utils::Castable<VertexPulling, Transform> {
+class VertexPulling final : public Castable<VertexPulling, Transform> {
public:
/// Configuration options for the transform
- struct Config final : public utils::Castable<Config, Data> {
+ struct Config final : public Castable<Config, Data> {
/// Constructor
Config();
diff --git a/src/tint/lang/wgsl/ast/transform/while_to_loop.cc b/src/tint/lang/wgsl/ast/transform/while_to_loop.cc
index 5db8f1e..9e815ee 100644
--- a/src/tint/lang/wgsl/ast/transform/while_to_loop.cc
+++ b/src/tint/lang/wgsl/ast/transform/while_to_loop.cc
@@ -48,7 +48,7 @@
CloneContext ctx{&b, src, /* auto_clone_symbols */ true};
ctx.ReplaceAll([&](const WhileStatement* w) -> const Statement* {
- utils::Vector<const Statement*, 16> stmts;
+ tint::Vector<const Statement*, 16> stmts;
auto* cond = w->condition;
// !condition
diff --git a/src/tint/lang/wgsl/ast/transform/while_to_loop.h b/src/tint/lang/wgsl/ast/transform/while_to_loop.h
index 8171912..2a60203 100644
--- a/src/tint/lang/wgsl/ast/transform/while_to_loop.h
+++ b/src/tint/lang/wgsl/ast/transform/while_to_loop.h
@@ -21,7 +21,7 @@
/// WhileToLoop is a Transform that converts a while statement into a loop
/// statement. This is required by the SPIR-V writer.
-class WhileToLoop final : public utils::Castable<WhileToLoop, Transform> {
+class WhileToLoop final : public Castable<WhileToLoop, Transform> {
public:
/// Constructor
WhileToLoop();
diff --git a/src/tint/lang/wgsl/ast/transform/zero_init_workgroup_memory.cc b/src/tint/lang/wgsl/ast/transform/zero_init_workgroup_memory.cc
index d1f59f2..c8772d6 100644
--- a/src/tint/lang/wgsl/ast/transform/zero_init_workgroup_memory.cc
+++ b/src/tint/lang/wgsl/ast/transform/zero_init_workgroup_memory.cc
@@ -48,7 +48,7 @@
} // namespace
-using StatementList = utils::Vector<const Statement*, 8>;
+using StatementList = tint::Vector<const Statement*, 8>;
/// PIMPL state for the transform
struct ZeroInitWorkgroupMemory::State {
@@ -84,14 +84,12 @@
struct Hasher {
/// @param i the ArrayIndex to calculate a hash for
/// @returns the hash value for the ArrayIndex `i`
- size_t operator()(const ArrayIndex& i) const {
- return utils::Hash(i.modulo, i.division);
- }
+ size_t operator()(const ArrayIndex& i) const { return Hash(i.modulo, i.division); }
};
};
/// A list of unique ArrayIndex
- using ArrayIndices = utils::UniqueVector<ArrayIndex, 4, ArrayIndex::Hasher>;
+ using ArrayIndices = UniqueVector<ArrayIndex, 4, ArrayIndex::Hasher>;
/// Expression holds information about an expression that is being built for a
/// statement will zero workgroup values.
@@ -186,7 +184,7 @@
// No existing local index parameter. Append one to the entry point.
auto param_name = b.Symbols().New("local_invocation_index");
auto* local_invocation_index = b.Builtin(builtin::BuiltinValue::kLocalInvocationIndex);
- auto* param = b.Param(param_name, b.ty.u32(), utils::Vector{local_invocation_index});
+ auto* param = b.Param(param_name, b.ty.u32(), tint::Vector{local_invocation_index});
ctx.InsertBack(fn->params, param);
local_index = [=] { return b.Expr(param->name->symbol); };
}
@@ -354,8 +352,8 @@
}
auto array_indices = a.array_indices;
array_indices.Add(ArrayIndex{modulo, division});
- auto index = utils::GetOrCreate(array_index_names, ArrayIndex{modulo, division},
- [&] { return b.Symbols().New("i"); });
+ auto index = tint::GetOrCreate(array_index_names, ArrayIndex{modulo, division},
+ [&] { return b.Symbols().New("i"); });
return Expression{b.IndexAccessor(a.expr, index), a.num_iterations, array_indices};
};
return BuildZeroingStatements(arr->ElemType(), get_el);
diff --git a/src/tint/lang/wgsl/ast/transform/zero_init_workgroup_memory.h b/src/tint/lang/wgsl/ast/transform/zero_init_workgroup_memory.h
index 9d69b9e..cb3de9a 100644
--- a/src/tint/lang/wgsl/ast/transform/zero_init_workgroup_memory.h
+++ b/src/tint/lang/wgsl/ast/transform/zero_init_workgroup_memory.h
@@ -22,7 +22,7 @@
/// ZeroInitWorkgroupMemory is a transform that injects code at the top of entry
/// points to zero-initialize workgroup memory used by that entry point (and all
/// transitive functions called by that entry point)
-class ZeroInitWorkgroupMemory final : public utils::Castable<ZeroInitWorkgroupMemory, Transform> {
+class ZeroInitWorkgroupMemory final : public Castable<ZeroInitWorkgroupMemory, Transform> {
public:
/// Constructor
ZeroInitWorkgroupMemory();
diff --git a/src/tint/lang/wgsl/ast/traverse_expressions.h b/src/tint/lang/wgsl/ast/traverse_expressions.h
index ed002db..f3ecd3c 100644
--- a/src/tint/lang/wgsl/ast/traverse_expressions.h
+++ b/src/tint/lang/wgsl/ast/traverse_expressions.h
@@ -62,16 +62,15 @@
/// @return true on success, false on error
template <TraverseOrder ORDER = TraverseOrder::LeftToRight, typename CALLBACK>
bool TraverseExpressions(const Expression* root, diag::List& diags, CALLBACK&& callback) {
- using EXPR_TYPE = std::remove_pointer_t<utils::traits::ParameterType<CALLBACK, 0>>;
- constexpr static bool kHasDepthArg =
- utils::traits::SignatureOfT<CALLBACK>::parameter_count == 2;
+ using EXPR_TYPE = std::remove_pointer_t<tint::traits::ParameterType<CALLBACK, 0>>;
+ constexpr static bool kHasDepthArg = tint::traits::SignatureOfT<CALLBACK>::parameter_count == 2;
struct Pending {
const Expression* expr;
size_t depth;
};
- utils::Vector<Pending, 32> to_visit{{root, 0}};
+ tint::Vector<Pending, 32> to_visit{{root, 0}};
auto push_single = [&](const Expression* expr, size_t depth) { to_visit.Push({expr, depth}); };
auto push_pair = [&](const Expression* left, const Expression* right, size_t depth) {
@@ -83,9 +82,9 @@
to_visit.Push({right, depth});
}
};
- auto push_list = [&](utils::VectorRef<const Expression*> exprs, size_t depth) {
+ auto push_list = [&](VectorRef<const Expression*> exprs, size_t depth) {
if (ORDER == TraverseOrder::LeftToRight) {
- for (auto* expr : utils::Reverse(exprs)) {
+ for (auto* expr : tint::Reverse(exprs)) {
to_visit.Push({expr, depth});
}
} else {
diff --git a/src/tint/lang/wgsl/ast/traverse_expressions_test.cc b/src/tint/lang/wgsl/ast/traverse_expressions_test.cc
index 1a0607b..7fd864a 100644
--- a/src/tint/lang/wgsl/ast/traverse_expressions_test.cc
+++ b/src/tint/lang/wgsl/ast/traverse_expressions_test.cc
@@ -97,7 +97,7 @@
auto* b2 = Bitcast<i32>(b1);
auto* root = Bitcast<i32>(b2);
{
- utils::Vector<const Expression*, 8> l2r;
+ tint::Vector<const Expression*, 8> l2r;
TraverseExpressions<TraverseOrder::LeftToRight>(root, Diagnostics(),
[&](const Expression* expr) {
l2r.Push(expr);
@@ -106,7 +106,7 @@
EXPECT_THAT(l2r, ElementsAre(root, b2, b1, b0, e));
}
{
- utils::Vector<const Expression*, 8> r2l;
+ tint::Vector<const Expression*, 8> r2l;
TraverseExpressions<TraverseOrder::RightToLeft>(root, Diagnostics(),
[&](const Expression* expr) {
r2l.Push(expr);
@@ -117,11 +117,11 @@
}
TEST_F(TraverseExpressionsTest, DescendCallExpression) {
- utils::Vector e{Expr(1_i), Expr(1_i), Expr(1_i), Expr(1_i)};
- utils::Vector c{Call("a", e[0], e[1]), Call("b", e[2], e[3])};
+ tint::Vector e{Expr(1_i), Expr(1_i), Expr(1_i), Expr(1_i)};
+ tint::Vector c{Call("a", e[0], e[1]), Call("b", e[2], e[3])};
auto* root = Call("c", c[0], c[1]);
{
- utils::Vector<const Expression*, 8> l2r;
+ tint::Vector<const Expression*, 8> l2r;
TraverseExpressions<TraverseOrder::LeftToRight>(root, Diagnostics(),
[&](const Expression* expr) {
l2r.Push(expr);
@@ -130,7 +130,7 @@
EXPECT_THAT(l2r, ElementsAre(root, c[0], e[0], e[1], c[1], e[2], e[3]));
}
{
- utils::Vector<const Expression*, 8> r2l;
+ tint::Vector<const Expression*, 8> r2l;
TraverseExpressions<TraverseOrder::RightToLeft>(root, Diagnostics(),
[&](const Expression* expr) {
r2l.Push(expr);
diff --git a/src/tint/lang/wgsl/ast/type_decl.h b/src/tint/lang/wgsl/ast/type_decl.h
index d270c00..7f81120 100644
--- a/src/tint/lang/wgsl/ast/type_decl.h
+++ b/src/tint/lang/wgsl/ast/type_decl.h
@@ -25,7 +25,7 @@
namespace tint::ast {
/// The base class for type declarations.
-class TypeDecl : public utils::Castable<TypeDecl, Node> {
+class TypeDecl : public Castable<TypeDecl, Node> {
public:
/// Create a new struct statement
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/unary_op.cc b/src/tint/lang/wgsl/ast/unary_op.cc
index 288e19c..35f28f7 100644
--- a/src/tint/lang/wgsl/ast/unary_op.cc
+++ b/src/tint/lang/wgsl/ast/unary_op.cc
@@ -16,7 +16,7 @@
namespace tint::ast {
-utils::StringStream& operator<<(utils::StringStream& out, UnaryOp mod) {
+StringStream& operator<<(StringStream& out, UnaryOp mod) {
switch (mod) {
case UnaryOp::kAddressOf: {
out << "address-of";
diff --git a/src/tint/lang/wgsl/ast/unary_op.h b/src/tint/lang/wgsl/ast/unary_op.h
index 209f499..2dda746 100644
--- a/src/tint/lang/wgsl/ast/unary_op.h
+++ b/src/tint/lang/wgsl/ast/unary_op.h
@@ -31,7 +31,7 @@
/// @param out the stream to write to
/// @param mod the UnaryOp
/// @return the stream so calls can be chained
-utils::StringStream& operator<<(utils::StringStream& out, UnaryOp mod);
+StringStream& operator<<(StringStream& out, UnaryOp mod);
} // namespace tint::ast
diff --git a/src/tint/lang/wgsl/ast/unary_op_expression.h b/src/tint/lang/wgsl/ast/unary_op_expression.h
index 2880928..7cc3378 100644
--- a/src/tint/lang/wgsl/ast/unary_op_expression.h
+++ b/src/tint/lang/wgsl/ast/unary_op_expression.h
@@ -21,7 +21,7 @@
namespace tint::ast {
/// A unary op expression
-class UnaryOpExpression final : public utils::Castable<UnaryOpExpression, Expression> {
+class UnaryOpExpression final : public Castable<UnaryOpExpression, Expression> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/var.cc b/src/tint/lang/wgsl/ast/var.cc
index c953aae..9b05102 100644
--- a/src/tint/lang/wgsl/ast/var.cc
+++ b/src/tint/lang/wgsl/ast/var.cc
@@ -28,7 +28,7 @@
const Expression* address_space,
const Expression* access,
const Expression* init,
- utils::VectorRef<const Attribute*> attrs)
+ VectorRef<const Attribute*> attrs)
: Base(pid, nid, src, n, ty, init, std::move(attrs)),
declared_address_space(address_space),
declared_access(access) {}
diff --git a/src/tint/lang/wgsl/ast/var.h b/src/tint/lang/wgsl/ast/var.h
index 87c94e5..e34f5ce 100644
--- a/src/tint/lang/wgsl/ast/var.h
+++ b/src/tint/lang/wgsl/ast/var.h
@@ -39,7 +39,7 @@
/// ```
///
/// @see https://www.w3.org/TR/WGSL/#var-decls
-class Var final : public utils::Castable<Var, Variable> {
+class Var final : public Castable<Var, Variable> {
public:
/// Create a 'var' variable
/// @param pid the identifier of the program that owns this node
@@ -59,7 +59,7 @@
const Expression* declared_address_space,
const Expression* declared_access,
const Expression* initializer,
- utils::VectorRef<const Attribute*> attributes);
+ VectorRef<const Attribute*> attributes);
/// Destructor
~Var() override;
diff --git a/src/tint/lang/wgsl/ast/variable.cc b/src/tint/lang/wgsl/ast/variable.cc
index 2bc8550..a2cfc5e 100644
--- a/src/tint/lang/wgsl/ast/variable.cc
+++ b/src/tint/lang/wgsl/ast/variable.cc
@@ -27,7 +27,7 @@
const Identifier* n,
Type ty,
const Expression* init,
- utils::VectorRef<const Attribute*> attrs)
+ VectorRef<const Attribute*> attrs)
: Base(pid, nid, src), name(n), type(ty), initializer(init), attributes(std::move(attrs)) {
TINT_ASSERT(AST, name);
if (name) {
diff --git a/src/tint/lang/wgsl/ast/variable.h b/src/tint/lang/wgsl/ast/variable.h
index 31e6a64..58a214e 100644
--- a/src/tint/lang/wgsl/ast/variable.h
+++ b/src/tint/lang/wgsl/ast/variable.h
@@ -40,7 +40,7 @@
/// declaration, "override" declaration, "const" declaration, or formal parameter to a function.
///
/// @see https://www.w3.org/TR/WGSL/#value-decls
-class Variable : public utils::Castable<Variable, Node> {
+class Variable : public Castable<Variable, Node> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
@@ -56,7 +56,7 @@
const Identifier* name,
Type type,
const Expression* initializer,
- utils::VectorRef<const Attribute*> attributes);
+ VectorRef<const Attribute*> attributes);
/// Destructor
~Variable() override;
@@ -83,7 +83,7 @@
const Expression* const initializer;
/// The attributes attached to this variable
- const utils::Vector<const Attribute*, 2> attributes;
+ const tint::Vector<const Attribute*, 2> attributes;
};
} // namespace tint::ast
diff --git a/src/tint/lang/wgsl/ast/variable_decl_statement.h b/src/tint/lang/wgsl/ast/variable_decl_statement.h
index f76622e..92bd4ec 100644
--- a/src/tint/lang/wgsl/ast/variable_decl_statement.h
+++ b/src/tint/lang/wgsl/ast/variable_decl_statement.h
@@ -21,7 +21,7 @@
namespace tint::ast {
/// A variable declaration statement
-class VariableDeclStatement final : public utils::Castable<VariableDeclStatement, Statement> {
+class VariableDeclStatement final : public Castable<VariableDeclStatement, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/ast/variable_test.cc b/src/tint/lang/wgsl/ast/variable_test.cc
index 6981b61..e010f30 100644
--- a/src/tint/lang/wgsl/ast/variable_test.cc
+++ b/src/tint/lang/wgsl/ast/variable_test.cc
@@ -40,7 +40,7 @@
TEST_F(VariableTest, CreationWithSource) {
auto* v = Var(Source{Source::Range{Source::Location{27, 4}, Source::Location{27, 5}}}, "i",
- ty.f32(), builtin::AddressSpace::kPrivate, utils::Empty);
+ ty.f32(), builtin::AddressSpace::kPrivate, tint::Empty);
CheckIdentifier(v->name, "i");
CheckIdentifier(v->declared_address_space, "private");
@@ -53,7 +53,7 @@
TEST_F(VariableTest, CreationEmpty) {
auto* v = Var(Source{Source::Range{Source::Location{27, 4}, Source::Location{27, 7}}}, "a_var",
- ty.i32(), builtin::AddressSpace::kWorkgroup, utils::Empty);
+ ty.i32(), builtin::AddressSpace::kWorkgroup, tint::Empty);
CheckIdentifier(v->name, "a_var");
CheckIdentifier(v->declared_address_space, "workgroup");
@@ -114,7 +114,7 @@
}
TEST_F(VariableTest, HasBindingPoint_NeitherProvided) {
- auto* var = Var("my_var", ty.i32(), builtin::AddressSpace::kFunction, utils::Empty);
+ auto* var = Var("my_var", ty.i32(), builtin::AddressSpace::kFunction, tint::Empty);
EXPECT_FALSE(var->HasBindingPoint());
}
diff --git a/src/tint/lang/wgsl/ast/while_statement.cc b/src/tint/lang/wgsl/ast/while_statement.cc
index 25b736c..0019916 100644
--- a/src/tint/lang/wgsl/ast/while_statement.cc
+++ b/src/tint/lang/wgsl/ast/while_statement.cc
@@ -27,7 +27,7 @@
const Source& src,
const Expression* cond,
const BlockStatement* b,
- utils::VectorRef<const ast::Attribute*> attrs)
+ VectorRef<const ast::Attribute*> attrs)
: Base(pid, nid, src), condition(cond), body(b), attributes(std::move(attrs)) {
TINT_ASSERT(AST, cond);
TINT_ASSERT(AST, body);
diff --git a/src/tint/lang/wgsl/ast/while_statement.h b/src/tint/lang/wgsl/ast/while_statement.h
index d87bdb6..d3eaa0a 100644
--- a/src/tint/lang/wgsl/ast/while_statement.h
+++ b/src/tint/lang/wgsl/ast/while_statement.h
@@ -22,7 +22,7 @@
class Expression;
/// A while loop statement
-class WhileStatement final : public utils::Castable<WhileStatement, Statement> {
+class WhileStatement final : public Castable<WhileStatement, Statement> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
@@ -36,7 +36,7 @@
const Source& source,
const Expression* condition,
const BlockStatement* body,
- utils::VectorRef<const ast::Attribute*> attributes);
+ VectorRef<const ast::Attribute*> attributes);
/// Destructor
~WhileStatement() override;
@@ -54,7 +54,7 @@
const BlockStatement* const body;
/// The attribute list
- const utils::Vector<const Attribute*, 1> attributes;
+ const tint::Vector<const Attribute*, 1> attributes;
};
} // namespace tint::ast
diff --git a/src/tint/lang/wgsl/ast/while_statement_test.cc b/src/tint/lang/wgsl/ast/while_statement_test.cc
index 59b55cc..c6508f9 100644
--- a/src/tint/lang/wgsl/ast/while_statement_test.cc
+++ b/src/tint/lang/wgsl/ast/while_statement_test.cc
@@ -47,7 +47,7 @@
auto* attr2 = DiagnosticAttribute(builtin::DiagnosticSeverity::kOff, "bar");
auto* cond = create<BinaryExpression>(BinaryOp::kLessThan, Expr("i"), Expr(5_u));
auto* body = Block(Return());
- auto* l = While(cond, body, utils::Vector{attr1, attr2});
+ auto* l = While(cond, body, tint::Vector{attr1, attr2});
EXPECT_THAT(l->attributes, testing::ElementsAre(attr1, attr2));
}
diff --git a/src/tint/lang/wgsl/ast/workgroup_attribute.h b/src/tint/lang/wgsl/ast/workgroup_attribute.h
index a90bb5f..2494da8 100644
--- a/src/tint/lang/wgsl/ast/workgroup_attribute.h
+++ b/src/tint/lang/wgsl/ast/workgroup_attribute.h
@@ -28,7 +28,7 @@
namespace tint::ast {
/// A workgroup attribute
-class WorkgroupAttribute final : public utils::Castable<WorkgroupAttribute, Attribute> {
+class WorkgroupAttribute final : public Castable<WorkgroupAttribute, Attribute> {
public:
/// constructor
/// @param pid the identifier of the program that owns this node
diff --git a/src/tint/lang/wgsl/helpers/append_vector.cc b/src/tint/lang/wgsl/helpers/append_vector.cc
index ed77827..221001f 100644
--- a/src/tint/lang/wgsl/helpers/append_vector.cc
+++ b/src/tint/lang/wgsl/helpers/append_vector.cc
@@ -113,7 +113,7 @@
// to convert a vector of a different type, e.g. vec2<i32>(vec2<u32>()).
// In that case, preserve the original argument, or you'll get a type error.
- utils::Vector<const sem::ValueExpression*, 4> packed;
+ Vector<const sem::ValueExpression*, 4> packed;
if (auto vc = AsVectorConstructor(vector_sem)) {
const auto num_supplied = vc.call->Arguments().Length();
if (num_supplied == 0) {
@@ -143,7 +143,7 @@
sem::EvaluationStage::kRuntime);
auto* scalar_cast_sem = b->create<sem::Call>(
scalar_cast_ast, scalar_cast_target, sem::EvaluationStage::kRuntime,
- utils::Vector<const sem::ValueExpression*, 1>{scalar_sem}, statement,
+ Vector<const sem::ValueExpression*, 1>{scalar_sem}, statement,
/* constant_value */ nullptr, /* has_side_effects */ false);
b->Sem().Add(scalar_cast_ast, scalar_cast_sem);
packed.Push(scalar_cast_sem);
@@ -152,17 +152,17 @@
}
auto* ctor_ast =
- b->Call(packed_ast_ty, utils::Transform(packed, [&](const sem::ValueExpression* expr) {
+ b->Call(packed_ast_ty, tint::Transform(packed, [&](const sem::ValueExpression* expr) {
return expr->Declaration();
}));
auto* ctor_target = b->create<sem::ValueConstructor>(
packed_sem_ty,
- utils::Transform(packed,
- [&](const tint::sem::ValueExpression* arg, size_t i) {
- return b->create<sem::Parameter>(
- nullptr, static_cast<uint32_t>(i), arg->Type()->UnwrapRef(),
- builtin::AddressSpace::kUndefined, builtin::Access::kUndefined);
- }),
+ tint::Transform(packed,
+ [&](const tint::sem::ValueExpression* arg, size_t i) {
+ return b->create<sem::Parameter>(
+ nullptr, static_cast<uint32_t>(i), arg->Type()->UnwrapRef(),
+ builtin::AddressSpace::kUndefined, builtin::Access::kUndefined);
+ }),
sem::EvaluationStage::kRuntime);
auto* ctor_sem = b->create<sem::Call>(ctor_ast, ctor_target, sem::EvaluationStage::kRuntime,
std::move(packed), statement,
diff --git a/src/tint/lang/wgsl/helpers/check_supported_extensions.cc b/src/tint/lang/wgsl/helpers/check_supported_extensions.cc
index 090c8a7..9c3a530 100644
--- a/src/tint/lang/wgsl/helpers/check_supported_extensions.cc
+++ b/src/tint/lang/wgsl/helpers/check_supported_extensions.cc
@@ -26,8 +26,8 @@
bool CheckSupportedExtensions(std::string_view writer_name,
const ast::Module& module,
diag::List& diags,
- utils::VectorRef<builtin::Extension> supported) {
- utils::Hashset<builtin::Extension, 32> set;
+ VectorRef<builtin::Extension> supported) {
+ Hashset<builtin::Extension, 32> set;
for (auto ext : supported) {
set.Add(ext);
}
@@ -37,7 +37,7 @@
if (!set.Contains(ext->name)) {
diags.add_error(diag::System::Writer,
std::string(writer_name) + " backend does not support extension '" +
- utils::ToString(ext->name) + "'",
+ tint::ToString(ext->name) + "'",
ext->source);
return false;
}
diff --git a/src/tint/lang/wgsl/helpers/check_supported_extensions.h b/src/tint/lang/wgsl/helpers/check_supported_extensions.h
index 02854f1..4407632 100644
--- a/src/tint/lang/wgsl/helpers/check_supported_extensions.h
+++ b/src/tint/lang/wgsl/helpers/check_supported_extensions.h
@@ -36,7 +36,7 @@
bool CheckSupportedExtensions(std::string_view writer_name,
const ast::Module& module,
diag::List& diags,
- utils::VectorRef<builtin::Extension> supported);
+ VectorRef<builtin::Extension> supported);
} // namespace tint::writer
diff --git a/src/tint/lang/wgsl/helpers/check_supported_extensions_test.cc b/src/tint/lang/wgsl/helpers/check_supported_extensions_test.cc
index e5fe1d4..1c527ed 100644
--- a/src/tint/lang/wgsl/helpers/check_supported_extensions_test.cc
+++ b/src/tint/lang/wgsl/helpers/check_supported_extensions_test.cc
@@ -27,7 +27,7 @@
Enable(builtin::Extension::kF16);
ASSERT_TRUE(CheckSupportedExtensions("writer", AST(), Diagnostics(),
- utils::Vector{
+ Vector{
builtin::Extension::kF16,
builtin::Extension::kChromiumExperimentalDp4A,
}));
@@ -37,7 +37,7 @@
Enable(Source{{12, 34}}, builtin::Extension::kF16);
ASSERT_FALSE(CheckSupportedExtensions("writer", AST(), Diagnostics(),
- utils::Vector{
+ Vector{
builtin::Extension::kChromiumExperimentalDp4A,
}));
EXPECT_EQ(Diagnostics().str(), "12:34 error: writer backend does not support extension 'f16'");
diff --git a/src/tint/lang/wgsl/helpers/ir_program_test.h b/src/tint/lang/wgsl/helpers/ir_program_test.h
index 129e140..0bcb2d3 100644
--- a/src/tint/lang/wgsl/helpers/ir_program_test.h
+++ b/src/tint/lang/wgsl/helpers/ir_program_test.h
@@ -39,7 +39,7 @@
/// Build the module, cleaning up the program before returning.
/// @returns the generated module
- utils::Result<ir::Module, std::string> Build() {
+ tint::Result<ir::Module, std::string> Build() {
SetResolveOnBuild(true);
Program program{std::move(*this)};
@@ -60,7 +60,7 @@
/// Build the module from the given WGSL.
/// @param wgsl the WGSL to convert to IR
/// @returns the generated module
- utils::Result<ir::Module, std::string> Build(std::string wgsl) {
+ tint::Result<ir::Module, std::string> Build(std::string wgsl) {
#if TINT_BUILD_WGSL_READER
Source::File file("test.wgsl", std::move(wgsl));
auto program = wgsl::reader::Parse(&file);
diff --git a/src/tint/lang/wgsl/inspector/inspector.cc b/src/tint/lang/wgsl/inspector/inspector.cc
index 52e38e0..6a77a16 100644
--- a/src/tint/lang/wgsl/inspector/inspector.cc
+++ b/src/tint/lang/wgsl/inspector/inspector.cc
@@ -456,7 +456,7 @@
std::vector<ResourceBinding> Inspector::GetTextureResourceBindings(
const std::string& entry_point,
- const tint::utils::TypeInfo* texture_type,
+ const tint::TypeInfo* texture_type,
ResourceBinding::ResourceType resource_type) {
auto* func = FindEntryPointByName(entry_point);
if (!func) {
@@ -485,25 +485,24 @@
std::vector<ResourceBinding> Inspector::GetDepthTextureResourceBindings(
const std::string& entry_point) {
- return GetTextureResourceBindings(entry_point, &utils::TypeInfo::Of<type::DepthTexture>(),
+ return GetTextureResourceBindings(entry_point, &tint::TypeInfo::Of<type::DepthTexture>(),
ResourceBinding::ResourceType::kDepthTexture);
}
std::vector<ResourceBinding> Inspector::GetDepthMultisampledTextureResourceBindings(
const std::string& entry_point) {
return GetTextureResourceBindings(entry_point,
- &utils::TypeInfo::Of<type::DepthMultisampledTexture>(),
+ &tint::TypeInfo::Of<type::DepthMultisampledTexture>(),
ResourceBinding::ResourceType::kDepthMultisampledTexture);
}
std::vector<ResourceBinding> Inspector::GetExternalTextureResourceBindings(
const std::string& entry_point) {
- return GetTextureResourceBindings(entry_point, &utils::TypeInfo::Of<type::ExternalTexture>(),
+ return GetTextureResourceBindings(entry_point, &tint::TypeInfo::Of<type::ExternalTexture>(),
ResourceBinding::ResourceType::kExternalTexture);
}
-utils::VectorRef<SamplerTexturePair> Inspector::GetSamplerTextureUses(
- const std::string& entry_point) {
+VectorRef<SamplerTexturePair> Inspector::GetSamplerTextureUses(const std::string& entry_point) {
auto* func = FindEntryPointByName(entry_point);
if (!func) {
return {};
@@ -556,7 +555,7 @@
// turn specified as an upper bound for Vulkan layout sizing. Since D3D
// and Metal are even less specific, we assume Vulkan behavior as a
// good-enough approximation everywhere.
- total_size += utils::RoundUp(align, size);
+ total_size += tint::RoundUp(align, size);
}
}
@@ -568,7 +567,7 @@
std::vector<std::string> out;
out.reserve(extensions.Length());
for (auto ext : extensions) {
- out.push_back(utils::ToString(ext));
+ out.push_back(tint::ToString(ext));
}
return out;
}
@@ -581,7 +580,7 @@
for (auto* node : global_decls) {
if (auto* enable = node->As<ast::Enable>()) {
for (auto* ext : enable->extensions) {
- result.push_back({utils::ToString(ext->name), ext->source});
+ result.push_back({tint::ToString(ext->name), ext->source});
}
}
}
@@ -606,7 +605,7 @@
void Inspector::AddEntryPointInOutVariables(std::string name,
const type::Type* type,
- utils::VectorRef<const ast::Attribute*> attributes,
+ VectorRef<const ast::Attribute*> attributes,
std::optional<uint32_t> location,
std::vector<StageVariable>& variables) const {
// Skip builtins.
@@ -645,7 +644,7 @@
bool Inspector::ContainsBuiltin(builtin::BuiltinValue builtin,
const type::Type* type,
- utils::VectorRef<const ast::Attribute*> attributes) const {
+ VectorRef<const ast::Attribute*> attributes) const {
auto* unwrapped_type = type->UnwrapRef();
if (auto* struct_ty = unwrapped_type->As<sem::Struct>()) {
@@ -785,8 +784,8 @@
return;
}
- sampler_targets_ = std::make_unique<
- std::unordered_map<std::string, utils::UniqueVector<SamplerTexturePair, 4>>>();
+ sampler_targets_ =
+ std::make_unique<std::unordered_map<std::string, UniqueVector<SamplerTexturePair, 4>>>();
auto& sem = program_->Sem();
@@ -849,7 +848,7 @@
std::tuple<InterpolationType, InterpolationSampling> Inspector::CalculateInterpolationData(
const type::Type* type,
- utils::VectorRef<const ast::Attribute*> attributes) const {
+ VectorRef<const ast::Attribute*> attributes) const {
auto* interpolation_attribute = ast::GetAttribute<ast::InterpolateAttribute>(attributes);
if (type->is_integer_scalar_or_vector()) {
return {InterpolationType::kFlat, InterpolationSampling::kNone};
@@ -923,7 +922,7 @@
std::array<const sem::GlobalVariable*, N> globals{};
std::array<const sem::Parameter*, N> parameters{};
- utils::UniqueVector<const ast::CallExpression*, 8> callsites;
+ UniqueVector<const ast::CallExpression*, 8> callsites;
for (size_t i = 0; i < N; i++) {
const sem::Variable* root_ident = sem.GetVal(exprs[i])->RootIdentifier();
diff --git a/src/tint/lang/wgsl/inspector/inspector.h b/src/tint/lang/wgsl/inspector/inspector.h
index e0a1690..6b08045 100644
--- a/src/tint/lang/wgsl/inspector/inspector.h
+++ b/src/tint/lang/wgsl/inspector/inspector.h
@@ -127,7 +127,7 @@
/// @param entry_point name of the entry point to get information about.
/// @returns vector of all of the sampler/texture sampling pairs that are used
/// by that entry point.
- utils::VectorRef<SamplerTexturePair> GetSamplerTextureUses(const std::string& entry_point);
+ VectorRef<SamplerTexturePair> GetSamplerTextureUses(const std::string& entry_point);
/// @param entry_point name of the entry point to get information about.
/// @param placeholder the sampler binding point to use for texture-only
@@ -157,7 +157,7 @@
private:
const Program* program_;
diag::List diagnostics_;
- std::unique_ptr<std::unordered_map<std::string, utils::UniqueVector<SamplerTexturePair, 4>>>
+ std::unique_ptr<std::unordered_map<std::string, UniqueVector<SamplerTexturePair, 4>>>
sampler_targets_;
/// @param name name of the entry point to find
@@ -175,7 +175,7 @@
/// @param variables the list to add the variables to
void AddEntryPointInOutVariables(std::string name,
const type::Type* type,
- utils::VectorRef<const ast::Attribute*> attributes,
+ VectorRef<const ast::Attribute*> attributes,
std::optional<uint32_t> location,
std::vector<StageVariable>& variables) const;
@@ -184,7 +184,7 @@
/// Otherwise, check `attributes` for the attribute.
bool ContainsBuiltin(builtin::BuiltinValue builtin,
const type::Type* type,
- utils::VectorRef<const ast::Attribute*> attributes) const;
+ VectorRef<const ast::Attribute*> attributes) const;
/// Gathers all the texture resource bindings of the given type for the given
/// entry point.
@@ -195,7 +195,7 @@
/// @returns vector of all of the bindings for depth textures.
std::vector<ResourceBinding> GetTextureResourceBindings(
const std::string& entry_point,
- const tint::utils::TypeInfo* texture_type,
+ const tint::TypeInfo* texture_type,
ResourceBinding::ResourceType resource_type);
/// @param entry_point name of the entry point to get information about.
@@ -227,7 +227,7 @@
/// @returns the interpolation type and sampling modes for the value
std::tuple<InterpolationType, InterpolationSampling> CalculateInterpolationData(
const type::Type* type,
- utils::VectorRef<const ast::Attribute*> attributes) const;
+ VectorRef<const ast::Attribute*> attributes) const;
/// For a N-uple of expressions, resolve to the appropriate global resources
/// and call 'cb'.
diff --git a/src/tint/lang/wgsl/inspector/inspector_test.cc b/src/tint/lang/wgsl/inspector/inspector_test.cc
index fa016f8..a0b0cf9 100644
--- a/src/tint/lang/wgsl/inspector/inspector_test.cc
+++ b/src/tint/lang/wgsl/inspector/inspector_test.cc
@@ -153,7 +153,7 @@
}
TEST_F(InspectorGetEntryPointTest, OneEntryPoint) {
- MakeEmptyBodyFunction("foo", utils::Vector{
+ MakeEmptyBodyFunction("foo", Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -171,11 +171,11 @@
}
TEST_F(InspectorGetEntryPointTest, MultipleEntryPoints) {
- MakeEmptyBodyFunction("foo", utils::Vector{
+ MakeEmptyBodyFunction("foo", Vector{
Stage(ast::PipelineStage::kFragment),
});
- MakeEmptyBodyFunction("bar", utils::Vector{
+ MakeEmptyBodyFunction("bar", Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -197,16 +197,16 @@
}
TEST_F(InspectorGetEntryPointTest, MixFunctionsAndEntryPoints) {
- MakeEmptyBodyFunction("func", utils::Empty);
+ MakeEmptyBodyFunction("func", tint::Empty);
- MakeCallerBodyFunction("foo", utils::Vector{std::string("func")},
- utils::Vector{
+ MakeCallerBodyFunction("foo", Vector{std::string("func")},
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
- MakeCallerBodyFunction("bar", utils::Vector{std::string("func")},
- utils::Vector{
+ MakeCallerBodyFunction("bar", Vector{std::string("func")},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -227,7 +227,7 @@
}
TEST_F(InspectorGetEntryPointTest, DefaultWorkgroupSize) {
- MakeEmptyBodyFunction("foo", utils::Vector{
+ MakeEmptyBodyFunction("foo", Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(8_i, 2_i, 1_i),
});
@@ -246,7 +246,7 @@
}
TEST_F(InspectorGetEntryPointTest, NonDefaultWorkgroupSize) {
- MakeEmptyBodyFunction("foo", utils::Vector{
+ MakeEmptyBodyFunction("foo", Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(8_i, 2_i, 1_i),
});
@@ -265,10 +265,10 @@
}
TEST_F(InspectorGetEntryPointTest, NoInOutVariables) {
- MakeEmptyBodyFunction("func", utils::Empty);
+ MakeEmptyBodyFunction("func", tint::Empty);
- MakeCallerBodyFunction("foo", utils::Vector{std::string("func")},
- utils::Vector{
+ MakeCallerBodyFunction("foo", Vector{std::string("func")},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -293,18 +293,18 @@
}
auto* in_var = Param("in_var", tint_type(),
- utils::Vector{
+ Vector{
Location(0_u),
Flat(),
});
- Func("foo", utils::Vector{in_var}, tint_type(),
- utils::Vector{
+ Func("foo", Vector{in_var}, tint_type(),
+ Vector{
Return("in_var"),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(0_u),
});
Inspector& inspector = Build();
@@ -339,28 +339,28 @@
TEST_F(InspectorGetEntryPointTest, MultipleInOutVariables) {
auto* in_var0 = Param("in_var0", ty.u32(),
- utils::Vector{
+ Vector{
Location(0_u),
Flat(),
});
auto* in_var1 = Param("in_var1", ty.u32(),
- utils::Vector{
+ Vector{
Location(1_u),
Flat(),
});
auto* in_var4 = Param("in_var4", ty.u32(),
- utils::Vector{
+ Vector{
Location(4_u),
Flat(),
});
- Func("foo", utils::Vector{in_var0, in_var1, in_var4}, ty.u32(),
- utils::Vector{
+ Func("foo", Vector{in_var0, in_var1, in_var4}, ty.u32(),
+ Vector{
Return("in_var0"),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(0_u),
});
Inspector& inspector = Build();
@@ -396,34 +396,34 @@
TEST_F(InspectorGetEntryPointTest, MultipleEntryPointsInOutVariables) {
auto* in_var_foo = Param("in_var_foo", ty.u32(),
- utils::Vector{
+ Vector{
Location(0_u),
Flat(),
});
- Func("foo", utils::Vector{in_var_foo}, ty.u32(),
- utils::Vector{
+ Func("foo", Vector{in_var_foo}, ty.u32(),
+ Vector{
Return("in_var_foo"),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(0_u),
});
auto* in_var_bar = Param("in_var_bar", ty.u32(),
- utils::Vector{
+ Vector{
Location(0_u),
Flat(),
});
- Func("bar", utils::Vector{in_var_bar}, ty.u32(),
- utils::Vector{
+ Func("bar", Vector{in_var_bar}, ty.u32(),
+ Vector{
Return("in_var_bar"),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(1_u),
});
@@ -463,21 +463,21 @@
TEST_F(InspectorGetEntryPointTest, BuiltInsNotStageVariables) {
auto* in_var0 = Param("in_var0", ty.u32(),
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kSampleIndex),
});
auto* in_var1 = Param("in_var1", ty.f32(),
- utils::Vector{
+ Vector{
Location(0_u),
});
- Func("foo", utils::Vector{in_var0, in_var1}, ty.f32(),
- utils::Vector{
+ Func("foo", Vector{in_var0, in_var1}, ty.f32(),
+ Vector{
Return("in_var1"),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kFragDepth),
});
Inspector& inspector = Build();
@@ -497,19 +497,19 @@
}
TEST_F(InspectorGetEntryPointTest, InOutStruct) {
- auto* interface = MakeInOutStruct("interface", utils::Vector{
+ auto* interface = MakeInOutStruct("interface", Vector{
InOutInfo{"a", 0u},
InOutInfo{"b", 1u},
});
Func("foo",
- utils::Vector{
+ Vector{
Param("param", ty.Of(interface)),
},
ty.Of(interface),
- utils::Vector{
+ Vector{
Return("param"),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
Inspector& inspector = Build();
@@ -541,19 +541,19 @@
}
TEST_F(InspectorGetEntryPointTest, MultipleEntryPointsInOutSharedStruct) {
- auto* interface = MakeInOutStruct("interface", utils::Vector{
+ auto* interface = MakeInOutStruct("interface", Vector{
InOutInfo{"a", 0u},
InOutInfo{"b", 1u},
});
- Func("foo", utils::Empty, ty.Of(interface),
- utils::Vector{
+ Func("foo", tint::Empty, ty.Of(interface),
+ Vector{
Return(Call(ty.Of(interface))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
- Func("bar", utils::Vector{Param("param", ty.Of(interface))}, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("bar", Vector{Param("param", ty.Of(interface))}, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
Inspector& inspector = Build();
@@ -589,25 +589,25 @@
}
TEST_F(InspectorGetEntryPointTest, MixInOutVariablesAndStruct) {
- auto* struct_a = MakeInOutStruct("struct_a", utils::Vector{
+ auto* struct_a = MakeInOutStruct("struct_a", Vector{
InOutInfo{"a", 0u},
InOutInfo{"b", 1u},
});
- auto* struct_b = MakeInOutStruct("struct_b", utils::Vector{
+ auto* struct_b = MakeInOutStruct("struct_b", Vector{
InOutInfo{"a", 2u},
});
Func("foo",
- utils::Vector{
+ Vector{
Param("param_a", ty.Of(struct_a)),
Param("param_b", ty.Of(struct_b)),
- Param("param_c", ty.f32(), utils::Vector{Location(3_u)}),
- Param("param_d", ty.f32(), utils::Vector{Location(4_u)}),
+ Param("param_c", ty.f32(), Vector{Location(3_u)}),
+ Param("param_d", ty.f32(), Vector{Location(4_u)}),
},
ty.Of(struct_a),
- utils::Vector{
+ Vector{
Return("param_a"),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
Inspector& inspector = Build();
@@ -652,7 +652,7 @@
TEST_F(InspectorGetEntryPointTest, OverrideUnreferenced) {
Override("foo", ty.f32());
- MakeEmptyBodyFunction("ep_func", utils::Vector{
+ MakeEmptyBodyFunction("ep_func", Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -668,7 +668,7 @@
TEST_F(InspectorGetEntryPointTest, OverrideReferencedByEntryPoint) {
Override("foo", ty.f32());
MakePlainGlobalReferenceBodyFunction("ep_func", "foo", ty.f32(),
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -684,9 +684,9 @@
TEST_F(InspectorGetEntryPointTest, OverrideReferencedByCallee) {
Override("foo", ty.f32());
- MakePlainGlobalReferenceBodyFunction("callee_func", "foo", ty.f32(), utils::Empty);
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("callee_func")},
- utils::Vector{
+ MakePlainGlobalReferenceBodyFunction("callee_func", "foo", ty.f32(), tint::Empty);
+ MakeCallerBodyFunction("ep_func", Vector{std::string("callee_func")},
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -703,9 +703,9 @@
TEST_F(InspectorGetEntryPointTest, OverrideSomeReferenced) {
Override("foo", ty.f32(), Id(1_a));
Override("bar", ty.f32(), Id(2_a));
- MakePlainGlobalReferenceBodyFunction("callee_func", "foo", ty.f32(), utils::Empty);
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("callee_func")},
- utils::Vector{
+ MakePlainGlobalReferenceBodyFunction("callee_func", "foo", ty.f32(), tint::Empty);
+ MakeCallerBodyFunction("ep_func", Vector{std::string("callee_func")},
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -724,7 +724,7 @@
Override("foo", ty.f32());
Override("bar", ty.f32(), Mul(2_a, "foo"));
MakePlainGlobalReferenceBodyFunction("ep_func", "bar", ty.f32(),
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -745,7 +745,7 @@
Override("foo", ty.f32());
GlobalVar("bar", builtin::AddressSpace::kPrivate, ty.f32(), Mul(2_a, "foo"));
MakePlainGlobalReferenceBodyFunction("ep_func", "bar", ty.f32(),
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -764,14 +764,14 @@
Override("foo1", ty.f32());
Override("bar1", ty.f32(), Mul(2_a, "foo1"));
MakePlainGlobalReferenceBodyFunction("ep_func1", "bar1", ty.f32(),
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
Override("foo2", ty.f32());
Override("bar2", ty.f32(), Mul(2_a, "foo2"));
MakePlainGlobalReferenceBodyFunction("ep_func2", "bar2", ty.f32(),
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -797,7 +797,7 @@
TEST_F(InspectorGetEntryPointTest, OverrideReferencedByAttribute) {
Override("wgsize", ty.u32());
- MakeEmptyBodyFunction("ep_func", utils::Vector{
+ MakeEmptyBodyFunction("ep_func", Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize("wgsize"),
});
@@ -815,7 +815,7 @@
TEST_F(InspectorGetEntryPointTest, OverrideReferencedByAttributeIndirectly) {
Override("foo", ty.u32());
Override("bar", ty.u32(), Mul(2_a, "foo"));
- MakeEmptyBodyFunction("ep_func", utils::Vector{
+ MakeEmptyBodyFunction("ep_func", Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(Mul(2_a, Expr("bar"))),
});
@@ -835,11 +835,11 @@
TEST_F(InspectorGetEntryPointTest, OverrideReferencedByArraySize) {
Override("size", ty.u32());
GlobalVar("v", builtin::AddressSpace::kWorkgroup, ty.array(ty.f32(), "size"));
- Func("ep", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("ep", tint::Empty, ty.void_(),
+ Vector{
Assign(Phony(), IndexAccessor("v", 0_a)),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -858,11 +858,11 @@
Override("foo", ty.u32());
Override("bar", ty.u32(), Mul(2_a, "foo"));
GlobalVar("v", builtin::AddressSpace::kWorkgroup, ty.array(ty.f32(), Mul(2_a, Expr("bar"))));
- Func("ep", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("ep", tint::Empty, ty.void_(),
+ Vector{
Assign(Phony(), IndexAccessor("v", 0_a)),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -886,11 +886,11 @@
Override("zoo", ty.u32());
Alias("MyArrayUnused", ty.array(ty.f32(), Mul(2_a, Expr("zoo"))));
GlobalVar("v", builtin::AddressSpace::kWorkgroup, ty("MyArray"));
- Func("ep", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("ep", tint::Empty, ty.void_(),
+ Vector{
Assign(Phony(), IndexAccessor("v", 0_a)),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -916,16 +916,16 @@
Override("i32_var", ty.i32());
Override("f16_var", ty.f16());
- MakePlainGlobalReferenceBodyFunction("bool_func", "bool_var", ty.bool_(), utils::Empty);
- MakePlainGlobalReferenceBodyFunction("float_func", "float_var", ty.f32(), utils::Empty);
- MakePlainGlobalReferenceBodyFunction("u32_func", "u32_var", ty.u32(), utils::Empty);
- MakePlainGlobalReferenceBodyFunction("i32_func", "i32_var", ty.i32(), utils::Empty);
- MakePlainGlobalReferenceBodyFunction("f16_func", "f16_var", ty.f16(), utils::Empty);
+ MakePlainGlobalReferenceBodyFunction("bool_func", "bool_var", ty.bool_(), tint::Empty);
+ MakePlainGlobalReferenceBodyFunction("float_func", "float_var", ty.f32(), tint::Empty);
+ MakePlainGlobalReferenceBodyFunction("u32_func", "u32_var", ty.u32(), tint::Empty);
+ MakePlainGlobalReferenceBodyFunction("i32_func", "i32_var", ty.i32(), tint::Empty);
+ MakePlainGlobalReferenceBodyFunction("f16_func", "f16_var", ty.f16(), tint::Empty);
MakeCallerBodyFunction(
"ep_func",
- utils::Vector{std::string("bool_func"), "float_func", "u32_func", "i32_func", "f16_func"},
- utils::Vector{
+ Vector{std::string("bool_func"), "float_func", "u32_func", "i32_func", "f16_func"},
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -951,7 +951,7 @@
TEST_F(InspectorGetEntryPointTest, OverrideInitialized) {
Override("foo", ty.f32(), Expr(0_f));
MakePlainGlobalReferenceBodyFunction("ep_func", "foo", ty.f32(),
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -969,7 +969,7 @@
TEST_F(InspectorGetEntryPointTest, OverrideUninitialized) {
Override("foo", ty.f32());
MakePlainGlobalReferenceBodyFunction("ep_func", "foo", ty.f32(),
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -989,11 +989,11 @@
Override("foo_no_id", ty.f32());
Override("foo_id", ty.f32(), Id(1234_a));
- MakePlainGlobalReferenceBodyFunction("no_id_func", "foo_no_id", ty.f32(), utils::Empty);
- MakePlainGlobalReferenceBodyFunction("id_func", "foo_id", ty.f32(), utils::Empty);
+ MakePlainGlobalReferenceBodyFunction("no_id_func", "foo_no_id", ty.f32(), tint::Empty);
+ MakePlainGlobalReferenceBodyFunction("id_func", "foo_id", ty.f32(), tint::Empty);
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("no_id_func"), "id_func"},
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", Vector{std::string("no_id_func"), "id_func"},
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -1013,16 +1013,16 @@
}
TEST_F(InspectorGetEntryPointTest, NonOverrideSkipped) {
- auto* foo_struct_type = MakeUniformBufferType("foo_type", utils::Vector{
+ auto* foo_struct_type = MakeUniformBufferType("foo_type", Vector{
ty.i32(),
});
AddUniformBuffer("foo_ub", ty.Of(foo_struct_type), 0, 0);
MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub",
- utils::Vector{
+ Vector{
MemberInfo{0, ty.i32()},
});
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("ub_func")},
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", Vector{std::string("ub_func")},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1035,7 +1035,7 @@
}
TEST_F(InspectorGetEntryPointTest, BuiltinNotReferenced) {
- MakeEmptyBodyFunction("ep_func", utils::Vector{
+ MakeEmptyBodyFunction("ep_func", Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1055,14 +1055,14 @@
TEST_F(InspectorGetEntryPointTest, InputSampleMaskSimpleReferenced) {
auto* in_var = Param("in_var", ty.u32(),
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kSampleMask),
});
- Func("ep_func", utils::Vector{in_var}, ty.void_(),
- utils::Vector{
+ Func("ep_func", Vector{in_var}, ty.void_(),
+ Vector{
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1075,22 +1075,21 @@
}
TEST_F(InspectorGetEntryPointTest, InputSampleMaskStructReferenced) {
- utils::Vector members{
- Member("inner_position", ty.u32(),
- utils::Vector{Builtin(builtin::BuiltinValue::kSampleMask)}),
+ Vector members{
+ Member("inner_position", ty.u32(), Vector{Builtin(builtin::BuiltinValue::kSampleMask)}),
};
Structure("in_struct", members);
Func("ep_func",
- utils::Vector{
- Param("in_var", ty("in_struct"), utils::Empty),
+ Vector{
+ Param("in_var", ty("in_struct"), tint::Empty),
},
ty.void_(),
- utils::Vector{
+ Vector{
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1104,17 +1103,17 @@
TEST_F(InspectorGetEntryPointTest, OutputSampleMaskSimpleReferenced) {
Func("ep_func",
- utils::Vector{
- Param("in_var", ty.u32(), utils::Vector{Builtin(builtin::BuiltinValue::kSampleMask)}),
+ Vector{
+ Param("in_var", ty.u32(), Vector{Builtin(builtin::BuiltinValue::kSampleMask)}),
},
ty.u32(),
- utils::Vector{
+ Vector{
Return("in_var"),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kSampleMask),
});
@@ -1127,17 +1126,17 @@
}
TEST_F(InspectorGetEntryPointTest, OutputSampleMaskStructReferenced) {
- Structure("out_struct", utils::Vector{
+ Structure("out_struct", Vector{
Member("inner_sample_mask", ty.u32(),
- utils::Vector{Builtin(builtin::BuiltinValue::kSampleMask)}),
+ Vector{Builtin(builtin::BuiltinValue::kSampleMask)}),
});
- Func("ep_func", utils::Empty, ty("out_struct"),
- utils::Vector{
+ Func("ep_func", tint::Empty, ty("out_struct"),
+ Vector{
Decl(Var("out_var", ty("out_struct"))),
Return("out_var"),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1151,15 +1150,14 @@
TEST_F(InspectorGetEntryPointTest, InputPositionSimpleReferenced) {
Func("ep_func",
- utils::Vector{
- Param("in_var", ty.vec4<f32>(),
- utils::Vector{Builtin(builtin::BuiltinValue::kPosition)}),
+ Vector{
+ Param("in_var", ty.vec4<f32>(), Vector{Builtin(builtin::BuiltinValue::kPosition)}),
},
ty.void_(),
- utils::Vector{
+ Vector{
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1172,20 +1170,20 @@
}
TEST_F(InspectorGetEntryPointTest, InputPositionStructReferenced) {
- Structure("in_struct", utils::Vector{
+ Structure("in_struct", Vector{
Member("inner_position", ty.vec4<f32>(),
- utils::Vector{Builtin(builtin::BuiltinValue::kPosition)}),
+ Vector{Builtin(builtin::BuiltinValue::kPosition)}),
});
Func("ep_func",
- utils::Vector{
- Param("in_var", ty("in_struct"), utils::Empty),
+ Vector{
+ Param("in_var", ty("in_struct"), tint::Empty),
},
ty.void_(),
- utils::Vector{
+ Vector{
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1199,15 +1197,14 @@
TEST_F(InspectorGetEntryPointTest, FrontFacingSimpleReferenced) {
Func("ep_func",
- utils::Vector{
- Param("in_var", ty.bool_(),
- utils::Vector{Builtin(builtin::BuiltinValue::kFrontFacing)}),
+ Vector{
+ Param("in_var", ty.bool_(), Vector{Builtin(builtin::BuiltinValue::kFrontFacing)}),
},
ty.void_(),
- utils::Vector{
+ Vector{
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1220,20 +1217,20 @@
}
TEST_F(InspectorGetEntryPointTest, FrontFacingStructReferenced) {
- Structure("in_struct", utils::Vector{
+ Structure("in_struct", Vector{
Member("inner_position", ty.bool_(),
- utils::Vector{Builtin(builtin::BuiltinValue::kFrontFacing)}),
+ Vector{Builtin(builtin::BuiltinValue::kFrontFacing)}),
});
Func("ep_func",
- utils::Vector{
- Param("in_var", ty("in_struct"), utils::Empty),
+ Vector{
+ Param("in_var", ty("in_struct"), tint::Empty),
},
ty.void_(),
- utils::Vector{
+ Vector{
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1247,14 +1244,14 @@
TEST_F(InspectorGetEntryPointTest, SampleIndexSimpleReferenced) {
Func("ep_func",
- utils::Vector{
- Param("in_var", ty.u32(), utils::Vector{Builtin(builtin::BuiltinValue::kSampleIndex)}),
+ Vector{
+ Param("in_var", ty.u32(), Vector{Builtin(builtin::BuiltinValue::kSampleIndex)}),
},
ty.void_(),
- utils::Vector{
+ Vector{
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1267,20 +1264,20 @@
}
TEST_F(InspectorGetEntryPointTest, SampleIndexStructReferenced) {
- Structure("in_struct", utils::Vector{
+ Structure("in_struct", Vector{
Member("inner_position", ty.u32(),
- utils::Vector{Builtin(builtin::BuiltinValue::kSampleIndex)}),
+ Vector{Builtin(builtin::BuiltinValue::kSampleIndex)}),
});
Func("ep_func",
- utils::Vector{
- Param("in_var", ty("in_struct"), utils::Empty),
+ Vector{
+ Param("in_var", ty("in_struct"), tint::Empty),
},
ty.void_(),
- utils::Vector{
+ Vector{
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1293,16 +1290,16 @@
}
TEST_F(InspectorGetEntryPointTest, NumWorkgroupsSimpleReferenced) {
- Func("ep_func",
- utils::Vector{
- Param("in_var", ty.vec3<u32>(),
- utils::Vector{Builtin(builtin::BuiltinValue::kNumWorkgroups)}),
- },
- ty.void_(),
- utils::Vector{
- Return(),
- },
- utils::Vector{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}, utils::Empty);
+ Func(
+ "ep_func",
+ Vector{
+ Param("in_var", ty.vec3<u32>(), Vector{Builtin(builtin::BuiltinValue::kNumWorkgroups)}),
+ },
+ ty.void_(),
+ Vector{
+ Return(),
+ },
+ Vector{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}, tint::Empty);
Inspector& inspector = Build();
@@ -1313,21 +1310,20 @@
}
TEST_F(InspectorGetEntryPointTest, NumWorkgroupsStructReferenced) {
- Structure("in_struct",
- utils::Vector{
- Member("inner_position", ty.vec3<u32>(),
- utils::Vector{Builtin(builtin::BuiltinValue::kNumWorkgroups)}),
- });
+ Structure("in_struct", Vector{
+ Member("inner_position", ty.vec3<u32>(),
+ Vector{Builtin(builtin::BuiltinValue::kNumWorkgroups)}),
+ });
Func("ep_func",
- utils::Vector{
- Param("in_var", ty("in_struct"), utils::Empty),
+ Vector{
+ Param("in_var", ty("in_struct"), tint::Empty),
},
ty.void_(),
- utils::Vector{
+ Vector{
Return(),
},
- utils::Vector{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}, utils::Empty);
+ Vector{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)}, tint::Empty);
Inspector& inspector = Build();
@@ -1339,13 +1335,13 @@
TEST_F(InspectorGetEntryPointTest, FragDepthSimpleReferenced) {
Func("ep_func", {}, ty.f32(),
- utils::Vector{
+ Vector{
Return(Expr(0_f)),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kFragDepth),
});
@@ -1358,17 +1354,17 @@
}
TEST_F(InspectorGetEntryPointTest, FragDepthStructReferenced) {
- Structure("out_struct", utils::Vector{
+ Structure("out_struct", Vector{
Member("inner_frag_depth", ty.f32(),
- utils::Vector{Builtin(builtin::BuiltinValue::kFragDepth)}),
+ Vector{Builtin(builtin::BuiltinValue::kFragDepth)}),
});
- Func("ep_func", utils::Empty, ty("out_struct"),
- utils::Vector{
+ Func("ep_func", tint::Empty, ty("out_struct"),
+ Vector{
Decl(Var("out_var", ty("out_struct"))),
Return("out_var"),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1381,19 +1377,19 @@
}
TEST_F(InspectorGetEntryPointTest, ImplicitInterpolate) {
- Structure("in_struct", utils::Vector{
- Member("struct_inner", ty.f32(), utils::Vector{Location(0_a)}),
+ Structure("in_struct", Vector{
+ Member("struct_inner", ty.f32(), Vector{Location(0_a)}),
});
Func("ep_func",
- utils::Vector{
- Param("in_var", ty("in_struct"), utils::Empty),
+ Vector{
+ Param("in_var", ty("in_struct"), tint::Empty),
},
ty.void_(),
- utils::Vector{
+ Vector{
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1409,22 +1405,21 @@
TEST_P(InspectorGetEntryPointInterpolateTest, Test) {
auto& params = GetParam();
- Structure(
- "in_struct",
- utils::Vector{
- Member("struct_inner", ty.f32(),
- utils::Vector{Interpolate(params.in_type, params.in_sampling), Location(0_a)}),
- });
+ Structure("in_struct",
+ Vector{
+ Member("struct_inner", ty.f32(),
+ Vector{Interpolate(params.in_type, params.in_sampling), Location(0_a)}),
+ });
Func("ep_func",
- utils::Vector{
- Param("in_var", ty("in_struct"), utils::Empty),
+ Vector{
+ Param("in_var", ty("in_struct"), tint::Empty),
},
ty.void_(),
- utils::Vector{
+ Vector{
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1692,7 +1687,7 @@
}
TEST_F(InspectorGetStorageSizeTest, Empty) {
- MakeEmptyBodyFunction("ep_func", utils::Vector{
+ MakeEmptyBodyFunction("ep_func", Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -1704,13 +1699,13 @@
AddUniformBuffer("ub_var", ty.i32(), 0, 0);
AddStorageBuffer("sb_var", ty.i32(), builtin::Access::kReadWrite, 1, 0);
AddStorageBuffer("rosb_var", ty.i32(), builtin::Access::kRead, 1, 1);
- Func("ep_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("ep_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("ub", Expr("ub_var"))),
Decl(Let("sb", Expr("sb_var"))),
Decl(Let("rosb", Expr("rosb_var"))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -1721,36 +1716,36 @@
}
TEST_F(InspectorGetStorageSizeTest, Simple_Struct) {
- auto* ub_struct_type = MakeUniformBufferType("ub_type", utils::Vector{
+ auto* ub_struct_type = MakeUniformBufferType("ub_type", Vector{
ty.i32(),
ty.i32(),
});
AddUniformBuffer("ub_var", ty.Of(ub_struct_type), 0, 0);
MakeStructVariableReferenceBodyFunction("ub_func", "ub_var",
- utils::Vector{
+ Vector{
MemberInfo{0, ty.i32()},
});
- auto sb = MakeStorageBufferTypes("sb_type", utils::Vector{
+ auto sb = MakeStorageBufferTypes("sb_type", Vector{
ty.i32(),
});
AddStorageBuffer("sb_var", sb(), builtin::Access::kReadWrite, 1, 0);
MakeStructVariableReferenceBodyFunction("sb_func", "sb_var",
- utils::Vector{
+ Vector{
MemberInfo{0, ty.i32()},
});
- auto ro_sb = MakeStorageBufferTypes("rosb_type", utils::Vector{
+ auto ro_sb = MakeStorageBufferTypes("rosb_type", Vector{
ty.i32(),
});
AddStorageBuffer("rosb_var", ro_sb(), builtin::Access::kRead, 1, 1);
MakeStructVariableReferenceBodyFunction("rosb_func", "rosb_var",
- utils::Vector{
+ Vector{
MemberInfo{0, ty.i32()},
});
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("ub_func"), "sb_func", "rosb_func"},
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", Vector{std::string("ub_func"), "sb_func", "rosb_func"},
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -1762,11 +1757,11 @@
TEST_F(InspectorGetStorageSizeTest, NonStructVec3) {
AddUniformBuffer("ub_var", ty.vec3<f32>(), 0, 0);
- Func("ep_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("ep_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("ub", Expr("ub_var"))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -1777,15 +1772,15 @@
}
TEST_F(InspectorGetStorageSizeTest, StructVec3) {
- auto* ub_struct_type = MakeUniformBufferType("ub_type", utils::Vector{
+ auto* ub_struct_type = MakeUniformBufferType("ub_type", Vector{
ty.vec3<f32>(),
});
AddUniformBuffer("ub_var", ty.Of(ub_struct_type), 0, 0);
- Func("ep_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("ep_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("ub", Expr("ub_var"))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -1796,8 +1791,8 @@
}
TEST_F(InspectorGetResourceBindingsTest, Empty) {
- MakeCallerBodyFunction("ep_func", utils::Empty,
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1809,30 +1804,30 @@
}
TEST_F(InspectorGetResourceBindingsTest, Simple) {
- auto* ub_struct_type = MakeUniformBufferType("ub_type", utils::Vector{
+ auto* ub_struct_type = MakeUniformBufferType("ub_type", Vector{
ty.i32(),
});
AddUniformBuffer("ub_var", ty.Of(ub_struct_type), 0, 0);
MakeStructVariableReferenceBodyFunction("ub_func", "ub_var",
- utils::Vector{
+ Vector{
MemberInfo{0, ty.i32()},
});
- auto sb = MakeStorageBufferTypes("sb_type", utils::Vector{
+ auto sb = MakeStorageBufferTypes("sb_type", Vector{
ty.i32(),
});
AddStorageBuffer("sb_var", sb(), builtin::Access::kReadWrite, 1, 0);
MakeStructVariableReferenceBodyFunction("sb_func", "sb_var",
- utils::Vector{
+ Vector{
MemberInfo{0, ty.i32()},
});
- auto ro_sb = MakeStorageBufferTypes("rosb_type", utils::Vector{
+ auto ro_sb = MakeStorageBufferTypes("rosb_type", Vector{
ty.i32(),
});
AddStorageBuffer("rosb_var", ro_sb(), builtin::Access::kRead, 1, 1);
MakeStructVariableReferenceBodyFunction("rosb_func", "rosb_var",
- utils::Vector{
+ Vector{
MemberInfo{0, ty.i32()},
});
@@ -1841,7 +1836,7 @@
AddSampler("s_var", 3, 0);
AddGlobalVariable("s_coords", ty.f32());
MakeSamplerReferenceBodyFunction("s_func", "s_texture", "s_var", "s_coords", ty.f32(),
- utils::Empty);
+ tint::Empty);
auto cs_depth_texture_type = ty.depth_texture(type::TextureDimension::k2d);
AddResource("cs_texture", cs_depth_texture_type, 3, 1);
@@ -1849,22 +1844,22 @@
AddGlobalVariable("cs_coords", ty.vec2<f32>());
AddGlobalVariable("cs_depth", ty.f32());
MakeComparisonSamplerReferenceBodyFunction("cs_func", "cs_texture", "cs_var", "cs_coords",
- "cs_depth", ty.f32(), utils::Empty);
+ "cs_depth", ty.f32(), tint::Empty);
auto depth_ms_texture_type = ty.depth_multisampled_texture(type::TextureDimension::k2d);
AddResource("depth_ms_texture", depth_ms_texture_type, 3, 3);
- Func("depth_ms_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("depth_ms_func", tint::Empty, ty.void_(),
+ Vector{
Ignore("depth_ms_texture"),
});
auto st_type =
MakeStorageTextureTypes(type::TextureDimension::k2d, builtin::TexelFormat::kR32Uint);
AddStorageTexture("st_var", st_type, 4, 0);
- MakeStorageTextureBodyFunction("st_func", "st_var", ty.vec2<u32>(), utils::Empty);
+ MakeStorageTextureBodyFunction("st_func", "st_var", ty.vec2<u32>(), tint::Empty);
MakeCallerBodyFunction("ep_func",
- utils::Vector{
+ Vector{
std::string("ub_func"),
std::string("sb_func"),
std::string("rosb_func"),
@@ -1873,7 +1868,7 @@
std::string("depth_ms_func"),
std::string("st_func"),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1930,18 +1925,18 @@
}
TEST_F(InspectorGetUniformBufferResourceBindingsTest, NonEntryPointFunc) {
- auto* foo_struct_type = MakeUniformBufferType("foo_type", utils::Vector{
+ auto* foo_struct_type = MakeUniformBufferType("foo_type", Vector{
ty.i32(),
});
AddUniformBuffer("foo_ub", ty.Of(foo_struct_type), 0, 0);
MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub",
- utils::Vector{
+ Vector{
MemberInfo{0, ty.i32()},
});
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("ub_func")},
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", Vector{std::string("ub_func")},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1954,10 +1949,10 @@
TEST_F(InspectorGetUniformBufferResourceBindingsTest, Simple_NonStruct) {
AddUniformBuffer("foo_ub", ty.i32(), 0, 0);
- MakePlainGlobalReferenceBodyFunction("ub_func", "foo_ub", ty.i32(), utils::Empty);
+ MakePlainGlobalReferenceBodyFunction("ub_func", "foo_ub", ty.i32(), tint::Empty);
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("ub_func")},
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", Vector{std::string("ub_func")},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1975,18 +1970,18 @@
}
TEST_F(InspectorGetUniformBufferResourceBindingsTest, Simple_Struct) {
- auto* foo_struct_type = MakeUniformBufferType("foo_type", utils::Vector{
+ auto* foo_struct_type = MakeUniformBufferType("foo_type", Vector{
ty.i32(),
});
AddUniformBuffer("foo_ub", ty.Of(foo_struct_type), 0, 0);
MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub",
- utils::Vector{
+ Vector{
MemberInfo{0, ty.i32()},
});
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("ub_func")},
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", Vector{std::string("ub_func")},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2004,7 +1999,7 @@
}
TEST_F(InspectorGetUniformBufferResourceBindingsTest, MultipleMembers) {
- auto* foo_struct_type = MakeUniformBufferType("foo_type", utils::Vector{
+ auto* foo_struct_type = MakeUniformBufferType("foo_type", Vector{
ty.i32(),
ty.u32(),
ty.f32(),
@@ -2012,14 +2007,14 @@
AddUniformBuffer("foo_ub", ty.Of(foo_struct_type), 0, 0);
MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub",
- utils::Vector{
+ Vector{
MemberInfo{0, ty.i32()},
MemberInfo{1, ty.u32()},
MemberInfo{2, ty.f32()},
});
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("ub_func")},
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", Vector{std::string("ub_func")},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2037,18 +2032,18 @@
}
TEST_F(InspectorGetUniformBufferResourceBindingsTest, ContainingPadding) {
- auto* foo_struct_type = MakeUniformBufferType("foo_type", utils::Vector{
+ auto* foo_struct_type = MakeUniformBufferType("foo_type", Vector{
ty.vec3<f32>(),
});
AddUniformBuffer("foo_ub", ty.Of(foo_struct_type), 0, 0);
MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub",
- utils::Vector{
+ Vector{
MemberInfo{0, ty.vec3<f32>()},
});
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("ub_func")},
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", Vector{std::string("ub_func")},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2067,10 +2062,10 @@
TEST_F(InspectorGetUniformBufferResourceBindingsTest, NonStructVec3) {
AddUniformBuffer("foo_ub", ty.vec3<f32>(), 0, 0);
- MakePlainGlobalReferenceBodyFunction("ub_func", "foo_ub", ty.vec3<f32>(), utils::Empty);
+ MakePlainGlobalReferenceBodyFunction("ub_func", "foo_ub", ty.vec3<f32>(), tint::Empty);
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("ub_func")},
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", Vector{std::string("ub_func")},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2088,7 +2083,7 @@
}
TEST_F(InspectorGetUniformBufferResourceBindingsTest, MultipleUniformBuffers) {
- auto* ub_struct_type = MakeUniformBufferType("ub_type", utils::Vector{
+ auto* ub_struct_type = MakeUniformBufferType("ub_type", Vector{
ty.i32(),
ty.u32(),
ty.f32(),
@@ -2099,7 +2094,7 @@
auto AddReferenceFunc = [this](const std::string& func_name, const std::string& var_name) {
MakeStructVariableReferenceBodyFunction(func_name, var_name,
- utils::Vector{
+ Vector{
MemberInfo{0, ty.i32()},
MemberInfo{1, ty.u32()},
MemberInfo{2, ty.f32()},
@@ -2111,14 +2106,14 @@
auto FuncCall = [&](const std::string& callee) { return CallStmt(Call(callee)); };
- Func("ep_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("ep_func", tint::Empty, ty.void_(),
+ Vector{
FuncCall("ub_foo_func"),
FuncCall("ub_bar_func"),
FuncCall("ub_baz_func"),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2150,13 +2145,13 @@
TEST_F(InspectorGetUniformBufferResourceBindingsTest, ContainingArray) {
// Manually create uniform buffer to make sure it had a valid layout (array
// with elem stride of 16, and that is 16-byte aligned within the struct)
- auto* foo_struct_type = Structure("foo_type", utils::Vector{
+ auto* foo_struct_type = Structure("foo_type", Vector{
Member("0i32", ty.i32()),
Member("b",
- ty.array<u32, 4>(utils::Vector{
+ ty.array<u32, 4>(Vector{
Stride(16),
}),
- utils::Vector{
+ Vector{
MemberAlign(16_i),
}),
});
@@ -2164,12 +2159,12 @@
AddUniformBuffer("foo_ub", ty.Of(foo_struct_type), 0, 0);
MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub",
- utils::Vector{
+ Vector{
MemberInfo{0, ty.i32()},
});
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("ub_func")},
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", Vector{std::string("ub_func")},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2188,10 +2183,10 @@
TEST_F(InspectorGetStorageBufferResourceBindingsTest, Simple_NonStruct) {
AddStorageBuffer("foo_sb", ty.i32(), builtin::Access::kReadWrite, 0, 0);
- MakePlainGlobalReferenceBodyFunction("sb_func", "foo_sb", ty.i32(), utils::Empty);
+ MakePlainGlobalReferenceBodyFunction("sb_func", "foo_sb", ty.i32(), tint::Empty);
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("sb_func")},
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", Vector{std::string("sb_func")},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2209,18 +2204,18 @@
}
TEST_F(InspectorGetStorageBufferResourceBindingsTest, Simple_Struct) {
- auto foo_struct_type = MakeStorageBufferTypes("foo_type", utils::Vector{
+ auto foo_struct_type = MakeStorageBufferTypes("foo_type", Vector{
ty.i32(),
});
AddStorageBuffer("foo_sb", foo_struct_type(), builtin::Access::kReadWrite, 0, 0);
MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
- utils::Vector{
+ Vector{
MemberInfo{0, ty.i32()},
});
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("sb_func")},
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", Vector{std::string("sb_func")},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2238,7 +2233,7 @@
}
TEST_F(InspectorGetStorageBufferResourceBindingsTest, MultipleMembers) {
- auto foo_struct_type = MakeStorageBufferTypes("foo_type", utils::Vector{
+ auto foo_struct_type = MakeStorageBufferTypes("foo_type", Vector{
ty.i32(),
ty.u32(),
ty.f32(),
@@ -2246,14 +2241,14 @@
AddStorageBuffer("foo_sb", foo_struct_type(), builtin::Access::kReadWrite, 0, 0);
MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
- utils::Vector{
+ Vector{
MemberInfo{0, ty.i32()},
MemberInfo{1, ty.u32()},
MemberInfo{2, ty.f32()},
});
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("sb_func")},
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", Vector{std::string("sb_func")},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2271,7 +2266,7 @@
}
TEST_F(InspectorGetStorageBufferResourceBindingsTest, MultipleStorageBuffers) {
- auto sb_struct_type = MakeStorageBufferTypes("sb_type", utils::Vector{
+ auto sb_struct_type = MakeStorageBufferTypes("sb_type", Vector{
ty.i32(),
ty.u32(),
ty.f32(),
@@ -2282,7 +2277,7 @@
auto AddReferenceFunc = [this](const std::string& func_name, const std::string& var_name) {
MakeStructVariableReferenceBodyFunction(func_name, var_name,
- utils::Vector{
+ Vector{
MemberInfo{0, ty.i32()},
MemberInfo{1, ty.u32()},
MemberInfo{2, ty.f32()},
@@ -2294,14 +2289,14 @@
auto FuncCall = [&](const std::string& callee) { return CallStmt(Call(callee)); };
- Func("ep_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("ep_func", tint::Empty, ty.void_(),
+ Vector{
FuncCall("sb_foo_func"),
FuncCall("sb_bar_func"),
FuncCall("sb_baz_func"),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2331,19 +2326,19 @@
}
TEST_F(InspectorGetStorageBufferResourceBindingsTest, ContainingArray) {
- auto foo_struct_type = MakeStorageBufferTypes("foo_type", utils::Vector{
+ auto foo_struct_type = MakeStorageBufferTypes("foo_type", Vector{
ty.i32(),
ty.array<u32, 4>(),
});
AddStorageBuffer("foo_sb", foo_struct_type(), builtin::Access::kReadWrite, 0, 0);
MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
- utils::Vector{
+ Vector{
MemberInfo{0, ty.i32()},
});
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("sb_func")},
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", Vector{std::string("sb_func")},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2361,19 +2356,19 @@
}
TEST_F(InspectorGetStorageBufferResourceBindingsTest, ContainingRuntimeArray) {
- auto foo_struct_type = MakeStorageBufferTypes("foo_type", utils::Vector{
+ auto foo_struct_type = MakeStorageBufferTypes("foo_type", Vector{
ty.i32(),
ty.array<u32>(),
});
AddStorageBuffer("foo_sb", foo_struct_type(), builtin::Access::kReadWrite, 0, 0);
MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
- utils::Vector{
+ Vector{
MemberInfo{0, ty.i32()},
});
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("sb_func")},
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", Vector{std::string("sb_func")},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2391,18 +2386,18 @@
}
TEST_F(InspectorGetStorageBufferResourceBindingsTest, ContainingPadding) {
- auto foo_struct_type = MakeStorageBufferTypes("foo_type", utils::Vector{
+ auto foo_struct_type = MakeStorageBufferTypes("foo_type", Vector{
ty.vec3<f32>(),
});
AddStorageBuffer("foo_sb", foo_struct_type(), builtin::Access::kReadWrite, 0, 0);
MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
- utils::Vector{
+ Vector{
MemberInfo{0, ty.vec3<f32>()},
});
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("sb_func")},
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", Vector{std::string("sb_func")},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2421,10 +2416,10 @@
TEST_F(InspectorGetStorageBufferResourceBindingsTest, NonStructVec3) {
AddStorageBuffer("foo_ub", ty.vec3<f32>(), builtin::Access::kReadWrite, 0, 0);
- MakePlainGlobalReferenceBodyFunction("ub_func", "foo_ub", ty.vec3<f32>(), utils::Empty);
+ MakePlainGlobalReferenceBodyFunction("ub_func", "foo_ub", ty.vec3<f32>(), tint::Empty);
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("ub_func")},
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", Vector{std::string("ub_func")},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2442,18 +2437,18 @@
}
TEST_F(InspectorGetStorageBufferResourceBindingsTest, SkipReadOnly) {
- auto foo_struct_type = MakeStorageBufferTypes("foo_type", utils::Vector{
+ auto foo_struct_type = MakeStorageBufferTypes("foo_type", Vector{
ty.i32(),
});
AddStorageBuffer("foo_sb", foo_struct_type(), builtin::Access::kRead, 0, 0);
MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
- utils::Vector{
+ Vector{
MemberInfo{0, ty.i32()},
});
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("sb_func")},
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", Vector{std::string("sb_func")},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2465,18 +2460,18 @@
}
TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, Simple) {
- auto foo_struct_type = MakeStorageBufferTypes("foo_type", utils::Vector{
+ auto foo_struct_type = MakeStorageBufferTypes("foo_type", Vector{
ty.i32(),
});
AddStorageBuffer("foo_sb", foo_struct_type(), builtin::Access::kRead, 0, 0);
MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
- utils::Vector{
+ Vector{
MemberInfo{0, ty.i32()},
});
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("sb_func")},
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", Vector{std::string("sb_func")},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2494,7 +2489,7 @@
}
TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, MultipleStorageBuffers) {
- auto sb_struct_type = MakeStorageBufferTypes("sb_type", utils::Vector{
+ auto sb_struct_type = MakeStorageBufferTypes("sb_type", Vector{
ty.i32(),
ty.u32(),
ty.f32(),
@@ -2505,7 +2500,7 @@
auto AddReferenceFunc = [this](const std::string& func_name, const std::string& var_name) {
MakeStructVariableReferenceBodyFunction(func_name, var_name,
- utils::Vector{
+ Vector{
MemberInfo{0, ty.i32()},
MemberInfo{1, ty.u32()},
MemberInfo{2, ty.f32()},
@@ -2517,14 +2512,14 @@
auto FuncCall = [&](const std::string& callee) { return CallStmt(Call(callee)); };
- Func("ep_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("ep_func", tint::Empty, ty.void_(),
+ Vector{
FuncCall("sb_foo_func"),
FuncCall("sb_bar_func"),
FuncCall("sb_baz_func"),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2554,19 +2549,19 @@
}
TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, ContainingArray) {
- auto foo_struct_type = MakeStorageBufferTypes("foo_type", utils::Vector{
+ auto foo_struct_type = MakeStorageBufferTypes("foo_type", Vector{
ty.i32(),
ty.array<u32, 4>(),
});
AddStorageBuffer("foo_sb", foo_struct_type(), builtin::Access::kRead, 0, 0);
MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
- utils::Vector{
+ Vector{
MemberInfo{0, ty.i32()},
});
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("sb_func")},
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", Vector{std::string("sb_func")},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2584,19 +2579,19 @@
}
TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, ContainingRuntimeArray) {
- auto foo_struct_type = MakeStorageBufferTypes("foo_type", utils::Vector{
+ auto foo_struct_type = MakeStorageBufferTypes("foo_type", Vector{
ty.i32(),
ty.array<u32>(),
});
AddStorageBuffer("foo_sb", foo_struct_type(), builtin::Access::kRead, 0, 0);
MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
- utils::Vector{
+ Vector{
MemberInfo{0, ty.i32()},
});
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("sb_func")},
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", Vector{std::string("sb_func")},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2614,18 +2609,18 @@
}
TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, SkipNonReadOnly) {
- auto foo_struct_type = MakeStorageBufferTypes("foo_type", utils::Vector{
+ auto foo_struct_type = MakeStorageBufferTypes("foo_type", Vector{
ty.i32(),
});
AddStorageBuffer("foo_sb", foo_struct_type(), builtin::Access::kReadWrite, 0, 0);
MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
- utils::Vector{
+ Vector{
MemberInfo{0, ty.i32()},
});
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("sb_func")},
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", Vector{std::string("sb_func")},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2643,7 +2638,7 @@
AddGlobalVariable("foo_coords", ty.f32());
MakeSamplerReferenceBodyFunction("ep", "foo_texture", "foo_sampler", "foo_coords", ty.f32(),
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2659,7 +2654,7 @@
}
TEST_F(InspectorGetSamplerResourceBindingsTest, NoSampler) {
- MakeEmptyBodyFunction("ep_func", utils::Vector{
+ MakeEmptyBodyFunction("ep_func", Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2678,10 +2673,10 @@
AddGlobalVariable("foo_coords", ty.f32());
MakeSamplerReferenceBodyFunction("foo_func", "foo_texture", "foo_sampler", "foo_coords",
- ty.f32(), utils::Empty);
+ ty.f32(), tint::Empty);
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("foo_func")},
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", Vector{std::string("foo_func")},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2703,7 +2698,7 @@
AddGlobalVariable("foo_coords", ty.f32());
MakeSamplerReferenceBodyFunction("ep", "foo_texture", "foo_sampler", "foo_coords", ty.f32(),
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2722,7 +2717,7 @@
MakeComparisonSamplerReferenceBodyFunction("ep", "foo_texture", "foo_sampler", "foo_coords",
"foo_depth", ty.f32(),
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2743,7 +2738,7 @@
MakeComparisonSamplerReferenceBodyFunction("ep", "foo_texture", "foo_sampler", "foo_coords",
"foo_depth", ty.f32(),
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2759,7 +2754,7 @@
}
TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, NoSampler) {
- MakeEmptyBodyFunction("ep_func", utils::Vector{
+ MakeEmptyBodyFunction("ep_func", Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2779,10 +2774,10 @@
AddGlobalVariable("foo_depth", ty.f32());
MakeComparisonSamplerReferenceBodyFunction("foo_func", "foo_texture", "foo_sampler",
- "foo_coords", "foo_depth", ty.f32(), utils::Empty);
+ "foo_coords", "foo_depth", ty.f32(), tint::Empty);
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("foo_func")},
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", Vector{std::string("foo_func")},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2806,7 +2801,7 @@
MakeComparisonSamplerReferenceBodyFunction("ep", "foo_texture", "foo_sampler", "foo_coords",
"foo_depth", ty.f32(),
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2823,7 +2818,7 @@
AddGlobalVariable("foo_coords", ty.f32());
MakeSamplerReferenceBodyFunction("ep", "foo_texture", "foo_sampler", "foo_coords", ty.f32(),
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2836,7 +2831,7 @@
}
TEST_F(InspectorGetSampledTextureResourceBindingsTest, Empty) {
- MakeEmptyBodyFunction("foo", utils::Vector{
+ MakeEmptyBodyFunction("foo", Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2858,7 +2853,7 @@
MakeSamplerReferenceBodyFunction("ep", "foo_texture", "foo_sampler", "foo_coords",
GetBaseType(GetParam().sampled_kind),
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2908,7 +2903,7 @@
MakeSamplerReferenceBodyFunction("ep", "foo_texture", "foo_sampler", "foo_coords",
"foo_array_index", GetBaseType(GetParam().sampled_kind),
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2944,11 +2939,11 @@
AddGlobalVariable("foo_coords", coord_type);
AddGlobalVariable("foo_sample_index", ty.i32());
- Func("ep", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("ep", tint::Empty, ty.void_(),
+ Vector{
Assign(Phony(), Call("textureLoad", "foo_texture", "foo_coords", "foo_sample_index")),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2986,7 +2981,7 @@
inspector::ResourceBinding::SampledKind::kUInt}));
TEST_F(InspectorGetMultisampledArrayTextureResourceBindingsTest, Empty) {
- MakeEmptyBodyFunction("foo", utils::Vector{
+ MakeEmptyBodyFunction("foo", Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2999,7 +2994,7 @@
}
TEST_F(InspectorGetStorageTextureResourceBindingsTest, Empty) {
- MakeEmptyBodyFunction("ep", utils::Vector{
+ MakeEmptyBodyFunction("ep", Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -3046,7 +3041,7 @@
ASSERT_FALSE(dim_type == nullptr);
MakeStorageTextureBodyFunction("ep", "st_var", dim_type,
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -3128,11 +3123,11 @@
auto depth_texture_type = ty.depth_texture(GetParam().type_dim);
AddResource("dt", depth_texture_type, 0, 0);
- Func("ep", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("ep", tint::Empty, ty.void_(),
+ Vector{
Assign(Phony(), Call("textureDimensions", "dt")),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -3165,11 +3160,11 @@
auto depth_ms_texture_type = ty.depth_multisampled_texture(type::TextureDimension::k2d);
AddResource("tex", depth_ms_texture_type, 0, 0);
- Func("ep", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("ep", tint::Empty, ty.void_(),
+ Vector{
Assign(Phony(), Call("textureDimensions", "tex")),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -3189,11 +3184,11 @@
auto external_texture_type = ty.external_texture();
AddResource("et", external_texture_type, 0, 0);
- Func("ep", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("ep", tint::Empty, ty.void_(),
+ Vector{
Assign(Phony(), Call("textureDimensions", "et")),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -3278,8 +3273,8 @@
auto result_1 = inspector.GetSamplerTextureUses("main");
ASSERT_FALSE(inspector.has_error()) << inspector.error();
- EXPECT_EQ((utils::Vector<sem::SamplerTexturePair, 4>(result_0)),
- (utils::Vector<sem::SamplerTexturePair, 4>(result_1)));
+ EXPECT_EQ((Vector<sem::SamplerTexturePair, 4>(result_0)),
+ (Vector<sem::SamplerTexturePair, 4>(result_1)));
}
TEST_F(InspectorGetSamplerTextureUsesTest, BothIndirect) {
@@ -3470,7 +3465,7 @@
}
TEST_F(InspectorGetWorkgroupStorageSizeTest, Empty) {
- MakeEmptyBodyFunction("ep_func", utils::Vector{
+ MakeEmptyBodyFunction("ep_func", Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -3480,10 +3475,10 @@
TEST_F(InspectorGetWorkgroupStorageSizeTest, Simple) {
AddWorkgroupStorage("wg_f32", ty.f32());
- MakePlainGlobalReferenceBodyFunction("f32_func", "wg_f32", ty.f32(), utils::Empty);
+ MakePlainGlobalReferenceBodyFunction("f32_func", "wg_f32", ty.f32(), tint::Empty);
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("f32_func")},
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", Vector{std::string("f32_func")},
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -3495,24 +3490,24 @@
TEST_F(InspectorGetWorkgroupStorageSizeTest, CompoundTypes) {
// This struct should occupy 68 bytes. 4 from the i32 field, and another 64
// from the 4-element array with 16-byte stride.
- auto* wg_struct_type = MakeStructType("WgStruct", utils::Vector{
+ auto* wg_struct_type = MakeStructType("WgStruct", Vector{
ty.i32(),
- ty.array<i32, 4>(utils::Vector{
+ ty.array<i32, 4>(Vector{
Stride(16),
}),
});
AddWorkgroupStorage("wg_struct_var", ty.Of(wg_struct_type));
MakeStructVariableReferenceBodyFunction("wg_struct_func", "wg_struct_var",
- utils::Vector{
+ Vector{
MemberInfo{0, ty.i32()},
});
// Plus another 4 bytes from this other workgroup-class f32.
AddWorkgroupStorage("wg_f32", ty.f32());
- MakePlainGlobalReferenceBodyFunction("f32_func", "wg_f32", ty.f32(), utils::Empty);
+ MakePlainGlobalReferenceBodyFunction("f32_func", "wg_f32", ty.f32(), tint::Empty);
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("wg_struct_func"), "f32_func"},
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", Vector{std::string("wg_struct_func"), "f32_func"},
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -3525,10 +3520,10 @@
// vec3<f32> has an alignment of 16 but a size of 12. We leverage this to test
// that our padded size calculation for workgroup storage is accurate.
AddWorkgroupStorage("wg_vec3", ty.vec3<f32>());
- MakePlainGlobalReferenceBodyFunction("wg_func", "wg_vec3", ty.vec3<f32>(), utils::Empty);
+ MakePlainGlobalReferenceBodyFunction("wg_func", "wg_vec3", ty.vec3<f32>(), tint::Empty);
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("wg_func")},
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", Vector{std::string("wg_func")},
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -3542,18 +3537,18 @@
// of its last member, rounded up to the alignment of its largest member. So
// here the struct is expected to occupy 1024 bytes of workgroup storage.
const auto* wg_struct_type = MakeStructTypeFromMembers(
- "WgStruct", utils::Vector{
- MakeStructMember(0, ty.f32(), utils::Vector{MemberAlign(1024_i)}),
+ "WgStruct", Vector{
+ MakeStructMember(0, ty.f32(), Vector{MemberAlign(1024_i)}),
});
AddWorkgroupStorage("wg_struct_var", ty.Of(wg_struct_type));
MakeStructVariableReferenceBodyFunction("wg_struct_func", "wg_struct_var",
- utils::Vector{
+ Vector{
MemberInfo{0, ty.f32()},
});
- MakeCallerBodyFunction("ep_func", utils::Vector{std::string("wg_struct_func")},
- utils::Vector{
+ MakeCallerBodyFunction("ep_func", Vector{std::string("wg_struct_func")},
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
diff --git a/src/tint/lang/wgsl/inspector/test_inspector_builder.cc b/src/tint/lang/wgsl/inspector/test_inspector_builder.cc
index 4327c5e..e247141 100644
--- a/src/tint/lang/wgsl/inspector/test_inspector_builder.cc
+++ b/src/tint/lang/wgsl/inspector/test_inspector_builder.cc
@@ -28,32 +28,32 @@
InspectorBuilder::~InspectorBuilder() = default;
void InspectorBuilder::MakeEmptyBodyFunction(std::string name,
- utils::VectorRef<const ast::Attribute*> attributes) {
- Func(name, utils::Empty, ty.void_(), utils::Vector{Return()}, attributes);
+ VectorRef<const ast::Attribute*> attributes) {
+ Func(name, tint::Empty, ty.void_(), Vector{Return()}, attributes);
}
void InspectorBuilder::MakeCallerBodyFunction(std::string caller,
- utils::VectorRef<std::string> callees,
- utils::VectorRef<const ast::Attribute*> attributes) {
- utils::Vector<const ast::Statement*, 8> body;
+ VectorRef<std::string> callees,
+ VectorRef<const ast::Attribute*> attributes) {
+ Vector<const ast::Statement*, 8> body;
body.Reserve(callees.Length() + 1);
for (auto callee : callees) {
body.Push(CallStmt(Call(callee)));
}
body.Push(Return());
- Func(caller, utils::Empty, ty.void_(), body, attributes);
+ Func(caller, tint::Empty, ty.void_(), body, attributes);
}
const ast::Struct* InspectorBuilder::MakeInOutStruct(std::string name,
- utils::VectorRef<InOutInfo> inout_vars) {
- utils::Vector<const ast::StructMember*, 8> members;
+ VectorRef<InOutInfo> inout_vars) {
+ Vector<const ast::StructMember*, 8> members;
for (auto var : inout_vars) {
std::string member_name;
uint32_t location;
std::tie(member_name, location) = var;
members.Push(Member(member_name, ty.u32(),
- utils::Vector{
+ Vector{
Location(AInt(location)),
Flat(),
}));
@@ -65,15 +65,15 @@
std::string func,
std::string var,
ast::Type type,
- utils::VectorRef<const ast::Attribute*> attributes) {
- utils::Vector<const ast::Statement*, 3> stmts;
+ VectorRef<const ast::Attribute*> attributes) {
+ Vector<const ast::Statement*, 3> stmts;
stmts.Push(Decl(Var("local_" + var, type)));
stmts.Push(Assign("local_" + var, var));
stmts.Push(Return());
- return Func(func, utils::Empty, ty.void_(), std::move(stmts), std::move(attributes));
+ return Func(func, tint::Empty, ty.void_(), std::move(stmts), std::move(attributes));
}
-bool InspectorBuilder::ContainsName(utils::VectorRef<StageVariable> vec, const std::string& name) {
+bool InspectorBuilder::ContainsName(VectorRef<StageVariable> vec, const std::string& name) {
for (auto& s : vec) {
if (s.name == name) {
return true;
@@ -87,8 +87,8 @@
}
const ast::Struct* InspectorBuilder::MakeStructType(const std::string& name,
- utils::VectorRef<ast::Type> member_types) {
- utils::Vector<const ast::StructMember*, 8> members;
+ VectorRef<ast::Type> member_types) {
+ Vector<const ast::StructMember*, 8> members;
for (auto type : member_types) {
members.Push(MakeStructMember(members.Length(), type, {}));
}
@@ -97,26 +97,25 @@
const ast::Struct* InspectorBuilder::MakeStructTypeFromMembers(
const std::string& name,
- utils::VectorRef<const ast::StructMember*> members) {
+ VectorRef<const ast::StructMember*> members) {
return Structure(name, std::move(members));
}
const ast::StructMember* InspectorBuilder::MakeStructMember(
size_t index,
ast::Type type,
- utils::VectorRef<const ast::Attribute*> attributes) {
+ VectorRef<const ast::Attribute*> attributes) {
return Member(StructMemberName(index, type), type, std::move(attributes));
}
-const ast::Struct* InspectorBuilder::MakeUniformBufferType(
- const std::string& name,
- utils::VectorRef<ast::Type> member_types) {
+const ast::Struct* InspectorBuilder::MakeUniformBufferType(const std::string& name,
+ VectorRef<ast::Type> member_types) {
return MakeStructType(name, member_types);
}
std::function<ast::Type()> InspectorBuilder::MakeStorageBufferTypes(
const std::string& name,
- utils::VectorRef<ast::Type> member_types) {
+ VectorRef<ast::Type> member_types) {
MakeStructType(name, member_types);
return [this, name] { return ty(name); };
}
@@ -145,8 +144,8 @@
void InspectorBuilder::MakeStructVariableReferenceBodyFunction(
std::string func_name,
std::string struct_name,
- utils::VectorRef<std::tuple<size_t, ast::Type>> members) {
- utils::Vector<const ast::Statement*, 8> stmts;
+ VectorRef<std::tuple<size_t, ast::Type>> members) {
+ Vector<const ast::Statement*, 8> stmts;
for (auto member : members) {
size_t member_idx;
ast::Type member_type;
@@ -167,7 +166,7 @@
stmts.Push(Return());
- Func(func_name, utils::Empty, ty.void_(), stmts);
+ Func(func_name, tint::Empty, ty.void_(), stmts);
}
void InspectorBuilder::AddSampler(const std::string& name, uint32_t group, uint32_t binding) {
@@ -199,15 +198,15 @@
const std::string& sampler_name,
const std::string& coords_name,
ast::Type base_type,
- utils::VectorRef<const ast::Attribute*> attributes) {
+ VectorRef<const ast::Attribute*> attributes) {
std::string result_name = "sampler_result";
- utils::Vector stmts{
+ Vector stmts{
Decl(Var(result_name, ty.vec(base_type, 4))),
Assign(result_name, Call("textureSample", texture_name, sampler_name, coords_name)),
Return(),
};
- return Func(func_name, utils::Empty, ty.void_(), std::move(stmts), std::move(attributes));
+ return Func(func_name, tint::Empty, ty.void_(), std::move(stmts), std::move(attributes));
}
const ast::Function* InspectorBuilder::MakeSamplerReferenceBodyFunction(
@@ -217,16 +216,16 @@
const std::string& coords_name,
const std::string& array_index,
ast::Type base_type,
- utils::VectorRef<const ast::Attribute*> attributes) {
+ VectorRef<const ast::Attribute*> attributes) {
std::string result_name = "sampler_result";
- utils::Vector stmts{
+ Vector stmts{
Decl(Var("sampler_result", ty.vec(base_type, 4))),
Assign("sampler_result",
Call("textureSample", texture_name, sampler_name, coords_name, array_index)),
Return(),
};
- return Func(func_name, utils::Empty, ty.void_(), std::move(stmts), std::move(attributes));
+ return Func(func_name, tint::Empty, ty.void_(), std::move(stmts), std::move(attributes));
}
const ast::Function* InspectorBuilder::MakeComparisonSamplerReferenceBodyFunction(
@@ -236,16 +235,16 @@
const std::string& coords_name,
const std::string& depth_name,
ast::Type base_type,
- utils::VectorRef<const ast::Attribute*> attributes) {
+ VectorRef<const ast::Attribute*> attributes) {
std::string result_name = "sampler_result";
- utils::Vector stmts{
+ Vector stmts{
Decl(Var("sampler_result", base_type)),
Assign("sampler_result",
Call("textureSampleCompare", texture_name, sampler_name, coords_name, depth_name)),
Return(),
};
- return Func(func_name, utils::Empty, ty.void_(), std::move(stmts), std::move(attributes));
+ return Func(func_name, tint::Empty, ty.void_(), std::move(stmts), std::move(attributes));
}
ast::Type InspectorBuilder::GetBaseType(ResourceBinding::SampledKind sampled_kind) {
@@ -274,7 +273,7 @@
return ty.vec3(scalar);
default:
[=] {
- utils::StringStream str;
+ StringStream str;
str << dim;
FAIL() << "Unsupported texture dimension: " << str.str();
}();
@@ -298,14 +297,14 @@
const std::string& func_name,
const std::string& st_name,
ast::Type dim_type,
- utils::VectorRef<const ast::Attribute*> attributes) {
- utils::Vector stmts{
+ VectorRef<const ast::Attribute*> attributes) {
+ Vector stmts{
Decl(Var("dim", dim_type)),
Assign("dim", Call("textureDimensions", st_name)),
Return(),
};
- return Func(func_name, utils::Empty, ty.void_(), std::move(stmts), std::move(attributes));
+ return Func(func_name, tint::Empty, ty.void_(), std::move(stmts), std::move(attributes));
}
std::function<ast::Type()> InspectorBuilder::GetTypeFunction(ComponentType component,
diff --git a/src/tint/lang/wgsl/inspector/test_inspector_builder.h b/src/tint/lang/wgsl/inspector/test_inspector_builder.h
index c2f22e4..83dcc5d 100644
--- a/src/tint/lang/wgsl/inspector/test_inspector_builder.h
+++ b/src/tint/lang/wgsl/inspector/test_inspector_builder.h
@@ -45,16 +45,15 @@
/// Generates an empty function
/// @param name name of the function created
/// @param attributes the function attributes
- void MakeEmptyBodyFunction(std::string name,
- utils::VectorRef<const ast::Attribute*> attributes);
+ void MakeEmptyBodyFunction(std::string name, VectorRef<const ast::Attribute*> attributes);
/// Generates a function that calls other functions
/// @param caller name of the function created
/// @param callees names of the functions to be called
/// @param attributes the function attributes
void MakeCallerBodyFunction(std::string caller,
- utils::VectorRef<std::string> callees,
- utils::VectorRef<const ast::Attribute*> attributes);
+ VectorRef<std::string> callees,
+ VectorRef<const ast::Attribute*> attributes);
/// InOutInfo is a tuple of name and location for a structure member
using InOutInfo = std::tuple<std::string, uint32_t>;
@@ -63,13 +62,13 @@
/// @param name the name of the generated struct
/// @param inout_vars tuples of {name, loc} that will be the struct members
/// @returns a structure object
- const ast::Struct* MakeInOutStruct(std::string name, utils::VectorRef<InOutInfo> inout_vars);
+ const ast::Struct* MakeInOutStruct(std::string name, VectorRef<InOutInfo> inout_vars);
// TODO(crbug.com/tint/697): Remove this.
/// Add In/Out variables to the global variables
/// @param inout_vars tuples of {in, out} that will be added as entries to the
/// global variables
- void AddInOutVariables(utils::VectorRef<std::tuple<std::string, std::string>> inout_vars);
+ void AddInOutVariables(VectorRef<std::tuple<std::string, std::string>> inout_vars);
// TODO(crbug.com/tint/697): Remove this.
/// Generates a function that references in/out variables
@@ -77,10 +76,9 @@
/// @param inout_vars tuples of {in, out} that will be converted into out = in
/// calls in the function body
/// @param attributes the function attributes
- void MakeInOutVariableBodyFunction(
- std::string name,
- utils::VectorRef<std::tuple<std::string, std::string>> inout_vars,
- utils::VectorRef<const ast::Attribute*> attributes);
+ void MakeInOutVariableBodyFunction(std::string name,
+ VectorRef<std::tuple<std::string, std::string>> inout_vars,
+ VectorRef<const ast::Attribute*> attributes);
// TODO(crbug.com/tint/697): Remove this.
/// Generates a function that references in/out variables and calls another
@@ -94,8 +92,8 @@
const ast::Function* MakeInOutVariableCallerBodyFunction(
std::string caller,
std::string callee,
- utils::VectorRef<std::tuple<std::string, std::string>> inout_vars,
- utils::VectorRef<const ast::Attribute*> attributes);
+ VectorRef<std::tuple<std::string, std::string>> inout_vars,
+ VectorRef<const ast::Attribute*> attributes);
/// Generates a function that references module-scoped, plain-typed constant
/// or variable.
@@ -108,12 +106,12 @@
std::string func,
std::string var,
ast::Type type,
- utils::VectorRef<const ast::Attribute*> attributes);
+ VectorRef<const ast::Attribute*> attributes);
/// @param vec Vector of StageVariable to be searched
/// @param name Name to be searching for
/// @returns true if name is in vec, otherwise false
- bool ContainsName(utils::VectorRef<StageVariable> vec, const std::string& name);
+ bool ContainsName(VectorRef<StageVariable> vec, const std::string& name);
/// Builds a string for accessing a member in a generated struct
/// @param idx index of member
@@ -125,16 +123,14 @@
/// @param name name for the type
/// @param member_types a vector of member types
/// @returns a struct type
- const ast::Struct* MakeStructType(const std::string& name,
- utils::VectorRef<ast::Type> member_types);
+ const ast::Struct* MakeStructType(const std::string& name, VectorRef<ast::Type> member_types);
/// Generates a struct type from a list of member nodes.
/// @param name name for the struct type
/// @param members a vector of members
/// @returns a struct type
- const ast::Struct* MakeStructTypeFromMembers(
- const std::string& name,
- utils::VectorRef<const ast::StructMember*> members);
+ const ast::Struct* MakeStructTypeFromMembers(const std::string& name,
+ VectorRef<const ast::StructMember*> members);
/// Generates a struct member with a specified index and type.
/// @param index index of the field within the struct
@@ -143,21 +139,21 @@
/// @returns a struct member
const ast::StructMember* MakeStructMember(size_t index,
ast::Type type,
- utils::VectorRef<const ast::Attribute*> attributes);
+ VectorRef<const ast::Attribute*> attributes);
/// Generates types appropriate for using in an uniform buffer
/// @param name name for the type
/// @param member_types a vector of member types
/// @returns a struct type that has the layout for an uniform buffer.
const ast::Struct* MakeUniformBufferType(const std::string& name,
- utils::VectorRef<ast::Type> member_types);
+ VectorRef<ast::Type> member_types);
/// Generates types appropriate for using in a storage buffer
/// @param name name for the type
/// @param member_types a vector of member types
/// @returns a function that returns the created structure.
std::function<ast::Type()> MakeStorageBufferTypes(const std::string& name,
- utils::VectorRef<ast::Type> member_types);
+ VectorRef<ast::Type> member_types);
/// Adds an uniform buffer variable to the program
/// @param name the name of the variable
@@ -195,7 +191,7 @@
/// @param members list of members to access, by index and type
void MakeStructVariableReferenceBodyFunction(std::string func_name,
std::string struct_name,
- utils::VectorRef<MemberInfo> members);
+ VectorRef<MemberInfo> members);
/// Adds a regular sampler variable to the program
/// @param name the name of the variable
@@ -235,7 +231,7 @@
const std::string& sampler_name,
const std::string& coords_name,
ast::Type base_type,
- utils::VectorRef<const ast::Attribute*> attributes);
+ VectorRef<const ast::Attribute*> attributes);
/// Generates a function that references a specific sampler variable
/// @param func_name name of the function created
@@ -253,7 +249,7 @@
const std::string& coords_name,
const std::string& array_index,
ast::Type base_type,
- utils::VectorRef<const ast::Attribute*> attributes);
+ VectorRef<const ast::Attribute*> attributes);
/// Generates a function that references a specific comparison sampler
/// variable.
@@ -272,7 +268,7 @@
const std::string& coords_name,
const std::string& depth_name,
ast::Type base_type,
- utils::VectorRef<const ast::Attribute*> attributes);
+ VectorRef<const ast::Attribute*> attributes);
/// Gets an appropriate type for the data in a given texture type.
/// @param sampled_kind type of in the texture
@@ -312,7 +308,7 @@
const std::string& func_name,
const std::string& st_name,
ast::Type dim_type,
- utils::VectorRef<const ast::Attribute*> attributes);
+ VectorRef<const ast::Attribute*> attributes);
/// Get a generator function that returns a type appropriate for a stage
/// variable with the given combination of component and composition type.
diff --git a/src/tint/lang/wgsl/ir_roundtrip_test.cc b/src/tint/lang/wgsl/ir_roundtrip_test.cc
index b38c10f..9a03b3a 100644
--- a/src/tint/lang/wgsl/ir_roundtrip_test.cc
+++ b/src/tint/lang/wgsl/ir_roundtrip_test.cc
@@ -31,7 +31,7 @@
class IRToProgramRoundtripTest : public helpers::IRProgramTest {
public:
void Test(std::string_view input_wgsl, std::string_view expected_wgsl) {
- auto input = utils::TrimSpace(input_wgsl);
+ auto input = tint::TrimSpace(input_wgsl);
Source::File file("test.wgsl", std::string(input));
auto input_program = wgsl::reader::Parse(&file);
ASSERT_TRUE(input_program.IsValid()) << input_program.Diagnostics().str();
@@ -56,8 +56,8 @@
auto output = wgsl::writer::Generate(&output_program, {});
ASSERT_TRUE(output.success) << output.error;
- auto expected = expected_wgsl.empty() ? input : utils::TrimSpace(expected_wgsl);
- auto got = utils::TrimSpace(output.wgsl);
+ auto expected = expected_wgsl.empty() ? input : tint::TrimSpace(expected_wgsl);
+ auto got = tint::TrimSpace(output.wgsl);
EXPECT_EQ(expected, got) << "IR:" << std::endl << disassembly;
}
diff --git a/src/tint/lang/wgsl/program/program.h b/src/tint/lang/wgsl/program/program.h
index 1067cea..6ae49fc 100644
--- a/src/tint/lang/wgsl/program/program.h
+++ b/src/tint/lang/wgsl/program/program.h
@@ -39,10 +39,10 @@
class Program {
public:
/// ASTNodeAllocator is an alias to BlockAllocator<ast::Node>
- using ASTNodeAllocator = utils::BlockAllocator<ast::Node>;
+ using ASTNodeAllocator = BlockAllocator<ast::Node>;
/// SemNodeAllocator is an alias to BlockAllocator<sem::Node>
- using SemNodeAllocator = utils::BlockAllocator<sem::Node>;
+ using SemNodeAllocator = BlockAllocator<sem::Node>;
/// Constructor
Program();
diff --git a/src/tint/lang/wgsl/program/program_builder.cc b/src/tint/lang/wgsl/program/program_builder.cc
index 86d13d9..9059f34 100644
--- a/src/tint/lang/wgsl/program/program_builder.cc
+++ b/src/tint/lang/wgsl/program/program_builder.cc
@@ -128,9 +128,9 @@
return stmt;
}
-const ast::Function* ProgramBuilder::WrapInFunction(utils::VectorRef<const ast::Statement*> stmts) {
+const ast::Function* ProgramBuilder::WrapInFunction(VectorRef<const ast::Statement*> stmts) {
return Func("test_function", {}, ty.void_(), std::move(stmts),
- utils::Vector{
+ Vector{
create<ast::StageAttribute>(ast::PipelineStage::kCompute),
WorkgroupSize(1_i, 1_i, 1_i),
});
diff --git a/src/tint/lang/wgsl/program/program_builder.h b/src/tint/lang/wgsl/program/program_builder.h
index c70ddbc..fde203e 100644
--- a/src/tint/lang/wgsl/program/program_builder.h
+++ b/src/tint/lang/wgsl/program/program_builder.h
@@ -144,53 +144,53 @@
/// Evaluates to true if T can be converted to an identifier.
template <typename T>
- static constexpr const bool IsIdentifierLike = std::is_same_v<T, Symbol> || // Symbol
- std::is_enum_v<T> || // Enum
- utils::traits::IsStringLike<T>; // String
+ static constexpr const bool IsIdentifierLike = std::is_same_v<T, Symbol> || // Symbol
+ std::is_enum_v<T> || // Enum
+ tint::traits::IsStringLike<T>; // String
/// A helper used to disable overloads if the first type in `TYPES` is a Source. Used to avoid
/// ambiguities in overloads that take a Source as the first parameter and those that
/// perfectly-forward the first argument.
template <typename... TYPES>
- using DisableIfSource = utils::traits::EnableIf<
- !IsSource<utils::traits::Decay<utils::traits::NthTypeOf<0, TYPES..., void>>>>;
+ using DisableIfSource = tint::traits::EnableIf<
+ !IsSource<tint::traits::Decay<tint::traits::NthTypeOf<0, TYPES..., void>>>>;
/// A helper used to disable overloads if the first type in `TYPES` is a scalar type. Used to
/// avoid ambiguities in overloads that take a scalar as the first parameter and those that
/// perfectly-forward the first argument.
template <typename... TYPES>
- using DisableIfScalar = utils::traits::EnableIf<
- !IsScalar<utils::traits::Decay<utils::traits::NthTypeOf<0, TYPES..., void>>>>;
+ using DisableIfScalar = tint::traits::EnableIf<
+ !IsScalar<tint::traits::Decay<tint::traits::NthTypeOf<0, TYPES..., void>>>>;
/// A helper used to enable overloads if the first type in `TYPES` is a scalar type. Used to
/// avoid ambiguities in overloads that take a scalar as the first parameter and those that
/// perfectly-forward the first argument.
template <typename... TYPES>
- using EnableIfScalar = utils::traits::EnableIf<
- IsScalar<utils::traits::Decay<utils::traits::NthTypeOf<0, TYPES..., void>>>>;
+ using EnableIfScalar = tint::traits::EnableIf<
+ IsScalar<tint::traits::Decay<tint::traits::NthTypeOf<0, TYPES..., void>>>>;
- /// A helper used to disable overloads if the first type in `TYPES` is a utils::Vector or
- /// utils::VectorRef.
+ /// A helper used to disable overloads if the first type in `TYPES` is a Vector or
+ /// VectorRef.
template <typename... TYPES>
- using DisableIfVectorLike = utils::traits::EnableIf<
- !utils::IsVectorLike<utils::traits::Decay<utils::traits::NthTypeOf<0, TYPES..., void>>>>;
+ using DisableIfVectorLike = tint::traits::EnableIf<
+ !tint::IsVectorLike<tint::traits::Decay<tint::traits::NthTypeOf<0, TYPES..., void>>>>;
/// A helper used to enable overloads if the first type in `TYPES` is identifier-like.
template <typename... TYPES>
- using EnableIfIdentifierLike = utils::traits::EnableIf<
- IsIdentifierLike<utils::traits::Decay<utils::traits::NthTypeOf<0, TYPES..., void>>>>;
+ using EnableIfIdentifierLike = tint::traits::EnableIf<
+ IsIdentifierLike<tint::traits::Decay<tint::traits::NthTypeOf<0, TYPES..., void>>>>;
/// A helper used to disable overloads if the first type in `TYPES` is Infer or an abstract
/// numeric.
template <typename... TYPES>
- using DisableIfInferOrAbstract = utils::traits::EnableIf<
- !IsInferOrAbstract<utils::traits::Decay<utils::traits::NthTypeOf<0, TYPES..., void>>>>;
+ using DisableIfInferOrAbstract = tint::traits::EnableIf<
+ !IsInferOrAbstract<tint::traits::Decay<tint::traits::NthTypeOf<0, TYPES..., void>>>>;
/// A helper used to enable overloads if the first type in `TYPES` is Infer or an abstract
/// numeric.
template <typename... TYPES>
- using EnableIfInferOrAbstract = utils::traits::EnableIf<
- IsInferOrAbstract<utils::traits::Decay<utils::traits::NthTypeOf<0, TYPES..., void>>>>;
+ using EnableIfInferOrAbstract = tint::traits::EnableIf<
+ IsInferOrAbstract<tint::traits::Decay<tint::traits::NthTypeOf<0, TYPES..., void>>>>;
/// VarOptions is a helper for accepting an arbitrary number of order independent options for
/// constructing an ast::Var.
@@ -205,7 +205,7 @@
const ast::Expression* address_space = nullptr;
const ast::Expression* access = nullptr;
const ast::Expression* initializer = nullptr;
- utils::Vector<const ast::Attribute*, 4> attributes;
+ Vector<const ast::Attribute*, 4> attributes;
private:
void Set(ProgramBuilder&, ast::Type t) { type = t; }
@@ -220,9 +220,7 @@
}
}
void Set(ProgramBuilder&, const ast::Expression* c) { initializer = c; }
- void Set(ProgramBuilder&, utils::VectorRef<const ast::Attribute*> l) {
- attributes = std::move(l);
- }
+ void Set(ProgramBuilder&, VectorRef<const ast::Attribute*> l) { attributes = std::move(l); }
void Set(ProgramBuilder&, const ast::Attribute* a) { attributes.Push(a); }
};
@@ -232,7 +230,7 @@
template <typename... ARGS>
explicit LetOptions(ARGS&&... args) {
static constexpr bool has_init =
- (utils::traits::IsTypeOrDerived<utils::traits::PtrElTy<ARGS>, ast::Expression> ||
+ (tint::traits::IsTypeOrDerived<tint::traits::PtrElTy<ARGS>, ast::Expression> ||
...);
static_assert(has_init, "Let() must be constructed with an initializer expression");
(Set(std::forward<ARGS>(args)), ...);
@@ -241,12 +239,12 @@
ast::Type type;
const ast::Expression* initializer = nullptr;
- utils::Vector<const ast::Attribute*, 4> attributes;
+ Vector<const ast::Attribute*, 4> attributes;
private:
void Set(ast::Type t) { type = t; }
void Set(const ast::Expression* c) { initializer = c; }
- void Set(utils::VectorRef<const ast::Attribute*> l) { attributes = std::move(l); }
+ void Set(VectorRef<const ast::Attribute*> l) { attributes = std::move(l); }
void Set(const ast::Attribute* a) { attributes.Push(a); }
};
@@ -256,7 +254,7 @@
template <typename... ARGS>
explicit ConstOptions(ARGS&&... args) {
static constexpr bool has_init =
- (utils::traits::IsTypeOrDerived<utils::traits::PtrElTy<ARGS>, ast::Expression> ||
+ (tint::traits::IsTypeOrDerived<tint::traits::PtrElTy<ARGS>, ast::Expression> ||
...);
static_assert(has_init, "Const() must be constructed with an initializer expression");
(Set(std::forward<ARGS>(args)), ...);
@@ -265,12 +263,12 @@
ast::Type type;
const ast::Expression* initializer = nullptr;
- utils::Vector<const ast::Attribute*, 4> attributes;
+ Vector<const ast::Attribute*, 4> attributes;
private:
void Set(ast::Type t) { type = t; }
void Set(const ast::Expression* c) { initializer = c; }
- void Set(utils::VectorRef<const ast::Attribute*> l) { attributes = std::move(l); }
+ void Set(VectorRef<const ast::Attribute*> l) { attributes = std::move(l); }
void Set(const ast::Attribute* a) { attributes.Push(a); }
};
@@ -285,21 +283,21 @@
ast::Type type;
const ast::Expression* initializer = nullptr;
- utils::Vector<const ast::Attribute*, 4> attributes;
+ Vector<const ast::Attribute*, 4> attributes;
private:
void Set(ast::Type t) { type = t; }
void Set(const ast::Expression* c) { initializer = c; }
- void Set(utils::VectorRef<const ast::Attribute*> l) { attributes = std::move(l); }
+ void Set(VectorRef<const ast::Attribute*> l) { attributes = std::move(l); }
void Set(const ast::Attribute* a) { attributes.Push(a); }
};
public:
/// ASTNodeAllocator is an alias to BlockAllocator<ast::Node>
- using ASTNodeAllocator = utils::BlockAllocator<ast::Node>;
+ using ASTNodeAllocator = BlockAllocator<ast::Node>;
/// SemNodeAllocator is an alias to BlockAllocator<sem::Node>
- using SemNodeAllocator = utils::BlockAllocator<sem::Node>;
+ using SemNodeAllocator = BlockAllocator<sem::Node>;
/// Constructor
ProgramBuilder();
@@ -443,7 +441,7 @@
/// @param args the arguments to pass to the constructor
/// @returns the node pointer
template <typename T, typename... ARGS>
- utils::traits::EnableIfIsType<T, ast::Node>* create(const Source& source, ARGS&&... args) {
+ tint::traits::EnableIfIsType<T, ast::Node>* create(const Source& source, ARGS&&... args) {
AssertNotMoved();
return ast_nodes_.Create<T>(id_, AllocateNodeID(), source, std::forward<ARGS>(args)...);
}
@@ -455,7 +453,7 @@
/// destructed.
/// @returns the node pointer
template <typename T>
- utils::traits::EnableIfIsType<T, ast::Node>* create() {
+ tint::traits::EnableIfIsType<T, ast::Node>* create() {
AssertNotMoved();
return ast_nodes_.Create<T>(id_, AllocateNodeID(), source_);
}
@@ -469,10 +467,10 @@
/// @param args the remaining arguments to pass to the constructor
/// @returns the node pointer
template <typename T, typename ARG0, typename... ARGS>
- utils::traits::EnableIf</* T is ast::Node and ARG0 is not Source */
- utils::traits::IsTypeOrDerived<T, ast::Node> &&
- !utils::traits::IsTypeOrDerived<ARG0, Source>,
- T>*
+ tint::traits::EnableIf</* T is ast::Node and ARG0 is not Source */
+ tint::traits::IsTypeOrDerived<T, ast::Node> &&
+ !tint::traits::IsTypeOrDerived<ARG0, Source>,
+ T>*
create(ARG0&& arg0, ARGS&&... args) {
AssertNotMoved();
return ast_nodes_.Create<T>(id_, AllocateNodeID(), source_, std::forward<ARG0>(arg0),
@@ -484,9 +482,9 @@
/// @param args the arguments to pass to the constructor
/// @returns the node pointer
template <typename T, typename... ARGS>
- utils::traits::EnableIf<utils::traits::IsTypeOrDerived<T, sem::Node> &&
- !utils::traits::IsTypeOrDerived<T, type::Node>,
- T>*
+ tint::traits::EnableIf<tint::traits::IsTypeOrDerived<T, sem::Node> &&
+ !tint::traits::IsTypeOrDerived<T, type::Node>,
+ T>*
create(ARGS&&... args) {
AssertNotMoved();
return sem_nodes_.Create<T>(std::forward<ARGS>(args)...);
@@ -499,7 +497,7 @@
/// @param args the arguments to pass to the constructor
/// @returns the new, or existing node
template <typename T, typename... ARGS>
- utils::traits::EnableIfIsType<T, type::Node>* create(ARGS&&... args) {
+ tint::traits::EnableIfIsType<T, type::Node>* create(ARGS&&... args) {
AssertNotMoved();
return constants.types.Get<T>(std::forward<ARGS>(args)...);
}
@@ -538,8 +536,8 @@
typename = DisableIfSource<NAME>,
typename = std::enable_if_t<!std::is_same_v<std::decay_t<NAME>, ast::Type>>>
ast::Type operator()(NAME&& name, ARGS&&... args) const {
- if constexpr (utils::traits::IsTypeOrDerived<utils::traits::PtrElTy<NAME>,
- ast::Expression>) {
+ if constexpr (tint::traits::IsTypeOrDerived<tint::traits::PtrElTy<NAME>,
+ ast::Expression>) {
static_assert(sizeof...(ARGS) == 0);
return {name};
} else {
@@ -1002,7 +1000,7 @@
/// @param attrs the optional attributes for the array
/// @return an array of type `T`
ast::Type array(ast::Type subtype,
- utils::VectorRef<const ast::Attribute*> attrs = utils::Empty) const {
+ VectorRef<const ast::Attribute*> attrs = tint::Empty) const {
return array(builder->source_, subtype, std::move(attrs));
}
@@ -1012,10 +1010,10 @@
/// @return an array of type `T`
ast::Type array(const Source& source,
ast::Type subtype,
- utils::VectorRef<const ast::Attribute*> attrs = utils::Empty) const {
+ VectorRef<const ast::Attribute*> attrs = tint::Empty) const {
return ast::Type{builder->Expr(
builder->create<ast::TemplatedIdentifier>(source, builder->Sym("array"),
- utils::Vector{
+ Vector{
subtype.expr,
},
std::move(attrs)))};
@@ -1028,7 +1026,7 @@
template <typename COUNT, typename = DisableIfVectorLike<COUNT>>
ast::Type array(ast::Type subtype,
COUNT&& n,
- utils::VectorRef<const ast::Attribute*> attrs = utils::Empty) const {
+ VectorRef<const ast::Attribute*> attrs = tint::Empty) const {
return array(builder->source_, subtype, std::forward<COUNT>(n), std::move(attrs));
}
@@ -1041,10 +1039,10 @@
ast::Type array(const Source& source,
ast::Type subtype,
COUNT&& n,
- utils::VectorRef<const ast::Attribute*> attrs = utils::Empty) const {
+ VectorRef<const ast::Attribute*> attrs = tint::Empty) const {
return ast::Type{builder->Expr(
builder->create<ast::TemplatedIdentifier>(source, builder->Sym("array"),
- utils::Vector{
+ Vector{
subtype.expr,
builder->Expr(std::forward<COUNT>(n)),
},
@@ -1071,18 +1069,18 @@
/// @return a inferred-size or runtime-sized array of type `T`
template <typename T, int N = 0, typename = DisableIfInferOrAbstract<T>>
ast::Type array(const Source& source,
- utils::VectorRef<const ast::Attribute*> attrs = utils::Empty) const {
+ VectorRef<const ast::Attribute*> attrs = tint::Empty) const {
if constexpr (N == 0) {
- return ast::Type{builder->Expr(builder->create<ast::TemplatedIdentifier>(
- source, builder->Sym("array"),
- utils::Vector<const ast::Expression*, 1>{
- Of<T>().expr,
- },
- std::move(attrs)))};
+ return ast::Type{builder->Expr(
+ builder->create<ast::TemplatedIdentifier>(source, builder->Sym("array"),
+ Vector<const ast::Expression*, 1>{
+ Of<T>().expr,
+ },
+ std::move(attrs)))};
} else {
return ast::Type{builder->Expr(builder->create<ast::TemplatedIdentifier>(
source, builder->Sym("array"),
- utils::Vector{
+ Vector{
Of<T>().expr,
builder->Expr(builder->source_, tint::u32(N)),
},
@@ -1093,7 +1091,7 @@
/// @param attrs the optional attributes for the array
/// @return an array of size `N` of type `T`
template <typename T, int N = 0, typename = DisableIfInferOrAbstract<T>>
- ast::Type array(utils::VectorRef<const ast::Attribute*> attrs = utils::Empty) const {
+ ast::Type array(VectorRef<const ast::Attribute*> attrs = tint::Empty) const {
return array<T, N>(builder->source_, std::move(attrs));
}
@@ -1426,7 +1424,7 @@
/// @return a Symbol with the given enum value
template <typename ENUM, typename = std::enable_if_t<std::is_enum_v<std::decay_t<ENUM>>>>
Symbol Sym(ENUM&& enumerator) {
- return Sym(utils::ToString(enumerator));
+ return Sym(tint::ToString(enumerator));
}
/// @return nullptr
@@ -1436,8 +1434,8 @@
/// @return an ast::Identifier with the given symbol
template <typename IDENTIFIER>
const ast::Identifier* Ident(IDENTIFIER&& identifier) {
- if constexpr (utils::traits::IsTypeOrDerived<utils::traits::PtrElTy<IDENTIFIER>,
- ast::Identifier>) {
+ if constexpr (tint::traits::IsTypeOrDerived<tint::traits::PtrElTy<IDENTIFIER>,
+ ast::Identifier>) {
return identifier; // Passthrough
} else {
return Ident(source_, std::forward<IDENTIFIER>(identifier));
@@ -1471,12 +1469,12 @@
return create<ast::Identifier>(source, Sym(std::forward<IDENTIFIER>(identifier)));
}
return create<ast::TemplatedIdentifier>(source, Sym(std::forward<IDENTIFIER>(identifier)),
- std::move(arg_exprs), utils::Empty);
+ std::move(arg_exprs), tint::Empty);
}
/// @param expr the expression
/// @return expr (passthrough)
- template <typename T, typename = utils::traits::EnableIfIsType<T, ast::Expression>>
+ template <typename T, typename = tint::traits::EnableIfIsType<T, ast::Expression>>
const T* Expr(const T* expr) {
return expr;
}
@@ -1595,7 +1593,7 @@
/// @param list the list to append too
/// @param arg the arg to create
template <size_t N, typename ARG>
- void Append(utils::Vector<const ast::Expression*, N>& list, ARG&& arg) {
+ void Append(Vector<const ast::Expression*, N>& list, ARG&& arg) {
list.Push(Expr(std::forward<ARG>(arg)));
}
@@ -1605,33 +1603,32 @@
/// @param arg0 the first argument
/// @param args the rest of the arguments
template <size_t N, typename ARG0, typename... ARGS>
- void Append(utils::Vector<const ast::Expression*, N>& list, ARG0&& arg0, ARGS&&... args) {
+ void Append(Vector<const ast::Expression*, N>& list, ARG0&& arg0, ARGS&&... args) {
Append(list, std::forward<ARG0>(arg0));
Append(list, std::forward<ARGS>(args)...);
}
- /// @return utils::EmptyType
- utils::EmptyType ExprList() { return utils::Empty; }
+ /// @return tint::EmptyType
+ tint::EmptyType ExprList() { return tint::Empty; }
/// @param args the list of expressions
/// @return the list of expressions converted to `ast::Expression`s using
/// `Expr()`,
template <typename... ARGS, typename = DisableIfVectorLike<ARGS...>>
auto ExprList(ARGS&&... args) {
- return utils::Vector<const ast::Expression*, sizeof...(ARGS)>{Expr(args)...};
+ return Vector<const ast::Expression*, sizeof...(ARGS)>{Expr(args)...};
}
/// @param list the list of expressions
/// @return `list`
template <typename T, size_t N>
- utils::Vector<T, N> ExprList(utils::Vector<T, N>&& list) {
+ Vector<T, N> ExprList(Vector<T, N>&& list) {
return std::move(list);
}
/// @param list the list of expressions
/// @return `list`
- utils::VectorRef<const ast::Expression*> ExprList(
- utils::VectorRef<const ast::Expression*> list) {
+ VectorRef<const ast::Expression*> ExprList(VectorRef<const ast::Expression*> list) {
return list;
}
@@ -1691,7 +1688,7 @@
/// @return an `ast::Enable` enabling the given extension.
const ast::Enable* Enable(builtin::Extension extension) {
auto* ext = create<ast::Extension>(extension);
- auto* enable = create<ast::Enable>(utils::Vector{ext});
+ auto* enable = create<ast::Enable>(Vector{ext});
AST().AddEnable(enable);
return enable;
}
@@ -1702,7 +1699,7 @@
/// @return an `ast::Enable` enabling the given extension.
const ast::Enable* Enable(const Source& source, builtin::Extension extension) {
auto* ext = create<ast::Extension>(source, extension);
- auto* enable = create<ast::Enable>(source, utils::Vector{ext});
+ auto* enable = create<ast::Enable>(source, Vector{ext});
AST().AddEnable(enable);
return enable;
}
@@ -1808,7 +1805,7 @@
template <typename NAME>
const ast::Parameter* Param(NAME&& name,
ast::Type type,
- utils::VectorRef<const ast::Attribute*> attributes = utils::Empty) {
+ VectorRef<const ast::Attribute*> attributes = tint::Empty) {
return Param(source_, std::forward<NAME>(name), type, std::move(attributes));
}
@@ -1821,7 +1818,7 @@
const ast::Parameter* Param(const Source& source,
NAME&& name,
ast::Type type,
- utils::VectorRef<const ast::Attribute*> attributes = utils::Empty) {
+ VectorRef<const ast::Attribute*> attributes = tint::Empty) {
return create<ast::Parameter>(source, Ident(std::forward<NAME>(name)), type,
std::move(attributes));
}
@@ -2374,7 +2371,7 @@
OBJECT&& object,
MEMBER&& member) {
static_assert(
- !utils::traits::IsType<utils::traits::PtrElTy<MEMBER>, ast::TemplatedIdentifier>,
+ !tint::traits::IsType<tint::traits::PtrElTy<MEMBER>, ast::TemplatedIdentifier>,
"it is currently invalid for a structure to hold a templated member");
return create<ast::MemberAccessorExpression>(source, Expr(std::forward<OBJECT>(object)),
Ident(std::forward<MEMBER>(member)));
@@ -2489,14 +2486,14 @@
/// @param attributes the optional function attributes
/// @param return_type_attributes the optional function return type attributes
/// @returns the function pointer
- template <typename NAME, typename BODY = utils::VectorRef<const ast::Statement*>>
+ template <typename NAME, typename BODY = VectorRef<const ast::Statement*>>
const ast::Function* Func(
NAME&& name,
- utils::VectorRef<const ast::Parameter*> params,
+ VectorRef<const ast::Parameter*> params,
ast::Type type,
BODY&& body,
- utils::VectorRef<const ast::Attribute*> attributes = utils::Empty,
- utils::VectorRef<const ast::Attribute*> return_type_attributes = utils::Empty) {
+ VectorRef<const ast::Attribute*> attributes = tint::Empty,
+ VectorRef<const ast::Attribute*> return_type_attributes = tint::Empty) {
return Func(source_, std::forward<NAME>(name), std::move(params), type,
std::forward<BODY>(body), std::move(attributes),
std::move(return_type_attributes));
@@ -2512,18 +2509,18 @@
/// @param attributes the optional function attributes
/// @param return_type_attributes the optional function return type attributes
/// @returns the function pointer
- template <typename NAME, typename BODY = utils::VectorRef<const ast::Statement*>>
+ template <typename NAME, typename BODY = VectorRef<const ast::Statement*>>
const ast::Function* Func(
const Source& source,
NAME&& name,
- utils::VectorRef<const ast::Parameter*> params,
+ VectorRef<const ast::Parameter*> params,
ast::Type type,
BODY&& body,
- utils::VectorRef<const ast::Attribute*> attributes = utils::Empty,
- utils::VectorRef<const ast::Attribute*> return_type_attributes = utils::Empty) {
+ VectorRef<const ast::Attribute*> attributes = tint::Empty,
+ VectorRef<const ast::Attribute*> return_type_attributes = tint::Empty) {
const ast::BlockStatement* block = nullptr;
- using BODY_T = utils::traits::PtrElTy<BODY>;
- if constexpr (utils::traits::IsTypeOrDerived<BODY_T, ast::BlockStatement> ||
+ using BODY_T = tint::traits::PtrElTy<BODY>;
+ if constexpr (tint::traits::IsTypeOrDerived<BODY_T, ast::BlockStatement> ||
std::is_same_v<BODY_T, std::nullptr_t>) {
block = body;
} else {
@@ -2641,10 +2638,9 @@
/// @param attributes the optional struct attributes
/// @returns the struct type
template <typename NAME>
- const ast::Struct* Structure(
- NAME&& name,
- utils::VectorRef<const ast::StructMember*> members,
- utils::VectorRef<const ast::Attribute*> attributes = utils::Empty) {
+ const ast::Struct* Structure(NAME&& name,
+ VectorRef<const ast::StructMember*> members,
+ VectorRef<const ast::Attribute*> attributes = tint::Empty) {
return Structure(source_, std::forward<NAME>(name), std::move(members),
std::move(attributes));
}
@@ -2656,11 +2652,10 @@
/// @param attributes the optional struct attributes
/// @returns the struct type
template <typename NAME>
- const ast::Struct* Structure(
- const Source& source,
- NAME&& name,
- utils::VectorRef<const ast::StructMember*> members,
- utils::VectorRef<const ast::Attribute*> attributes = utils::Empty) {
+ const ast::Struct* Structure(const Source& source,
+ NAME&& name,
+ VectorRef<const ast::StructMember*> members,
+ VectorRef<const ast::Attribute*> attributes = tint::Empty) {
auto* type = create<ast::Struct>(source, Ident(std::forward<NAME>(name)),
std::move(members), std::move(attributes));
AST().AddTypeDecl(type);
@@ -2673,10 +2668,9 @@
/// @param attributes the optional struct member attributes
/// @returns the struct member pointer
template <typename NAME, typename = DisableIfSource<NAME>>
- const ast::StructMember* Member(
- NAME&& name,
- ast::Type type,
- utils::VectorRef<const ast::Attribute*> attributes = utils::Empty) {
+ const ast::StructMember* Member(NAME&& name,
+ ast::Type type,
+ VectorRef<const ast::Attribute*> attributes = tint::Empty) {
return Member(source_, std::forward<NAME>(name), type, std::move(attributes));
}
@@ -2687,11 +2681,10 @@
/// @param attributes the optional struct member attributes
/// @returns the struct member pointer
template <typename NAME>
- const ast::StructMember* Member(
- const Source& source,
- NAME&& name,
- ast::Type type,
- utils::VectorRef<const ast::Attribute*> attributes = utils::Empty) {
+ const ast::StructMember* Member(const Source& source,
+ NAME&& name,
+ ast::Type type,
+ VectorRef<const ast::Attribute*> attributes = tint::Empty) {
return create<ast::StructMember>(source, Ident(std::forward<NAME>(name)), type,
std::move(attributes));
}
@@ -2704,7 +2697,7 @@
template <typename NAME>
const ast::StructMember* Member(uint32_t offset, NAME&& name, ast::Type type) {
return create<ast::StructMember>(source_, Ident(std::forward<NAME>(name)), type,
- utils::Vector<const ast::Attribute*, 1>{
+ Vector<const ast::Attribute*, 1>{
MemberOffset(AInt(offset)),
});
}
@@ -2713,9 +2706,8 @@
/// @param statements the statements of the block
/// @param attributes the optional attributes of the block
/// @returns the block statement pointer
- const ast::BlockStatement* Block(
- utils::VectorRef<const ast::Statement*> statements,
- utils::VectorRef<const ast::Attribute*> attributes = utils::Empty) {
+ const ast::BlockStatement* Block(VectorRef<const ast::Statement*> statements,
+ VectorRef<const ast::Attribute*> attributes = tint::Empty) {
return Block(source_, std::move(statements), std::move(attributes));
}
@@ -2724,10 +2716,9 @@
/// @param statements the statements of the block
/// @param attributes the optional attributes of the block
/// @returns the block statement pointer
- const ast::BlockStatement* Block(
- const Source& source,
- utils::VectorRef<const ast::Statement*> statements,
- utils::VectorRef<const ast::Attribute*> attributes = utils::Empty) {
+ const ast::BlockStatement* Block(const Source& source,
+ VectorRef<const ast::Statement*> statements,
+ VectorRef<const ast::Attribute*> attributes = tint::Empty) {
return create<ast::BlockStatement>(source, std::move(statements), std::move(attributes));
}
@@ -2747,12 +2738,11 @@
/// @returns the block statement pointer
template <typename... STATEMENTS, typename = DisableIfVectorLike<STATEMENTS...>>
const ast::BlockStatement* Block(const Source& source, STATEMENTS&&... statements) {
- return create<ast::BlockStatement>(
- source,
- utils::Vector<const ast::Statement*, sizeof...(statements)>{
- std::forward<STATEMENTS>(statements)...,
- },
- utils::Empty);
+ return create<ast::BlockStatement>(source,
+ Vector<const ast::Statement*, sizeof...(statements)>{
+ std::forward<STATEMENTS>(statements)...,
+ },
+ tint::Empty);
}
/// A wrapper type for the Else statement used to create If statements.
@@ -2779,7 +2769,7 @@
CONDITION&& condition,
const ast::BlockStatement* body,
const ElseStmt else_stmt = ElseStmt(),
- utils::VectorRef<const ast::Attribute*> attributes = utils::Empty) {
+ VectorRef<const ast::Attribute*> attributes = tint::Empty) {
return create<ast::IfStatement>(source, Expr(std::forward<CONDITION>(condition)), body,
else_stmt.stmt, std::move(attributes));
}
@@ -2795,7 +2785,7 @@
const ast::IfStatement* If(CONDITION&& condition,
const ast::BlockStatement* body,
const ElseStmt else_stmt = ElseStmt(),
- utils::VectorRef<const ast::Attribute*> attributes = utils::Empty) {
+ VectorRef<const ast::Attribute*> attributes = tint::Empty) {
return create<ast::IfStatement>(Expr(std::forward<CONDITION>(condition)), body,
else_stmt.stmt, std::move(attributes));
}
@@ -2906,11 +2896,10 @@
/// @param continuing the optional continuing block
/// @param attributes optional attributes
/// @returns the loop statement pointer
- const ast::LoopStatement* Loop(
- const Source& source,
- const ast::BlockStatement* body,
- const ast::BlockStatement* continuing = nullptr,
- utils::VectorRef<const ast::Attribute*> attributes = utils::Empty) {
+ const ast::LoopStatement* Loop(const Source& source,
+ const ast::BlockStatement* body,
+ const ast::BlockStatement* continuing = nullptr,
+ VectorRef<const ast::Attribute*> attributes = tint::Empty) {
return create<ast::LoopStatement>(source, body, continuing, std::move(attributes));
}
@@ -2919,10 +2908,9 @@
/// @param continuing the optional continuing block
/// @param attributes optional attributes
/// @returns the loop statement pointer
- const ast::LoopStatement* Loop(
- const ast::BlockStatement* body,
- const ast::BlockStatement* continuing = nullptr,
- utils::VectorRef<const ast::Attribute*> attributes = utils::Empty) {
+ const ast::LoopStatement* Loop(const ast::BlockStatement* body,
+ const ast::BlockStatement* continuing = nullptr,
+ VectorRef<const ast::Attribute*> attributes = tint::Empty) {
return create<ast::LoopStatement>(body, continuing, std::move(attributes));
}
@@ -2936,13 +2924,12 @@
/// @param attributes optional attributes
/// @returns the for loop statement pointer
template <typename COND>
- const ast::ForLoopStatement* For(
- const Source& source,
- const ast::Statement* init,
- COND&& cond,
- const ast::Statement* cont,
- const ast::BlockStatement* body,
- utils::VectorRef<const ast::Attribute*> attributes = utils::Empty) {
+ const ast::ForLoopStatement* For(const Source& source,
+ const ast::Statement* init,
+ COND&& cond,
+ const ast::Statement* cont,
+ const ast::BlockStatement* body,
+ VectorRef<const ast::Attribute*> attributes = tint::Empty) {
return create<ast::ForLoopStatement>(source, init, Expr(std::forward<COND>(cond)), cont,
body, std::move(attributes));
}
@@ -2956,12 +2943,11 @@
/// @param attributes optional attributes
/// @returns the for loop statement pointer
template <typename COND>
- const ast::ForLoopStatement* For(
- const ast::Statement* init,
- COND&& cond,
- const ast::Statement* cont,
- const ast::BlockStatement* body,
- utils::VectorRef<const ast::Attribute*> attributes = utils::Empty) {
+ const ast::ForLoopStatement* For(const ast::Statement* init,
+ COND&& cond,
+ const ast::Statement* cont,
+ const ast::BlockStatement* body,
+ VectorRef<const ast::Attribute*> attributes = tint::Empty) {
return create<ast::ForLoopStatement>(init, Expr(std::forward<COND>(cond)), cont, body,
std::move(attributes));
}
@@ -2973,11 +2959,10 @@
/// @param attributes optional attributes
/// @returns the while statement pointer
template <typename COND>
- const ast::WhileStatement* While(
- const Source& source,
- COND&& cond,
- const ast::BlockStatement* body,
- utils::VectorRef<const ast::Attribute*> attributes = utils::Empty) {
+ const ast::WhileStatement* While(const Source& source,
+ COND&& cond,
+ const ast::BlockStatement* body,
+ VectorRef<const ast::Attribute*> attributes = tint::Empty) {
return create<ast::WhileStatement>(source, Expr(std::forward<COND>(cond)), body,
std::move(attributes));
}
@@ -2988,10 +2973,9 @@
/// @param attributes optional attributes
/// @returns the while loop statement pointer
template <typename COND>
- const ast::WhileStatement* While(
- COND&& cond,
- const ast::BlockStatement* body,
- utils::VectorRef<const ast::Attribute*> attributes = utils::Empty) {
+ const ast::WhileStatement* While(COND&& cond,
+ const ast::BlockStatement* body,
+ VectorRef<const ast::Attribute*> attributes = tint::Empty) {
return create<ast::WhileStatement>(Expr(std::forward<COND>(cond)), body,
std::move(attributes));
}
@@ -3022,9 +3006,8 @@
Cases&&... cases) {
return create<ast::SwitchStatement>(
source, Expr(std::forward<ExpressionInit>(condition)),
- utils::Vector<const ast::CaseStatement*, sizeof...(cases)>{
- std::forward<Cases>(cases)...},
- utils::Empty, utils::Empty);
+ Vector<const ast::CaseStatement*, sizeof...(cases)>{std::forward<Cases>(cases)...},
+ tint::Empty, tint::Empty);
}
/// Creates a ast::SwitchStatement with input expression and cases
@@ -3038,9 +3021,8 @@
const ast::SwitchStatement* Switch(ExpressionInit&& condition, Cases&&... cases) {
return create<ast::SwitchStatement>(
Expr(std::forward<ExpressionInit>(condition)),
- utils::Vector<const ast::CaseStatement*, sizeof...(cases)>{
- std::forward<Cases>(cases)...},
- utils::Empty, utils::Empty);
+ Vector<const ast::CaseStatement*, sizeof...(cases)>{std::forward<Cases>(cases)...},
+ tint::Empty, tint::Empty);
}
/// Creates a ast::SwitchStatement with input expression, cases, and optional attributes
@@ -3054,9 +3036,9 @@
const ast::SwitchStatement* Switch(
const Source& source,
ExpressionInit&& condition,
- utils::VectorRef<const ast::CaseStatement*> cases,
- utils::VectorRef<const ast::Attribute*> stmt_attributes = utils::Empty,
- utils::VectorRef<const ast::Attribute*> body_attributes = utils::Empty) {
+ VectorRef<const ast::CaseStatement*> cases,
+ VectorRef<const ast::Attribute*> stmt_attributes = tint::Empty,
+ VectorRef<const ast::Attribute*> body_attributes = tint::Empty) {
return create<ast::SwitchStatement>(source, Expr(std::forward<ExpressionInit>(condition)),
cases, std::move(stmt_attributes),
std::move(body_attributes));
@@ -3071,9 +3053,9 @@
template <typename ExpressionInit, typename = DisableIfSource<ExpressionInit>>
const ast::SwitchStatement* Switch(
ExpressionInit&& condition,
- utils::VectorRef<const ast::CaseStatement*> cases,
- utils::VectorRef<const ast::Attribute*> stmt_attributes = utils::Empty,
- utils::VectorRef<const ast::Attribute*> body_attributes = utils::Empty) {
+ VectorRef<const ast::CaseStatement*> cases,
+ VectorRef<const ast::Attribute*> stmt_attributes = tint::Empty,
+ VectorRef<const ast::Attribute*> body_attributes = tint::Empty) {
return create<ast::SwitchStatement>(Expr(std::forward<ExpressionInit>(condition)), cases,
std::move(stmt_attributes), std::move(body_attributes));
}
@@ -3082,7 +3064,7 @@
/// @param selectors list of selectors
/// @param body the case body
/// @returns the case statement pointer
- const ast::CaseStatement* Case(utils::VectorRef<const ast::CaseSelector*> selectors,
+ const ast::CaseStatement* Case(VectorRef<const ast::CaseSelector*> selectors,
const ast::BlockStatement* body = nullptr) {
return Case(source_, std::move(selectors), body);
}
@@ -3093,7 +3075,7 @@
/// @param body the case body
/// @returns the case statement pointer
const ast::CaseStatement* Case(const Source& source,
- utils::VectorRef<const ast::CaseSelector*> selectors,
+ VectorRef<const ast::CaseSelector*> selectors,
const ast::BlockStatement* body = nullptr) {
return create<ast::CaseStatement>(source, std::move(selectors), body ? body : Block());
}
@@ -3104,7 +3086,7 @@
/// @returns the case statement pointer
const ast::CaseStatement* Case(const ast::CaseSelector* selector,
const ast::BlockStatement* body = nullptr) {
- return Case(utils::Vector{selector}, body ? body : Block());
+ return Case(Vector{selector}, body ? body : Block());
}
/// Convenience function that creates a 'default' ast::CaseStatement
@@ -3120,7 +3102,7 @@
/// @returns the case statement pointer
const ast::CaseStatement* DefaultCase(const Source& source,
const ast::BlockStatement* body = nullptr) {
- return Case(source, utils::Vector{DefaultCaseSelector(source)}, body);
+ return Case(source, Vector{DefaultCaseSelector(source)}, body);
}
/// Convenience function that creates a case selector
@@ -3413,9 +3395,8 @@
/// @returns the diagnostic rule name
template <typename NAME>
const ast::DiagnosticRuleName* DiagnosticRuleName(NAME&& name) {
- static_assert(
- !utils::traits::IsType<utils::traits::PtrElTy<NAME>, ast::TemplatedIdentifier>,
- "it is invalid for a diagnostic rule name to be templated");
+ static_assert(!tint::traits::IsType<tint::traits::PtrElTy<NAME>, ast::TemplatedIdentifier>,
+ "it is invalid for a diagnostic rule name to be templated");
auto* name_ident = Ident(std::forward<NAME>(name));
return create<ast::DiagnosticRuleName>(name_ident->source, name_ident);
}
@@ -3426,11 +3407,10 @@
/// @returns the diagnostic rule name
template <typename CATEGORY, typename NAME, typename = DisableIfSource<CATEGORY>>
const ast::DiagnosticRuleName* DiagnosticRuleName(CATEGORY&& category, NAME&& name) {
+ static_assert(!tint::traits::IsType<tint::traits::PtrElTy<NAME>, ast::TemplatedIdentifier>,
+ "it is invalid for a diagnostic rule name to be templated");
static_assert(
- !utils::traits::IsType<utils::traits::PtrElTy<NAME>, ast::TemplatedIdentifier>,
- "it is invalid for a diagnostic rule name to be templated");
- static_assert(
- !utils::traits::IsType<utils::traits::PtrElTy<CATEGORY>, ast::TemplatedIdentifier>,
+ !tint::traits::IsType<tint::traits::PtrElTy<CATEGORY>, ast::TemplatedIdentifier>,
"it is invalid for a diagnostic rule category to be templated");
auto* category_ident = Ident(std::forward<CATEGORY>(category));
auto* name_ident = Ident(std::forward<NAME>(name));
@@ -3445,9 +3425,8 @@
/// @returns the diagnostic rule name
template <typename NAME>
const ast::DiagnosticRuleName* DiagnosticRuleName(const Source& source, NAME&& name) {
- static_assert(
- !utils::traits::IsType<utils::traits::PtrElTy<NAME>, ast::TemplatedIdentifier>,
- "it is invalid for a diagnostic rule name to be templated");
+ static_assert(!tint::traits::IsType<tint::traits::PtrElTy<NAME>, ast::TemplatedIdentifier>,
+ "it is invalid for a diagnostic rule name to be templated");
auto* name_ident = Ident(std::forward<NAME>(name));
return create<ast::DiagnosticRuleName>(source, name_ident);
}
@@ -3461,11 +3440,10 @@
const ast::DiagnosticRuleName* DiagnosticRuleName(const Source& source,
CATEGORY&& category,
NAME&& name) {
+ static_assert(!tint::traits::IsType<tint::traits::PtrElTy<NAME>, ast::TemplatedIdentifier>,
+ "it is invalid for a diagnostic rule name to be templated");
static_assert(
- !utils::traits::IsType<utils::traits::PtrElTy<NAME>, ast::TemplatedIdentifier>,
- "it is invalid for a diagnostic rule name to be templated");
- static_assert(
- !utils::traits::IsType<utils::traits::PtrElTy<CATEGORY>, ast::TemplatedIdentifier>,
+ !tint::traits::IsType<tint::traits::PtrElTy<CATEGORY>, ast::TemplatedIdentifier>,
"it is invalid for a diagnostic rule category to be templated");
auto* category_ident = Ident(std::forward<CATEGORY>(category));
auto* name_ident = Ident(std::forward<NAME>(name));
@@ -3589,9 +3567,9 @@
/// @param args a mix of ast::Expression, ast::Statement, ast::Variables.
/// @returns the function
template <typename... ARGS,
- typename = utils::traits::EnableIf<(CanWrapInStatement<ARGS>::value && ...)>>
+ typename = tint::traits::EnableIf<(CanWrapInStatement<ARGS>::value && ...)>>
const ast::Function* WrapInFunction(ARGS&&... args) {
- utils::Vector stmts{
+ Vector stmts{
WrapInStatement(std::forward<ARGS>(args))...,
};
return WrapInFunction(std::move(stmts));
@@ -3599,7 +3577,7 @@
/// @param stmts a list of ast::Statement that will be wrapped by a function,
/// so that each statement is reachable by the Resolver.
/// @returns the function
- const ast::Function* WrapInFunction(utils::VectorRef<const ast::Statement*> stmts);
+ const ast::Function* WrapInFunction(VectorRef<const ast::Statement*> stmts);
/// The constants manager
constant::Manager constants;
diff --git a/src/tint/lang/wgsl/reader/parser/classify_template_args.cc b/src/tint/lang/wgsl/reader/parser/classify_template_args.cc
index f913893..2cf8b9f 100644
--- a/src/tint/lang/wgsl/reader/parser/classify_template_args.cc
+++ b/src/tint/lang/wgsl/reader/parser/classify_template_args.cc
@@ -66,7 +66,7 @@
Token* token; // A pointer to the opening '<' token
uint64_t expr_depth; // The value of 'expr_depth' for the opening '<'
};
- utils::Vector<StackEntry, 16> stack;
+ Vector<StackEntry, 16> stack;
for (size_t i = 0; i < count - 1; i++) {
switch (tokens[i].type()) {
diff --git a/src/tint/lang/wgsl/reader/parser/classify_template_args_test.cc b/src/tint/lang/wgsl/reader/parser/classify_template_args_test.cc
index 741dd0d..b07e1c6 100644
--- a/src/tint/lang/wgsl/reader/parser/classify_template_args_test.cc
+++ b/src/tint/lang/wgsl/reader/parser/classify_template_args_test.cc
@@ -40,7 +40,7 @@
Lexer l(&file);
auto tokens = l.Lex();
ClassifyTemplateArguments(tokens);
- auto types = utils::Transform(tokens, [&](const Token& t) { return t.type(); });
+ auto types = tint::Transform(tokens, [&](const Token& t) { return t.type(); });
EXPECT_THAT(types, testing::ContainerEq(params.tokens));
}
diff --git a/src/tint/lang/wgsl/reader/parser/error_msg_test.cc b/src/tint/lang/wgsl/reader/parser/error_msg_test.cc
index 65e88b1..d200c8a 100644
--- a/src/tint/lang/wgsl/reader/parser/error_msg_test.cc
+++ b/src/tint/lang/wgsl/reader/parser/error_msg_test.cc
@@ -539,8 +539,8 @@
TEST_F(ParserImplErrorTest, GlobalDeclConstExprMaxDepth) {
uint32_t kMaxDepth = 128;
- utils::StringStream src;
- utils::StringStream mkr;
+ StringStream src;
+ StringStream mkr;
src << "const i : i32 = ";
mkr << " ";
for (size_t i = 0; i < kMaxDepth + 8; i++) {
@@ -556,7 +556,7 @@
src << ")";
}
src << ";";
- utils::StringStream err;
+ StringStream err;
err << "test.wgsl:1:529 error: maximum parser recursive depth reached\n"
<< src.str() << "\n"
<< mkr.str() << "\n";
diff --git a/src/tint/lang/wgsl/reader/parser/expression_test.cc b/src/tint/lang/wgsl/reader/parser/expression_test.cc
index 6ab05d2..cf5ed2d 100644
--- a/src/tint/lang/wgsl/reader/parser/expression_test.cc
+++ b/src/tint/lang/wgsl/reader/parser/expression_test.cc
@@ -468,7 +468,7 @@
static bool ParsedAsTemplateArgumentList(BinaryOperatorInfo lhs_op, BinaryOperatorInfo rhs_op) {
return lhs_op.bit == kOpLt && rhs_op.bit & (kOpGt | kOpGe | kOpShr);
}
-static utils::StringStream& operator<<(utils::StringStream& o, const Case& c) {
+static StringStream& operator<<(StringStream& o, const Case& c) {
return o << "a " << c.lhs_op.symbol << " b " << c.rhs_op.symbol << " c ";
}
@@ -488,7 +488,7 @@
using ParserImplMixedBinaryOpTest = WGSLParserTestWithParam<Case>;
TEST_P(ParserImplMixedBinaryOpTest, Test) {
- utils::StringStream wgsl;
+ StringStream wgsl;
wgsl << GetParam();
auto p = parser(wgsl.str());
auto e = p->expression();
@@ -500,7 +500,7 @@
EXPECT_TRUE(e.errored);
EXPECT_EQ(e.value, nullptr);
EXPECT_TRUE(p->has_error());
- utils::StringStream expected;
+ StringStream expected;
expected << "1:3: mixing '" << GetParam().lhs_op.symbol << "' and '"
<< GetParam().rhs_op.symbol << "' requires parenthesis";
EXPECT_EQ(p->error(), expected.str());
diff --git a/src/tint/lang/wgsl/reader/parser/function_decl_test.cc b/src/tint/lang/wgsl/reader/parser/function_decl_test.cc
index 0a4209f..675b1b6 100644
--- a/src/tint/lang/wgsl/reader/parser/function_decl_test.cc
+++ b/src/tint/lang/wgsl/reader/parser/function_decl_test.cc
@@ -60,9 +60,9 @@
"\x95\x9e\x5f\xf0\x9d\x95\x93";
std::string src = "fn $function($param_a : i32, $param_b : f32) { return; }";
- src = utils::ReplaceAll(src, "$function", function_ident);
- src = utils::ReplaceAll(src, "$param_a", param_a_ident);
- src = utils::ReplaceAll(src, "$param_b", param_b_ident);
+ src = tint::ReplaceAll(src, "$function", function_ident);
+ src = tint::ReplaceAll(src, "$param_a", param_a_ident);
+ src = tint::ReplaceAll(src, "$param_b", param_b_ident);
auto p = parser(src);
auto attrs = p->attribute_list();
diff --git a/src/tint/lang/wgsl/reader/parser/lexer.cc b/src/tint/lang/wgsl/reader/parser/lexer.cc
index a75888b..132925b 100644
--- a/src/tint/lang/wgsl/reader/parser/lexer.cc
+++ b/src/tint/lang/wgsl/reader/parser/lexer.cc
@@ -47,16 +47,16 @@
// See https://www.w3.org/TR/WGSL/#blankspace
auto* utf8 = reinterpret_cast<const uint8_t*>(&str[i]);
- auto [cp, n] = utils::utf8::Decode(utf8, str.size() - i);
+ auto [cp, n] = tint::utf8::Decode(utf8, str.size() - i);
if (n == 0) {
return false;
}
- static const auto kSpace = utils::CodePoint(0x0020); // space
- static const auto kHTab = utils::CodePoint(0x0009); // horizontal tab
- static const auto kL2R = utils::CodePoint(0x200E); // left-to-right mark
- static const auto kR2L = utils::CodePoint(0x200F); // right-to-left mark
+ static const auto kSpace = tint::CodePoint(0x0020); // space
+ static const auto kHTab = tint::CodePoint(0x0009); // horizontal tab
+ static const auto kL2R = tint::CodePoint(0x200E); // left-to-right mark
+ static const auto kR2L = tint::CodePoint(0x200F); // right-to-left mark
if (cp == kSpace || cp == kHTab || cp == kL2R || cp == kR2L) {
*is_blankspace = true;
@@ -414,9 +414,9 @@
end_ptr = &at(length() - 1) + 1;
}
- auto ret = utils::ParseDouble(std::string_view(&at(start), end - start));
+ auto ret = tint::ParseDouble(std::string_view(&at(start), end - start));
double value = ret ? ret.Get() : 0.0;
- bool overflow = !ret && ret.Failure() == utils::ParseNumberError::kResultOutOfRange;
+ bool overflow = !ret && ret.Failure() == tint::ParseNumberError::kResultOutOfRange;
// If the value didn't fit in a double, check for underflow as that is 0.0 in WGSL and not an
// error.
@@ -968,12 +968,12 @@
// Must begin with an XID_Source unicode character, or underscore
{
auto* utf8 = reinterpret_cast<const uint8_t*>(&at(pos()));
- auto [code_point, n] = utils::utf8::Decode(utf8, length() - pos());
+ auto [code_point, n] = tint::utf8::Decode(utf8, length() - pos());
if (n == 0) {
advance(); // Skip the bad byte.
return Token{Token::Type::kError, source, "invalid UTF-8"};
}
- if (code_point != utils::CodePoint('_') && !code_point.IsXIDStart()) {
+ if (code_point != tint::CodePoint('_') && !code_point.IsXIDStart()) {
return {};
}
// Consume start codepoint
@@ -983,7 +983,7 @@
while (!is_eol()) {
// Must continue with an XID_Continue unicode character
auto* utf8 = reinterpret_cast<const uint8_t*>(&at(pos()));
- auto [code_point, n] = utils::utf8::Decode(utf8, line().size() - pos());
+ auto [code_point, n] = tint::utf8::Decode(utf8, line().size() - pos());
if (n == 0) {
advance(); // Skip the bad byte.
return Token{Token::Type::kError, source, "invalid UTF-8"};
diff --git a/src/tint/lang/wgsl/reader/parser/parser.cc b/src/tint/lang/wgsl/reader/parser/parser.cc
index 7efe47d..ea686d2 100644
--- a/src/tint/lang/wgsl/reader/parser/parser.cc
+++ b/src/tint/lang/wgsl/reader/parser/parser.cc
@@ -192,9 +192,9 @@
Parser::FunctionHeader::FunctionHeader(Source src,
const ast::Identifier* n,
- utils::VectorRef<const ast::Parameter*> p,
+ VectorRef<const ast::Parameter*> p,
ast::Type ret_ty,
- utils::VectorRef<const ast::Attribute*> ret_attrs)
+ VectorRef<const ast::Attribute*> ret_attrs)
: source(src),
name(n),
params(std::move(p)),
@@ -213,7 +213,7 @@
std::string_view err,
std::string_view use) {
if (silence_diags_ == 0) {
- utils::StringStream msg;
+ StringStream msg;
msg << err;
if (!use.empty()) {
msg << " for " << use;
@@ -415,7 +415,7 @@
return add_error(peek().source(), "enable directives don't take parenthesis");
}
- utils::Vector<const ast::Extension*, 4> extensions;
+ Vector<const ast::Extension*, 4> extensions;
while (continue_parsing()) {
Source ext_src = peek().source();
auto ext =
@@ -908,7 +908,7 @@
}
/// Create a sensible error message
- utils::StringStream err;
+ StringStream err;
err << "expected " << name;
if (!use.empty()) {
@@ -916,7 +916,7 @@
}
err << "\n";
- utils::SuggestAlternatives(t.to_str(), strings, err);
+ tint::SuggestAlternatives(t.to_str(), strings, err);
synchronized_ = false;
return add_error(t.source(), err.str());
@@ -1506,7 +1506,7 @@
decl->address_space, // address space
decl->access, // access control
initializer, // initializer
- utils::Empty); // attributes
+ tint::Empty); // attributes
return create<ast::VariableDeclStatement>(var->source, var);
}
@@ -2023,7 +2023,7 @@
// : CONTINUING continuing_compound_statement
Maybe<const ast::BlockStatement*> Parser::continuing_statement() {
if (!match(Token::Type::kContinuing)) {
- return create<ast::BlockStatement>(Source{}, utils::Empty, utils::Empty);
+ return create<ast::BlockStatement>(Source{}, tint::Empty, tint::Empty);
}
return continuing_compound_statement();
@@ -2757,7 +2757,7 @@
Source source;
ast::UnaryOp op;
};
- utils::Vector<LHSData, 4> ops;
+ Vector<LHSData, 4> ops;
while (true) {
auto& t = peek();
if (!t.Is(Token::Type::kAndAnd) && !t.Is(Token::Type::kAnd) && !t.Is(Token::Type::kStar)) {
@@ -2790,7 +2790,7 @@
const ast::Expression* ret = expr.value;
// Consume the ops in reverse order so we have the correct AST ordering.
- for (auto& info : utils::Reverse(ops)) {
+ for (auto& info : tint::Reverse(ops)) {
ret = create<ast::UnaryOpExpression>(info.source, info.op, ret);
}
return ret;
@@ -3003,7 +3003,7 @@
break;
}
- utils::Vector<const ast::Expression*, 2> args;
+ Vector<const ast::Expression*, 2> args;
// Handle no parameter items which should have no parens
if (min == 0) {
@@ -3086,7 +3086,7 @@
}
}
-Expect<Void> Parser::expect_attributes_consumed(utils::VectorRef<const ast::Attribute*> in) {
+Expect<Void> Parser::expect_attributes_consumed(VectorRef<const ast::Attribute*> in) {
if (in.IsEmpty()) {
return kSuccess;
}
@@ -3242,7 +3242,7 @@
return false;
}
- utils::StringStream err;
+ StringStream err;
if (tok == Token::Type::kTemplateArgsLeft && t.type() == Token::Type::kLessThan) {
err << "missing closing '>'";
} else {
diff --git a/src/tint/lang/wgsl/reader/parser/parser.h b/src/tint/lang/wgsl/reader/parser/parser.h
index a617511..9adc95c 100644
--- a/src/tint/lang/wgsl/reader/parser/parser.h
+++ b/src/tint/lang/wgsl/reader/parser/parser.h
@@ -72,13 +72,13 @@
public:
/// Pre-determined small vector sizes for AST pointers
//! @cond Doxygen_Suppress
- using AttributeList = utils::Vector<const ast::Attribute*, 4>;
- using CaseSelectorList = utils::Vector<const ast::CaseSelector*, 4>;
- using CaseStatementList = utils::Vector<const ast::CaseStatement*, 4>;
- using ExpressionList = utils::Vector<const ast::Expression*, 8>;
- using ParameterList = utils::Vector<const ast::Parameter*, 8>;
- using StatementList = utils::Vector<const ast::Statement*, 8>;
- using StructMemberList = utils::Vector<const ast::StructMember*, 8>;
+ using AttributeList = Vector<const ast::Attribute*, 4>;
+ using CaseSelectorList = Vector<const ast::CaseSelector*, 4>;
+ using CaseStatementList = Vector<const ast::CaseStatement*, 4>;
+ using ExpressionList = Vector<const ast::Expression*, 8>;
+ using ParameterList = Vector<const ast::Parameter*, 8>;
+ using StatementList = Vector<const ast::Statement*, 8>;
+ using StructMemberList = Vector<const ast::StructMember*, 8>;
//! @endcond
/// Empty structure used by functions that do not return a value, but need to signal success /
@@ -233,9 +233,9 @@
/// @param ret_attrs return type attributes
FunctionHeader(Source src,
const ast::Identifier* n,
- utils::VectorRef<const ast::Parameter*> p,
+ VectorRef<const ast::Parameter*> p,
ast::Type ret_ty,
- utils::VectorRef<const ast::Attribute*> ret_attrs);
+ VectorRef<const ast::Attribute*> ret_attrs);
/// Destructor
~FunctionHeader();
/// Assignment operator
@@ -248,7 +248,7 @@
/// Function name
const ast::Identifier* name;
/// Function parameters
- utils::Vector<const ast::Parameter*, 8> params;
+ Vector<const ast::Parameter*, 8> params;
/// Function return type
ast::Type return_type;
/// Function return type attributes
@@ -824,7 +824,7 @@
/// Reports an error if the attribute list `list` is not empty.
/// Used to ensure that all attributes are consumed.
- Expect<Void> expect_attributes_consumed(utils::VectorRef<const ast::Attribute*> list);
+ Expect<Void> expect_attributes_consumed(VectorRef<const ast::Attribute*> list);
/// Raises an error if the next token is the start of a template list.
/// Used to hint to the user that the parser interpreted the following as a templated identifier
diff --git a/src/tint/lang/wgsl/reader/parser/struct_decl_test.cc b/src/tint/lang/wgsl/reader/parser/struct_decl_test.cc
index 85a7836..4d5690a 100644
--- a/src/tint/lang/wgsl/reader/parser/struct_decl_test.cc
+++ b/src/tint/lang/wgsl/reader/parser/struct_decl_test.cc
@@ -52,9 +52,9 @@
$member_a : i32,
$member_b : f32,
})";
- src = utils::ReplaceAll(src, "$struct", struct_ident);
- src = utils::ReplaceAll(src, "$member_a", member_a_ident);
- src = utils::ReplaceAll(src, "$member_b", member_b_ident);
+ src = tint::ReplaceAll(src, "$struct", struct_ident);
+ src = tint::ReplaceAll(src, "$member_a", member_a_ident);
+ src = tint::ReplaceAll(src, "$member_b", member_b_ident);
auto p = parser(src);
diff --git a/src/tint/lang/wgsl/reader/parser/token.h b/src/tint/lang/wgsl/reader/parser/token.h
index a2a6bc2..2523c91 100644
--- a/src/tint/lang/wgsl/reader/parser/token.h
+++ b/src/tint/lang/wgsl/reader/parser/token.h
@@ -359,7 +359,7 @@
std::variant<int64_t, double, std::string, std::string_view> value_;
};
-inline utils::StringStream& operator<<(utils::StringStream& out, Token::Type type) {
+inline StringStream& operator<<(StringStream& out, Token::Type type) {
out << Token::TypeToName(type);
return out;
}
diff --git a/src/tint/lang/wgsl/reader/parser/variable_attribute_test.cc b/src/tint/lang/wgsl/reader/parser/variable_attribute_test.cc
index 35c8460..7fe3138 100644
--- a/src/tint/lang/wgsl/reader/parser/variable_attribute_test.cc
+++ b/src/tint/lang/wgsl/reader/parser/variable_attribute_test.cc
@@ -220,7 +220,7 @@
class BuiltinTest : public WGSLParserTestWithParam<builtin::BuiltinValue> {};
TEST_P(BuiltinTest, Attribute_Builtin) {
- auto str = utils::ToString(GetParam());
+ auto str = tint::ToString(GetParam());
auto p = parser("builtin(" + str + ")");
auto attr = p->attribute();
@@ -236,7 +236,7 @@
ast::CheckIdentifier(builtin->builtin, str);
}
TEST_P(BuiltinTest, Attribute_Builtin_TrailingComma) {
- auto str = utils::ToString(GetParam());
+ auto str = tint::ToString(GetParam());
auto p = parser("builtin(" + str + ",)");
auto attr = p->attribute();
diff --git a/src/tint/lang/wgsl/reader/parser/variable_qualifier_test.cc b/src/tint/lang/wgsl/reader/parser/variable_qualifier_test.cc
index 8f792ab..95706c2 100644
--- a/src/tint/lang/wgsl/reader/parser/variable_qualifier_test.cc
+++ b/src/tint/lang/wgsl/reader/parser/variable_qualifier_test.cc
@@ -39,12 +39,12 @@
EXPECT_FALSE(sc.errored);
EXPECT_TRUE(sc.matched);
if (params.address_space != builtin::AddressSpace::kUndefined) {
- ast::CheckIdentifier(sc->address_space, utils::ToString(params.address_space));
+ ast::CheckIdentifier(sc->address_space, tint::ToString(params.address_space));
} else {
EXPECT_EQ(sc->address_space, nullptr);
}
if (params.access != builtin::Access::kUndefined) {
- ast::CheckIdentifier(sc->access, utils::ToString(params.access));
+ ast::CheckIdentifier(sc->access, tint::ToString(params.access));
} else {
EXPECT_EQ(sc->access, nullptr);
}
diff --git a/src/tint/lang/wgsl/reader/program_to_ir/accessor_test.cc b/src/tint/lang/wgsl/reader/program_to_ir/accessor_test.cc
index a166366..9e646c5 100644
--- a/src/tint/lang/wgsl/reader/program_to_ir/accessor_test.cc
+++ b/src/tint/lang/wgsl/reader/program_to_ir/accessor_test.cc
@@ -151,7 +151,7 @@
// var a: MyStruct;
// let b = a.foo
- auto* s = Structure("MyStruct", utils::Vector{
+ auto* s = Structure("MyStruct", Vector{
Member("foo", ty.i32()),
});
auto* a = Var("a", ty.Of(s), builtin::AddressSpace::kFunction);
@@ -183,10 +183,10 @@
// var a: Outer;
// let b = a.foo.bar
- auto* inner = Structure("Inner", utils::Vector{
+ auto* inner = Structure("Inner", Vector{
Member("bar", ty.f32()),
});
- auto* outer = Structure("Outer", utils::Vector{
+ auto* outer = Structure("Outer", Vector{
Member("a", ty.i32()),
Member("foo", ty.Of(inner)),
});
@@ -224,12 +224,12 @@
// var a: array<Outer, 4>
// let b = a[0].foo[1].bar
- auto* inner = Structure("Inner", utils::Vector{
+ auto* inner = Structure("Inner", Vector{
Member("b", ty.i32()),
Member("c", ty.f32()),
Member("bar", ty.vec4<f32>()),
});
- auto* outer = Structure("Outer", utils::Vector{
+ auto* outer = Structure("Outer", Vector{
Member("a", ty.i32()),
Member("foo", ty.array(ty.Of(inner), 4_u)),
});
@@ -362,7 +362,7 @@
// var a: MyStruct;
// let b = a.foo.zyx.yx[0]
- auto* s = Structure("MyStruct", utils::Vector{
+ auto* s = Structure("MyStruct", Vector{
Member("a", ty.i32()),
Member("foo", ty.vec4<f32>()),
});
@@ -443,7 +443,7 @@
// let a: MyStruct = MyStruct();
// let b = a.foo
- auto* s = Structure("MyStruct", utils::Vector{
+ auto* s = Structure("MyStruct", Vector{
Member("foo", ty.i32()),
});
auto* a = Let("a", ty.Of(s), Call("MyStruct"));
@@ -474,10 +474,10 @@
// let a: Outer = Outer();
// let b = a.foo.bar
- auto* inner = Structure("Inner", utils::Vector{
+ auto* inner = Structure("Inner", Vector{
Member("bar", ty.f32()),
});
- auto* outer = Structure("Outer", utils::Vector{
+ auto* outer = Structure("Outer", Vector{
Member("a", ty.i32()),
Member("foo", ty.Of(inner)),
});
@@ -514,12 +514,12 @@
// let a: array<Outer, 4> = array();
// let b = a[0].foo[1].bar
- auto* inner = Structure("Inner", utils::Vector{
+ auto* inner = Structure("Inner", Vector{
Member("b", ty.i32()),
Member("c", ty.f32()),
Member("bar", ty.vec4<f32>()),
});
- auto* outer = Structure("Outer", utils::Vector{
+ auto* outer = Structure("Outer", Vector{
Member("a", ty.i32()),
Member("foo", ty.array(ty.Of(inner), 4_u)),
});
@@ -626,7 +626,7 @@
// let a: MyStruct = MyStruct();
// let b = a.foo.zyx.yx[0]
- auto* s = Structure("MyStruct", utils::Vector{
+ auto* s = Structure("MyStruct", Vector{
Member("a", ty.i32()),
Member("foo", ty.vec4<f32>()),
});
diff --git a/src/tint/lang/wgsl/reader/program_to_ir/binary_test.cc b/src/tint/lang/wgsl/reader/program_to_ir/binary_test.cc
index c36254a..7c62af3 100644
--- a/src/tint/lang/wgsl/reader/program_to_ir/binary_test.cc
+++ b/src/tint/lang/wgsl/reader/program_to_ir/binary_test.cc
@@ -26,7 +26,7 @@
using ProgramToIRBinaryTest = helpers::IRProgramTest;
TEST_F(ProgramToIRBinaryTest, EmitExpression_Binary_Add) {
- Func("my_func", utils::Empty, ty.u32(), utils::Vector{Return(0_u)});
+ Func("my_func", tint::Empty, ty.u32(), Vector{Return(0_u)});
auto* expr = Add(Call("my_func"), 4_u);
WrapInFunction(expr);
@@ -95,7 +95,7 @@
}
TEST_F(ProgramToIRBinaryTest, EmitExpression_Binary_Subtract) {
- Func("my_func", utils::Empty, ty.u32(), utils::Vector{Return(0_u)});
+ Func("my_func", tint::Empty, ty.u32(), Vector{Return(0_u)});
auto* expr = Sub(Call("my_func"), 4_u);
WrapInFunction(expr);
@@ -164,7 +164,7 @@
}
TEST_F(ProgramToIRBinaryTest, EmitExpression_Binary_Multiply) {
- Func("my_func", utils::Empty, ty.u32(), utils::Vector{Return(0_u)});
+ Func("my_func", tint::Empty, ty.u32(), Vector{Return(0_u)});
auto* expr = Mul(Call("my_func"), 4_u);
WrapInFunction(expr);
@@ -210,7 +210,7 @@
}
TEST_F(ProgramToIRBinaryTest, EmitExpression_Binary_Div) {
- Func("my_func", utils::Empty, ty.u32(), utils::Vector{Return(0_u)});
+ Func("my_func", tint::Empty, ty.u32(), Vector{Return(0_u)});
auto* expr = Div(Call("my_func"), 4_u);
WrapInFunction(expr);
@@ -256,7 +256,7 @@
}
TEST_F(ProgramToIRBinaryTest, EmitExpression_Binary_Modulo) {
- Func("my_func", utils::Empty, ty.u32(), utils::Vector{Return(0_u)});
+ Func("my_func", tint::Empty, ty.u32(), Vector{Return(0_u)});
auto* expr = Mod(Call("my_func"), 4_u);
WrapInFunction(expr);
@@ -302,7 +302,7 @@
}
TEST_F(ProgramToIRBinaryTest, EmitExpression_Binary_And) {
- Func("my_func", utils::Empty, ty.u32(), utils::Vector{Return(0_u)});
+ Func("my_func", tint::Empty, ty.u32(), Vector{Return(0_u)});
auto* expr = And(Call("my_func"), 4_u);
WrapInFunction(expr);
@@ -348,7 +348,7 @@
}
TEST_F(ProgramToIRBinaryTest, EmitExpression_Binary_Or) {
- Func("my_func", utils::Empty, ty.u32(), utils::Vector{Return(0_u)});
+ Func("my_func", tint::Empty, ty.u32(), Vector{Return(0_u)});
auto* expr = Or(Call("my_func"), 4_u);
WrapInFunction(expr);
@@ -394,7 +394,7 @@
}
TEST_F(ProgramToIRBinaryTest, EmitExpression_Binary_Xor) {
- Func("my_func", utils::Empty, ty.u32(), utils::Vector{Return(0_u)});
+ Func("my_func", tint::Empty, ty.u32(), Vector{Return(0_u)});
auto* expr = Xor(Call("my_func"), 4_u);
WrapInFunction(expr);
@@ -440,7 +440,7 @@
}
TEST_F(ProgramToIRBinaryTest, EmitExpression_Binary_LogicalAnd) {
- Func("my_func", utils::Empty, ty.bool_(), utils::Vector{Return(true)});
+ Func("my_func", tint::Empty, ty.bool_(), Vector{Return(true)});
auto* let = Let("logical_and", LogicalAnd(Call("my_func"), false));
auto* expr = If(let, Block());
WrapInFunction(let, expr);
@@ -476,7 +476,7 @@
}
TEST_F(ProgramToIRBinaryTest, EmitExpression_Binary_LogicalOr) {
- Func("my_func", utils::Empty, ty.bool_(), utils::Vector{Return(true)});
+ Func("my_func", tint::Empty, ty.bool_(), Vector{Return(true)});
auto* let = Let("logical_or", LogicalOr(Call("my_func"), true));
auto* expr = If(let, Block());
WrapInFunction(let, expr);
@@ -512,7 +512,7 @@
}
TEST_F(ProgramToIRBinaryTest, EmitExpression_Binary_Equal) {
- Func("my_func", utils::Empty, ty.u32(), utils::Vector{Return(0_u)});
+ Func("my_func", tint::Empty, ty.u32(), Vector{Return(0_u)});
auto* expr = Equal(Call("my_func"), 4_u);
WrapInFunction(expr);
@@ -535,7 +535,7 @@
}
TEST_F(ProgramToIRBinaryTest, EmitExpression_Binary_NotEqual) {
- Func("my_func", utils::Empty, ty.u32(), utils::Vector{Return(0_u)});
+ Func("my_func", tint::Empty, ty.u32(), Vector{Return(0_u)});
auto* expr = NotEqual(Call("my_func"), 4_u);
WrapInFunction(expr);
@@ -558,7 +558,7 @@
}
TEST_F(ProgramToIRBinaryTest, EmitExpression_Binary_LessThan) {
- Func("my_func", utils::Empty, ty.u32(), utils::Vector{Return(0_u)});
+ Func("my_func", tint::Empty, ty.u32(), Vector{Return(0_u)});
auto* expr = LessThan(Call("my_func"), 4_u);
WrapInFunction(expr);
@@ -581,7 +581,7 @@
}
TEST_F(ProgramToIRBinaryTest, EmitExpression_Binary_GreaterThan) {
- Func("my_func", utils::Empty, ty.u32(), utils::Vector{Return(0_u)});
+ Func("my_func", tint::Empty, ty.u32(), Vector{Return(0_u)});
auto* expr = GreaterThan(Call("my_func"), 4_u);
WrapInFunction(expr);
@@ -604,7 +604,7 @@
}
TEST_F(ProgramToIRBinaryTest, EmitExpression_Binary_LessThanEqual) {
- Func("my_func", utils::Empty, ty.u32(), utils::Vector{Return(0_u)});
+ Func("my_func", tint::Empty, ty.u32(), Vector{Return(0_u)});
auto* expr = LessThanEqual(Call("my_func"), 4_u);
WrapInFunction(expr);
@@ -627,7 +627,7 @@
}
TEST_F(ProgramToIRBinaryTest, EmitExpression_Binary_GreaterThanEqual) {
- Func("my_func", utils::Empty, ty.u32(), utils::Vector{Return(0_u)});
+ Func("my_func", tint::Empty, ty.u32(), Vector{Return(0_u)});
auto* expr = GreaterThanEqual(Call("my_func"), 4_u);
WrapInFunction(expr);
@@ -650,7 +650,7 @@
}
TEST_F(ProgramToIRBinaryTest, EmitExpression_Binary_ShiftLeft) {
- Func("my_func", utils::Empty, ty.u32(), utils::Vector{Return(0_u)});
+ Func("my_func", tint::Empty, ty.u32(), Vector{Return(0_u)});
auto* expr = Shl(Call("my_func"), 4_u);
WrapInFunction(expr);
@@ -696,7 +696,7 @@
}
TEST_F(ProgramToIRBinaryTest, EmitExpression_Binary_ShiftRight) {
- Func("my_func", utils::Empty, ty.u32(), utils::Vector{Return(0_u)});
+ Func("my_func", tint::Empty, ty.u32(), Vector{Return(0_u)});
auto* expr = Shr(Call("my_func"), 4_u);
WrapInFunction(expr);
@@ -742,7 +742,7 @@
}
TEST_F(ProgramToIRBinaryTest, EmitExpression_Binary_Compound) {
- Func("my_func", utils::Empty, ty.f32(), utils::Vector{Return(0_f)});
+ Func("my_func", tint::Empty, ty.f32(), Vector{Return(0_f)});
auto* expr = LogicalAnd(LessThan(Call("my_func"), 2_f),
GreaterThan(2.5_f, Div(Call("my_func"), Mul(2.3_f, Call("my_func")))));
@@ -780,7 +780,7 @@
}
TEST_F(ProgramToIRBinaryTest, EmitExpression_Binary_Compound_WithConstEval) {
- Func("my_func", utils::Vector{Param("p", ty.bool_())}, ty.bool_(), utils::Vector{Return(true)});
+ Func("my_func", Vector{Param("p", ty.bool_())}, ty.bool_(), Vector{Return(true)});
auto* expr = Call("my_func", LogicalAnd(LessThan(2.4_f, 2_f),
GreaterThan(2.5_f, Div(10_f, Mul(2.3_f, 9.4_f)))));
WrapInFunction(expr);
diff --git a/src/tint/lang/wgsl/reader/program_to_ir/call_test.cc b/src/tint/lang/wgsl/reader/program_to_ir/call_test.cc
index fc7799e..bad855e 100644
--- a/src/tint/lang/wgsl/reader/program_to_ir/call_test.cc
+++ b/src/tint/lang/wgsl/reader/program_to_ir/call_test.cc
@@ -27,7 +27,7 @@
using ProgramToIRCallTest = helpers::IRProgramTest;
TEST_F(ProgramToIRCallTest, EmitExpression_Bitcast) {
- Func("my_func", utils::Empty, ty.f32(), utils::Vector{Return(0_f)});
+ Func("my_func", tint::Empty, ty.f32(), Vector{Return(0_f)});
auto* expr = Bitcast<f32>(Call("my_func"));
WrapInFunction(expr);
@@ -53,7 +53,7 @@
TEST_F(ProgramToIRCallTest, EmitStatement_Discard) {
auto* expr = Discard();
Func("test_function", {}, ty.void_(), expr,
- utils::Vector{
+ Vector{
create<ast::StageAttribute>(ast::PipelineStage::kFragment),
});
@@ -70,7 +70,7 @@
}
TEST_F(ProgramToIRCallTest, EmitStatement_UserFunction) {
- Func("my_func", utils::Vector{Param("p", ty.f32())}, ty.void_(), utils::Empty);
+ Func("my_func", Vector{Param("p", ty.f32())}, ty.void_(), tint::Empty);
auto* stmt = CallStmt(Call("my_func", Mul(2_a, 3_a)));
WrapInFunction(stmt);
diff --git a/src/tint/lang/wgsl/reader/program_to_ir/function_test.cc b/src/tint/lang/wgsl/reader/program_to_ir/function_test.cc
index d773315..edb4d75 100644
--- a/src/tint/lang/wgsl/reader/program_to_ir/function_test.cc
+++ b/src/tint/lang/wgsl/reader/program_to_ir/function_test.cc
@@ -27,10 +27,9 @@
using ProgramToIRFunctionTest = helpers::IRProgramTest;
TEST_F(ProgramToIRFunctionTest, EmitFunction_Vertex) {
- Func("test", utils::Empty, ty.vec4<f32>(),
- utils::Vector{Return(Call<vec4<f32>>(0_f, 0_f, 0_f, 0_f))},
- utils::Vector{Stage(ast::PipelineStage::kVertex)},
- utils::Vector{Builtin(builtin::BuiltinValue::kPosition)});
+ Func("test", tint::Empty, ty.vec4<f32>(), Vector{Return(Call<vec4<f32>>(0_f, 0_f, 0_f, 0_f))},
+ Vector{Stage(ast::PipelineStage::kVertex)},
+ Vector{Builtin(builtin::BuiltinValue::kPosition)});
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
@@ -44,8 +43,8 @@
}
TEST_F(ProgramToIRFunctionTest, EmitFunction_Fragment) {
- Func("test", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("test", tint::Empty, ty.void_(), tint::Empty,
+ Vector{Stage(ast::PipelineStage::kFragment)});
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
@@ -59,8 +58,8 @@
}
TEST_F(ProgramToIRFunctionTest, EmitFunction_Compute) {
- Func("test", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{Stage(ast::PipelineStage::kCompute), WorkgroupSize(8_i, 4_i, 2_i)});
+ Func("test", tint::Empty, ty.void_(), tint::Empty,
+ Vector{Stage(ast::PipelineStage::kCompute), WorkgroupSize(8_i, 4_i, 2_i)});
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
@@ -75,8 +74,8 @@
}
TEST_F(ProgramToIRFunctionTest, EmitFunction_Return) {
- Func("test", utils::Empty, ty.vec3<f32>(),
- utils::Vector{Return(Call<vec3<f32>>(0_f, 0_f, 0_f))}, utils::Empty);
+ Func("test", tint::Empty, ty.vec3<f32>(), Vector{Return(Call<vec3<f32>>(0_f, 0_f, 0_f))},
+ tint::Empty);
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
@@ -90,8 +89,8 @@
}
TEST_F(ProgramToIRFunctionTest, EmitFunction_UnreachableEnd_ReturnValue) {
- Func("test", utils::Empty, ty.f32(),
- utils::Vector{If(true, Block(Return(0_f)), Else(Block(Return(1_f))))}, utils::Empty);
+ Func("test", tint::Empty, ty.f32(),
+ Vector{If(true, Block(Return(0_f)), Else(Block(Return(1_f))))}, tint::Empty);
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
@@ -113,10 +112,9 @@
}
TEST_F(ProgramToIRFunctionTest, EmitFunction_ReturnPosition) {
- Func("test", utils::Empty, ty.vec4<f32>(),
- utils::Vector{Return(Call<vec4<f32>>(1_f, 2_f, 3_f, 4_f))},
- utils::Vector{Stage(ast::PipelineStage::kVertex)},
- utils::Vector{Builtin(builtin::BuiltinValue::kPosition)});
+ Func("test", tint::Empty, ty.vec4<f32>(), Vector{Return(Call<vec4<f32>>(1_f, 2_f, 3_f, 4_f))},
+ Vector{Stage(ast::PipelineStage::kVertex)},
+ Vector{Builtin(builtin::BuiltinValue::kPosition)});
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
@@ -130,10 +128,9 @@
}
TEST_F(ProgramToIRFunctionTest, EmitFunction_ReturnPositionInvariant) {
- Func("test", utils::Empty, ty.vec4<f32>(),
- utils::Vector{Return(Call<vec4<f32>>(1_f, 2_f, 3_f, 4_f))},
- utils::Vector{Stage(ast::PipelineStage::kVertex)},
- utils::Vector{Builtin(builtin::BuiltinValue::kPosition), Invariant()});
+ Func("test", tint::Empty, ty.vec4<f32>(), Vector{Return(Call<vec4<f32>>(1_f, 2_f, 3_f, 4_f))},
+ Vector{Stage(ast::PipelineStage::kVertex)},
+ Vector{Builtin(builtin::BuiltinValue::kPosition), Invariant()});
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
@@ -148,9 +145,8 @@
}
TEST_F(ProgramToIRFunctionTest, EmitFunction_ReturnLocation) {
- Func("test", utils::Empty, ty.vec4<f32>(),
- utils::Vector{Return(Call<vec4<f32>>(1_f, 2_f, 3_f, 4_f))},
- utils::Vector{Stage(ast::PipelineStage::kFragment)}, utils::Vector{Location(1_i)});
+ Func("test", tint::Empty, ty.vec4<f32>(), Vector{Return(Call<vec4<f32>>(1_f, 2_f, 3_f, 4_f))},
+ Vector{Stage(ast::PipelineStage::kFragment)}, Vector{Location(1_i)});
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
@@ -165,11 +161,10 @@
}
TEST_F(ProgramToIRFunctionTest, EmitFunction_ReturnLocation_Interpolate) {
- Func("test", utils::Empty, ty.vec4<f32>(),
- utils::Vector{Return(Call<vec4<f32>>(1_f, 2_f, 3_f, 4_f))},
- utils::Vector{Stage(ast::PipelineStage::kFragment)},
- utils::Vector{Location(1_i), Interpolate(builtin::InterpolationType::kLinear,
- builtin::InterpolationSampling::kCentroid)});
+ Func("test", tint::Empty, ty.vec4<f32>(), Vector{Return(Call<vec4<f32>>(1_f, 2_f, 3_f, 4_f))},
+ Vector{Stage(ast::PipelineStage::kFragment)},
+ Vector{Location(1_i), Interpolate(builtin::InterpolationType::kLinear,
+ builtin::InterpolationSampling::kCentroid)});
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
@@ -185,9 +180,9 @@
}
TEST_F(ProgramToIRFunctionTest, EmitFunction_ReturnFragDepth) {
- Func("test", utils::Empty, ty.f32(), utils::Vector{Return(1_f)},
- utils::Vector{Stage(ast::PipelineStage::kFragment)},
- utils::Vector{Builtin(builtin::BuiltinValue::kFragDepth)});
+ Func("test", tint::Empty, ty.f32(), Vector{Return(1_f)},
+ Vector{Stage(ast::PipelineStage::kFragment)},
+ Vector{Builtin(builtin::BuiltinValue::kFragDepth)});
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
@@ -201,9 +196,9 @@
}
TEST_F(ProgramToIRFunctionTest, EmitFunction_ReturnSampleMask) {
- Func("test", utils::Empty, ty.u32(), utils::Vector{Return(1_u)},
- utils::Vector{Stage(ast::PipelineStage::kFragment)},
- utils::Vector{Builtin(builtin::BuiltinValue::kSampleMask)});
+ Func("test", tint::Empty, ty.u32(), Vector{Return(1_u)},
+ Vector{Stage(ast::PipelineStage::kFragment)},
+ Vector{Builtin(builtin::BuiltinValue::kSampleMask)});
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
diff --git a/src/tint/lang/wgsl/reader/program_to_ir/materialize_test.cc b/src/tint/lang/wgsl/reader/program_to_ir/materialize_test.cc
index c47ef08..236a50e 100644
--- a/src/tint/lang/wgsl/reader/program_to_ir/materialize_test.cc
+++ b/src/tint/lang/wgsl/reader/program_to_ir/materialize_test.cc
@@ -28,7 +28,7 @@
TEST_F(ProgramToIRMaterializeTest, EmitExpression_MaterializedCall) {
auto* expr = Return(Call("trunc", 2.5_f));
- Func("test_function", {}, ty.f32(), expr, utils::Empty);
+ Func("test_function", {}, ty.f32(), expr, tint::Empty);
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
diff --git a/src/tint/lang/wgsl/reader/program_to_ir/program_to_ir.cc b/src/tint/lang/wgsl/reader/program_to_ir/program_to_ir.cc
index 649f070..e0c3c0f 100644
--- a/src/tint/lang/wgsl/reader/program_to_ir/program_to_ir.cc
+++ b/src/tint/lang/wgsl/reader/program_to_ir/program_to_ir.cc
@@ -110,7 +110,7 @@
namespace {
-using ResultType = utils::Result<ir::Module, diag::List>;
+using ResultType = tint::Result<ir::Module, diag::List>;
/// Impl is the private-implementation of FromProgram().
class Impl {
@@ -145,7 +145,7 @@
};
/// The stack of flow control instructions.
- utils::Vector<ir::ControlInstruction*, 8> control_stack_;
+ Vector<ir::ControlInstruction*, 8> control_stack_;
struct VectorRefElementAccess {
ir::Value* vector = nullptr;
@@ -356,7 +356,7 @@
scopes_.Push();
TINT_DEFER(scopes_.Pop());
- utils::Vector<ir::FunctionParam*, 1> params;
+ Vector<ir::FunctionParam*, 1> params;
for (auto* p : ast_func->params) {
const auto* param_sem = program_->Sem().Get(p)->As<sem::Parameter>();
auto* ty = param_sem->Type()->Clone(clone_ctx_.type_ctx);
@@ -457,7 +457,7 @@
current_function_ = nullptr;
}
- void EmitStatements(utils::VectorRef<const ast::Statement*> stmts) {
+ void EmitStatements(VectorRef<const ast::Statement*> stmts) {
for (auto* s : stmts) {
EmitStatement(s);
@@ -745,7 +745,7 @@
const auto* sem = program_->Sem().Get(stmt);
for (const auto* c : sem->Cases()) {
- utils::Vector<ir::Switch::CaseSelector, 4> selectors;
+ Vector<ir::Switch::CaseSelector, 4> selectors;
for (const auto* selector : c->Selectors()) {
if (selector->IsDefault()) {
selectors.Push({nullptr});
@@ -843,9 +843,9 @@
private:
Impl& impl;
- utils::Vector<ir::Block*, 8> blocks;
- utils::Vector<std::function<void()>, 64> tasks;
- utils::Hashmap<const ast::Expression*, ValueOrVecElAccess, 64> bindings_;
+ Vector<ir::Block*, 8> blocks;
+ Vector<std::function<void()>, 64> tasks;
+ Hashmap<const ast::Expression*, ValueOrVecElAccess, 64> bindings_;
void Bind(const ast::Expression* expr, ir::Value* value) {
// If this expression maps to sem::Load, insert a load instruction to get the result
@@ -1062,7 +1062,7 @@
return;
}
}
- utils::Vector<ir::Value*, 8> args;
+ Vector<ir::Value*, 8> args;
args.Reserve(expr->args.Length());
// Emit the arguments
for (const auto* arg : expr->args) {
@@ -1246,7 +1246,7 @@
},
[&](const ast::CallExpression* e) {
tasks.Push([=] { EmitCall(e); });
- for (auto* arg : utils::Reverse(e->args)) {
+ for (auto* arg : tint::Reverse(e->args)) {
tasks.Push([=] { Process(arg); });
}
},
@@ -1401,7 +1401,7 @@
} // namespace
-utils::Result<ir::Module, std::string> ProgramToIR(const Program* program) {
+tint::Result<ir::Module, std::string> ProgramToIR(const Program* program) {
if (!program->IsValid()) {
return std::string("input program is not valid");
}
diff --git a/src/tint/lang/wgsl/reader/program_to_ir/program_to_ir.h b/src/tint/lang/wgsl/reader/program_to_ir/program_to_ir.h
index dc86b8f..602d478 100644
--- a/src/tint/lang/wgsl/reader/program_to_ir/program_to_ir.h
+++ b/src/tint/lang/wgsl/reader/program_to_ir/program_to_ir.h
@@ -35,7 +35,7 @@
/// @note this assumes the `program.IsValid()`, and has had const-eval done so
/// any abstract values have been calculated and converted into the relevant
/// concrete types.
-utils::Result<ir::Module, std::string> ProgramToIR(const Program* program);
+tint::Result<ir::Module, std::string> ProgramToIR(const Program* program);
} // namespace tint::wgsl::reader
diff --git a/src/tint/lang/wgsl/reader/program_to_ir/program_to_ir_test.cc b/src/tint/lang/wgsl/reader/program_to_ir/program_to_ir_test.cc
index bfaf84a..baaaf9f 100644
--- a/src/tint/lang/wgsl/reader/program_to_ir/program_to_ir_test.cc
+++ b/src/tint/lang/wgsl/reader/program_to_ir/program_to_ir_test.cc
@@ -44,7 +44,7 @@
}
if (count > 1) {
ADD_FAILURE() << "FindSingleInstruction() found " << count << " nodes of type "
- << utils::TypeInfo::Of<T>().name;
+ << tint::TypeInfo::Of<T>().name;
}
return found;
}
@@ -54,7 +54,7 @@
using IR_FromProgramTest = helpers::IRProgramTest;
TEST_F(IR_FromProgramTest, Func) {
- Func("f", utils::Empty, ty.void_(), utils::Empty);
+ Func("f", tint::Empty, ty.void_(), tint::Empty);
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
@@ -75,7 +75,7 @@
}
TEST_F(IR_FromProgramTest, Func_WithParam) {
- Func("f", utils::Vector{Param("a", ty.u32())}, ty.u32(), utils::Vector{Return("a")});
+ Func("f", Vector{Param("a", ty.u32())}, ty.u32(), Vector{Return("a")});
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
@@ -96,8 +96,8 @@
}
TEST_F(IR_FromProgramTest, Func_WithMultipleParam) {
- Func("f", utils::Vector{Param("a", ty.u32()), Param("b", ty.i32()), Param("c", ty.bool_())},
- ty.void_(), utils::Empty);
+ Func("f", Vector{Param("a", ty.u32()), Param("b", ty.i32()), Param("c", ty.bool_())},
+ ty.void_(), tint::Empty);
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
@@ -118,8 +118,7 @@
}
TEST_F(IR_FromProgramTest, EntryPoint) {
- Func("f", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("f", tint::Empty, ty.void_(), tint::Empty, Vector{Stage(ast::PipelineStage::kFragment)});
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
@@ -821,9 +820,9 @@
}
TEST_F(IR_FromProgramTest, Switch) {
- auto* ast_switch = Switch(
- 1_i, utils::Vector{Case(utils::Vector{CaseSelector(0_i)}, Block()),
- Case(utils::Vector{CaseSelector(1_i)}, Block()), DefaultCase(Block())});
+ auto* ast_switch =
+ Switch(1_i, Vector{Case(Vector{CaseSelector(0_i)}, Block()),
+ Case(Vector{CaseSelector(1_i)}, Block()), DefaultCase(Block())});
WrapInFunction(ast_switch);
@@ -874,8 +873,7 @@
TEST_F(IR_FromProgramTest, Switch_MultiSelector) {
auto* ast_switch = Switch(
1_i,
- utils::Vector{Case(
- utils::Vector{CaseSelector(0_i), CaseSelector(1_i), DefaultCaseSelector()}, Block())});
+ Vector{Case(Vector{CaseSelector(0_i), CaseSelector(1_i), DefaultCaseSelector()}, Block())});
WrapInFunction(ast_switch);
@@ -915,7 +913,7 @@
}
TEST_F(IR_FromProgramTest, Switch_OnlyDefault) {
- auto* ast_switch = Switch(1_i, utils::Vector{DefaultCase(Block())});
+ auto* ast_switch = Switch(1_i, Vector{DefaultCase(Block())});
WrapInFunction(ast_switch);
auto res = Build();
@@ -946,9 +944,9 @@
}
TEST_F(IR_FromProgramTest, Switch_WithBreak) {
- auto* ast_switch = Switch(1_i, utils::Vector{Case(utils::Vector{CaseSelector(0_i)},
- Block(Break(), If(true, Block(Return())))),
- DefaultCase(Block())});
+ auto* ast_switch = Switch(
+ 1_i, Vector{Case(Vector{CaseSelector(0_i)}, Block(Break(), If(true, Block(Return())))),
+ DefaultCase(Block())});
WrapInFunction(ast_switch);
auto res = Build();
@@ -989,9 +987,8 @@
}
TEST_F(IR_FromProgramTest, Switch_AllReturn) {
- auto* ast_switch =
- Switch(1_i, utils::Vector{Case(utils::Vector{CaseSelector(0_i)}, Block(Return())),
- DefaultCase(Block(Return()))});
+ auto* ast_switch = Switch(1_i, Vector{Case(Vector{CaseSelector(0_i)}, Block(Return())),
+ DefaultCase(Block(Return()))});
auto* ast_if = If(true, Block(Return()));
WrapInFunction(ast_switch, ast_if);
@@ -1032,7 +1029,7 @@
}
TEST_F(IR_FromProgramTest, Emit_Phony) {
- Func("b", utils::Empty, ty.i32(), Return(1_i));
+ Func("b", tint::Empty, ty.i32(), Return(1_i));
WrapInFunction(Ignore(Call("b")));
auto m = Build();
@@ -1054,12 +1051,11 @@
}
TEST_F(IR_FromProgramTest, Func_WithParam_WithAttribute_Invariant) {
- Func(
- "f",
- utils::Vector{Param("a", ty.vec4<f32>(),
- utils::Vector{Invariant(), Builtin(builtin::BuiltinValue::kPosition)})},
- ty.vec4<f32>(), utils::Vector{Return("a")},
- utils::Vector{Stage(ast::PipelineStage::kFragment)}, utils::Vector{Location(1_i)});
+ Func("f",
+ Vector{Param("a", ty.vec4<f32>(),
+ Vector{Invariant(), Builtin(builtin::BuiltinValue::kPosition)})},
+ ty.vec4<f32>(), Vector{Return("a")}, Vector{Stage(ast::PipelineStage::kFragment)},
+ Vector{Location(1_i)});
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
@@ -1074,9 +1070,8 @@
}
TEST_F(IR_FromProgramTest, Func_WithParam_WithAttribute_Location) {
- Func("f", utils::Vector{Param("a", ty.f32(), utils::Vector{Location(2_i)})}, ty.f32(),
- utils::Vector{Return("a")}, utils::Vector{Stage(ast::PipelineStage::kFragment)},
- utils::Vector{Location(1_i)});
+ Func("f", Vector{Param("a", ty.f32(), Vector{Location(2_i)})}, ty.f32(), Vector{Return("a")},
+ Vector{Stage(ast::PipelineStage::kFragment)}, Vector{Location(1_i)});
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
@@ -1092,12 +1087,12 @@
TEST_F(IR_FromProgramTest, Func_WithParam_WithAttribute_Location_WithInterpolation_LinearCentroid) {
Func("f",
- utils::Vector{Param(
- "a", ty.f32(),
- utils::Vector{Location(2_i), Interpolate(builtin::InterpolationType::kLinear,
- builtin::InterpolationSampling::kCentroid)})},
- ty.f32(), utils::Vector{Return("a")}, utils::Vector{Stage(ast::PipelineStage::kFragment)},
- utils::Vector{Location(1_i)});
+ Vector{
+ Param("a", ty.f32(),
+ Vector{Location(2_i), Interpolate(builtin::InterpolationType::kLinear,
+ builtin::InterpolationSampling::kCentroid)})},
+ ty.f32(), Vector{Return("a")}, Vector{Stage(ast::PipelineStage::kFragment)},
+ Vector{Location(1_i)});
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
@@ -1114,11 +1109,10 @@
TEST_F(IR_FromProgramTest, Func_WithParam_WithAttribute_Location_WithInterpolation_Flat) {
Func("f",
- utils::Vector{
- Param("a", ty.f32(),
- utils::Vector{Location(2_i), Interpolate(builtin::InterpolationType::kFlat)})},
- ty.f32(), utils::Vector{Return("a")}, utils::Vector{Stage(ast::PipelineStage::kFragment)},
- utils::Vector{Location(1_i)});
+ Vector{Param("a", ty.f32(),
+ Vector{Location(2_i), Interpolate(builtin::InterpolationType::kFlat)})},
+ ty.f32(), Vector{Return("a")}, Vector{Stage(ast::PipelineStage::kFragment)},
+ Vector{Location(1_i)});
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
diff --git a/src/tint/lang/wgsl/reader/program_to_ir/unary_test.cc b/src/tint/lang/wgsl/reader/program_to_ir/unary_test.cc
index d124aa9..28d7ce8 100644
--- a/src/tint/lang/wgsl/reader/program_to_ir/unary_test.cc
+++ b/src/tint/lang/wgsl/reader/program_to_ir/unary_test.cc
@@ -26,7 +26,7 @@
using ProgramToIRUnaryTest = helpers::IRProgramTest;
TEST_F(ProgramToIRUnaryTest, EmitExpression_Unary_Not) {
- Func("my_func", utils::Empty, ty.bool_(), utils::Vector{Return(false)});
+ Func("my_func", tint::Empty, ty.bool_(), Vector{Return(false)});
auto* expr = Not(Call("my_func"));
WrapInFunction(expr);
@@ -49,8 +49,7 @@
}
TEST_F(ProgramToIRUnaryTest, EmitExpression_Unary_Not_Vector) {
- Func("my_func", utils::Empty, ty.vec4<bool>(),
- utils::Vector{Return(vec(ty.bool_(), 4, false))});
+ Func("my_func", tint::Empty, ty.vec4<bool>(), Vector{Return(vec(ty.bool_(), 4, false))});
auto* expr = Not(Call("my_func"));
WrapInFunction(expr);
@@ -73,7 +72,7 @@
}
TEST_F(ProgramToIRUnaryTest, EmitExpression_Unary_Complement) {
- Func("my_func", utils::Empty, ty.u32(), utils::Vector{Return(1_u)});
+ Func("my_func", tint::Empty, ty.u32(), Vector{Return(1_u)});
auto* expr = Complement(Call("my_func"));
WrapInFunction(expr);
@@ -96,7 +95,7 @@
}
TEST_F(ProgramToIRUnaryTest, EmitExpression_Unary_Negation) {
- Func("my_func", utils::Empty, ty.i32(), utils::Vector{Return(1_i)});
+ Func("my_func", tint::Empty, ty.i32(), Vector{Return(1_i)});
auto* expr = Negation(Call("my_func"));
WrapInFunction(expr);
@@ -142,7 +141,7 @@
TEST_F(ProgramToIRUnaryTest, EmitExpression_Unary_Indirection) {
GlobalVar("v1", builtin::AddressSpace::kPrivate, ty.i32());
- utils::Vector stmts = {
+ Vector stmts = {
Decl(Let("v3", AddressOf("v1"))),
Assign(Deref("v3"), 42_i),
};
diff --git a/src/tint/lang/wgsl/reader/program_to_ir/var_test.cc b/src/tint/lang/wgsl/reader/program_to_ir/var_test.cc
index 1ecedad..2024db7 100644
--- a/src/tint/lang/wgsl/reader/program_to_ir/var_test.cc
+++ b/src/tint/lang/wgsl/reader/program_to_ir/var_test.cc
@@ -54,8 +54,7 @@
}
TEST_F(ProgramToIRVarTest, Emit_GlobalVar_GroupBinding) {
- GlobalVar("a", ty.u32(), builtin::AddressSpace::kStorage,
- utils::Vector{Group(2_u), Binding(3_u)});
+ GlobalVar("a", ty.u32(), builtin::AddressSpace::kStorage, Vector{Group(2_u), Binding(3_u)});
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
@@ -142,7 +141,7 @@
}
TEST_F(ProgramToIRVarTest, Emit_Var_Assign_ArrayOfArray_EvalOrder) {
- Func("f", utils::Vector{Param("p", ty.i32())}, ty.i32(), utils::Vector{Return("p")});
+ Func("f", Vector{Param("p", ty.i32())}, ty.i32(), Vector{Return("p")});
auto* lhs = //
IndexAccessor( //
@@ -193,7 +192,7 @@
}
TEST_F(ProgramToIRVarTest, Emit_Var_Assign_ArrayOfVec_EvalOrder) {
- Func("f", utils::Vector{Param("p", ty.i32())}, ty.i32(), utils::Vector{Return("p")});
+ Func("f", Vector{Param("p", ty.i32())}, ty.i32(), Vector{Return("p")});
auto* lhs = //
IndexAccessor( //
@@ -237,7 +236,7 @@
}
TEST_F(ProgramToIRVarTest, Emit_Var_Assign_ArrayOfMatrix_EvalOrder) {
- Func("f", utils::Vector{Param("p", ty.i32())}, ty.i32(), utils::Vector{Return("p")});
+ Func("f", Vector{Param("p", ty.i32())}, ty.i32(), Vector{Return("p")});
auto* lhs = //
IndexAccessor( //
@@ -307,7 +306,7 @@
}
TEST_F(ProgramToIRVarTest, Emit_Var_CompoundAssign_ArrayOfArray_EvalOrder) {
- Func("f", utils::Vector{Param("p", ty.i32())}, ty.i32(), utils::Vector{Return("p")});
+ Func("f", Vector{Param("p", ty.i32())}, ty.i32(), Vector{Return("p")});
auto* lhs = //
IndexAccessor( //
@@ -360,7 +359,7 @@
}
TEST_F(ProgramToIRVarTest, Emit_Var_CompoundAssign_ArrayOfMatrix_EvalOrder) {
- Func("f", utils::Vector{Param("p", ty.i32())}, ty.i32(), utils::Vector{Return("p")});
+ Func("f", Vector{Param("p", ty.i32())}, ty.i32(), Vector{Return("p")});
auto* lhs = //
IndexAccessor( //
diff --git a/src/tint/lang/wgsl/resolver/address_space_layout_validation_test.cc b/src/tint/lang/wgsl/resolver/address_space_layout_validation_test.cc
index 1dd70ab..361232e 100644
--- a/src/tint/lang/wgsl/resolver/address_space_layout_validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/address_space_layout_validation_test.cc
@@ -35,9 +35,9 @@
// var<storage> a : S;
Structure(Source{{12, 34}}, "S",
- utils::Vector{
- Member("a", ty.f32(), utils::Vector{MemberSize(5_a)}),
- Member(Source{{34, 56}}, "b", ty.f32(), utils::Vector{MemberAlign(1_i)}),
+ Vector{
+ Member("a", ty.f32(), Vector{MemberSize(5_a)}),
+ Member(Source{{34, 56}}, "b", ty.f32(), Vector{MemberAlign(1_i)}),
});
GlobalVar(Source{{78, 90}}, "a", ty("S"), builtin::AddressSpace::kStorage, Group(0_a),
@@ -65,9 +65,9 @@
// var<storage> a : S;
Structure(Source{{12, 34}}, "S",
- utils::Vector{
- Member("a", ty.f32(), utils::Vector{MemberSize(5_a)}),
- Member(Source{{34, 56}}, "b", ty.f32(), utils::Vector{MemberAlign(4_i)}),
+ Vector{
+ Member("a", ty.f32(), Vector{MemberSize(5_a)}),
+ Member(Source{{34, 56}}, "b", ty.f32(), Vector{MemberAlign(4_i)}),
});
GlobalVar(Source{{78, 90}}, "a", ty("S"), builtin::AddressSpace::kStorage, Group(0_a),
@@ -91,12 +91,12 @@
// var<uniform> a : Outer;
Structure(Source{{12, 34}}, "Inner",
- utils::Vector{
+ Vector{
Member("scalar", ty.i32()),
});
Structure(Source{{34, 56}}, "Outer",
- utils::Vector{
+ Vector{
Member("scalar", ty.f32()),
Member(Source{{56, 78}}, "inner", ty("Inner")),
});
@@ -135,14 +135,14 @@
// var<uniform> a : Outer;
Structure(Source{{12, 34}}, "Inner",
- utils::Vector{
+ Vector{
Member("scalar", ty.i32()),
});
Structure(Source{{34, 56}}, "Outer",
- utils::Vector{
+ Vector{
Member("scalar", ty.f32()),
- Member(Source{{56, 78}}, "inner", ty("Inner"), utils::Vector{MemberAlign(16_i)}),
+ Member(Source{{56, 78}}, "inner", ty("Inner"), Vector{MemberAlign(16_i)}),
});
GlobalVar(Source{{78, 90}}, "a", ty("Outer"), builtin::AddressSpace::kUniform, Group(0_a),
@@ -162,10 +162,10 @@
//
// @group(0) @binding(0)
// var<uniform> a : Outer;
- Alias("Inner", ty.array<f32, 10>(utils::Vector{Stride(16)}));
+ Alias("Inner", ty.array<f32, 10>(Vector{Stride(16)}));
Structure(Source{{12, 34}}, "Outer",
- utils::Vector{
+ Vector{
Member("scalar", ty.f32()),
Member(Source{{56, 78}}, "inner", ty("Inner")),
});
@@ -195,12 +195,12 @@
//
// @group(0) @binding(0)
// var<uniform> a : Outer;
- Alias("Inner", ty.array<f32, 10>(utils::Vector{Stride(16)}));
+ Alias("Inner", ty.array<f32, 10>(Vector{Stride(16)}));
Structure(Source{{12, 34}}, "Outer",
- utils::Vector{
+ Vector{
Member("scalar", ty.f32()),
- Member(Source{{34, 56}}, "inner", ty("Inner"), utils::Vector{MemberAlign(16_i)}),
+ Member(Source{{34, 56}}, "inner", ty("Inner"), Vector{MemberAlign(16_i)}),
});
GlobalVar(Source{{78, 90}}, "a", ty("Outer"), builtin::AddressSpace::kUniform, Group(0_a),
@@ -225,12 +225,12 @@
// var<uniform> a : Outer;
Structure(Source{{12, 34}}, "Inner",
- utils::Vector{
- Member("scalar", ty.i32(), utils::Vector{MemberAlign(1_i), MemberSize(5_a)}),
+ Vector{
+ Member("scalar", ty.i32(), Vector{MemberAlign(1_i), MemberSize(5_a)}),
});
Structure(Source{{34, 56}}, "Outer",
- utils::Vector{
+ Vector{
Member(Source{{56, 78}}, "inner", ty("Inner")),
Member(Source{{78, 90}}, "scalar", ty.i32()),
});
@@ -274,15 +274,15 @@
// var<uniform> a : Outer;
Structure(Source{{12, 34}}, "Inner",
- utils::Vector{
+ Vector{
Member("a", ty.i32()),
Member("b", ty.i32()),
Member("c", ty.i32()),
- Member("scalar", ty.i32(), utils::Vector{MemberAlign(1_i), MemberSize(5_a)}),
+ Member("scalar", ty.i32(), Vector{MemberAlign(1_i), MemberSize(5_a)}),
});
Structure(Source{{34, 56}}, "Outer",
- utils::Vector{
+ Vector{
Member(Source{{56, 78}}, "inner", ty("Inner")),
Member(Source{{78, 90}}, "scalar", ty.i32()),
});
@@ -325,14 +325,14 @@
// var<uniform> a : Outer;
Structure(Source{{12, 34}}, "Inner",
- utils::Vector{
- Member("scalar", ty.i32(), utils::Vector{MemberAlign(1_i), MemberSize(5_a)}),
+ Vector{
+ Member("scalar", ty.i32(), Vector{MemberAlign(1_i), MemberSize(5_a)}),
});
Structure(Source{{34, 56}}, "Outer",
- utils::Vector{
+ Vector{
Member(Source{{56, 78}}, "inner", ty("Inner")),
- Member(Source{{78, 90}}, "scalar", ty.i32(), utils::Vector{MemberAlign(16_i)}),
+ Member(Source{{78, 90}}, "scalar", ty.i32(), Vector{MemberAlign(16_i)}),
});
GlobalVar(Source{{22, 34}}, "a", ty("Outer"), builtin::AddressSpace::kUniform, Group(0_a),
@@ -351,7 +351,7 @@
// @group(0) @binding(0)
// var<uniform> a : ScalarPackedAtEndOfVec3;
- Structure("ScalarPackedAtEndOfVec3", utils::Vector{
+ Structure("ScalarPackedAtEndOfVec3", Vector{
Member("v", ty.vec3(ty.f32())),
Member("s", ty.f32()),
});
@@ -374,7 +374,7 @@
Enable(builtin::Extension::kF16);
- Structure("ScalarPackedAtEndOfVec3", utils::Vector{
+ Structure("ScalarPackedAtEndOfVec3", Vector{
Member("v", ty.vec3(ty.f16())),
Member("s", ty.f16()),
});
@@ -400,7 +400,7 @@
Alias("Inner", ty.array<f32, 10>());
Structure(Source{{12, 34}}, "Outer",
- utils::Vector{
+ Vector{
Member("inner", ty(Source{{34, 56}}, "Inner")),
Member("scalar", ty.i32()),
});
@@ -434,7 +434,7 @@
Alias("Inner", ty.array<vec2<f32>, 10>());
Structure(Source{{12, 34}}, "Outer",
- utils::Vector{
+ Vector{
Member("inner", ty(Source{{34, 56}}, "Inner")),
Member("scalar", ty.i32()),
});
@@ -470,14 +470,14 @@
// @group(0) @binding(0)
// var<uniform> a : Outer;
- auto* array_elem = Structure("ArrayElem", utils::Vector{
+ auto* array_elem = Structure("ArrayElem", Vector{
Member("a", ty.f32()),
Member("b", ty.i32()),
});
Alias("Inner", ty.array(ty.Of(array_elem), 10_u));
Structure(Source{{12, 34}}, "Outer",
- utils::Vector{
+ Vector{
Member("inner", ty(Source{{34, 56}}, "Inner")),
Member("scalar", ty.i32()),
});
@@ -518,7 +518,7 @@
// var<uniform> a : array<Outer, 4u>;
Structure(Source{{12, 34}}, "Outer",
- utils::Vector{
+ Vector{
Member("inner", ty.array(Source{{34, 56}}, ty.array<f32, 4>(), 4_u)),
});
@@ -547,10 +547,10 @@
// @group(0) @binding(0)
// var<uniform> a : Outer;
- Alias("Inner", ty.array<f32, 10>(utils::Vector{Stride(16)}));
+ Alias("Inner", ty.array<f32, 10>(Vector{Stride(16)}));
Structure(Source{{12, 34}}, "Outer",
- utils::Vector{
+ Vector{
Member("inner", ty(Source{{34, 56}}, "Inner")),
Member("scalar", ty.i32()),
});
@@ -570,10 +570,9 @@
// };
// var<push_constant> a : S;
Enable(builtin::Extension::kChromiumExperimentalPushConstant);
- Structure(
- Source{{12, 34}}, "S",
- utils::Vector{Member("a", ty.f32(), utils::Vector{MemberSize(5_a)}),
- Member(Source{{34, 56}}, "b", ty.f32(), utils::Vector{MemberAlign(1_i)})});
+ Structure(Source{{12, 34}}, "S",
+ Vector{Member("a", ty.f32(), Vector{MemberSize(5_a)}),
+ Member(Source{{34, 56}}, "b", ty.f32(), Vector{MemberAlign(1_i)})});
GlobalVar(Source{{78, 90}}, "a", ty("S"), builtin::AddressSpace::kPushConstant);
ASSERT_FALSE(r()->Resolve());
@@ -597,8 +596,8 @@
// };
// var<push_constant> a : S;
Enable(builtin::Extension::kChromiumExperimentalPushConstant);
- Structure("S", utils::Vector{Member("a", ty.f32(), utils::Vector{MemberSize(5_a)}),
- Member("b", ty.f32(), utils::Vector{MemberAlign(4_i)})});
+ Structure("S", Vector{Member("a", ty.f32(), Vector{MemberSize(5_a)}),
+ Member("b", ty.f32(), Vector{MemberAlign(4_i)})});
GlobalVar("a", ty("S"), builtin::AddressSpace::kPushConstant);
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -622,12 +621,12 @@
Enable(builtin::Extension::kChromiumInternalRelaxedUniformLayout);
Structure(Source{{12, 34}}, "Inner",
- utils::Vector{
+ Vector{
Member("scalar", ty.i32()),
});
Structure(Source{{34, 56}}, "Outer",
- utils::Vector{
+ Vector{
Member("scalar", ty.f32()),
Member(Source{{56, 78}}, "inner", ty("Inner")),
});
@@ -653,10 +652,10 @@
Enable(builtin::Extension::kChromiumInternalRelaxedUniformLayout);
- Alias("Inner", ty.array<f32, 10>(utils::Vector{Stride(16)}));
+ Alias("Inner", ty.array<f32, 10>(Vector{Stride(16)}));
Structure(Source{{12, 34}}, "Outer",
- utils::Vector{
+ Vector{
Member("scalar", ty.f32()),
Member(Source{{56, 78}}, "inner", ty("Inner")),
});
@@ -685,12 +684,12 @@
Enable(builtin::Extension::kChromiumInternalRelaxedUniformLayout);
Structure(Source{{12, 34}}, "Inner",
- utils::Vector{
- Member("scalar", ty.i32(), utils::Vector{MemberAlign(1_i), MemberSize(5_a)}),
+ Vector{
+ Member("scalar", ty.i32(), Vector{MemberAlign(1_i), MemberSize(5_a)}),
});
Structure(Source{{34, 56}}, "Outer",
- utils::Vector{
+ Vector{
Member(Source{{56, 78}}, "inner", ty("Inner")),
Member(Source{{78, 90}}, "scalar", ty.i32()),
});
@@ -714,7 +713,7 @@
Enable(builtin::Extension::kChromiumInternalRelaxedUniformLayout);
Structure(Source{{12, 34}}, "Outer",
- utils::Vector{
+ Vector{
Member("arr", ty.array<f32, 10>()),
});
@@ -739,7 +738,7 @@
Enable(builtin::Extension::kChromiumInternalRelaxedUniformLayout);
Structure(Source{{12, 34}}, "Outer",
- utils::Vector{
+ Vector{
Member("arr", ty.array<vec3<f16>, 10>()),
});
diff --git a/src/tint/lang/wgsl/resolver/address_space_validation_test.cc b/src/tint/lang/wgsl/resolver/address_space_validation_test.cc
index 521d60c..826507e 100644
--- a/src/tint/lang/wgsl/resolver/address_space_validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/address_space_validation_test.cc
@@ -79,7 +79,7 @@
TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_Private_RuntimeArrayInStruct) {
// struct S { m : array<i32> };
// var<private> v : S;
- Structure("S", utils::Vector{Member(Source{{12, 34}}, "m", ty.array(ty.i32()))});
+ Structure("S", Vector{Member(Source{{12, 34}}, "m", ty.array(ty.i32()))});
GlobalVar(Source{{56, 78}}, "v", ty("S"), builtin::AddressSpace::kPrivate);
EXPECT_FALSE(r()->Resolve());
@@ -92,7 +92,7 @@
TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_Private_RuntimeArrayInStruct) {
// struct S { m : array<i32> };
// type t = ptr<private, S>;
- Structure("S", utils::Vector{Member(Source{{12, 34}}, "m", ty.array(ty.i32()))});
+ Structure("S", Vector{Member(Source{{12, 34}}, "m", ty.array(ty.i32()))});
Alias("t", ty.ptr<private_>(ty("S")));
EXPECT_FALSE(r()->Resolve());
@@ -126,7 +126,7 @@
TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_Workgroup_RuntimeArrayInStruct) {
// struct S { m : array<i32> };
// var<workgroup> v : S;
- Structure("S", utils::Vector{Member(Source{{12, 34}}, "m", ty.array(ty.i32()))});
+ Structure("S", Vector{Member(Source{{12, 34}}, "m", ty.array(ty.i32()))});
GlobalVar(Source{{56, 78}}, "v", ty("S"), builtin::AddressSpace::kWorkgroup);
EXPECT_FALSE(r()->Resolve());
@@ -139,7 +139,7 @@
TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_Workgroup_RuntimeArrayInStruct) {
// struct S { m : array<i32> };
// type t = ptr<workgroup, S>;
- Structure("S", utils::Vector{Member(Source{{12, 34}}, "m", ty.array(ty.i32()))});
+ Structure("S", Vector{Member(Source{{12, 34}}, "m", ty.array(ty.i32()))});
Alias(Source{{56, 78}}, "t", ty.ptr<workgroup>(ty("S")));
EXPECT_FALSE(r()->Resolve());
@@ -319,7 +319,7 @@
TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_Storage_ArrayF32) {
// struct S{ a : f32 };
// var<storage, read> g : array<S, 3u>;
- Structure("S", utils::Vector{Member("a", ty.f32())});
+ Structure("S", Vector{Member("a", ty.f32())});
GlobalVar("g", ty.array(ty("S"), 3_u), builtin::AddressSpace::kStorage, builtin::Access::kRead,
Binding(0_a), Group(0_a));
@@ -329,7 +329,7 @@
TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_Storage_ArrayF32) {
// struct S{ a : f32 };
// type t = ptr<storage, array<S, 3u>>;
- Structure("S", utils::Vector{Member("a", ty.f32())});
+ Structure("S", Vector{Member("a", ty.f32())});
Alias("t", ty.ptr<storage>(ty.array(ty("S"), 3_u)));
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -341,7 +341,7 @@
// var<storage, read> g : array<S, 3u>;
Enable(builtin::Extension::kF16);
- Structure("S", utils::Vector{Member("a", ty.f16())});
+ Structure("S", Vector{Member("a", ty.f16())});
GlobalVar("g", ty.array(ty("S"), 3_u), builtin::AddressSpace::kStorage, builtin::Access::kRead,
Binding(0_a), Group(0_a));
@@ -354,7 +354,7 @@
// type t = ptr<storage, array<S, 3u>, read>;
Enable(builtin::Extension::kF16);
- Structure("S", utils::Vector{Member("a", ty.f16())});
+ Structure("S", Vector{Member("a", ty.f16())});
Alias("t", ty.ptr<storage, read>(ty.array(ty("S"), 3_u)));
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -363,7 +363,7 @@
TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_Storage_StructI32) {
// struct S { x : i32 };
// var<storage, read> g : S;
- Structure("S", utils::Vector{Member("x", ty.i32())});
+ Structure("S", Vector{Member("x", ty.i32())});
GlobalVar("g", ty("S"), builtin::AddressSpace::kStorage, builtin::Access::kRead, Binding(0_a),
Group(0_a));
@@ -373,7 +373,7 @@
TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_Storage_StructI32) {
// struct S { x : i32 };
// type t = ptr<storage, S, read>;
- Structure("S", utils::Vector{Member("x", ty.i32())});
+ Structure("S", Vector{Member("x", ty.i32())});
Alias("t", ty.ptr<storage, read>(ty("S")));
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -383,7 +383,7 @@
// struct S { x : i32 };
// type a1 = S;
// var<storage, read> g : a1;
- Structure("S", utils::Vector{Member("x", ty.i32())});
+ Structure("S", Vector{Member("x", ty.i32())});
Alias("a1", ty("S"));
Alias("a2", ty("a1"));
GlobalVar("g", ty("a2"), builtin::AddressSpace::kStorage, builtin::Access::kRead, Binding(0_a),
@@ -396,7 +396,7 @@
// struct S { x : i32 };
// type a1 = S;
// type t = ptr<storage, a1, read>;
- Structure("S", utils::Vector{Member("x", ty.i32())});
+ Structure("S", Vector{Member("x", ty.i32())});
Alias("a1", ty("S"));
Alias("a2", ty("a1"));
Alias("t", ty.ptr<storage, read>(ty("a2")));
@@ -409,7 +409,7 @@
// var<storage, read> g : S;
Enable(builtin::Extension::kF16);
- Structure("S", utils::Vector{Member("x", ty.f16())});
+ Structure("S", Vector{Member("x", ty.f16())});
GlobalVar("g", ty("S"), builtin::AddressSpace::kStorage, builtin::Access::kRead, Binding(0_a),
Group(0_a));
@@ -421,7 +421,7 @@
// type t = ptr<storage, S, read>;
Enable(builtin::Extension::kF16);
- Structure("S", utils::Vector{Member("x", ty.f16())});
+ Structure("S", Vector{Member("x", ty.f16())});
Alias("t", ty.ptr<storage, read>(ty("S")));
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -433,7 +433,7 @@
// var<storage, read> g : a1;
Enable(builtin::Extension::kF16);
- Structure("S", utils::Vector{Member("x", ty.f16())});
+ Structure("S", Vector{Member("x", ty.f16())});
Alias("a1", ty("S"));
Alias("a2", ty("a1"));
GlobalVar("g", ty("a2"), builtin::AddressSpace::kStorage, builtin::Access::kRead, Binding(0_a),
@@ -448,7 +448,7 @@
// type t = ptr<storage, a1, read>;
Enable(builtin::Extension::kF16);
- Structure("S", utils::Vector{Member("x", ty.f16())});
+ Structure("S", Vector{Member("x", ty.f16())});
Alias("a1", ty("S"));
Alias("a2", ty("a1"));
Alias("g", ty.ptr<storage, read>(ty("a2")));
@@ -534,8 +534,7 @@
// struct S { m: array<f32>; };
// @group(0) @binding(0) var<uniform> svar : S;
- Structure("S",
- utils::Vector{Member(Source{{56, 78}}, "m", ty.array(Source{{12, 34}}, ty.i32()))});
+ Structure("S", Vector{Member(Source{{56, 78}}, "m", ty.array(Source{{12, 34}}, ty.i32()))});
GlobalVar(Source{{90, 12}}, "svar", ty("S"), builtin::AddressSpace::kUniform, Binding(0_a),
Group(0_a));
@@ -551,8 +550,7 @@
// struct S { m: array<f32>; };
// type t = ptr<uniform, S>;
- Structure("S",
- utils::Vector{Member(Source{{56, 78}}, "m", ty.array(Source{{12, 34}}, ty.i32()))});
+ Structure("S", Vector{Member(Source{{56, 78}}, "m", ty.array(Source{{12, 34}}, ty.i32()))});
Alias("t", ty.ptr<uniform>(Source{{90, 12}}, ty("S")));
@@ -720,7 +718,7 @@
// @size(16) f : f32;
// }
// var<uniform> g : array<S, 3u>;
- Structure("S", utils::Vector{Member("a", ty.f32(), utils::Vector{MemberSize(16_a)})});
+ Structure("S", Vector{Member("a", ty.f32(), Vector{MemberSize(16_a)})});
GlobalVar("g", ty.array(ty("S"), 3_u), builtin::AddressSpace::kUniform, Binding(0_a),
Group(0_a));
@@ -732,7 +730,7 @@
// @size(16) f : f32;
// }
// type t = ptr<uniform, array<S, 3u>>;
- Structure("S", utils::Vector{Member("a", ty.f32(), utils::Vector{MemberSize(16_a)})});
+ Structure("S", Vector{Member("a", ty.f32(), Vector{MemberSize(16_a)})});
Alias("t", ty.ptr<uniform>(ty.array(ty("S"), 3_u)));
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -746,7 +744,7 @@
// var<uniform> g : array<S, 3u>;
Enable(builtin::Extension::kF16);
- Structure("S", utils::Vector{Member("a", ty.f16(), utils::Vector{MemberSize(16_a)})});
+ Structure("S", Vector{Member("a", ty.f16(), Vector{MemberSize(16_a)})});
GlobalVar("g", ty.array(ty("S"), 3_u), builtin::AddressSpace::kUniform, Binding(0_a),
Group(0_a));
@@ -761,7 +759,7 @@
// type t = ptr<uniform, array<S, 3u>>;
Enable(builtin::Extension::kF16);
- Structure("S", utils::Vector{Member("a", ty.f16(), utils::Vector{MemberSize(16_a)})});
+ Structure("S", Vector{Member("a", ty.f16(), Vector{MemberSize(16_a)})});
Alias("t", ty.ptr<uniform>(ty.array(ty("S"), 3_u)));
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -770,7 +768,7 @@
TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_UniformBufferStructI32) {
// struct S { x : i32 };
// var<uniform> g : S;
- Structure("S", utils::Vector{Member("x", ty.i32())});
+ Structure("S", Vector{Member("x", ty.i32())});
GlobalVar("g", ty("S"), builtin::AddressSpace::kUniform, Binding(0_a), Group(0_a));
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -779,7 +777,7 @@
TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_UniformBufferStructI32) {
// struct S { x : i32 };
// type t = ptr<uniform, S>;
- Structure("S", utils::Vector{Member("x", ty.i32())});
+ Structure("S", Vector{Member("x", ty.i32())});
Alias("t", ty.ptr<uniform>(ty("S")));
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -789,7 +787,7 @@
// struct S { x : i32 };
// type a1 = S;
// var<uniform> g : a1;
- Structure("S", utils::Vector{Member("x", ty.i32())});
+ Structure("S", Vector{Member("x", ty.i32())});
Alias("a1", ty("S"));
GlobalVar("g", ty("a1"), builtin::AddressSpace::kUniform, Binding(0_a), Group(0_a));
@@ -800,7 +798,7 @@
// struct S { x : i32 };
// type a1 = S;
// type t = ptr<uniform, a1>;
- Structure("S", utils::Vector{Member("x", ty.i32())});
+ Structure("S", Vector{Member("x", ty.i32())});
Alias("a1", ty("S"));
Alias("t", ty.ptr<uniform>(ty("a1")));
@@ -813,7 +811,7 @@
// var<uniform> g : S;
Enable(builtin::Extension::kF16);
- Structure("S", utils::Vector{Member("x", ty.f16())});
+ Structure("S", Vector{Member("x", ty.f16())});
GlobalVar("g", ty("S"), builtin::AddressSpace::kUniform, Binding(0_a), Group(0_a));
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -825,7 +823,7 @@
// type t = ptr<uniform, S>;
Enable(builtin::Extension::kF16);
- Structure("S", utils::Vector{Member("x", ty.f16())});
+ Structure("S", Vector{Member("x", ty.f16())});
Alias("t", ty.ptr<uniform>(ty("S")));
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -838,7 +836,7 @@
// var<uniform> g : a1;
Enable(builtin::Extension::kF16);
- Structure("S", utils::Vector{Member("x", ty.f16())});
+ Structure("S", Vector{Member("x", ty.f16())});
Alias("a1", ty("S"));
GlobalVar("g", ty("a1"), builtin::AddressSpace::kUniform, Binding(0_a), Group(0_a));
@@ -852,7 +850,7 @@
// type t = ptr<uniform, a1>;
Enable(builtin::Extension::kF16);
- Structure("S", utils::Vector{Member("x", ty.f16())});
+ Structure("S", Vector{Member("x", ty.f16())});
Alias("a1", ty("S"));
Alias("t", ty.ptr<uniform>(ty("a1")));
@@ -980,7 +978,7 @@
// struct S { a : f32}
// var<push_constant> g : array<S, 3u>;
Enable(builtin::Extension::kChromiumExperimentalPushConstant);
- Structure("S", utils::Vector{Member("a", ty.f32())});
+ Structure("S", Vector{Member("a", ty.f32())});
GlobalVar("g", ty.array(ty("S"), 3_u), builtin::AddressSpace::kPushConstant);
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -991,7 +989,7 @@
// struct S { a : f32}
// type t = ptr<push_constant, array<S, 3u>>;
Enable(builtin::Extension::kChromiumExperimentalPushConstant);
- Structure("S", utils::Vector{Member("a", ty.f32())});
+ Structure("S", Vector{Member("a", ty.f32())});
Alias("t", ty.ptr<push_constant>(ty.array(ty("S"), 3_u)));
ASSERT_TRUE(r()->Resolve()) << r()->error();
diff --git a/src/tint/lang/wgsl/resolver/alias_analysis_test.cc b/src/tint/lang/wgsl/resolver/alias_analysis_test.cc
index e429ecb..d0826b9 100644
--- a/src/tint/lang/wgsl/resolver/alias_analysis_test.cc
+++ b/src/tint/lang/wgsl/resolver/alias_analysis_test.cc
@@ -43,7 +43,7 @@
class TwoPointers : public ResolverTestWithParam<TwoPointerConfig> {
protected:
void SetUp() override {
- utils::Vector<const ast::Statement*, 4> body;
+ Vector<const ast::Statement*, 4> body;
if (GetParam().address_space == builtin::AddressSpace::kFunction) {
body.Push(Decl(Var("v1", ty.i32())));
body.Push(Decl(Var("v2", ty.i32())));
@@ -53,13 +53,13 @@
}
body.Push(CallStmt(Call("target", AddressOf(Source{{12, 34}}, "v1"),
AddressOf(Source{{56, 78}}, GetParam().aliased ? "v1" : "v2"))));
- Func("caller", utils::Empty, ty.void_(), body);
+ Func("caller", tint::Empty, ty.void_(), body);
}
- void Run(utils::Vector<const ast::Statement*, 4>&& body, const char* err = nullptr) {
+ void Run(Vector<const ast::Statement*, 4>&& body, const char* err = nullptr) {
auto addrspace = GetParam().address_space;
Func("target",
- utils::Vector{
+ Vector{
Param("p1", ty.ptr<i32>(addrspace)),
Param("p2", ty.ptr<i32>(addrspace)),
},
@@ -129,22 +129,22 @@
//
// f1(p1, p2);
Func("f2",
- utils::Vector{
+ Vector{
Param("p1", ty.ptr<i32>(GetParam().address_space)),
Param("p2", ty.ptr<i32>(GetParam().address_space)),
},
ty.void_(),
- utils::Vector{
+ Vector{
Assign(Phony(), Deref("p1")),
Assign(Deref("p2"), 42_a),
});
Func("f1",
- utils::Vector{
+ Vector{
Param("p1", ty.ptr<i32>(GetParam().address_space)),
Param("p2", ty.ptr<i32>(GetParam().address_space)),
},
ty.void_(),
- utils::Vector{
+ Vector{
CallStmt(Call("f2", "p1", "p2")),
});
Run(
@@ -166,19 +166,19 @@
// f1(p1);
// f2(p2);
Func("f1",
- utils::Vector<const ast::Parameter*, 4>{
+ Vector<const ast::Parameter*, 4>{
Param("p1", ty.ptr<i32>(GetParam().address_space)),
},
ty.void_(),
- utils::Vector{
+ Vector{
Assign(Phony(), Deref("p1")),
});
Func("f2",
- utils::Vector<const ast::Parameter*, 4>{
+ Vector<const ast::Parameter*, 4>{
Param("p2", ty.ptr<i32>(GetParam().address_space)),
},
ty.void_(),
- utils::Vector{
+ Vector{
Assign(Deref("p2"), 42_a),
});
Run(
@@ -198,7 +198,7 @@
TwoPointerConfig{builtin::AddressSpace::kPrivate, false},
TwoPointerConfig{builtin::AddressSpace::kPrivate, true}),
[](const ::testing::TestParamInfo<TwoPointers::ParamType>& p) {
- utils::StringStream ss;
+ StringStream ss;
ss << (p.param.aliased ? "Aliased" : "Unaliased") << "_"
<< p.param.address_space;
return ss.str();
@@ -219,16 +219,16 @@
void SetUp() override {
GlobalVar("global_1", builtin::AddressSpace::kPrivate, ty.i32());
GlobalVar("global_2", builtin::AddressSpace::kPrivate, ty.i32());
- Func("caller", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("caller", tint::Empty, ty.void_(),
+ Vector{
CallStmt(Call("target",
AddressOf(Source{{12, 34}}, GetParam() ? "global_1" : "global_2"))),
});
}
- void Run(utils::Vector<const ast::Statement*, 4>&& body, const char* err = nullptr) {
+ void Run(Vector<const ast::Statement*, 4>&& body, const char* err = nullptr) {
Func("target",
- utils::Vector<const ast::Parameter*, 4>{
+ Vector<const ast::Parameter*, 4>{
Param("p1", ty.ptr<i32>(builtin::AddressSpace::kPrivate)),
},
ty.void_(), std::move(body));
@@ -297,19 +297,19 @@
//
// f1(p1);
Func("f2",
- utils::Vector<const ast::Parameter*, 4>{
+ Vector<const ast::Parameter*, 4>{
Param("p1", ty.ptr<i32>(builtin::AddressSpace::kPrivate)),
},
ty.void_(),
- utils::Vector{
+ Vector{
Assign(Deref("p1"), 42_a),
});
Func("f1",
- utils::Vector<const ast::Parameter*, 4>{
+ Vector<const ast::Parameter*, 4>{
Param("p1", ty.ptr<i32>(builtin::AddressSpace::kPrivate)),
},
ty.void_(),
- utils::Vector{
+ Vector{
Assign(Phony(), Deref("p1")),
CallStmt(Call("f2", AddressOf(Source{{56, 78}}, "global_1"))),
});
@@ -332,20 +332,20 @@
//
// f1(p1);
Func("f2",
- utils::Vector<const ast::Parameter*, 4>{
+ Vector<const ast::Parameter*, 4>{
Param("p1", ty.ptr<i32>(builtin::AddressSpace::kPrivate)),
},
ty.void_(),
- utils::Vector{
+ Vector{
Assign(Phony(), Deref("p1")),
Assign(Expr(Source{{56, 78}}, "global_1"), 42_a),
});
Func("f1",
- utils::Vector<const ast::Parameter*, 4>{
+ Vector<const ast::Parameter*, 4>{
Param("p1", ty.ptr<i32>(builtin::AddressSpace::kPrivate)),
},
ty.void_(),
- utils::Vector{
+ Vector{
CallStmt(Call("f2", "p1")),
});
Run(
@@ -367,19 +367,19 @@
//
// f1(p1);
Func("f2",
- utils::Vector<const ast::Parameter*, 4>{
+ Vector<const ast::Parameter*, 4>{
Param("p1", ty.ptr<i32>(builtin::AddressSpace::kPrivate)),
},
ty.void_(),
- utils::Vector{
+ Vector{
Assign(Phony(), Deref("p1")),
});
Func("f1",
- utils::Vector<const ast::Parameter*, 4>{
+ Vector<const ast::Parameter*, 4>{
Param("p1", ty.ptr<i32>(builtin::AddressSpace::kPrivate)),
},
ty.void_(),
- utils::Vector{
+ Vector{
Assign(Deref("p1"), 42_a),
CallStmt(Call("f2", AddressOf(Source{{56, 78}}, "global_1"))),
});
@@ -402,20 +402,20 @@
//
// f1(p1);
Func("f2",
- utils::Vector{
+ Vector{
Param("p1", ty.ptr<i32>(builtin::AddressSpace::kPrivate)),
},
ty.void_(),
- utils::Vector{
+ Vector{
Assign(Deref("p1"), 42_a),
Assign(Phony(), Expr(Source{{56, 78}}, "global_1")),
});
Func("f1",
- utils::Vector{
+ Vector{
Param("p1", ty.ptr<i32>(builtin::AddressSpace::kPrivate)),
},
ty.void_(),
- utils::Vector{
+ Vector{
CallStmt(Call("f2", "p1")),
});
Run(
@@ -437,15 +437,15 @@
// f1(p1);
// f2();
Func("f1",
- utils::Vector{
+ Vector{
Param("p1", ty.ptr<i32>(builtin::AddressSpace::kPrivate)),
},
ty.void_(),
- utils::Vector{
+ Vector{
Assign(Phony(), Deref("p1")),
});
- Func("f2", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f2", tint::Empty, ty.void_(),
+ Vector{
Assign(Expr(Source{{56, 78}}, "global_1"), 42_a),
});
Run(
@@ -478,8 +478,8 @@
class Use : public ResolverTestWithParam<bool> {
protected:
void SetUp() override {
- Func("caller", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("caller", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v1", ty.i32())),
Decl(Var("v2", ty.i32())),
CallStmt(Call("target", AddressOf(Source{{12, 34}}, "v1"),
@@ -489,12 +489,12 @@
void Run(const ast::Statement* stmt, const char* err = nullptr) {
Func("target",
- utils::Vector{
+ Vector{
Param("p1", ty.ptr<i32>(builtin::AddressSpace::kFunction)),
Param("p2", ty.ptr<i32>(builtin::AddressSpace::kFunction)),
},
ty.void_(),
- utils::Vector{
+ Vector{
Assign(Deref("p1"), 42_a),
stmt,
});
@@ -604,11 +604,11 @@
// fn foo(p : ptr<function, i32>) -> i32 { return *p; }
// foo(p2);
Func("foo",
- utils::Vector{
+ Vector{
Param("p", ty.ptr<i32>(builtin::AddressSpace::kFunction)),
},
ty.i32(),
- utils::Vector{
+ Vector{
Return(Deref("p")),
});
Run(Assign(Phony(), Call("foo", "p2")), R"(56:78 error: invalid aliased pointer argument
@@ -617,7 +617,7 @@
TEST_P(Use, Read_Switch) {
// Switch (*p2) { default {} }
- Run(Switch(Deref("p2"), utils::Vector{DefaultCase(Block())}),
+ Run(Switch(Deref("p2"), Vector{DefaultCase(Block())}),
R"(56:78 error: invalid aliased pointer argument
12:34 note: aliases with another argument passed here)");
}
@@ -650,8 +650,8 @@
class UseBool : public ResolverTestWithParam<bool> {
protected:
void SetUp() override {
- Func("caller", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("caller", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v1", ty.bool_())),
Decl(Var("v2", ty.bool_())),
CallStmt(Call("target", AddressOf(Source{{12, 34}}, "v1"),
@@ -661,12 +661,12 @@
void Run(const ast::Statement* stmt, const char* err = nullptr) {
Func("target",
- utils::Vector{
+ Vector{
Param("p1", ty.ptr<bool>(builtin::AddressSpace::kFunction)),
Param("p2", ty.ptr<bool>(builtin::AddressSpace::kFunction)),
},
ty.void_(),
- utils::Vector{
+ Vector{
Assign(Deref("p1"), true),
stmt,
});
@@ -724,19 +724,19 @@
// var v : S;
// f2(&v, &v);
// }
- Structure("S", utils::Vector{Member("a", ty.i32())});
+ Structure("S", Vector{Member("a", ty.i32())});
Func("f2",
- utils::Vector{
+ Vector{
Param("p1", ty.ptr<function>(ty("S"))),
Param("p2", ty.ptr<function>(ty("S"))),
},
ty.void_(),
- utils::Vector{
+ Vector{
Decl(Let("newp", AddressOf(MemberAccessor(Deref("p2"), "a")))),
Assign(MemberAccessor(Deref("p1"), "a"), 42_a),
});
- Func("f1", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f1", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v", ty("S"))),
CallStmt(Call("f2", AddressOf("v"), AddressOf("v"))),
});
@@ -753,19 +753,19 @@
// var v : S;
// f2(&v, &v);
// }
- Structure("S", utils::Vector{Member("a", ty.i32())});
+ Structure("S", Vector{Member("a", ty.i32())});
Func("f2",
- utils::Vector{
+ Vector{
Param("p1", ty.ptr<function>(ty("S"))),
Param("p2", ty.ptr<function>(ty("S"))),
},
ty.void_(),
- utils::Vector{
+ Vector{
Assign(Phony(), MemberAccessor(Deref("p2"), "a")),
Assign(Deref("p1"), Call("S")),
});
- Func("f1", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f1", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v", ty("S"))),
CallStmt(
Call("f2", AddressOf(Source{{12, 34}}, "v"), AddressOf(Source{{56, 76}}, "v"))),
@@ -785,19 +785,19 @@
// var v : S;
// f2(&v, &v);
// }
- Structure("S", utils::Vector{Member("a", ty.i32())});
+ Structure("S", Vector{Member("a", ty.i32())});
Func("f2",
- utils::Vector{
+ Vector{
Param("p1", ty.ptr<function>(ty("S"))),
Param("p2", ty.ptr<function>(ty("S"))),
},
ty.void_(),
- utils::Vector{
+ Vector{
Assign(Phony(), Deref("p2")),
Assign(MemberAccessor(Deref("p1"), "a"), 42_a),
});
- Func("f1", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f1", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v", ty("S"))),
CallStmt(
Call("f2", AddressOf(Source{{12, 34}}, "v"), AddressOf(Source{{56, 76}}, "v"))),
@@ -816,19 +816,19 @@
// var v : vec4<f32>;
// f2(&v, &v);
// }
- Structure("S", utils::Vector{Member("a", ty.i32())});
+ Structure("S", Vector{Member("a", ty.i32())});
Func("f2",
- utils::Vector{
+ Vector{
Param("p1", ty.ptr<function, vec4<f32>>()),
Param("p2", ty.ptr<function, vec4<f32>>()),
},
ty.void_(),
- utils::Vector{
+ Vector{
Assign(Phony(), MemberAccessor(Deref("p2"), "zy")),
Assign(Deref("p1"), Call<vec4<f32>>()),
});
- Func("f1", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f1", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v", ty.vec4<f32>())),
CallStmt(
Call("f2", AddressOf(Source{{12, 34}}, "v"), AddressOf(Source{{56, 76}}, "v"))),
@@ -850,17 +850,17 @@
// f1(&v);
// }
Func("f1",
- utils::Vector{
+ Vector{
Param("p", ty.ptr<i32>(builtin::AddressSpace::kFunction)),
},
ty.void_(),
- utils::Vector{
+ Vector{
Decl(Var("v", ty.i32())),
Assign(Phony(), Deref("p")),
Assign(Deref("p"), 42_a),
});
- Func("f2", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f2", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v", ty.i32())),
CallStmt(Call("f1", AddressOf("v"))),
});
@@ -877,8 +877,8 @@
// *p1 = 42;
// *p2 = 42;
// }
- Func("f1", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f1", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v", ty.i32())),
Decl(Let("p1", AddressOf("v"))),
Decl(Let("p2", AddressOf("v"))),
@@ -903,23 +903,23 @@
// f3(&v);
// }
Func("f2",
- utils::Vector{
+ Vector{
Param("p", ty.ptr<i32>(builtin::AddressSpace::kFunction)),
},
ty.void_(),
- utils::Vector{
+ Vector{
Assign(Deref("p"), 42_a),
});
Func("f3",
- utils::Vector{
+ Vector{
Param("p", ty.ptr<i32>(builtin::AddressSpace::kFunction)),
},
ty.void_(),
- utils::Vector{
+ Vector{
Assign(Deref("p"), 42_a),
});
- Func("f1", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f1", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v", ty.i32())),
CallStmt(Call("f2", AddressOf("v"))),
CallStmt(Call("f3", AddressOf("v"))),
diff --git a/src/tint/lang/wgsl/resolver/array_accessor_test.cc b/src/tint/lang/wgsl/resolver/array_accessor_test.cc
index 99b56d1..bc42921 100644
--- a/src/tint/lang/wgsl/resolver/array_accessor_test.cc
+++ b/src/tint/lang/wgsl/resolver/array_accessor_test.cc
@@ -262,8 +262,8 @@
auto* idx = Var("idx", ty.i32(), Call<i32>());
auto* acc = IndexAccessor("a", Expr(Source{{12, 34}}, idx));
auto* f = Var("f", ty.f32(), acc);
- Func("my_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("my_func", tint::Empty, ty.void_(),
+ Vector{
Decl(a),
Decl(idx),
Decl(f),
@@ -283,8 +283,8 @@
// var f : f32 = a[2.0f];
auto* a = Let("a", ty.array<f32, 3>(), Call<array<f32, 3>>());
auto* f = Var("a_2", ty.f32(), IndexAccessor("a", Expr(Source{{12, 34}}, 2_f)));
- Func("my_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("my_func", tint::Empty, ty.void_(),
+ Vector{
Decl(a),
Decl(f),
});
@@ -298,8 +298,8 @@
auto* a = Let("a", ty.array<f32, 3>(), Call<array<f32, 3>>());
auto* acc = IndexAccessor("a", 2_i);
auto* f = Var("a_2", ty.f32(), acc);
- Func("my_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("my_func", tint::Empty, ty.void_(),
+ Vector{
Decl(a),
Decl(f),
});
@@ -322,7 +322,7 @@
auto* star_p = Deref(p);
auto* acc = IndexAccessor(Source{{12, 34}}, star_p, idx);
auto* x = Var("x", ty.f32(), acc);
- Func("func", utils::Vector{p}, ty.f32(), utils::Vector{Decl(idx), Decl(x), Return(x)});
+ Func("func", Vector{p}, ty.f32(), Vector{Decl(idx), Decl(x), Return(x)});
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -343,7 +343,7 @@
auto* accessor_expr = IndexAccessor(Source{{12, 34}}, p, idx);
auto* star_p = Deref(accessor_expr);
auto* x = Var("x", ty.f32(), star_p);
- Func("func", utils::Vector{p}, ty.f32(), utils::Vector{Decl(idx), Decl(x), Return(x)});
+ Func("func", Vector{p}, ty.f32(), Vector{Decl(idx), Decl(x), Return(x)});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
diff --git a/src/tint/lang/wgsl/resolver/assignment_validation_test.cc b/src/tint/lang/wgsl/resolver/assignment_validation_test.cc
index 7e8862f..8e991d6 100644
--- a/src/tint/lang/wgsl/resolver/assignment_validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/assignment_validation_test.cc
@@ -31,7 +31,7 @@
// struct S { m : i32 };
// @group(0) @binding(0)
// var<storage,read> a : S;
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("m", ty.i32()),
});
GlobalVar(Source{{12, 34}}, "a", ty.Of(s), builtin::AddressSpace::kStorage,
@@ -255,8 +255,8 @@
}
TEST_F(ResolverAssignmentValidationTest, AssignToParam_Fail) {
- Func("foo", utils::Vector{Param(Source{{56, 78}}, "arg", ty.i32())}, ty.void_(),
- utils::Vector{
+ Func("foo", Vector{Param(Source{{56, 78}}, "arg", ty.i32())}, ty.void_(),
+ Vector{
Assign(Expr(Source{{12, 34}}, "arg"), Expr(1_i)),
Return(),
});
@@ -274,7 +274,7 @@
// let a : S;
// a.i = 2i
// }
- Structure("S", utils::Vector{Member("i", ty.i32())});
+ Structure("S", Vector{Member("i", ty.i32())});
WrapInFunction(Let(Source{{98, 76}}, "a", ty("S"), Call("S")), //
Assign(MemberAccessor(Source{{12, 34}}, Expr(Source{{56, 78}}, "a"), "i"), 2_i));
@@ -308,7 +308,7 @@
// @group(0) @binding(0) var<storage, read_write> v : S;
// v.a = v.a;
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("a", ty.atomic(ty.i32())),
});
GlobalVar(Source{{12, 34}}, "v", ty.Of(s), builtin::AddressSpace::kStorage,
@@ -325,7 +325,7 @@
// @group(0) @binding(0) var<storage, read_write> v : S;
// v.a = v.a;
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("a", ty.array(ty.f32())),
});
GlobalVar(Source{{12, 34}}, "v", ty.Of(s), builtin::AddressSpace::kStorage,
@@ -345,7 +345,7 @@
// fn f() {
// _ = s;
// }
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("arr", ty.array<i32>()),
});
GlobalVar("s", ty.Of(s), builtin::AddressSpace::kStorage, Group(0_a), Binding(0_a));
@@ -367,7 +367,7 @@
// fn f() {
// _ = s.arr;
// }
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("arr", ty.array<i32>()),
});
GlobalVar("s", ty.Of(s), builtin::AddressSpace::kStorage, Group(0_a), Binding(0_a));
@@ -413,11 +413,11 @@
// _ = wg;
// _ = wg[3i];
// }
- auto* S = Structure("S", utils::Vector{
+ auto* S = Structure("S", Vector{
Member("i", ty.i32()),
Member("arr", ty.array<i32>()),
});
- auto* U = Structure("U", utils::Vector{
+ auto* U = Structure("U", Vector{
Member("i", ty.i32()),
});
GlobalVar("tex", ty.sampled_texture(type::TextureDimension::k2d, ty.f32()), Group(0_a),
diff --git a/src/tint/lang/wgsl/resolver/atomics_test.cc b/src/tint/lang/wgsl/resolver/atomics_test.cc
index 905c75f..798bedf 100644
--- a/src/tint/lang/wgsl/resolver/atomics_test.cc
+++ b/src/tint/lang/wgsl/resolver/atomics_test.cc
@@ -49,7 +49,7 @@
}
TEST_F(ResolverAtomicTest, GlobalStorageStruct) {
- auto* s = Structure("s", utils::Vector{Member("a", ty.atomic(Source{{12, 34}}, ty.i32()))});
+ auto* s = Structure("s", Vector{Member("a", ty.atomic(Source{{12, 34}}, ty.i32()))});
auto* g = GlobalVar("g", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(0_a), Group(0_a));
diff --git a/src/tint/lang/wgsl/resolver/atomics_validation_test.cc b/src/tint/lang/wgsl/resolver/atomics_validation_test.cc
index 27ac167..859d614 100644
--- a/src/tint/lang/wgsl/resolver/atomics_validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/atomics_validation_test.cc
@@ -40,7 +40,7 @@
}
TEST_F(ResolverAtomicValidationTest, AddressSpace_Storage_Struct) {
- auto* s = Structure("s", utils::Vector{Member(Source{{12, 34}}, "a", ty.atomic(ty.i32()))});
+ auto* s = Structure("s", Vector{Member(Source{{12, 34}}, "a", ty.atomic(ty.i32()))});
GlobalVar("g", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
Group(0_a), Binding(0_a));
@@ -71,7 +71,7 @@
}
TEST_F(ResolverAtomicValidationTest, InvalidAddressSpace_Struct) {
- auto* s = Structure("s", utils::Vector{Member("a", ty.atomic(ty.i32()))});
+ auto* s = Structure("s", Vector{Member("a", ty.atomic(ty.i32()))});
GlobalVar(Source{{56, 78}}, "g", ty.Of(s), builtin::AddressSpace::kPrivate);
EXPECT_FALSE(r()->Resolve());
@@ -85,9 +85,8 @@
// struct Outer { m : array<Inner, 4>; };
// var<private> g : Outer;
- auto* Inner =
- Structure("Inner", utils::Vector{Member("m", ty.atomic(Source{{12, 34}}, ty.i32()))});
- auto* Outer = Structure("Outer", utils::Vector{Member("m", ty.Of(Inner))});
+ auto* Inner = Structure("Inner", Vector{Member("m", ty.atomic(Source{{12, 34}}, ty.i32()))});
+ auto* Outer = Structure("Outer", Vector{Member("m", ty.Of(Inner))});
GlobalVar(Source{{56, 78}}, "g", ty.Of(Outer), builtin::AddressSpace::kPrivate);
EXPECT_FALSE(r()->Resolve());
@@ -101,9 +100,8 @@
// struct Outer { m : array<Inner, 4>; };
// var<private> g : Outer;
- auto* Inner =
- Structure("Inner", utils::Vector{Member(Source{{12, 34}}, "m", ty.atomic(ty.i32()))});
- auto* Outer = Structure("Outer", utils::Vector{Member("m", ty.Of(Inner))});
+ auto* Inner = Structure("Inner", Vector{Member(Source{{12, 34}}, "m", ty.atomic(ty.i32()))});
+ auto* Outer = Structure("Outer", Vector{Member("m", ty.Of(Inner))});
GlobalVar(Source{{56, 78}}, "g", ty.Of(Outer), builtin::AddressSpace::kPrivate);
EXPECT_FALSE(r()->Resolve());
@@ -131,7 +129,7 @@
// };
// var<private> v: array<S, 5u>;
- auto* s = Structure("S", utils::Vector{Member(Source{{12, 34}}, "m", ty.atomic<u32>())});
+ auto* s = Structure("S", Vector{Member(Source{{12, 34}}, "m", ty.atomic<u32>())});
GlobalVar(Source{{56, 78}}, "v", ty.array(ty.Of(s), 5_u), builtin::AddressSpace::kPrivate);
EXPECT_FALSE(r()->Resolve());
@@ -148,7 +146,7 @@
// var<private> v: array<S, 5u>;
auto* atomic_array = Alias("AtomicArray", ty.atomic(ty.i32()));
- auto* s = Structure("S", utils::Vector{Member(Source{{12, 34}}, "m", ty.Of(atomic_array))});
+ auto* s = Structure("S", Vector{Member(Source{{12, 34}}, "m", ty.Of(atomic_array))});
GlobalVar(Source{{56, 78}}, "v", ty.array(ty.Of(s), 5_u), builtin::AddressSpace::kPrivate);
EXPECT_FALSE(r()->Resolve());
@@ -177,17 +175,17 @@
auto array_atomic_u32_8 = ty.array(ty.atomic(ty.u32()), 8_u);
auto array_atomic_i32_4 = ty.array(ty.atomic(ty.i32()), 4_u);
- auto* s6 = Structure("S6", utils::Vector{Member("x", array_i32_4)});
- auto* s5 = Structure("S5", utils::Vector{Member("x", ty.Of(s6)), //
- Member(Source{{12, 34}}, "y", ty.Of(atomic_array)), //
- Member("z", array_atomic_u32_8)}); //
- auto* s4 = Structure("S4", utils::Vector{Member("x", ty.Of(s6)), //
- Member("y", ty.Of(s5)), //
- Member("z", array_atomic_i32_4)}); //
- auto* s3 = Structure("S3", utils::Vector{Member("x", ty.Of(s4))});
- auto* s2 = Structure("S2", utils::Vector{Member("x", ty.Of(s3))});
- auto* s1 = Structure("S1", utils::Vector{Member("x", ty.Of(s2))});
- auto* s0 = Structure("S0", utils::Vector{Member("x", ty.Of(s1))});
+ auto* s6 = Structure("S6", Vector{Member("x", array_i32_4)});
+ auto* s5 = Structure("S5", Vector{Member("x", ty.Of(s6)), //
+ Member(Source{{12, 34}}, "y", ty.Of(atomic_array)), //
+ Member("z", array_atomic_u32_8)}); //
+ auto* s4 = Structure("S4", Vector{Member("x", ty.Of(s6)), //
+ Member("y", ty.Of(s5)), //
+ Member("z", array_atomic_i32_4)}); //
+ auto* s3 = Structure("S3", Vector{Member("x", ty.Of(s4))});
+ auto* s2 = Structure("S2", Vector{Member("x", ty.Of(s3))});
+ auto* s1 = Structure("S1", Vector{Member("x", ty.Of(s2))});
+ auto* s0 = Structure("S0", Vector{Member("x", ty.Of(s1))});
GlobalVar(Source{{56, 78}}, "g", ty.Of(s0), builtin::AddressSpace::kPrivate);
EXPECT_FALSE(r()->Resolve());
@@ -197,7 +195,7 @@
}
TEST_F(ResolverAtomicValidationTest, Struct_AccessMode_Read) {
- auto* s = Structure("s", utils::Vector{Member(Source{{12, 34}}, "a", ty.atomic(ty.i32()))});
+ auto* s = Structure("s", Vector{Member(Source{{12, 34}}, "a", ty.atomic(ty.i32()))});
GlobalVar(Source{{56, 78}}, "g", ty.Of(s), builtin::AddressSpace::kStorage,
builtin::Access::kRead, Group(0_a), Binding(0_a));
@@ -209,7 +207,7 @@
}
TEST_F(ResolverAtomicValidationTest, InvalidAccessMode_Struct) {
- auto* s = Structure("s", utils::Vector{Member(Source{{12, 34}}, "a", ty.atomic(ty.i32()))});
+ auto* s = Structure("s", Vector{Member(Source{{12, 34}}, "a", ty.atomic(ty.i32()))});
GlobalVar(Source{{56, 78}}, "g", ty.Of(s), builtin::AddressSpace::kStorage,
builtin::Access::kRead, Group(0_a), Binding(0_a));
@@ -225,9 +223,8 @@
// struct Outer { m : array<Inner, 4>; };
// var<storage, read> g : Outer;
- auto* Inner =
- Structure("Inner", utils::Vector{Member(Source{{12, 34}}, "m", ty.atomic(ty.i32()))});
- auto* Outer = Structure("Outer", utils::Vector{Member("m", ty.Of(Inner))});
+ auto* Inner = Structure("Inner", Vector{Member(Source{{12, 34}}, "m", ty.atomic(ty.i32()))});
+ auto* Outer = Structure("Outer", Vector{Member("m", ty.Of(Inner))});
GlobalVar(Source{{56, 78}}, "g", ty.Of(Outer), builtin::AddressSpace::kStorage,
builtin::Access::kRead, Group(0_a), Binding(0_a));
@@ -243,9 +240,8 @@
// struct Outer { m : array<Inner, 4>; };
// var<storage, read> g : Outer;
- auto* Inner =
- Structure("Inner", utils::Vector{Member(Source{{12, 34}}, "m", ty.atomic(ty.i32()))});
- auto* Outer = Structure("Outer", utils::Vector{Member("m", ty.Of(Inner))});
+ auto* Inner = Structure("Inner", Vector{Member(Source{{12, 34}}, "m", ty.atomic(ty.i32()))});
+ auto* Outer = Structure("Outer", Vector{Member("m", ty.Of(Inner))});
GlobalVar(Source{{56, 78}}, "g", ty.Of(Outer), builtin::AddressSpace::kStorage,
builtin::Access::kRead, Group(0_a), Binding(0_a));
@@ -276,17 +272,17 @@
auto array_atomic_u32_8 = ty.array(ty.atomic(ty.u32()), 8_u);
auto array_atomic_i32_4 = ty.array(ty.atomic(ty.i32()), 4_u);
- auto* s6 = Structure("S6", utils::Vector{Member("x", array_i32_4)});
- auto* s5 = Structure("S5", utils::Vector{Member("x", ty.Of(s6)), //
- Member(Source{{56, 78}}, "y", ty.Of(atomic_array)), //
- Member("z", array_atomic_u32_8)}); //
- auto* s4 = Structure("S4", utils::Vector{Member("x", ty.Of(s6)), //
- Member("y", ty.Of(s5)), //
- Member("z", array_atomic_i32_4)}); //
- auto* s3 = Structure("S3", utils::Vector{Member("x", ty.Of(s4))});
- auto* s2 = Structure("S2", utils::Vector{Member("x", ty.Of(s3))});
- auto* s1 = Structure("S1", utils::Vector{Member("x", ty.Of(s2))});
- auto* s0 = Structure("S0", utils::Vector{Member("x", ty.Of(s1))});
+ auto* s6 = Structure("S6", Vector{Member("x", array_i32_4)});
+ auto* s5 = Structure("S5", Vector{Member("x", ty.Of(s6)), //
+ Member(Source{{56, 78}}, "y", ty.Of(atomic_array)), //
+ Member("z", array_atomic_u32_8)}); //
+ auto* s4 = Structure("S4", Vector{Member("x", ty.Of(s6)), //
+ Member("y", ty.Of(s5)), //
+ Member("z", array_atomic_i32_4)}); //
+ auto* s3 = Structure("S3", Vector{Member("x", ty.Of(s4))});
+ auto* s2 = Structure("S2", Vector{Member("x", ty.Of(s3))});
+ auto* s1 = Structure("S1", Vector{Member("x", ty.Of(s2))});
+ auto* s0 = Structure("S0", Vector{Member("x", ty.Of(s1))});
GlobalVar(Source{{12, 34}}, "g", ty.Of(s0), builtin::AddressSpace::kStorage,
builtin::Access::kRead, Group(0_a), Binding(0_a));
diff --git a/src/tint/lang/wgsl/resolver/attribute_validation_test.cc b/src/tint/lang/wgsl/resolver/attribute_validation_test.cc
index 66dea38..884d235 100644
--- a/src/tint/lang/wgsl/resolver/attribute_validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/attribute_validation_test.cc
@@ -85,9 +85,9 @@
}
};
-static utils::Vector<const ast::Attribute*, 2> createAttributes(const Source& source,
- ProgramBuilder& builder,
- AttributeKind kind) {
+static Vector<const ast::Attribute*, 2> createAttributes(const Source& source,
+ ProgramBuilder& builder,
+ AttributeKind kind) {
switch (kind) {
case AttributeKind::kAlign:
return {builder.MemberAlign(source, 4_i)};
@@ -175,10 +175,10 @@
EnableExtensionIfNecessary(params.kind);
Func("main",
- utils::Vector{
+ Vector{
Param("a", ty.vec4<f32>(), createAttributes({}, *this, params.kind)),
},
- ty.void_(), utils::Empty);
+ ty.void_(), tint::Empty);
if (params.should_pass) {
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -219,11 +219,11 @@
auto& params = GetParam();
EnableExtensionIfNecessary(params.kind);
- Func("main", utils::Empty, ty.f32(),
- utils::Vector{
+ Func("main", tint::Empty, ty.f32(),
+ Vector{
Return(1_f),
},
- utils::Empty, createAttributes({}, *this, params.kind));
+ tint::Empty, createAttributes({}, *this, params.kind));
if (params.should_pass) {
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -261,11 +261,11 @@
auto& params = GetParam();
EnableExtensionIfNecessary(params.kind);
Func("main",
- utils::Vector{
+ Vector{
Param("a", ty.vec4<f32>(), createAttributes(Source{{12, 34}}, *this, params.kind)),
},
- ty.void_(), utils::Empty,
- utils::Vector{
+ ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -318,8 +318,8 @@
attrs.Push(Builtin(Source{{34, 56}}, builtin::BuiltinValue::kPosition));
}
auto* p = Param("a", ty.vec4<f32>(), attrs);
- Func("frag_main", utils::Vector{p}, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("frag_main", Vector{p}, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -361,14 +361,14 @@
attrs.Push(Location(Source{{34, 56}}, 2_a));
}
auto* p = Param("a", ty.vec4<f32>(), attrs);
- Func("vertex_main", utils::Vector{p}, ty.vec4<f32>(),
- utils::Vector{
+ Func("vertex_main", Vector{p}, ty.vec4<f32>(),
+ Vector{
Return(Call<vec4<f32>>()),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kVertex),
},
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kPosition),
});
@@ -415,11 +415,11 @@
auto& params = GetParam();
EnableExtensionIfNecessary(params.kind);
- Func("main", utils::Empty, ty.vec4<f32>(),
- utils::Vector{
+ Func("main", tint::Empty, ty.vec4<f32>(),
+ Vector{
Return(Call<vec4<f32>>(1_f)),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
},
@@ -473,8 +473,8 @@
auto attrs = createAttributes(Source{{12, 34}}, *this, params.kind);
attrs.Push(Location(Source{{34, 56}}, 2_a));
- Func("frag_main", utils::Empty, ty.vec4<f32>(), utils::Vector{Return(Call<vec4<f32>>())},
- utils::Vector{
+ Func("frag_main", tint::Empty, ty.vec4<f32>(), Vector{Return(Call<vec4<f32>>())},
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
attrs);
@@ -530,11 +530,11 @@
if (params.kind != AttributeKind::kBuiltin) {
attrs.Push(Builtin(Source{{34, 56}}, builtin::BuiltinValue::kPosition));
}
- Func("vertex_main", utils::Empty, ty.vec4<f32>(),
- utils::Vector{
+ Func("vertex_main", tint::Empty, ty.vec4<f32>(),
+ Vector{
Return(Call<vec4<f32>>()),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kVertex),
},
attrs);
@@ -577,14 +577,14 @@
using EntryPointParameterAttributeTest = TestWithParams;
TEST_F(EntryPointParameterAttributeTest, DuplicateAttribute) {
- Func("main", utils::Empty, ty.f32(),
- utils::Vector{
+ Func("main", tint::Empty, ty.f32(),
+ Vector{
Return(1_f),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(Source{{12, 34}}, 2_a),
Location(Source{{56, 78}}, 3_a),
});
@@ -597,14 +597,14 @@
TEST_F(EntryPointParameterAttributeTest, DuplicateInternalAttribute) {
auto* s = Param("s", ty.sampler(type::SamplerKind::kSampler),
- utils::Vector{
+ Vector{
Binding(0_a),
Group(0_a),
Disable(ast::DisabledValidation::kBindingPointCollision),
Disable(ast::DisabledValidation::kEntryPointParameter),
});
- Func("f", utils::Vector{s}, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("f", Vector{s}, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -613,14 +613,14 @@
using EntryPointReturnTypeAttributeTest = ResolverTest;
TEST_F(EntryPointReturnTypeAttributeTest, DuplicateAttribute) {
- Func("main", utils::Empty, ty.f32(),
- utils::Vector{
+ Func("main", tint::Empty, ty.f32(),
+ Vector{
Return(1_f),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(Source{{12, 34}}, 2_a),
Location(Source{{56, 78}}, 3_a),
});
@@ -632,11 +632,11 @@
}
TEST_F(EntryPointReturnTypeAttributeTest, DuplicateInternalAttribute) {
- Func("f", utils::Empty, ty.i32(), utils::Vector{Return(1_i)},
- utils::Vector{
+ Func("f", tint::Empty, ty.i32(), Vector{Return(1_i)},
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Disable(ast::DisabledValidation::kBindingPointCollision),
Disable(ast::DisabledValidation::kEntryPointParameter),
});
@@ -652,7 +652,7 @@
auto& params = GetParam();
EnableExtensionIfNecessary(params.kind);
- Structure("mystruct", utils::Vector{Member("a", ty.f32())},
+ Structure("mystruct", Vector{Member("a", ty.f32())},
createAttributes(Source{{12, 34}}, *this, params.kind));
if (params.should_pass) {
@@ -687,7 +687,7 @@
TEST_P(StructMemberAttributeTest, IsValid) {
auto& params = GetParam();
EnableExtensionIfNecessary(params.kind);
- utils::Vector<const ast::StructMember*, 1> members;
+ Vector<const ast::StructMember*, 1> members;
if (params.kind == AttributeKind::kBuiltin) {
members.Push(
Member("a", ty.vec4<f32>(), createAttributes(Source{{12, 34}}, *this, params.kind)));
@@ -723,9 +723,9 @@
TestParams{AttributeKind::kWorkgroup, false},
TestParams{AttributeKind::kBindingAndGroup, false}));
TEST_F(StructMemberAttributeTest, DuplicateAttribute) {
- Structure("mystruct", utils::Vector{
+ Structure("mystruct", Vector{
Member("a", ty.i32(),
- utils::Vector{
+ Vector{
MemberAlign(Source{{12, 34}}, 4_i),
MemberAlign(Source{{56, 78}}, 8_i),
}),
@@ -736,9 +736,9 @@
12:34 note: first attribute declared here)");
}
TEST_F(StructMemberAttributeTest, InvariantAttributeWithPosition) {
- Structure("mystruct", utils::Vector{
+ Structure("mystruct", Vector{
Member("a", ty.vec4<f32>(),
- utils::Vector{
+ Vector{
Invariant(),
Builtin(builtin::BuiltinValue::kPosition),
}),
@@ -746,9 +746,9 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
}
TEST_F(StructMemberAttributeTest, InvariantAttributeWithoutPosition) {
- Structure("mystruct", utils::Vector{
+ Structure("mystruct", Vector{
Member("a", ty.vec4<f32>(),
- utils::Vector{
+ Vector{
Invariant(Source{{12, 34}}),
}),
});
@@ -761,15 +761,15 @@
TEST_F(StructMemberAttributeTest, Align_Attribute_Const) {
GlobalConst("val", ty.i32(), Expr(1_i));
- Structure("mystruct", utils::Vector{Member("a", ty.f32(), utils::Vector{MemberAlign("val")})});
+ Structure("mystruct", Vector{Member("a", ty.f32(), Vector{MemberAlign("val")})});
EXPECT_TRUE(r()->Resolve()) << r()->error();
}
TEST_F(StructMemberAttributeTest, Align_Attribute_ConstNegative) {
GlobalConst("val", ty.i32(), Expr(-2_i));
- Structure("mystruct", utils::Vector{Member(
- "a", ty.f32(), utils::Vector{MemberAlign(Source{{12, 34}}, "val")})});
+ Structure("mystruct",
+ Vector{Member("a", ty.f32(), Vector{MemberAlign(Source{{12, 34}}, "val")})});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
R"(12:34 error: @align value must be a positive, power-of-two integer)");
@@ -778,8 +778,8 @@
TEST_F(StructMemberAttributeTest, Align_Attribute_ConstPowerOfTwo) {
GlobalConst("val", ty.i32(), Expr(3_i));
- Structure("mystruct", utils::Vector{Member(
- "a", ty.f32(), utils::Vector{MemberAlign(Source{{12, 34}}, "val")})});
+ Structure("mystruct",
+ Vector{Member("a", ty.f32(), Vector{MemberAlign(Source{{12, 34}}, "val")})});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
R"(12:34 error: @align value must be a positive, power-of-two integer)");
@@ -788,8 +788,8 @@
TEST_F(StructMemberAttributeTest, Align_Attribute_ConstF32) {
GlobalConst("val", ty.f32(), Expr(1.23_f));
- Structure("mystruct", utils::Vector{Member(
- "a", ty.f32(), utils::Vector{MemberAlign(Source{{12, 34}}, "val")})});
+ Structure("mystruct",
+ Vector{Member("a", ty.f32(), Vector{MemberAlign(Source{{12, 34}}, "val")})});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), R"(12:34 error: @align must be an i32 or u32 value)");
}
@@ -797,24 +797,24 @@
TEST_F(StructMemberAttributeTest, Align_Attribute_ConstU32) {
GlobalConst("val", ty.u32(), Expr(2_u));
- Structure("mystruct", utils::Vector{Member(
- "a", ty.f32(), utils::Vector{MemberAlign(Source{{12, 34}}, "val")})});
+ Structure("mystruct",
+ Vector{Member("a", ty.f32(), Vector{MemberAlign(Source{{12, 34}}, "val")})});
EXPECT_TRUE(r()->Resolve());
}
TEST_F(StructMemberAttributeTest, Align_Attribute_ConstAInt) {
GlobalConst("val", Expr(2_a));
- Structure("mystruct", utils::Vector{Member(
- "a", ty.f32(), utils::Vector{MemberAlign(Source{{12, 34}}, "val")})});
+ Structure("mystruct",
+ Vector{Member("a", ty.f32(), Vector{MemberAlign(Source{{12, 34}}, "val")})});
EXPECT_TRUE(r()->Resolve()) << r()->error();
}
TEST_F(StructMemberAttributeTest, Align_Attribute_ConstAFloat) {
GlobalConst("val", Expr(2.0_a));
- Structure("mystruct", utils::Vector{Member(
- "a", ty.f32(), utils::Vector{MemberAlign(Source{{12, 34}}, "val")})});
+ Structure("mystruct",
+ Vector{Member("a", ty.f32(), Vector{MemberAlign(Source{{12, 34}}, "val")})});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), R"(12:34 error: @align must be an i32 or u32 value)");
}
@@ -824,8 +824,8 @@
builtin::Access::kUndefined, Expr(1.23_f));
Structure(Source{{6, 4}}, "mystruct",
- utils::Vector{Member(Source{{12, 5}}, "a", ty.f32(),
- utils::Vector{MemberAlign(Expr(Source{{12, 35}}, "val"))})});
+ Vector{Member(Source{{12, 5}}, "a", ty.f32(),
+ Vector{MemberAlign(Expr(Source{{12, 35}}, "val"))})});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), R"(12:35 error: var 'val' cannot be referenced at module-scope
1:2 note: var 'val' declared here)");
@@ -835,8 +835,7 @@
Override("val", ty.f32(), Expr(1.23_f));
Structure("mystruct",
- utils::Vector{Member("a", ty.f32(),
- utils::Vector{MemberAlign(Expr(Source{{12, 34}}, "val"))})});
+ Vector{Member("a", ty.f32(), Vector{MemberAlign(Expr(Source{{12, 34}}, "val"))})});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(
r()->error(),
@@ -846,15 +845,15 @@
TEST_F(StructMemberAttributeTest, Size_Attribute_Const) {
GlobalConst("val", ty.i32(), Expr(4_i));
- Structure("mystruct", utils::Vector{Member("a", ty.f32(), utils::Vector{MemberSize("val")})});
+ Structure("mystruct", Vector{Member("a", ty.f32(), Vector{MemberSize("val")})});
EXPECT_TRUE(r()->Resolve()) << r()->error();
}
TEST_F(StructMemberAttributeTest, Size_Attribute_ConstNegative) {
GlobalConst("val", ty.i32(), Expr(-2_i));
- Structure("mystruct", utils::Vector{Member(
- "a", ty.f32(), utils::Vector{MemberSize(Source{{12, 34}}, "val")})});
+ Structure("mystruct",
+ Vector{Member("a", ty.f32(), Vector{MemberSize(Source{{12, 34}}, "val")})});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), R"(12:34 error: @size must be a positive integer)");
}
@@ -862,8 +861,8 @@
TEST_F(StructMemberAttributeTest, Size_Attribute_ConstF32) {
GlobalConst("val", ty.f32(), Expr(1.23_f));
- Structure("mystruct", utils::Vector{Member(
- "a", ty.f32(), utils::Vector{MemberSize(Source{{12, 34}}, "val")})});
+ Structure("mystruct",
+ Vector{Member("a", ty.f32(), Vector{MemberSize(Source{{12, 34}}, "val")})});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), R"(12:34 error: @size must be an i32 or u32 value)");
}
@@ -871,24 +870,24 @@
TEST_F(StructMemberAttributeTest, Size_Attribute_ConstU32) {
GlobalConst("val", ty.u32(), Expr(4_u));
- Structure("mystruct", utils::Vector{Member(
- "a", ty.f32(), utils::Vector{MemberSize(Source{{12, 34}}, "val")})});
+ Structure("mystruct",
+ Vector{Member("a", ty.f32(), Vector{MemberSize(Source{{12, 34}}, "val")})});
EXPECT_TRUE(r()->Resolve()) << r()->error();
}
TEST_F(StructMemberAttributeTest, Size_Attribute_ConstAInt) {
GlobalConst("val", Expr(4_a));
- Structure("mystruct", utils::Vector{Member(
- "a", ty.f32(), utils::Vector{MemberSize(Source{{12, 34}}, "val")})});
+ Structure("mystruct",
+ Vector{Member("a", ty.f32(), Vector{MemberSize(Source{{12, 34}}, "val")})});
EXPECT_TRUE(r()->Resolve()) << r()->error();
}
TEST_F(StructMemberAttributeTest, Size_Attribute_ConstAFloat) {
GlobalConst("val", Expr(2.0_a));
- Structure("mystruct", utils::Vector{Member(
- "a", ty.f32(), utils::Vector{MemberSize(Source{{12, 34}}, "val")})});
+ Structure("mystruct",
+ Vector{Member("a", ty.f32(), Vector{MemberSize(Source{{12, 34}}, "val")})});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), R"(12:34 error: @size must be an i32 or u32 value)");
}
@@ -898,8 +897,8 @@
builtin::Access::kUndefined, Expr(1.23_f));
Structure(Source{{6, 4}}, "mystruct",
- utils::Vector{Member(Source{{12, 5}}, "a", ty.f32(),
- utils::Vector{MemberSize(Expr(Source{{12, 35}}, "val"))})});
+ Vector{Member(Source{{12, 5}}, "a", ty.f32(),
+ Vector{MemberSize(Expr(Source{{12, 35}}, "val"))})});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), R"(12:35 error: var 'val' cannot be referenced at module-scope
1:2 note: var 'val' declared here)");
@@ -909,8 +908,8 @@
Override("val", ty.f32(), Expr(1.23_f));
Structure("mystruct",
- utils::Vector{
- Member("a", ty.f32(), utils::Vector{MemberSize(Expr(Source{{12, 34}}, "val"))}),
+ Vector{
+ Member("a", ty.f32(), Vector{MemberSize(Expr(Source{{12, 34}}, "val"))}),
});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(
@@ -920,8 +919,8 @@
TEST_F(StructMemberAttributeTest, Size_On_RuntimeSizedArray) {
Structure("mystruct",
- utils::Vector{
- Member("a", ty.array<i32>(), utils::Vector{MemberSize(Source{{12, 34}}, 8_a)}),
+ Vector{
+ Member("a", ty.array<i32>(), Vector{MemberSize(Source{{12, 34}}, 8_a)}),
});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(
@@ -937,7 +936,7 @@
EnableExtensionIfNecessary(params.kind);
auto arr = ty.array(ty.f32(), createAttributes(Source{{12, 34}}, *this, params.kind));
- Structure("mystruct", utils::Vector{
+ Structure("mystruct", Vector{
Member("a", arr),
});
@@ -1022,7 +1021,7 @@
}
TEST_F(VariableAttributeTest, LocalVar) {
- auto* v = Var("a", ty.f32(), utils::Vector{Binding(Source{{12, 34}}, 2_a)});
+ auto* v = Var("a", ty.f32(), Vector{Binding(Source{{12, 34}}, 2_a)});
WrapInFunction(v);
@@ -1031,7 +1030,7 @@
}
TEST_F(VariableAttributeTest, LocalLet) {
- auto* v = Let("a", utils::Vector{Binding(Source{{12, 34}}, 2_a)}, Expr(1_a));
+ auto* v = Let("a", Vector{Binding(Source{{12, 34}}, 2_a)}, Expr(1_a));
WrapInFunction(v);
@@ -1077,7 +1076,7 @@
TEST_F(ConstantAttributeTest, InvalidAttribute) {
GlobalConst("a", ty.f32(), Expr(1.23_f),
- utils::Vector{
+ Vector{
Id(Source{{12, 34}}, 0_a),
});
@@ -1122,7 +1121,7 @@
TEST_F(OverrideAttributeTest, DuplicateAttribute) {
Override("a", ty.f32(), Expr(1.23_f),
- utils::Vector{
+ Vector{
Id(Source{{12, 34}}, 0_a),
Id(Source{{56, 78}}, 1_a),
});
@@ -1138,7 +1137,7 @@
auto& params = GetParam();
EnableExtensionIfNecessary(params.kind);
- WrapInFunction(Switch(Expr(0_a), utils::Vector{DefaultCase()},
+ WrapInFunction(Switch(Expr(0_a), Vector{DefaultCase()},
createAttributes(Source{{12, 34}}, *this, params.kind)));
if (params.should_pass) {
@@ -1174,7 +1173,7 @@
auto& params = GetParam();
EnableExtensionIfNecessary(params.kind);
- WrapInFunction(Switch(Expr(0_a), utils::Vector{DefaultCase()}, utils::Empty,
+ WrapInFunction(Switch(Expr(0_a), Vector{DefaultCase()}, tint::Empty,
createAttributes(Source{{12, 34}}, *this, params.kind)));
if (params.should_pass) {
@@ -1366,72 +1365,71 @@
BlockStatementTest() { EnableExtensionIfNecessary(GetParam().kind); }
};
TEST_P(BlockStatementTest, CompoundStatement) {
- Func("foo", utils::Empty, ty.void_(),
- utils::Vector{
- Block(utils::Vector{Return()}, createAttributes({}, *this, GetParam().kind)),
+ Func("foo", tint::Empty, ty.void_(),
+ Vector{
+ Block(Vector{Return()}, createAttributes({}, *this, GetParam().kind)),
});
Check();
}
TEST_P(BlockStatementTest, FunctionBody) {
- Func("foo", utils::Empty, ty.void_(),
- Block(utils::Vector{Return()}, createAttributes({}, *this, GetParam().kind)));
+ Func("foo", tint::Empty, ty.void_(),
+ Block(Vector{Return()}, createAttributes({}, *this, GetParam().kind)));
Check();
}
TEST_P(BlockStatementTest, IfStatementBody) {
- Func("foo", utils::Empty, ty.void_(),
- utils::Vector{
- If(Expr(true),
- Block(utils::Vector{Return()}, createAttributes({}, *this, GetParam().kind))),
+ Func("foo", tint::Empty, ty.void_(),
+ Vector{
+ If(Expr(true), Block(Vector{Return()}, createAttributes({}, *this, GetParam().kind))),
});
Check();
}
TEST_P(BlockStatementTest, ElseStatementBody) {
- Func("foo", utils::Empty, ty.void_(),
- utils::Vector{
- If(Expr(true), Block(utils::Vector{Return()}),
- Else(Block(utils::Vector{Return()}, createAttributes({}, *this, GetParam().kind)))),
+ Func("foo", tint::Empty, ty.void_(),
+ Vector{
+ If(Expr(true), Block(Vector{Return()}),
+ Else(Block(Vector{Return()}, createAttributes({}, *this, GetParam().kind)))),
});
Check();
}
TEST_P(BlockStatementTest, ForStatementBody) {
- Func("foo", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("foo", tint::Empty, ty.void_(),
+ Vector{
For(nullptr, Expr(true), nullptr,
- Block(utils::Vector{Break()}, createAttributes({}, *this, GetParam().kind))),
+ Block(Vector{Break()}, createAttributes({}, *this, GetParam().kind))),
});
Check();
}
TEST_P(BlockStatementTest, LoopStatementBody) {
- Func("foo", utils::Empty, ty.void_(),
- utils::Vector{
- Loop(Block(utils::Vector{Break()}, createAttributes({}, *this, GetParam().kind))),
+ Func("foo", tint::Empty, ty.void_(),
+ Vector{
+ Loop(Block(Vector{Break()}, createAttributes({}, *this, GetParam().kind))),
});
Check();
}
TEST_P(BlockStatementTest, WhileStatementBody) {
- Func("foo", utils::Empty, ty.void_(),
- utils::Vector{
- While(Expr(true),
- Block(utils::Vector{Break()}, createAttributes({}, *this, GetParam().kind))),
- });
+ Func(
+ "foo", tint::Empty, ty.void_(),
+ Vector{
+ While(Expr(true), Block(Vector{Break()}, createAttributes({}, *this, GetParam().kind))),
+ });
Check();
}
TEST_P(BlockStatementTest, CaseStatementBody) {
- Func("foo", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("foo", tint::Empty, ty.void_(),
+ Vector{
Switch(1_a,
- Case(CaseSelector(1_a), Block(utils::Vector{Break()},
- createAttributes({}, *this, GetParam().kind))),
+ Case(CaseSelector(1_a),
+ Block(Vector{Break()}, createAttributes({}, *this, GetParam().kind))),
DefaultCase(Block({}))),
});
Check();
}
TEST_P(BlockStatementTest, DefaultStatementBody) {
- Func("foo", utils::Empty, ty.void_(),
- utils::Vector{
- Switch(1_a, Case(CaseSelector(1_a), Block()),
- DefaultCase(Block(utils::Vector{Break()},
- createAttributes({}, *this, GetParam().kind)))),
+ Func("foo", tint::Empty, ty.void_(),
+ Vector{
+ Switch(
+ 1_a, Case(CaseSelector(1_a), Block()),
+ DefaultCase(Block(Vector{Break()}, createAttributes({}, *this, GetParam().kind)))),
});
Check();
}
@@ -1481,13 +1479,13 @@
auto& params = GetParam();
ast::Type el_ty = params.create_el_type(*this);
- utils::StringStream ss;
+ StringStream ss;
ss << "el_ty: " << FriendlyName(el_ty) << ", stride: " << params.stride
<< ", should_pass: " << params.should_pass;
SCOPED_TRACE(ss.str());
auto arr = ty.array(el_ty, 4_u,
- utils::Vector{
+ Vector{
create<ast::StrideAttribute>(Source{{12, 34}}, params.stride),
});
@@ -1569,7 +1567,7 @@
TEST_F(ArrayStrideTest, DuplicateAttribute) {
auto arr = ty.array(Source{{12, 34}}, ty.i32(), 4_u,
- utils::Vector{
+ Vector{
create<ast::StrideAttribute>(Source{{12, 34}}, 4u),
create<ast::StrideAttribute>(Source{{56, 78}}, 4u),
});
@@ -1590,7 +1588,7 @@
using ResourceAttributeTest = ResolverTest;
TEST_F(ResourceAttributeTest, UniformBufferMissingBinding) {
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("x", ty.i32()),
});
GlobalVar(Source{{12, 34}}, "G", ty.Of(s), builtin::AddressSpace::kUniform);
@@ -1601,7 +1599,7 @@
}
TEST_F(ResourceAttributeTest, StorageBufferMissingBinding) {
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("x", ty.i32()),
});
GlobalVar(Source{{12, 34}}, "G", ty.Of(s), builtin::AddressSpace::kStorage,
@@ -1650,14 +1648,14 @@
GlobalVar(Source{{56, 78}}, "B", ty.sampled_texture(type::TextureDimension::k2d, ty.f32()),
Binding(1_a), Group(2_a));
- Func("F", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("F", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("a", ty.vec4<f32>(),
Call("textureLoad", "A", Call<vec2<i32>>(1_i, 2_i), 0_i))),
Decl(Var("b", ty.vec4<f32>(),
Call("textureLoad", "B", Call<vec2<i32>>(1_i, 2_i), 0_i))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1674,20 +1672,20 @@
GlobalVar(Source{{56, 78}}, "B", ty.sampled_texture(type::TextureDimension::k2d, ty.f32()),
Binding(1_a), Group(2_a));
- Func("F_A", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("F_A", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("a", ty.vec4<f32>(),
Call("textureLoad", "A", Call<vec2<i32>>(1_i, 2_i), 0_i))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
- Func("F_B", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("F_B", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("b", ty.vec4<f32>(),
Call("textureLoad", "B", Call<vec2<i32>>(1_i, 2_i), 0_i))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1711,18 +1709,18 @@
using InvariantAttributeTests = ResolverTest;
TEST_F(InvariantAttributeTests, InvariantWithPosition) {
auto* param = Param("p", ty.vec4<f32>(),
- utils::Vector{
+ Vector{
Invariant(Source{{12, 34}}),
Builtin(Source{{56, 78}}, builtin::BuiltinValue::kPosition),
});
- Func("main", utils::Vector{param}, ty.vec4<f32>(),
- utils::Vector{
+ Func("main", Vector{param}, ty.vec4<f32>(),
+ Vector{
Return(Call<vec4<f32>>()),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(0_a),
});
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -1730,18 +1728,18 @@
TEST_F(InvariantAttributeTests, InvariantWithoutPosition) {
auto* param = Param("p", ty.vec4<f32>(),
- utils::Vector{
+ Vector{
Invariant(Source{{12, 34}}),
Location(0_a),
});
- Func("main", utils::Vector{param}, ty.vec4<f32>(),
- utils::Vector{
+ Func("main", Vector{param}, ty.vec4<f32>(),
+ Vector{
Return(Call<vec4<f32>>()),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(0_a),
});
EXPECT_FALSE(r()->Resolve());
@@ -1757,11 +1755,11 @@
using MustUseAttributeTests = ResolverTest;
TEST_F(MustUseAttributeTests, MustUse) {
- Func("main", utils::Empty, ty.vec4<f32>(),
- utils::Vector{
+ Func("main", tint::Empty, ty.vec4<f32>(),
+ Vector{
Return(Call<vec4<f32>>()),
},
- utils::Vector{
+ Vector{
MustUse(Source{{12, 34}}),
});
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -1775,8 +1773,8 @@
using WorkgroupAttribute = ResolverTest;
TEST_F(WorkgroupAttribute, ComputeShaderPass) {
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
create<ast::WorkgroupAttribute>(Source{{12, 34}}, Expr(1_i)),
});
@@ -1785,8 +1783,8 @@
}
TEST_F(WorkgroupAttribute, Missing) {
- Func(Source{{12, 34}}, "main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func(Source{{12, 34}}, "main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
});
@@ -1797,8 +1795,8 @@
}
TEST_F(WorkgroupAttribute, NotAnEntryPoint) {
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
create<ast::WorkgroupAttribute>(Source{{12, 34}}, Expr(1_i)),
});
@@ -1807,8 +1805,8 @@
}
TEST_F(WorkgroupAttribute, NotAComputeShader) {
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
create<ast::WorkgroupAttribute>(Source{{12, 34}}, Expr(1_i)),
});
@@ -1818,8 +1816,8 @@
}
TEST_F(WorkgroupAttribute, DuplicateAttribute) {
- Func(Source{{12, 34}}, "main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func(Source{{12, 34}}, "main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(Source{{12, 34}}, 1_i, nullptr, nullptr),
WorkgroupSize(Source{{56, 78}}, 2_i, nullptr, nullptr),
@@ -1852,15 +1850,15 @@
auto& params = GetParam();
Func("main",
- utils::Vector{
+ Vector{
Param("a", ty.f32(),
- utils::Vector{
+ Vector{
Location(0_a),
Interpolate(Source{{12, 34}}, params.type, params.sampling),
}),
},
- ty.void_(), utils::Empty,
- utils::Vector{
+ ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1878,15 +1876,15 @@
auto& params = GetParam();
Func("main",
- utils::Vector{
+ Vector{
Param("a", ty.i32(),
- utils::Vector{
+ Vector{
Location(0_a),
Interpolate(Source{{12, 34}}, params.type, params.sampling),
}),
},
- ty.void_(), utils::Empty,
- utils::Vector{
+ ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1909,15 +1907,15 @@
auto& params = GetParam();
Func("main",
- utils::Vector{
+ Vector{
Param("a", ty.vec4<u32>(),
- utils::Vector{
+ Vector{
Location(0_a),
Interpolate(Source{{12, 34}}, params.type, params.sampling),
}),
},
- ty.void_(), utils::Empty,
- utils::Vector{
+ ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1961,10 +1959,9 @@
Params{builtin::InterpolationType::kFlat, builtin::InterpolationSampling::kSample, false}));
TEST_F(InterpolateTest, FragmentInput_Integer_MissingFlatInterpolation) {
- Func("main",
- utils::Vector{Param(Source{{12, 34}}, "a", ty.i32(), utils::Vector{Location(0_a)})},
- ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", Vector{Param(Source{{12, 34}}, "a", ty.i32(), Vector{Location(0_a)})}, ty.void_(),
+ tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1976,16 +1973,15 @@
TEST_F(InterpolateTest, VertexOutput_Integer_MissingFlatInterpolation) {
auto* s = Structure(
- "S",
- utils::Vector{
- Member("pos", ty.vec4<f32>(), utils::Vector{Builtin(builtin::BuiltinValue::kPosition)}),
- Member(Source{{12, 34}}, "u", ty.u32(), utils::Vector{Location(0_a)}),
- });
- Func("main", utils::Empty, ty.Of(s),
- utils::Vector{
+ "S", Vector{
+ Member("pos", ty.vec4<f32>(), Vector{Builtin(builtin::BuiltinValue::kPosition)}),
+ Member(Source{{12, 34}}, "u", ty.u32(), Vector{Location(0_a)}),
+ });
+ Func("main", tint::Empty, ty.Of(s),
+ Vector{
Return(Call(ty.Of(s))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kVertex),
});
@@ -1998,15 +1994,15 @@
TEST_F(InterpolateTest, MissingLocationAttribute_Parameter) {
Func("main",
- utils::Vector{
+ Vector{
Param("a", ty.vec4<f32>(),
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kPosition),
Interpolate(Source{{12, 34}}, builtin::InterpolationType::kFlat),
}),
},
- ty.void_(), utils::Empty,
- utils::Vector{
+ ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -2016,14 +2012,14 @@
}
TEST_F(InterpolateTest, MissingLocationAttribute_ReturnType) {
- Func("main", utils::Empty, ty.vec4<f32>(),
- utils::Vector{
+ Func("main", tint::Empty, ty.vec4<f32>(),
+ Vector{
Return(Call<vec4<f32>>()),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kVertex),
},
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kPosition),
Interpolate(Source{{12, 34}}, builtin::InterpolationType::kFlat),
});
@@ -2034,12 +2030,11 @@
}
TEST_F(InterpolateTest, MissingLocationAttribute_Struct) {
- Structure(
- "S",
- utils::Vector{
- Member("a", ty.f32(),
- utils::Vector{Interpolate(Source{{12, 34}}, builtin::InterpolationType::kFlat)}),
- });
+ Structure("S",
+ Vector{
+ Member("a", ty.f32(),
+ Vector{Interpolate(Source{{12, 34}}, builtin::InterpolationType::kFlat)}),
+ });
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
@@ -2146,22 +2141,22 @@
using IdTest = ResolverTest;
TEST_F(IdTest, Const_I32) {
- Override("val", ty.f32(), utils::Vector{Id(1_i)});
+ Override("val", ty.f32(), Vector{Id(1_i)});
EXPECT_TRUE(r()->Resolve()) << r()->error();
}
TEST_F(IdTest, Const_U32) {
- Override("val", ty.f32(), utils::Vector{Id(1_u)});
+ Override("val", ty.f32(), Vector{Id(1_u)});
EXPECT_TRUE(r()->Resolve()) << r()->error();
}
TEST_F(IdTest, Const_AInt) {
- Override("val", ty.f32(), utils::Vector{Id(1_a)});
+ Override("val", ty.f32(), Vector{Id(1_a)});
EXPECT_TRUE(r()->Resolve()) << r()->error();
}
TEST_F(IdTest, NonConstant) {
- Override("val", ty.f32(), utils::Vector{Id(Call<u32>(Call(Source{{12, 34}}, "dpdx", 1_a)))});
+ Override("val", ty.f32(), Vector{Id(Call<u32>(Call(Source{{12, 34}}, "dpdx", 1_a)))});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(
r()->error(),
@@ -2169,19 +2164,19 @@
}
TEST_F(IdTest, Negative) {
- Override("val", ty.f32(), utils::Vector{Id(Source{{12, 34}}, -1_i)});
+ Override("val", ty.f32(), Vector{Id(Source{{12, 34}}, -1_i)});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), R"(12:34 error: @id value must be non-negative)");
}
TEST_F(IdTest, F32) {
- Override("val", ty.f32(), utils::Vector{Id(Source{{12, 34}}, 1_f)});
+ Override("val", ty.f32(), Vector{Id(Source{{12, 34}}, 1_f)});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), R"(12:34 error: @id must be an i32 or u32 value)");
}
TEST_F(IdTest, AFloat) {
- Override("val", ty.f32(), utils::Vector{Id(Source{{12, 34}}, 1.0_a)});
+ Override("val", ty.f32(), Vector{Id(Source{{12, 34}}, 1.0_a)});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), R"(12:34 error: @id must be an i32 or u32 value)");
}
@@ -2197,32 +2192,32 @@
switch (GetParam()) {
case LocationAttributeType::kEntryPointParameter:
Func("main",
- utils::Vector{Param(Source{{12, 34}}, "a", ty.i32(),
- utils::Vector{
- Location(Source{{12, 34}}, location_value),
- Flat(),
- })},
- ty.void_(), utils::Empty,
- utils::Vector{
+ Vector{Param(Source{{12, 34}}, "a", ty.i32(),
+ Vector{
+ Location(Source{{12, 34}}, location_value),
+ Flat(),
+ })},
+ ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
return;
case LocationAttributeType::kEntryPointReturnType:
- Func("main", utils::Empty, ty.f32(),
- utils::Vector{
+ Func("main", tint::Empty, ty.f32(),
+ Vector{
Return(1_a),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(Source{{12, 34}}, location_value),
});
return;
case LocationAttributeType::kStructureMember:
- Structure("S", utils::Vector{
+ Structure("S", Vector{
Member("m", ty.f32(),
- utils::Vector{
+ Vector{
Location(Source{{12, 34}}, location_value),
}),
});
@@ -2286,8 +2281,7 @@
using MustUseAttributeTest = ResolverTest;
TEST_F(MustUseAttributeTest, UsedOnFnWithNoReturnValue) {
- Func("fn_must_use", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{MustUse(Source{{12, 34}})});
+ Func("fn_must_use", tint::Empty, ty.void_(), tint::Empty, Vector{MustUse(Source{{12, 34}})});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
@@ -2300,10 +2294,10 @@
namespace InternalAttributeDeps {
namespace {
-class TestAttribute : public utils::Castable<TestAttribute, ast::InternalAttribute> {
+class TestAttribute : public Castable<TestAttribute, ast::InternalAttribute> {
public:
TestAttribute(GenerationID pid, ast::NodeID nid, const ast::IdentifierExpression* dep)
- : Base(pid, nid, utils::Vector{dep}) {}
+ : Base(pid, nid, Vector{dep}) {}
std::string InternalName() const override { return "test_attribute"; }
const Cloneable* Clone(CloneContext*) const override { return nullptr; }
};
@@ -2312,7 +2306,7 @@
TEST_F(InternalAttributeDepsTest, Dependency) {
auto* ident = Expr("v");
auto* attr = ASTNodes().Create<TestAttribute>(ID(), AllocateNodeID(), ident);
- auto* f = Func("f", utils::Empty, ty.void_(), utils::Empty, utils::Vector{attr});
+ auto* f = Func("f", tint::Empty, ty.void_(), tint::Empty, Vector{attr});
auto* v = GlobalVar("v", ty.i32(), builtin::AddressSpace::kPrivate);
EXPECT_TRUE(r()->Resolve()) << r()->error();
diff --git a/src/tint/lang/wgsl/resolver/builtin_enum_test.cc b/src/tint/lang/wgsl/resolver/builtin_enum_test.cc
index 9d11ed7..e6bcbf0 100644
--- a/src/tint/lang/wgsl/resolver/builtin_enum_test.cc
+++ b/src/tint/lang/wgsl/resolver/builtin_enum_test.cc
@@ -57,7 +57,7 @@
Enable(builtin::Extension::kChromiumExperimentalFullPtrParameters);
auto* tmpl = Ident(Source{{12, 34}}, GetParam(), "T");
- Func("f", utils::Vector{Param("p", ty("ptr", tmpl, ty.f32()))}, ty.void_(), utils::Empty);
+ Func("f", Vector{Param("p", ty("ptr", tmpl, ty.f32()))}, ty.void_(), tint::Empty);
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), "12:34 error: address space '" + std::string(GetParam()) +
"' does not take template arguments");
@@ -75,8 +75,8 @@
TEST_P(ResolverBuiltinValueUsedWithTemplateArgs, Test) {
// fn f(@builtin(BUILTIN<T>) p : vec4<f32>) {}
auto* tmpl = Ident(Source{{12, 34}}, GetParam(), "T");
- Func("f", utils::Vector{Param("p", ty.vec4<f32>(), utils::Vector{Builtin(tmpl)})}, ty.void_(),
- utils::Empty, utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("f", Vector{Param("p", ty.vec4<f32>(), Vector{Builtin(tmpl)})}, ty.void_(), tint::Empty,
+ Vector{Stage(ast::PipelineStage::kFragment)});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), "12:34 error: builtin value '" + std::string(GetParam()) +
"' does not take template arguments");
@@ -96,13 +96,13 @@
// fn f(@location(0) @interpolate(linear, INTERPOLATION_SAMPLING<T>) p : vec4<f32>) {}
auto* tmpl = Ident(Source{{12, 34}}, GetParam(), "T");
Func("f",
- utils::Vector{Param("p", ty.vec4<f32>(),
- utils::Vector{
- Location(0_a),
- Interpolate(builtin::InterpolationType::kLinear, tmpl),
- })},
- ty.void_(), utils::Empty,
- utils::Vector{
+ Vector{Param("p", ty.vec4<f32>(),
+ Vector{
+ Location(0_a),
+ Interpolate(builtin::InterpolationType::kLinear, tmpl),
+ })},
+ ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
EXPECT_FALSE(r()->Resolve());
@@ -124,13 +124,13 @@
// fn f(@location(0) @interpolate(INTERPOLATION_TYPE<T>, center) p : vec4<f32>) {}
auto* tmpl = Ident(Source{{12, 34}}, GetParam(), "T");
Func("f",
- utils::Vector{Param("p", ty.vec4<f32>(),
- utils::Vector{
- Location(0_a),
- Interpolate(tmpl, builtin::InterpolationSampling::kCenter),
- })},
- ty.void_(), utils::Empty,
- utils::Vector{
+ Vector{Param("p", ty.vec4<f32>(),
+ Vector{
+ Location(0_a),
+ Interpolate(tmpl, builtin::InterpolationSampling::kCenter),
+ })},
+ ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
EXPECT_FALSE(r()->Resolve());
diff --git a/src/tint/lang/wgsl/resolver/builtin_structs_test.cc b/src/tint/lang/wgsl/resolver/builtin_structs_test.cc
index 600c493..1ff6787 100644
--- a/src/tint/lang/wgsl/resolver/builtin_structs_test.cc
+++ b/src/tint/lang/wgsl/resolver/builtin_structs_test.cc
@@ -36,7 +36,7 @@
ASSERT_TRUE(r()->Resolve()) << r()->error();
auto* str = As<type::Struct>(TypeOf(var)->UnwrapRef());
ASSERT_NE(str, nullptr);
- EXPECT_EQ(str->Name().Name(), utils::ToString(GetParam()));
+ EXPECT_EQ(str->Name().Name(), tint::ToString(GetParam()));
EXPECT_FALSE(Is<sem::Struct>(str));
}
diff --git a/src/tint/lang/wgsl/resolver/builtin_test.cc b/src/tint/lang/wgsl/resolver/builtin_test.cc
index 8d8cdd8..ddfa96d 100644
--- a/src/tint/lang/wgsl/resolver/builtin_test.cc
+++ b/src/tint/lang/wgsl/resolver/builtin_test.cc
@@ -49,7 +49,7 @@
using namespace tint::builtin::fluent_types; // NOLINT
using namespace tint::number_suffixes; // NOLINT
-using ExpressionList = utils::Vector<const ast::Expression*, 8>;
+using ExpressionList = Vector<const ast::Expression*, 8>;
using ResolverBuiltinTest = ResolverTest;
@@ -215,7 +215,7 @@
TEST_F(ResolverBuiltinArrayTest, ArrayLength_Vector) {
auto ary = ty.array<i32>();
- auto* str = Structure("S", utils::Vector{Member("x", ary)});
+ auto* str = Structure("S", Vector{Member("x", ary)});
GlobalVar("a", ty.Of(str), builtin::AddressSpace::kStorage, builtin::Access::kRead,
Binding(0_a), Group(0_a));
@@ -2014,8 +2014,8 @@
GlobalVar("ident", ty.f32(), builtin::AddressSpace::kPrivate);
auto* expr = Call(name, "ident");
- Func("func", utils::Empty, ty.void_(), utils::Vector{Ignore(expr)},
- utils::Vector{create<ast::StageAttribute>(ast::PipelineStage::kFragment)});
+ Func("func", tint::Empty, ty.void_(), Vector{Ignore(expr)},
+ Vector{create<ast::StageAttribute>(ast::PipelineStage::kFragment)});
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -2028,8 +2028,8 @@
GlobalVar("ident", ty.vec4<f32>(), builtin::AddressSpace::kPrivate);
auto* expr = Call(name, "ident");
- Func("func", utils::Empty, ty.void_(), utils::Vector{Ignore(expr)},
- utils::Vector{create<ast::StageAttribute>(ast::PipelineStage::kFragment)});
+ Func("func", tint::Empty, ty.void_(), Vector{Ignore(expr)},
+ Vector{create<ast::StageAttribute>(ast::PipelineStage::kFragment)});
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -2071,7 +2071,7 @@
namespace texture_builtin_tests {
enum class Texture { kF32, kI32, kU32 };
-inline utils::StringStream& operator<<(utils::StringStream& out, Texture data) {
+inline StringStream& operator<<(StringStream& out, Texture data) {
if (data == Texture::kF32) {
out << "f32";
} else if (data == Texture::kI32) {
@@ -2088,7 +2088,7 @@
builtin::TexelFormat format = builtin::TexelFormat::kR32Float;
};
inline std::ostream& operator<<(std::ostream& out, TextureTestParams data) {
- utils::StringStream str;
+ StringStream str;
str << data.dim << "_" << data.type;
out << str.str();
return out;
@@ -2114,7 +2114,7 @@
return ty.vec3(scalar);
default:
[=] {
- utils::StringStream str;
+ StringStream str;
str << dim;
FAIL() << "Unsupported texture dimension: " << str.str();
}();
@@ -2124,7 +2124,7 @@
void add_call_param(std::string name, ast::Type type, ExpressionList* call_params) {
std::string type_name = type->identifier->symbol.Name();
- if (utils::HasPrefix(type_name, "texture") || utils::HasPrefix(type_name, "sampler")) {
+ if (tint::HasPrefix(type_name, "texture") || tint::HasPrefix(type_name, "sampler")) {
GlobalVar(name, type, Binding(0_a), Group(0_a));
} else {
GlobalVar(name, type, builtin::AddressSpace::kPrivate);
@@ -2191,8 +2191,8 @@
ResolverBuiltinTest_Texture,
testing::ValuesIn(ast::test::TextureOverloadCase::ValidCases()));
-static std::string to_str(const std::string& func, utils::VectorRef<const sem::Parameter*> params) {
- utils::StringStream out;
+static std::string to_str(const std::string& func, VectorRef<const sem::Parameter*> params) {
+ StringStream out;
out << func << "(";
bool first = true;
for (auto* param : params) {
@@ -2447,15 +2447,15 @@
auto* call = Call(param.function, param.args(this));
auto* stmt = param.returns_value ? static_cast<const ast::Statement*>(Assign(Phony(), call))
: static_cast<const ast::Statement*>(CallStmt(call));
- Func("func", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("func", tint::Empty, ty.void_(), Vector{stmt},
+ Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
if (std::string(param.function) == "textureDimensions") {
switch (param.texture_dimension) {
default: {
- utils::StringStream str;
+ StringStream str;
str << param.texture_dimension;
FAIL() << "invalid texture dimensions: " << str.str();
}
diff --git a/src/tint/lang/wgsl/resolver/builtin_validation_test.cc b/src/tint/lang/wgsl/resolver/builtin_validation_test.cc
index 1b226a2..97a4724 100644
--- a/src/tint/lang/wgsl/resolver/builtin_validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/builtin_validation_test.cc
@@ -29,8 +29,8 @@
TEST_F(ResolverBuiltinValidationTest, FunctionTypeMustMatchReturnStatementType_void_fail) {
// fn func { return workgroupBarrier(); }
- Func("func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("func", tint::Empty, ty.void_(),
+ Vector{
Return(Call(Source{Source::Location{12, 34}}, "workgroupBarrier")),
});
@@ -42,11 +42,11 @@
// @compute @workgroup_size(1) fn func { return dpdx(1.0); }
auto* dpdx = Call(Source{{3, 4}}, "dpdx", 1_f);
- Func(Source{{1, 2}}, "func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func(Source{{1, 2}}, "func", tint::Empty, ty.void_(),
+ Vector{
Assign(Phony(), dpdx),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -62,26 +62,26 @@
// @compute @workgroup_size(1) fn main { return f2(); }
auto* dpdx = Call(Source{{3, 4}}, "dpdx", 1_f);
- Func(Source{{1, 2}}, "f0", utils::Empty, ty.void_(),
- utils::Vector{
+ Func(Source{{1, 2}}, "f0", tint::Empty, ty.void_(),
+ Vector{
Assign(Phony(), dpdx),
});
- Func(Source{{3, 4}}, "f1", utils::Empty, ty.void_(),
- utils::Vector{
+ Func(Source{{3, 4}}, "f1", tint::Empty, ty.void_(),
+ Vector{
CallStmt(Call("f0")),
});
- Func(Source{{5, 6}}, "f2", utils::Empty, ty.void_(),
- utils::Vector{
+ Func(Source{{5, 6}}, "f2", tint::Empty, ty.void_(),
+ Vector{
CallStmt(Call("f1")),
});
- Func(Source{{7, 8}}, "main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func(Source{{7, 8}}, "main", tint::Empty, ty.void_(),
+ Vector{
CallStmt(Call("f2")),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -96,8 +96,8 @@
}
TEST_F(ResolverBuiltinValidationTest, BuiltinRedeclaredAsFunctionUsedAsFunction) {
- auto* mix = Func(Source{{12, 34}}, "mix", utils::Empty, ty.i32(),
- utils::Vector{
+ auto* mix = Func(Source{{12, 34}}, "mix", tint::Empty, ty.i32(),
+ Vector{
Return(1_i),
});
auto* use = Call("mix");
@@ -110,8 +110,8 @@
}
TEST_F(ResolverBuiltinValidationTest, BuiltinRedeclaredAsFunctionUsedAsVariable) {
- Func(Source{{12, 34}}, "mix", utils::Empty, ty.i32(),
- utils::Vector{
+ Func(Source{{12, 34}}, "mix", tint::Empty, ty.i32(),
+ Vector{
Return(1_i),
});
WrapInFunction(Decl(Var("v", Expr(Source{{56, 78}}, "mix"))));
@@ -172,7 +172,7 @@
}
TEST_F(ResolverBuiltinValidationTest, BuiltinRedeclaredAsStructUsedAsFunction) {
- Structure("mix", utils::Vector{
+ Structure("mix", Vector{
Member("m", ty.i32()),
});
WrapInFunction(Call(Source{{12, 34}}, "mix", 1_f, 2_f, 3_f));
@@ -183,7 +183,7 @@
}
TEST_F(ResolverBuiltinValidationTest, BuiltinRedeclaredAsStructUsedAsType) {
- auto* mix = Structure("mix", utils::Vector{
+ auto* mix = Structure("mix", Vector{
Member("m", ty.i32()),
});
auto* use = Call("mix");
@@ -325,11 +325,11 @@
: static_cast<const ast::Statement*>(CallStmt(call));
// Call the builtin with the constexpr argument replaced
- Func("func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("func", tint::Empty, ty.void_(),
+ Vector{
stmt,
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -337,7 +337,7 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
} else {
EXPECT_FALSE(r()->Resolve());
- utils::StringStream err;
+ StringStream err;
if (is_vector) {
err << "12:34 error: each component of the " << param.name
<< " argument must be at least " << param.min << " and at most " << param.max
@@ -382,11 +382,11 @@
: static_cast<const ast::Statement*>(CallStmt(call));
// Call the builtin with the constant-expression argument replaced
- Func("func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("func", tint::Empty, ty.void_(),
+ Vector{
stmt,
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -394,7 +394,7 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
} else {
EXPECT_FALSE(r()->Resolve());
- utils::StringStream err;
+ StringStream err;
if (is_vector) {
err << "12:34 error: each component of the " << param.name
<< " argument must be at least " << param.min << " and at most " << param.max
@@ -435,16 +435,16 @@
: static_cast<const ast::Statement*>(CallStmt(call));
// Call the builtin with the constant-expression argument replaced
- Func("func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("func", tint::Empty, ty.void_(),
+ Vector{
stmt,
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
EXPECT_FALSE(r()->Resolve());
- utils::StringStream err;
+ StringStream err;
err << "12:34 error: the " << param.name << " argument must be a const-expression";
EXPECT_EQ(r()->error(), err.str());
}
@@ -539,10 +539,10 @@
// fn func { return dot4I8Packed(1u, 2u); }
Enable(builtin::Extension::kChromiumExperimentalDp4A);
- Func("func", utils::Empty, ty.i32(),
- utils::Vector{
+ Func("func", tint::Empty, ty.i32(),
+ Vector{
Return(Call(Source{Source::Location{12, 34}}, "dot4I8Packed",
- utils::Vector{Expr(1_u), Expr(2_u)})),
+ Vector{Expr(1_u), Expr(2_u)})),
});
EXPECT_TRUE(r()->Resolve());
@@ -550,10 +550,10 @@
TEST_F(ResolverDP4aExtensionValidationTest, Dot4I8PackedWithoutExtension) {
// fn func { return dot4I8Packed(1u, 2u); }
- Func("func", utils::Empty, ty.i32(),
- utils::Vector{
+ Func("func", tint::Empty, ty.i32(),
+ Vector{
Return(Call(Source{Source::Location{12, 34}}, "dot4I8Packed",
- utils::Vector{Expr(1_u), Expr(2_u)})),
+ Vector{Expr(1_u), Expr(2_u)})),
});
EXPECT_FALSE(r()->Resolve());
@@ -567,10 +567,10 @@
// fn func { return dot4U8Packed(1u, 2u); }
Enable(builtin::Extension::kChromiumExperimentalDp4A);
- Func("func", utils::Empty, ty.u32(),
- utils::Vector{
+ Func("func", tint::Empty, ty.u32(),
+ Vector{
Return(Call(Source{Source::Location{12, 34}}, "dot4U8Packed",
- utils::Vector{Expr(1_u), Expr(2_u)})),
+ Vector{Expr(1_u), Expr(2_u)})),
});
EXPECT_TRUE(r()->Resolve());
@@ -578,10 +578,10 @@
TEST_F(ResolverDP4aExtensionValidationTest, Dot4U8PackedWithoutExtension) {
// fn func { return dot4U8Packed(1u, 2u); }
- Func("func", utils::Empty, ty.u32(),
- utils::Vector{
+ Func("func", tint::Empty, ty.u32(),
+ Vector{
Return(Call(Source{Source::Location{12, 34}}, "dot4U8Packed",
- utils::Vector{Expr(1_u), Expr(2_u)})),
+ Vector{Expr(1_u), Expr(2_u)})),
});
EXPECT_FALSE(r()->Resolve());
@@ -596,7 +596,7 @@
// workgroupUniformLoad(&v);
// }
GlobalVar("v", ty.i32(), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
- utils::Vector{Group(0_a), Binding(0_a)});
+ Vector{Group(0_a), Binding(0_a)});
WrapInFunction(CallStmt(Call("workgroupUniformLoad", AddressOf(Source{{12, 34}}, "v"))));
EXPECT_FALSE(r()->Resolve());
@@ -643,8 +643,8 @@
// fn foo() {
// workgroupUniformLoad(&v);
// }
- Structure("Inner", utils::Vector{Member("a", ty.array(ty.atomic<i32>(), 4_a))});
- Structure("S", utils::Vector{Member("i", ty("Inner"))});
+ Structure("Inner", Vector{Member("a", ty.array(ty.atomic<i32>(), 4_a))});
+ Structure("S", Vector{Member("i", ty("Inner"))});
GlobalVar(Source{{12, 34}}, "v", ty.array(ty("S"), 4_a), builtin::AddressSpace::kWorkgroup);
WrapInFunction(CallStmt(Call("workgroupUniformLoad", AddressOf("v"))));
diff --git a/src/tint/lang/wgsl/resolver/builtins_validation_test.cc b/src/tint/lang/wgsl/resolver/builtins_validation_test.cc
index d56a7f7..d1cf4f9 100644
--- a/src/tint/lang/wgsl/resolver/builtins_validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/builtins_validation_test.cc
@@ -109,26 +109,26 @@
const Params& params = GetParam();
auto* p = GlobalVar("p", ty.vec4<f32>(), builtin::AddressSpace::kPrivate);
- auto* input = Param("input", params.type(*this),
- utils::Vector{Builtin(Source{{12, 34}}, params.builtin)});
+ auto* input =
+ Param("input", params.type(*this), Vector{Builtin(Source{{12, 34}}, params.builtin)});
switch (params.stage) {
case ast::PipelineStage::kVertex:
- Func("main", utils::Vector{input}, ty.vec4<f32>(), utils::Vector{Return(p)},
- utils::Vector{Stage(ast::PipelineStage::kVertex)},
- utils::Vector{
+ Func("main", Vector{input}, ty.vec4<f32>(), Vector{Return(p)},
+ Vector{Stage(ast::PipelineStage::kVertex)},
+ Vector{
Builtin(Source{{12, 34}}, builtin::BuiltinValue::kPosition),
});
break;
case ast::PipelineStage::kFragment:
- Func("main", utils::Vector{input}, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", Vector{input}, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
{});
break;
case ast::PipelineStage::kCompute:
- Func("main", utils::Vector{input}, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", Vector{input}, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -140,7 +140,7 @@
if (params.is_valid) {
EXPECT_TRUE(r()->Resolve()) << r()->error();
} else {
- utils::StringStream err;
+ StringStream err;
err << "12:34 error: @builtin(" << params.builtin << ")";
err << " cannot be used in input of " << params.stage << " pipeline stage";
EXPECT_FALSE(r()->Resolve());
@@ -157,20 +157,20 @@
// @builtin(frag_depth) fd: f32,
// ) -> @location(0) f32 { return 1.0; }
Func("fs_main",
- utils::Vector{
+ Vector{
Param("fd", ty.f32(),
- utils::Vector{
+ Vector{
Builtin(Source{{12, 34}}, builtin::BuiltinValue::kFragDepth),
}),
},
ty.f32(),
- utils::Vector{
+ Vector{
Return(1_f),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(0_a),
});
EXPECT_FALSE(r()->Resolve());
@@ -187,25 +187,25 @@
// fn fragShader(arg: MyInputs) -> @location(0) f32 { return 1.0; }
auto* s = Structure("MyInputs",
- utils::Vector{
+ Vector{
Member("frag_depth", ty.f32(),
- utils::Vector{
+ Vector{
Builtin(Source{{12, 34}}, builtin::BuiltinValue::kFragDepth),
}),
});
Func("fragShader",
- utils::Vector{
+ Vector{
Param("arg", ty.Of(s)),
},
ty.f32(),
- utils::Vector{
+ Vector{
Return(1_f),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(0_a),
});
EXPECT_FALSE(r()->Resolve());
@@ -222,15 +222,15 @@
// @fragment
// fn fragShader() { var s : S; }
- Structure("S", utils::Vector{
+ Structure("S", Vector{
Member("idx", ty.u32(),
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kVertexIndex),
}),
});
- Func("fragShader", utils::Empty, ty.void_(), utils::Vector{Decl(Var("s", ty("S")))},
- utils::Vector{
+ Func("fragShader", tint::Empty, ty.void_(), Vector{Decl(Var("s", ty("S")))},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
EXPECT_TRUE(r()->Resolve());
@@ -246,24 +246,24 @@
// fn fragShader(is_front: MyInputs) -> @location(0) f32 { return 1.0; }
auto* s = Structure("MyInputs",
- utils::Vector{
+ Vector{
Member("position", ty.vec4<u32>(),
- utils::Vector{
+ Vector{
Builtin(Source{{12, 34}}, builtin::BuiltinValue::kPosition),
}),
});
Func("fragShader",
- utils::Vector{
+ Vector{
Param("arg", ty.Of(s)),
},
ty.f32(),
- utils::Vector{
+ Vector{
Return(1_f),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(0_a),
});
@@ -274,12 +274,12 @@
TEST_F(ResolverBuiltinsValidationTest, PositionNotF32_ReturnType_Fail) {
// @vertex
// fn main() -> @builtin(position) f32 { return 1.0; }
- Func("main", utils::Empty, ty.f32(),
- utils::Vector{
+ Func("main", tint::Empty, ty.f32(),
+ Vector{
Return(1_f),
},
- utils::Vector{Stage(ast::PipelineStage::kVertex)},
- utils::Vector{
+ Vector{Stage(ast::PipelineStage::kVertex)},
+ Vector{
Builtin(Source{{12, 34}}, builtin::BuiltinValue::kPosition),
});
@@ -295,20 +295,20 @@
// fn fragShader(is_front: MyInputs) -> @location(0) f32 { return 1.0; }
auto* s = Structure("MyInputs",
- utils::Vector{
+ Vector{
Member("frag_depth", ty.i32(),
- utils::Vector{
+ Vector{
Builtin(Source{{12, 34}}, builtin::BuiltinValue::kFragDepth),
}),
});
- Func("fragShader", utils::Vector{Param("arg", ty.Of(s))}, ty.f32(),
- utils::Vector{
+ Func("fragShader", Vector{Param("arg", ty.Of(s))}, ty.f32(),
+ Vector{
Return(1_f),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(0_a),
});
@@ -324,20 +324,20 @@
// fn fragShader(is_front: MyInputs) -> @location(0) f32 { return 1.0; }
auto* s = Structure(
- "MyInputs", utils::Vector{
+ "MyInputs", Vector{
Member("m", ty.f32(),
- utils::Vector{
+ Vector{
Builtin(Source{{12, 34}}, builtin::BuiltinValue::kSampleMask),
}),
});
- Func("fragShader", utils::Vector{Param("arg", ty.Of(s))}, ty.f32(),
- utils::Vector{
+ Func("fragShader", Vector{Param("arg", ty.Of(s))}, ty.f32(),
+ Vector{
Return(1_f),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(0_a),
});
@@ -348,11 +348,11 @@
TEST_F(ResolverBuiltinsValidationTest, SampleMaskNotU32_ReturnType_Fail) {
// @fragment
// fn main() -> @builtin(sample_mask) i32 { return 1; }
- Func("main", utils::Empty, ty.i32(), utils::Vector{Return(1_i)},
- utils::Vector{
+ Func("main", tint::Empty, ty.i32(), Vector{Return(1_i)},
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Builtin(Source{{12, 34}}, builtin::BuiltinValue::kSampleMask),
});
@@ -366,20 +366,20 @@
// @builtin(sample_mask) arg: bool
// ) -> @location(0) f32 { return 1.0; }
Func("fs_main",
- utils::Vector{
+ Vector{
Param("arg", ty.bool_(),
- utils::Vector{
+ Vector{
Builtin(Source{{12, 34}}, builtin::BuiltinValue::kSampleMask),
}),
},
ty.f32(),
- utils::Vector{
+ Vector{
Return(1_f),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(0_a),
});
EXPECT_FALSE(r()->Resolve());
@@ -394,20 +394,20 @@
// fn fragShader(is_front: MyInputs) -> @location(0) f32 { return 1.0; }
auto* s = Structure(
- "MyInputs", utils::Vector{
+ "MyInputs", Vector{
Member("m", ty.f32(),
- utils::Vector{
+ Vector{
Builtin(Source{{12, 34}}, builtin::BuiltinValue::kSampleIndex),
}),
});
- Func("fragShader", utils::Vector{Param("arg", ty.Of(s))}, ty.f32(),
- utils::Vector{
+ Func("fragShader", Vector{Param("arg", ty.Of(s))}, ty.f32(),
+ Vector{
Return(1_f),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(0_a),
});
@@ -421,20 +421,20 @@
// @builtin(sample_index) arg: bool
// ) -> @location(0) f32 { return 1.0; }
Func("fs_main",
- utils::Vector{
+ Vector{
Param("arg", ty.bool_(),
- utils::Vector{
+ Vector{
Builtin(Source{{12, 34}}, builtin::BuiltinValue::kSampleIndex),
}),
},
ty.f32(),
- utils::Vector{
+ Vector{
Return(1_f),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(0_a),
});
EXPECT_FALSE(r()->Resolve());
@@ -447,20 +447,20 @@
// @builtin(kPosition) p: vec3<f32>,
// ) -> @location(0) f32 { return 1.0; }
Func("fs_main",
- utils::Vector{
+ Vector{
Param("p", ty.vec3<f32>(),
- utils::Vector{
+ Vector{
Builtin(Source{{12, 34}}, builtin::BuiltinValue::kPosition),
}),
},
ty.f32(),
- utils::Vector{
+ Vector{
Return(1_f),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(0_a),
});
EXPECT_FALSE(r()->Resolve());
@@ -471,15 +471,15 @@
// @fragment
// fn fs_main() -> @builtin(kFragDepth) f32 { var fd: i32; return fd; }
auto* fd = Var("fd", ty.i32());
- Func("fs_main", utils::Empty, ty.i32(),
- utils::Vector{
+ Func("fs_main", tint::Empty, ty.i32(),
+ Vector{
Decl(fd),
Return(fd),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Builtin(Source{{12, 34}}, builtin::BuiltinValue::kFragDepth),
});
EXPECT_FALSE(r()->Resolve());
@@ -493,18 +493,18 @@
// @builtin(kPosition) p :vec4<f32>
// ) -> @builtin(kPosition) vec4<f32> { return vec4<f32>(); }
auto* p = Param("p", ty.vec4<f32>(),
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kPosition),
});
auto* vi = Param("vi", ty.f32(),
- utils::Vector{
+ Vector{
Builtin(Source{{12, 34}}, builtin::BuiltinValue::kVertexIndex),
});
- Func("main", utils::Vector{vi, p}, ty.vec4<f32>(), utils::Vector{Return(Expr("p"))},
- utils::Vector{
+ Func("main", Vector{vi, p}, ty.vec4<f32>(), Vector{Return(Expr("p"))},
+ Vector{
Stage(ast::PipelineStage::kVertex),
},
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kPosition),
});
EXPECT_FALSE(r()->Resolve());
@@ -518,18 +518,18 @@
// @builtin(kPosition) p :vec4<f32>
// ) -> @builtin(kPosition) vec4<f32> { return vec4<f32>(); }
auto* p = Param("p", ty.vec4<f32>(),
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kPosition),
});
auto* ii = Param("ii", ty.f32(),
- utils::Vector{
+ Vector{
Builtin(Source{{12, 34}}, builtin::BuiltinValue::kInstanceIndex),
});
- Func("main", utils::Vector{ii, p}, ty.vec4<f32>(), utils::Vector{Return(Expr("p"))},
- utils::Vector{
+ Func("main", Vector{ii, p}, ty.vec4<f32>(), Vector{Return(Expr("p"))},
+ Vector{
Stage(ast::PipelineStage::kVertex),
},
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kPosition),
});
EXPECT_FALSE(r()->Resolve());
@@ -545,31 +545,31 @@
// @builtin(sample_mask) sm : u32
// ) -> @builtin(frag_depth) f32 { var fd: f32; return fd; }
auto* p = Param("p", ty.vec4<f32>(),
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kPosition),
});
auto* ff = Param("ff", ty.bool_(),
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kFrontFacing),
});
auto* si = Param("si", ty.u32(),
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kSampleIndex),
});
auto* sm = Param("sm", ty.u32(),
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kSampleMask),
});
auto* var_fd = Var("fd", ty.f32());
- Func("fs_main", utils::Vector{p, ff, si, sm}, ty.f32(),
- utils::Vector{
+ Func("fs_main", Vector{p, ff, si, sm}, ty.f32(),
+ Vector{
Decl(var_fd),
Return(var_fd),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kFragDepth),
});
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -582,22 +582,22 @@
// @builtin(instance_index) ii : u32,
// ) -> @builtin(position) vec4<f32> { var p :vec4<f32>; return p; }
auto* vi = Param("vi", ty.u32(),
- utils::Vector{
+ Vector{
Builtin(Source{{12, 34}}, builtin::BuiltinValue::kVertexIndex),
});
auto* ii = Param("ii", ty.u32(),
- utils::Vector{
+ Vector{
Builtin(Source{{12, 34}}, builtin::BuiltinValue::kInstanceIndex),
});
auto* p = Var("p", ty.vec4<f32>());
- Func("main", utils::Vector{vi, ii}, ty.vec4<f32>(),
- utils::Vector{
+ Func("main", Vector{vi, ii}, ty.vec4<f32>(),
+ Vector{
Decl(p),
Return(p),
},
- utils::Vector{Stage(ast::PipelineStage::kVertex)},
- utils::Vector{
+ Vector{Stage(ast::PipelineStage::kVertex)},
+ Vector{
Builtin(builtin::BuiltinValue::kPosition),
});
@@ -615,41 +615,41 @@
// ) {}
auto* li_id = Param("li_id", ty.vec3<u32>(),
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kLocalInvocationId),
});
auto* li_index = Param("li_index", ty.u32(),
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kLocalInvocationIndex),
});
auto* gi = Param("gi", ty.vec3<u32>(),
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kGlobalInvocationId),
});
auto* wi = Param("wi", ty.vec3<u32>(),
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kWorkgroupId),
});
auto* nwgs = Param("nwgs", ty.vec3<u32>(),
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kNumWorkgroups),
});
- Func("main", utils::Vector{li_id, li_index, gi, wi, nwgs}, ty.void_(), utils::Empty,
- utils::Vector{Stage(ast::PipelineStage::kCompute),
- WorkgroupSize(Expr(Source{Source::Location{12, 34}}, 2_i))});
+ Func("main", Vector{li_id, li_index, gi, wi, nwgs}, ty.void_(), tint::Empty,
+ Vector{Stage(ast::PipelineStage::kCompute),
+ WorkgroupSize(Expr(Source{Source::Location{12, 34}}, 2_i))});
EXPECT_TRUE(r()->Resolve()) << r()->error();
}
TEST_F(ResolverBuiltinsValidationTest, ComputeBuiltin_WorkGroupIdNotVec3U32) {
auto* wi = Param("wi", ty.f32(),
- utils::Vector{
+ Vector{
Builtin(Source{{12, 34}}, builtin::BuiltinValue::kWorkgroupId),
});
- Func("main", utils::Vector{wi}, ty.void_(), utils::Empty,
- utils::Vector{Stage(ast::PipelineStage::kCompute),
- WorkgroupSize(Expr(Source{Source::Location{12, 34}}, 2_i))});
+ Func("main", Vector{wi}, ty.void_(), tint::Empty,
+ Vector{Stage(ast::PipelineStage::kCompute),
+ WorkgroupSize(Expr(Source{Source::Location{12, 34}}, 2_i))});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
@@ -659,12 +659,12 @@
TEST_F(ResolverBuiltinsValidationTest, ComputeBuiltin_NumWorkgroupsNotVec3U32) {
auto* nwgs = Param("nwgs", ty.f32(),
- utils::Vector{
+ Vector{
Builtin(Source{{12, 34}}, builtin::BuiltinValue::kNumWorkgroups),
});
- Func("main", utils::Vector{nwgs}, ty.void_(), utils::Empty,
- utils::Vector{Stage(ast::PipelineStage::kCompute),
- WorkgroupSize(Expr(Source{Source::Location{12, 34}}, 2_i))});
+ Func("main", Vector{nwgs}, ty.void_(), tint::Empty,
+ Vector{Stage(ast::PipelineStage::kCompute),
+ WorkgroupSize(Expr(Source{Source::Location{12, 34}}, 2_i))});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
@@ -674,12 +674,12 @@
TEST_F(ResolverBuiltinsValidationTest, ComputeBuiltin_GlobalInvocationNotVec3U32) {
auto* gi = Param("gi", ty.vec3<i32>(),
- utils::Vector{
+ Vector{
Builtin(Source{{12, 34}}, builtin::BuiltinValue::kGlobalInvocationId),
});
- Func("main", utils::Vector{gi}, ty.void_(), utils::Empty,
- utils::Vector{Stage(ast::PipelineStage::kCompute),
- WorkgroupSize(Expr(Source{Source::Location{12, 34}}, 2_i))});
+ Func("main", Vector{gi}, ty.void_(), tint::Empty,
+ Vector{Stage(ast::PipelineStage::kCompute),
+ WorkgroupSize(Expr(Source{Source::Location{12, 34}}, 2_i))});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
@@ -690,12 +690,12 @@
TEST_F(ResolverBuiltinsValidationTest, ComputeBuiltin_LocalInvocationIndexNotU32) {
auto* li_index =
Param("li_index", ty.vec3<u32>(),
- utils::Vector{
+ Vector{
Builtin(Source{{12, 34}}, builtin::BuiltinValue::kLocalInvocationIndex),
});
- Func("main", utils::Vector{li_index}, ty.void_(), utils::Empty,
- utils::Vector{Stage(ast::PipelineStage::kCompute),
- WorkgroupSize(Expr(Source{Source::Location{12, 34}}, 2_i))});
+ Func("main", Vector{li_index}, ty.void_(), tint::Empty,
+ Vector{Stage(ast::PipelineStage::kCompute),
+ WorkgroupSize(Expr(Source{Source::Location{12, 34}}, 2_i))});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
@@ -705,12 +705,12 @@
TEST_F(ResolverBuiltinsValidationTest, ComputeBuiltin_LocalInvocationNotVec3U32) {
auto* li_id = Param("li_id", ty.vec2<u32>(),
- utils::Vector{
+ Vector{
Builtin(Source{{12, 34}}, builtin::BuiltinValue::kLocalInvocationId),
});
- Func("main", utils::Vector{li_id}, ty.void_(), utils::Empty,
- utils::Vector{Stage(ast::PipelineStage::kCompute),
- WorkgroupSize(Expr(Source{Source::Location{12, 34}}, 2_i))});
+ Func("main", Vector{li_id}, ty.void_(), tint::Empty,
+ Vector{Stage(ast::PipelineStage::kCompute),
+ WorkgroupSize(Expr(Source{Source::Location{12, 34}}, 2_i))});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
@@ -728,32 +728,32 @@
// @fragment
// fn fragShader(arg: MyInputs) -> @location(0) f32 { return 1.0; }
- auto* s = Structure("MyInputs", utils::Vector{
+ auto* s = Structure("MyInputs", Vector{
Member("position", ty.vec4<f32>(),
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kPosition),
}),
Member("front_facing", ty.bool_(),
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kFrontFacing),
}),
Member("sample_index", ty.u32(),
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kSampleIndex),
}),
Member("sample_mask", ty.u32(),
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kSampleMask),
}),
});
- Func("fragShader", utils::Vector{Param("arg", ty.Of(s))}, ty.f32(),
- utils::Vector{
+ Func("fragShader", Vector{Param("arg", ty.Of(s))}, ty.f32(),
+ Vector{
Return(1_f),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(0_a),
});
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -766,17 +766,17 @@
// ) -> @location(0) f32 { return 1.0; }
auto* is_front = Param("is_front", ty.i32(),
- utils::Vector{
+ Vector{
Builtin(Source{{12, 34}}, builtin::BuiltinValue::kFrontFacing),
});
- Func("fs_main", utils::Vector{is_front}, ty.f32(),
- utils::Vector{
+ Func("fs_main", Vector{is_front}, ty.f32(),
+ Vector{
Return(1_f),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(0_a),
});
@@ -792,20 +792,20 @@
// fn fragShader(is_front: MyInputs) -> @location(0) f32 { return 1.0; }
auto* s = Structure(
- "MyInputs", utils::Vector{
+ "MyInputs", Vector{
Member("pos", ty.f32(),
- utils::Vector{
+ Vector{
Builtin(Source{{12, 34}}, builtin::BuiltinValue::kFrontFacing),
}),
});
- Func("fragShader", utils::Vector{Param("is_front", ty.Of(s))}, ty.f32(),
- utils::Vector{
+ Func("fragShader", Vector{Param("is_front", ty.Of(s))}, ty.f32(),
+ Vector{
Return(1_f),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(0_a),
});
@@ -823,11 +823,11 @@
// fn f(s : S) {}
auto* builtin = Builtin(builtin::BuiltinValue::kFrontFacing);
- auto* s = Structure("S", utils::Vector{
- Member("f", ty.bool_(), utils::Vector{builtin}),
+ auto* s = Structure("S", Vector{
+ Member("f", ty.bool_(), Vector{builtin}),
});
- Func("f", utils::Vector{Param("b", ty.Of(s))}, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("f", Vector{Param("b", ty.Of(s))}, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -844,9 +844,8 @@
// fn f(@builtin(front_facing) b : bool) {}
auto* builtin = Builtin(builtin::BuiltinValue::kFrontFacing);
- Func("f", utils::Vector{Param("b", ty.bool_(), utils::Vector{builtin})}, ty.void_(),
- utils::Empty,
- utils::Vector{
+ Func("f", Vector{Param("b", ty.bool_(), Vector{builtin})}, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1154,16 +1153,16 @@
std::string name = std::get<0>(GetParam());
uint32_t num_params = std::get<1>(GetParam());
- utils::Vector<const ast::Expression*, 8> params;
+ Vector<const ast::Expression*, 8> params;
for (uint32_t i = 0; i < num_params; ++i) {
params.Push(Expr(f32(i + 1)));
}
auto* builtin = Call(name, params);
- Func("func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("func", tint::Empty, ty.void_(),
+ Vector{
Assign(Phony(), builtin),
},
- utils::Vector{
+ Vector{
create<ast::StageAttribute>(ast::PipelineStage::kFragment),
});
@@ -1175,16 +1174,16 @@
std::string name = std::get<0>(GetParam());
uint32_t num_params = std::get<1>(GetParam());
- utils::Vector<const ast::Expression*, 8> params;
+ Vector<const ast::Expression*, 8> params;
for (uint32_t i = 0; i < num_params; ++i) {
params.Push(Call<vec2<f32>>(f32(i + 1), f32(i + 1)));
}
auto* builtin = Call(name, params);
- Func("func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("func", tint::Empty, ty.void_(),
+ Vector{
Assign(Phony(), builtin),
},
- utils::Vector{
+ Vector{
create<ast::StageAttribute>(ast::PipelineStage::kFragment),
});
@@ -1196,16 +1195,16 @@
std::string name = std::get<0>(GetParam());
uint32_t num_params = std::get<1>(GetParam());
- utils::Vector<const ast::Expression*, 8> params;
+ Vector<const ast::Expression*, 8> params;
for (uint32_t i = 0; i < num_params; ++i) {
params.Push(Call<vec3<f32>>(f32(i + 1), f32(i + 1), f32(i + 1)));
}
auto* builtin = Call(name, params);
- Func("func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("func", tint::Empty, ty.void_(),
+ Vector{
Assign(Phony(), builtin),
},
- utils::Vector{
+ Vector{
create<ast::StageAttribute>(ast::PipelineStage::kFragment),
});
@@ -1217,16 +1216,16 @@
std::string name = std::get<0>(GetParam());
uint32_t num_params = std::get<1>(GetParam());
- utils::Vector<const ast::Expression*, 8> params;
+ Vector<const ast::Expression*, 8> params;
for (uint32_t i = 0; i < num_params; ++i) {
params.Push(Call<vec4<f32>>(f32(i + 1), f32(i + 1), f32(i + 1), f32(i + 1)));
}
auto* builtin = Call(name, params);
- Func("func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("func", tint::Empty, ty.void_(),
+ Vector{
Assign(Phony(), builtin),
},
- utils::Vector{
+ Vector{
create<ast::StageAttribute>(ast::PipelineStage::kFragment),
});
@@ -1284,7 +1283,7 @@
std::string name = std::get<0>(GetParam());
uint32_t num_params = std::get<1>(GetParam());
- utils::Vector<const ast::Expression*, 8> params;
+ Vector<const ast::Expression*, 8> params;
for (uint32_t i = 0; i < num_params; ++i) {
params.Push(Call<u32>(1_i));
}
@@ -1299,7 +1298,7 @@
std::string name = std::get<0>(GetParam());
uint32_t num_params = std::get<1>(GetParam());
- utils::Vector<const ast::Expression*, 8> params;
+ Vector<const ast::Expression*, 8> params;
for (uint32_t i = 0; i < num_params; ++i) {
params.Push(Call<vec2<u32>>(1_u, 1_u));
}
@@ -1314,7 +1313,7 @@
std::string name = std::get<0>(GetParam());
uint32_t num_params = std::get<1>(GetParam());
- utils::Vector<const ast::Expression*, 8> params;
+ Vector<const ast::Expression*, 8> params;
for (uint32_t i = 0; i < num_params; ++i) {
params.Push(Call<vec3<u32>>(1_u, 1_u, 1_u));
}
@@ -1329,7 +1328,7 @@
std::string name = std::get<0>(GetParam());
uint32_t num_params = std::get<1>(GetParam());
- utils::Vector<const ast::Expression*, 8> params;
+ Vector<const ast::Expression*, 8> params;
for (uint32_t i = 0; i < num_params; ++i) {
params.Push(Call<vec4<u32>>(1_u, 1_u, 1_u, 1_u));
}
@@ -1344,7 +1343,7 @@
std::string name = std::get<0>(GetParam());
uint32_t num_params = std::get<1>(GetParam());
- utils::Vector<const ast::Expression*, 8> params;
+ Vector<const ast::Expression*, 8> params;
for (uint32_t i = 0; i < num_params; ++i) {
params.Push(Call<i32>(1_i));
}
@@ -1359,7 +1358,7 @@
std::string name = std::get<0>(GetParam());
uint32_t num_params = std::get<1>(GetParam());
- utils::Vector<const ast::Expression*, 8> params;
+ Vector<const ast::Expression*, 8> params;
for (uint32_t i = 0; i < num_params; ++i) {
params.Push(Call<vec2<i32>>(1_i, 1_i));
}
@@ -1374,7 +1373,7 @@
std::string name = std::get<0>(GetParam());
uint32_t num_params = std::get<1>(GetParam());
- utils::Vector<const ast::Expression*, 8> params;
+ Vector<const ast::Expression*, 8> params;
for (uint32_t i = 0; i < num_params; ++i) {
params.Push(Call<vec3<i32>>(1_i, 1_i, 1_i));
}
@@ -1389,7 +1388,7 @@
std::string name = std::get<0>(GetParam());
uint32_t num_params = std::get<1>(GetParam());
- utils::Vector<const ast::Expression*, 8> params;
+ Vector<const ast::Expression*, 8> params;
for (uint32_t i = 0; i < num_params; ++i) {
params.Push(Call<vec4<i32>>(1_i, 1_i, 1_i, 1_i));
}
@@ -1416,7 +1415,7 @@
std::string name = std::get<0>(GetParam());
uint32_t num_params = std::get<1>(GetParam());
- utils::Vector<const ast::Expression*, 8> params;
+ Vector<const ast::Expression*, 8> params;
for (uint32_t i = 0; i < num_params; ++i) {
params.Push(Call<vec2<bool>>(true, true));
}
@@ -1430,7 +1429,7 @@
std::string name = std::get<0>(GetParam());
uint32_t num_params = std::get<1>(GetParam());
- utils::Vector<const ast::Expression*, 8> params;
+ Vector<const ast::Expression*, 8> params;
for (uint32_t i = 0; i < num_params; ++i) {
params.Push(Call<vec3<bool>>(true, true, true));
}
@@ -1444,7 +1443,7 @@
std::string name = std::get<0>(GetParam());
uint32_t num_params = std::get<1>(GetParam());
- utils::Vector<const ast::Expression*, 8> params;
+ Vector<const ast::Expression*, 8> params;
for (uint32_t i = 0; i < num_params; ++i) {
params.Push(Call<vec4<bool>>(true, true, true, true));
}
diff --git a/src/tint/lang/wgsl/resolver/call_test.cc b/src/tint/lang/wgsl/resolver/call_test.cc
index 8db12e1..aae5181 100644
--- a/src/tint/lang/wgsl/resolver/call_test.cc
+++ b/src/tint/lang/wgsl/resolver/call_test.cc
@@ -66,14 +66,14 @@
TEST_F(ResolverCallTest, Valid) {
Enable(builtin::Extension::kF16);
- utils::Vector<const ast::Parameter*, 4> params;
- utils::Vector<const ast::Expression*, 4> args;
+ Vector<const ast::Parameter*, 4> params;
+ Vector<const ast::Expression*, 4> args;
for (auto& p : all_param_types) {
params.Push(Param(Sym(), p.create_type(*this)));
args.Push(p.create_value(*this, 0));
}
- auto* func = Func("foo", std::move(params), ty.f32(), utils::Vector{Return(1.23_f)});
+ auto* func = Func("foo", std::move(params), ty.f32(), Vector{Return(1.23_f)});
auto* call_expr = Call("foo", std::move(args));
WrapInFunction(call_expr);
@@ -86,8 +86,8 @@
TEST_F(ResolverCallTest, OutOfOrder) {
auto* call_expr = Call("b");
- Func("a", utils::Empty, ty.void_(), utils::Vector{CallStmt(call_expr)});
- auto* b = Func("b", utils::Empty, ty.void_(), utils::Empty);
+ Func("a", tint::Empty, ty.void_(), Vector{CallStmt(call_expr)});
+ auto* b = Func("b", tint::Empty, ty.void_(), tint::Empty);
EXPECT_TRUE(r()->Resolve()) << r()->error();
diff --git a/src/tint/lang/wgsl/resolver/call_validation_test.cc b/src/tint/lang/wgsl/resolver/call_validation_test.cc
index dd5f41b..ba273e5 100644
--- a/src/tint/lang/wgsl/resolver/call_validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/call_validation_test.cc
@@ -28,12 +28,12 @@
TEST_F(ResolverCallValidationTest, TooFewArgs) {
Func("foo",
- utils::Vector{
+ Vector{
Param(Sym(), ty.i32()),
Param(Sym(), ty.f32()),
},
ty.void_(),
- utils::Vector{
+ Vector{
Return(),
});
auto* call = Call(Source{{12, 34}}, "foo", 1_i);
@@ -45,12 +45,12 @@
TEST_F(ResolverCallValidationTest, TooManyArgs) {
Func("foo",
- utils::Vector{
+ Vector{
Param(Sym(), ty.i32()),
Param(Sym(), ty.f32()),
},
ty.void_(),
- utils::Vector{
+ Vector{
Return(),
});
auto* call = Call(Source{{12, 34}}, "foo", 1_i, 1_f, 1_f);
@@ -62,12 +62,12 @@
TEST_F(ResolverCallValidationTest, MismatchedArgs) {
Func("foo",
- utils::Vector{
+ Vector{
Param(Sym(), ty.i32()),
Param(Sym(), ty.f32()),
},
ty.void_(),
- utils::Vector{
+ Vector{
Return(),
});
auto* call = Call("foo", Expr(Source{{12, 34}}, true), 1_f);
@@ -83,14 +83,14 @@
// fn func() -> f32 { return 1.0; }
// fn main() {func(); return; }
- Func("func", utils::Empty, ty.f32(),
- utils::Vector{
+ Func("func", tint::Empty, ty.f32(),
+ Vector{
Return(Expr(1_f)),
},
- utils::Empty);
+ tint::Empty);
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
CallStmt(Source{{12, 34}}, Call("func")),
Return(),
});
@@ -105,9 +105,9 @@
// foo(&z);
// }
auto* param = Param("p", ty.ptr<function, i32>());
- Func("foo", utils::Vector{param}, ty.void_(), utils::Empty);
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("foo", Vector{param}, ty.void_(), tint::Empty);
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("z", ty.i32(), Expr(1_i))),
CallStmt(Call("foo", AddressOf(Source{{12, 34}}, Expr("z")))),
});
@@ -122,9 +122,9 @@
// foo(&z);
// }
auto* param = Param("p", ty.ptr<function, i32>());
- Func("foo", utils::Vector{param}, ty.void_(), utils::Empty);
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("foo", Vector{param}, ty.void_(), tint::Empty);
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("z", ty.i32(), Expr(1_i))),
CallStmt(Call("foo", AddressOf(Expr(Source{{12, 34}}, "z")))),
});
@@ -140,13 +140,13 @@
// var v : S;
// foo(&v.m);
// }
- auto* S = Structure("S", utils::Vector{
+ auto* S = Structure("S", Vector{
Member("m", ty.i32()),
});
auto* param = Param("p", ty.ptr<function, i32>());
- Func("foo", utils::Vector{param}, ty.void_(), utils::Empty);
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("foo", Vector{param}, ty.void_(), tint::Empty);
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v", ty.Of(S))),
CallStmt(Call("foo", AddressOf(Source{{12, 34}}, MemberAccessor("v", "m")))),
});
@@ -167,13 +167,13 @@
// foo(&v.m);
// }
Enable(builtin::Extension::kChromiumExperimentalFullPtrParameters);
- auto* S = Structure("S", utils::Vector{
+ auto* S = Structure("S", Vector{
Member("m", ty.i32()),
});
auto* param = Param("p", ty.ptr<function, i32>());
- Func("foo", utils::Vector{param}, ty.void_(), utils::Empty);
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("foo", Vector{param}, ty.void_(), tint::Empty);
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v", ty.Of(S))),
CallStmt(Call("foo", AddressOf(Source{{12, 34}}, MemberAccessor("v", "m")))),
});
@@ -187,13 +187,13 @@
// let v: S = S();
// foo(&v.m);
// }
- auto* S = Structure("S", utils::Vector{
+ auto* S = Structure("S", Vector{
Member("m", ty.i32()),
});
auto* param = Param("p", ty.ptr<function, i32>());
- Func("foo", utils::Vector{param}, ty.void_(), utils::Empty);
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("foo", Vector{param}, ty.void_(), tint::Empty);
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("v", ty.Of(S), Call(ty.Of(S)))),
CallStmt(Call("foo", AddressOf(MemberAccessor(Source{{12, 34}}, "v", "m")))),
});
@@ -208,16 +208,16 @@
// foo(p);
// }
Func("foo",
- utils::Vector{
+ Vector{
Param("p", ty.ptr<function, i32>()),
},
- ty.void_(), utils::Empty);
+ ty.void_(), tint::Empty);
Func("bar",
- utils::Vector{
+ Vector{
Param("p", ty.ptr<function, i32>()),
},
ty.void_(),
- utils::Vector{
+ Vector{
CallStmt(Call("foo", Expr("p"))),
});
@@ -235,24 +235,24 @@
// bar(&v);
// }
Func("foo",
- utils::Vector{
+ Vector{
Param("p", ty.ptr<function, i32>()),
},
- ty.void_(), utils::Empty);
+ ty.void_(), tint::Empty);
Func("bar",
- utils::Vector{
+ Vector{
Param("p", ty.ptr<function, i32>()),
},
ty.void_(),
- utils::Vector{
+ Vector{
CallStmt(Call("foo", "p")),
});
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v", ty.i32(), Expr(1_i))),
CallStmt(Call("foo", AddressOf("v"))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -268,17 +268,17 @@
// x(p);
// }
Func("x",
- utils::Vector{
+ Vector{
Param("p", ty.ptr<function, i32>()),
},
- ty.void_(), utils::Empty);
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ ty.void_(), tint::Empty);
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v", ty.i32())),
Decl(Let("p", ty.ptr<function, i32>(), AddressOf("v"))),
CallStmt(Call("x", "p")),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -293,17 +293,17 @@
// foo(p);
// }
Func("foo",
- utils::Vector{
+ Vector{
Param("p", ty.ptr<private_, i32>()),
},
- ty.void_(), utils::Empty);
+ ty.void_(), tint::Empty);
GlobalVar("v", ty.i32(), builtin::AddressSpace::kPrivate);
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("p", ty.ptr<private_, i32>(), AddressOf("v"))),
CallStmt(Call("foo", Expr(Source{{12, 34}}, "p"))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -318,17 +318,17 @@
// x(p);
// }
Func("foo",
- utils::Vector{
+ Vector{
Param("p", ty.ptr<function, i32>()),
},
- ty.void_(), utils::Empty);
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ ty.void_(), tint::Empty);
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v", ty.array<i32, 4>())),
Decl(Let("p", ty.ptr<function, i32>(), AddressOf(IndexAccessor("v", 0_a)))),
CallStmt(Call("foo", Expr(Source{{12, 34}}, "p"))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
EXPECT_FALSE(r()->Resolve());
@@ -348,17 +348,17 @@
// }
Enable(builtin::Extension::kChromiumExperimentalFullPtrParameters);
Func("foo",
- utils::Vector{
+ Vector{
Param("p", ty.ptr<function, i32>()),
},
- ty.void_(), utils::Empty);
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ ty.void_(), tint::Empty);
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v", ty.array<i32, 4>())),
Decl(Let("p", ty.ptr<function, i32>(), AddressOf(IndexAccessor("v", 0_a)))),
CallStmt(Call("foo", Expr(Source{{12, 34}}, "p"))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
EXPECT_TRUE(r()->Resolve());
@@ -375,19 +375,19 @@
// foo(&*p);
// }
Func("foo",
- utils::Vector{
+ Vector{
Param("p", ty.ptr<function, array<i32, 4>>()),
},
- ty.void_(), utils::Empty);
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ ty.void_(), tint::Empty);
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v", ty.array<i32, 4>())),
Decl(Let("p1", AddressOf("v"))),
Decl(Let("p2", Expr("p1"))),
Decl(Let("p3", AddressOf(Deref("p2")))),
CallStmt(Call("foo", AddressOf(Source{{12, 34}}, Deref("p3")))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -404,19 +404,19 @@
// foo(&*p);
// }
Func("foo",
- utils::Vector{
+ Vector{
Param("p", ty.ptr<function, i32>()),
},
- ty.void_(), utils::Empty);
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ ty.void_(), tint::Empty);
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v", ty.array<i32, 4>())),
Decl(Let("p1", AddressOf("v"))),
Decl(Let("p2", Expr("p1"))),
Decl(Let("p3", AddressOf(IndexAccessor(Deref("p2"), 0_a)))),
CallStmt(Call("foo", AddressOf(Source{{12, 34}}, Deref("p3")))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
EXPECT_FALSE(r()->Resolve());
@@ -438,29 +438,28 @@
// }
Enable(builtin::Extension::kChromiumExperimentalFullPtrParameters);
Func("foo",
- utils::Vector{
+ Vector{
Param("p", ty.ptr<function, i32>()),
},
- ty.void_(), utils::Empty);
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ ty.void_(), tint::Empty);
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v", ty.array<i32, 4>())),
Decl(Let("p1", AddressOf("v"))),
Decl(Let("p2", Expr("p1"))),
Decl(Let("p3", AddressOf(IndexAccessor(Deref("p2"), 0_a)))),
CallStmt(Call("foo", AddressOf(Source{{12, 34}}, Deref("p3")))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
EXPECT_TRUE(r()->Resolve());
}
TEST_F(ResolverCallValidationTest, MustUseFunction) {
- Func(Source{{56, 78}}, "fn_must_use", utils::Empty, ty.i32(), utils::Vector{Return(1_i)},
- utils::Vector{MustUse()});
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{CallStmt(Call(Source{{12, 34}}, "fn_must_use"))});
+ Func(Source{{56, 78}}, "fn_must_use", tint::Empty, ty.i32(), Vector{Return(1_i)},
+ Vector{MustUse()});
+ Func("f", tint::Empty, ty.void_(), Vector{CallStmt(Call(Source{{12, 34}}, "fn_must_use"))});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(
@@ -470,8 +469,7 @@
}
TEST_F(ResolverCallValidationTest, MustUseBuiltin) {
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{CallStmt(Call(Source{{12, 34}}, "max", 1_a, 2_a))});
+ Func("f", tint::Empty, ty.void_(), Vector{CallStmt(Call(Source{{12, 34}}, "max", 1_a, 2_a))});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), "12:34 error: ignoring return value of builtin 'max'");
@@ -482,9 +480,9 @@
// fn b() {
// a<i32>();
// }
- Func(Source{{56, 78}}, "a", utils::Empty, ty.void_(), utils::Empty);
- Func("b", utils::Empty, ty.void_(),
- utils::Vector{
+ Func(Source{{56, 78}}, "a", tint::Empty, ty.void_(), tint::Empty);
+ Func("b", tint::Empty, ty.void_(),
+ Vector{
CallStmt(Call(Ident(Source{{12, 34}}, "a", "i32"))),
});
@@ -497,8 +495,8 @@
// fn f() {
// min<i32>(1, 2);
// }
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("v", Call(Ident(Source{{12, 34}}, "min", "i32"), 1_a, 2_a))),
});
diff --git a/src/tint/lang/wgsl/resolver/compound_statement_test.cc b/src/tint/lang/wgsl/resolver/compound_statement_test.cc
index f774af0..e0c5100 100644
--- a/src/tint/lang/wgsl/resolver/compound_statement_test.cc
+++ b/src/tint/lang/wgsl/resolver/compound_statement_test.cc
@@ -35,7 +35,7 @@
// var x : 32;
// }
auto* stmt = Decl(Var("x", ty.i32()));
- auto* f = Func("F", utils::Empty, ty.void_(), utils::Vector{stmt});
+ auto* f = Func("F", tint::Empty, ty.void_(), Vector{stmt});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -57,7 +57,7 @@
// }
auto* stmt = Decl(Var("x", ty.i32()));
auto* block = Block(stmt);
- auto* f = Func("F", utils::Empty, ty.void_(), utils::Vector{block});
+ auto* f = Func("F", tint::Empty, ty.void_(), Vector{block});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -92,7 +92,7 @@
auto* brk = Break();
auto* stmt = Ignore(1_i);
auto* loop = Loop(Block(brk), Block(stmt));
- auto* f = Func("F", utils::Empty, ty.void_(), utils::Vector{loop});
+ auto* f = Func("F", tint::Empty, ty.void_(), Vector{loop});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -155,7 +155,7 @@
// }
auto* brk = Break();
auto* loop = Loop(Block(brk), Block());
- Func("F", utils::Empty, ty.void_(), utils::Vector{loop});
+ Func("F", tint::Empty, ty.void_(), Vector{loop});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -186,7 +186,7 @@
auto* stmt = Return();
auto* body = Block(stmt);
auto* for_ = For(init, cond, cont, body);
- auto* f = Func("F", utils::Empty, ty.void_(), utils::Vector{for_});
+ auto* f = Func("F", tint::Empty, ty.void_(), Vector{for_});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -250,7 +250,7 @@
auto* stmt = Return();
auto* body = Block(stmt);
auto* while_ = While(cond, body);
- auto* f = Func("W", utils::Empty, ty.void_(), utils::Vector{while_});
+ auto* f = Func("W", tint::Empty, ty.void_(), Vector{while_});
ASSERT_TRUE(r()->Resolve()) << r()->error();
diff --git a/src/tint/lang/wgsl/resolver/const_eval.cc b/src/tint/lang/wgsl/resolver/const_eval.cc
index dbf1f7a..aa5c67c 100644
--- a/src/tint/lang/wgsl/resolver/const_eval.cc
+++ b/src/tint/lang/wgsl/resolver/const_eval.cc
@@ -175,7 +175,7 @@
template <typename NumberT>
std::string OverflowErrorMessage(NumberT lhs, const char* op, NumberT rhs) {
- utils::StringStream ss;
+ StringStream ss;
ss << "'" << lhs.value << " " << op << " " << rhs.value << "' cannot be represented as '"
<< FriendlyName<NumberT>() << "'";
return ss.str();
@@ -183,7 +183,7 @@
template <typename VALUE_TY>
std::string OverflowErrorMessage(VALUE_TY value, std::string_view target_ty) {
- utils::StringStream ss;
+ StringStream ss;
ss << "value " << value << " cannot be represented as "
<< "'" << target_ty << "'";
return ss.str();
@@ -191,7 +191,7 @@
template <typename NumberT>
std::string OverflowExpErrorMessage(std::string_view base, NumberT exp) {
- utils::StringStream ss;
+ StringStream ss;
ss << base << "^" << exp << " cannot be represented as "
<< "'" << FriendlyName<NumberT>() << "'";
return ss.str();
@@ -345,11 +345,11 @@
};
using Action = std::variant<ActionConvert, ActionBuildSplat, ActionBuildComposite>;
- utils::Vector<Action, 8> pending{
+ Vector<Action, 8> pending{
ActionConvert{root_value, root_target_ty},
};
- utils::Vector<const constant::Value*, 32> value_stack;
+ Vector<const constant::Value*, 32> value_stack;
while (!pending.IsEmpty()) {
auto next = pending.Pop();
@@ -365,7 +365,7 @@
TINT_ASSERT(Resolver, value_stack.Length() >= build->count);
// Take build->count elements off the top of value_stack
// Note: The values are ordered with the first composite value at the top of the stack.
- utils::Vector<const constant::Value*, 32> elements;
+ Vector<const constant::Value*, 32> elements;
elements.Reserve(build->count);
for (size_t i = 0; i < build->count; i++) {
elements.Push(value_stack.Pop());
@@ -483,7 +483,7 @@
auto [el_ty, n] = First(cs...)->Type()->Elements();
if (!el_ty) {
constexpr bool kHasIndexParam =
- utils::traits::IsType<size_t, utils::traits::LastParameterType<F>>;
+ tint::traits::IsType<size_t, tint::traits::LastParameterType<F>>;
if constexpr (kHasIndexParam) {
return f(cs..., index);
} else {
@@ -493,7 +493,7 @@
auto* composite_el_ty = composite_ty->Elements(composite_ty).type;
- utils::Vector<const constant::Value*, 8> els;
+ Vector<const constant::Value*, 8> els;
els.Reserve(n);
for (uint32_t i = 0; i < n; i++) {
if (auto el = detail::TransformElements(builder, composite_el_ty, std::forward<F>(f),
@@ -541,7 +541,7 @@
const auto* element_ty = composite_ty->Elements(composite_ty).type;
- utils::Vector<const constant::Value*, 8> els;
+ Vector<const constant::Value*, 8> els;
els.Reserve(max_n);
for (uint32_t i = 0; i < max_n; i++) {
auto nested_or_self = [&](auto* c, uint32_t num_elems) {
@@ -575,7 +575,7 @@
if (use_runtime_semantics_) {
return ZeroValue(t);
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
}
@@ -602,8 +602,8 @@
return nullptr;
},
[&](const type::Struct* s) -> const constant::Value* {
- utils::Hashmap<const type::Type*, const constant::Value*, 8> zero_by_type;
- utils::Vector<const constant::Value*, 4> zeros;
+ Hashmap<const type::Type*, const constant::Value*, 8> zero_by_type;
+ Vector<const constant::Value*, 4> zeros;
zeros.Reserve(s->Members().Length());
for (auto* member : s->Members()) {
auto* zero = zero_by_type.GetOrCreate(member->Type(),
@@ -629,7 +629,7 @@
}
template <typename NumberT>
-utils::Result<NumberT> ConstEval::Add(const Source& source, NumberT a, NumberT b) {
+tint::Result<NumberT> ConstEval::Add(const Source& source, NumberT a, NumberT b) {
NumberT result;
if constexpr (IsAbstract<NumberT> || IsFloatingPoint<NumberT>) {
if (auto r = CheckedAdd(a, b)) {
@@ -639,7 +639,7 @@
if (use_runtime_semantics_) {
return NumberT{0};
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
} else {
@@ -659,7 +659,7 @@
}
template <typename NumberT>
-utils::Result<NumberT> ConstEval::Sub(const Source& source, NumberT a, NumberT b) {
+tint::Result<NumberT> ConstEval::Sub(const Source& source, NumberT a, NumberT b) {
NumberT result;
if constexpr (IsAbstract<NumberT> || IsFloatingPoint<NumberT>) {
if (auto r = CheckedSub(a, b)) {
@@ -669,7 +669,7 @@
if (use_runtime_semantics_) {
return NumberT{0};
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
} else {
@@ -689,7 +689,7 @@
}
template <typename NumberT>
-utils::Result<NumberT> ConstEval::Mul(const Source& source, NumberT a, NumberT b) {
+tint::Result<NumberT> ConstEval::Mul(const Source& source, NumberT a, NumberT b) {
using T = UnwrapNumber<NumberT>;
NumberT result;
if constexpr (IsAbstract<NumberT> || IsFloatingPoint<NumberT>) {
@@ -700,7 +700,7 @@
if (use_runtime_semantics_) {
return NumberT{0};
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
} else {
@@ -719,7 +719,7 @@
}
template <typename NumberT>
-utils::Result<NumberT> ConstEval::Div(const Source& source, NumberT a, NumberT b) {
+tint::Result<NumberT> ConstEval::Div(const Source& source, NumberT a, NumberT b) {
NumberT result;
if constexpr (IsAbstract<NumberT> || IsFloatingPoint<NumberT>) {
if (auto r = CheckedDiv(a, b)) {
@@ -729,7 +729,7 @@
if (use_runtime_semantics_) {
return a;
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
} else {
@@ -742,7 +742,7 @@
if (use_runtime_semantics_) {
return a;
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
if constexpr (std::is_signed_v<T>) {
@@ -753,7 +753,7 @@
if (use_runtime_semantics_) {
return a;
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
}
@@ -763,7 +763,7 @@
}
template <typename NumberT>
-utils::Result<NumberT> ConstEval::Mod(const Source& source, NumberT a, NumberT b) {
+tint::Result<NumberT> ConstEval::Mod(const Source& source, NumberT a, NumberT b) {
NumberT result;
if constexpr (IsAbstract<NumberT> || IsFloatingPoint<NumberT>) {
if (auto r = CheckedMod(a, b)) {
@@ -773,7 +773,7 @@
if (use_runtime_semantics_) {
return NumberT{0};
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
} else {
@@ -786,7 +786,7 @@
if (use_runtime_semantics_) {
return NumberT{0};
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
if constexpr (std::is_signed_v<T>) {
@@ -797,7 +797,7 @@
if (use_runtime_semantics_) {
return NumberT{0};
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
}
@@ -807,104 +807,104 @@
}
template <typename NumberT>
-utils::Result<NumberT> ConstEval::Dot2(const Source& source,
- NumberT a1,
- NumberT a2,
- NumberT b1,
- NumberT b2) {
+tint::Result<NumberT> ConstEval::Dot2(const Source& source,
+ NumberT a1,
+ NumberT a2,
+ NumberT b1,
+ NumberT b2) {
auto r1 = Mul(source, a1, b1);
if (!r1) {
- return utils::Failure;
+ return tint::Failure;
}
auto r2 = Mul(source, a2, b2);
if (!r2) {
- return utils::Failure;
+ return tint::Failure;
}
auto r = Add(source, r1.Get(), r2.Get());
if (!r) {
- return utils::Failure;
+ return tint::Failure;
}
return r;
}
template <typename NumberT>
-utils::Result<NumberT> ConstEval::Dot3(const Source& source,
- NumberT a1,
- NumberT a2,
- NumberT a3,
- NumberT b1,
- NumberT b2,
- NumberT b3) {
+tint::Result<NumberT> ConstEval::Dot3(const Source& source,
+ NumberT a1,
+ NumberT a2,
+ NumberT a3,
+ NumberT b1,
+ NumberT b2,
+ NumberT b3) {
auto r1 = Mul(source, a1, b1);
if (!r1) {
- return utils::Failure;
+ return tint::Failure;
}
auto r2 = Mul(source, a2, b2);
if (!r2) {
- return utils::Failure;
+ return tint::Failure;
}
auto r3 = Mul(source, a3, b3);
if (!r3) {
- return utils::Failure;
+ return tint::Failure;
}
auto r = Add(source, r1.Get(), r2.Get());
if (!r) {
- return utils::Failure;
+ return tint::Failure;
}
r = Add(source, r.Get(), r3.Get());
if (!r) {
- return utils::Failure;
+ return tint::Failure;
}
return r;
}
template <typename NumberT>
-utils::Result<NumberT> ConstEval::Dot4(const Source& source,
- NumberT a1,
- NumberT a2,
- NumberT a3,
- NumberT a4,
- NumberT b1,
- NumberT b2,
- NumberT b3,
- NumberT b4) {
+tint::Result<NumberT> ConstEval::Dot4(const Source& source,
+ NumberT a1,
+ NumberT a2,
+ NumberT a3,
+ NumberT a4,
+ NumberT b1,
+ NumberT b2,
+ NumberT b3,
+ NumberT b4) {
auto r1 = Mul(source, a1, b1);
if (!r1) {
- return utils::Failure;
+ return tint::Failure;
}
auto r2 = Mul(source, a2, b2);
if (!r2) {
- return utils::Failure;
+ return tint::Failure;
}
auto r3 = Mul(source, a3, b3);
if (!r3) {
- return utils::Failure;
+ return tint::Failure;
}
auto r4 = Mul(source, a4, b4);
if (!r4) {
- return utils::Failure;
+ return tint::Failure;
}
auto r = Add(source, r1.Get(), r2.Get());
if (!r) {
- return utils::Failure;
+ return tint::Failure;
}
r = Add(source, r.Get(), r3.Get());
if (!r) {
- return utils::Failure;
+ return tint::Failure;
}
r = Add(source, r.Get(), r4.Get());
if (!r) {
- return utils::Failure;
+ return tint::Failure;
}
return r;
}
template <typename NumberT>
-utils::Result<NumberT> ConstEval::Det2(const Source& source,
- NumberT a,
- NumberT b,
- NumberT c,
- NumberT d) {
+tint::Result<NumberT> ConstEval::Det2(const Source& source,
+ NumberT a,
+ NumberT b,
+ NumberT c,
+ NumberT d) {
// | a c |
// | b d |
//
@@ -914,30 +914,30 @@
auto r1 = Mul(source, a, d);
if (!r1) {
- return utils::Failure;
+ return tint::Failure;
}
auto r2 = Mul(source, c, b);
if (!r2) {
- return utils::Failure;
+ return tint::Failure;
}
auto r = Sub(source, r1.Get(), r2.Get());
if (!r) {
- return utils::Failure;
+ return tint::Failure;
}
return r;
}
template <typename NumberT>
-utils::Result<NumberT> ConstEval::Det3(const Source& source,
- NumberT a,
- NumberT b,
- NumberT c,
- NumberT d,
- NumberT e,
- NumberT f,
- NumberT g,
- NumberT h,
- NumberT i) {
+tint::Result<NumberT> ConstEval::Det3(const Source& source,
+ NumberT a,
+ NumberT b,
+ NumberT c,
+ NumberT d,
+ NumberT e,
+ NumberT f,
+ NumberT g,
+ NumberT h,
+ NumberT i) {
// | a d g |
// | b e h |
// | c f i |
@@ -949,53 +949,53 @@
auto det1 = Det2(source, e, f, h, i);
if (!det1) {
- return utils::Failure;
+ return tint::Failure;
}
auto a_det1 = Mul(source, a, det1.Get());
if (!a_det1) {
- return utils::Failure;
+ return tint::Failure;
}
auto det2 = Det2(source, b, c, h, i);
if (!det2) {
- return utils::Failure;
+ return tint::Failure;
}
auto d_det2 = Mul(source, d, det2.Get());
if (!d_det2) {
- return utils::Failure;
+ return tint::Failure;
}
auto det3 = Det2(source, b, c, e, f);
if (!det3) {
- return utils::Failure;
+ return tint::Failure;
}
auto g_det3 = Mul(source, g, det3.Get());
if (!g_det3) {
- return utils::Failure;
+ return tint::Failure;
}
auto r = Sub(source, a_det1.Get(), d_det2.Get());
if (!r) {
- return utils::Failure;
+ return tint::Failure;
}
return Add(source, r.Get(), g_det3.Get());
}
template <typename NumberT>
-utils::Result<NumberT> ConstEval::Det4(const Source& source,
- NumberT a,
- NumberT b,
- NumberT c,
- NumberT d,
- NumberT e,
- NumberT f,
- NumberT g,
- NumberT h,
- NumberT i,
- NumberT j,
- NumberT k,
- NumberT l,
- NumberT m,
- NumberT n,
- NumberT o,
- NumberT p) {
+tint::Result<NumberT> ConstEval::Det4(const Source& source,
+ NumberT a,
+ NumberT b,
+ NumberT c,
+ NumberT d,
+ NumberT e,
+ NumberT f,
+ NumberT g,
+ NumberT h,
+ NumberT i,
+ NumberT j,
+ NumberT k,
+ NumberT l,
+ NumberT m,
+ NumberT n,
+ NumberT o,
+ NumberT p) {
// | a e i m |
// | b f j n |
// | c g k o |
@@ -1009,55 +1009,55 @@
auto det1 = Det3(source, f, g, h, j, k, l, n, o, p);
if (!det1) {
- return utils::Failure;
+ return tint::Failure;
}
auto a_det1 = Mul(source, a, det1.Get());
if (!a_det1) {
- return utils::Failure;
+ return tint::Failure;
}
auto det2 = Det3(source, b, c, d, j, k, l, n, o, p);
if (!det2) {
- return utils::Failure;
+ return tint::Failure;
}
auto e_det2 = Mul(source, e, det2.Get());
if (!e_det2) {
- return utils::Failure;
+ return tint::Failure;
}
auto det3 = Det3(source, b, c, d, f, g, h, n, o, p);
if (!det3) {
- return utils::Failure;
+ return tint::Failure;
}
auto i_det3 = Mul(source, i, det3.Get());
if (!i_det3) {
- return utils::Failure;
+ return tint::Failure;
}
auto det4 = Det3(source, b, c, d, f, g, h, j, k, l);
if (!det4) {
- return utils::Failure;
+ return tint::Failure;
}
auto m_det4 = Mul(source, m, det4.Get());
if (!m_det4) {
- return utils::Failure;
+ return tint::Failure;
}
auto r = Sub(source, a_det1.Get(), e_det2.Get());
if (!r) {
- return utils::Failure;
+ return tint::Failure;
}
r = Add(source, r.Get(), i_det3.Get());
if (!r) {
- return utils::Failure;
+ return tint::Failure;
}
return Sub(source, r.Get(), m_det4.Get());
}
template <typename NumberT>
-utils::Result<NumberT> ConstEval::Sqrt(const Source& source, NumberT v) {
+tint::Result<NumberT> ConstEval::Sqrt(const Source& source, NumberT v) {
if (v < NumberT(0)) {
AddError("sqrt must be called with a value >= 0", source);
if (use_runtime_semantics_) {
return NumberT{0};
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
return NumberT{std::sqrt(v)};
@@ -1068,21 +1068,18 @@
if (auto r = Sqrt(source, v)) {
return CreateScalar(source, elem_ty, r.Get());
}
- return utils::Failure;
+ return tint::Failure;
};
}
template <typename NumberT>
-utils::Result<NumberT> ConstEval::Clamp(const Source& source,
- NumberT e,
- NumberT low,
- NumberT high) {
+tint::Result<NumberT> ConstEval::Clamp(const Source& source, NumberT e, NumberT low, NumberT high) {
if (low > high) {
- utils::StringStream ss;
+ StringStream ss;
ss << "clamp called with 'low' (" << low << ") greater than 'high' (" << high << ")";
AddError(ss.str(), source);
if (!use_runtime_semantics_) {
- return utils::Failure;
+ return tint::Failure;
}
}
return NumberT{std::min(std::max(e, low), high)};
@@ -1093,7 +1090,7 @@
if (auto r = Clamp(source, e, low, high)) {
return CreateScalar(source, elem_ty, r.Get());
}
- return utils::Failure;
+ return tint::Failure;
};
}
@@ -1102,7 +1099,7 @@
if (auto r = Add(source, a1, a2)) {
return CreateScalar(source, elem_ty, r.Get());
}
- return utils::Failure;
+ return tint::Failure;
};
}
@@ -1111,7 +1108,7 @@
if (auto r = Sub(source, a1, a2)) {
return CreateScalar(source, elem_ty, r.Get());
}
- return utils::Failure;
+ return tint::Failure;
};
}
@@ -1120,7 +1117,7 @@
if (auto r = Mul(source, a1, a2)) {
return CreateScalar(source, elem_ty, r.Get());
}
- return utils::Failure;
+ return tint::Failure;
};
}
@@ -1129,7 +1126,7 @@
if (auto r = Div(source, a1, a2)) {
return CreateScalar(source, elem_ty, r.Get());
}
- return utils::Failure;
+ return tint::Failure;
};
}
@@ -1138,7 +1135,7 @@
if (auto r = Mod(source, a1, a2)) {
return CreateScalar(source, elem_ty, r.Get());
}
- return utils::Failure;
+ return tint::Failure;
};
}
@@ -1147,7 +1144,7 @@
if (auto r = Dot2(source, a1, a2, b1, b2)) {
return CreateScalar(source, elem_ty, r.Get());
}
- return utils::Failure;
+ return tint::Failure;
};
}
@@ -1156,7 +1153,7 @@
if (auto r = Dot3(source, a1, a2, a3, b1, b2, b3)) {
return CreateScalar(source, elem_ty, r.Get());
}
- return utils::Failure;
+ return tint::Failure;
};
}
@@ -1166,7 +1163,7 @@
if (auto r = Dot4(source, a1, a2, a3, a4, b1, b2, b3, b4)) {
return CreateScalar(source, elem_ty, r.Get());
}
- return utils::Failure;
+ return tint::Failure;
};
}
@@ -1194,7 +1191,7 @@
v2->Index(0), v2->Index(1), v2->Index(2), v2->Index(3));
}
TINT_ICE(Resolver, builder.Diagnostics()) << "Expected vector";
- return utils::Failure;
+ return tint::Failure;
}
ConstEval::Result ConstEval::Length(const Source& source,
@@ -1213,7 +1210,7 @@
// Evaluates to sqrt(e[0]^2 + e[1]^2 + ...) if T is a vector type.
auto d = Dot(source, c0, c0);
if (!d) {
- return utils::Failure;
+ return tint::Failure;
}
return Dispatch_fa_f32_f16(SqrtFunc(source, ty), d.Get());
}
@@ -1243,7 +1240,7 @@
if (auto r = Det2(source, a, b, c, d)) {
return CreateScalar(source, elem_ty, r.Get());
}
- return utils::Failure;
+ return tint::Failure;
};
}
@@ -1253,7 +1250,7 @@
if (auto r = Det3(source, a, b, c, d, e, f, g, h, i)) {
return CreateScalar(source, elem_ty, r.Get());
}
- return utils::Failure;
+ return tint::Failure;
};
}
@@ -1263,7 +1260,7 @@
if (auto r = Det4(source, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)) {
return CreateScalar(source, elem_ty, r.Get());
}
- return utils::Failure;
+ return tint::Failure;
};
}
@@ -1297,7 +1294,7 @@
}
ConstEval::Result ConstEval::ArrayOrStructCtor(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args) {
+ VectorRef<const constant::Value*> args) {
if (args.IsEmpty()) {
return ZeroValue(ty);
}
@@ -1312,7 +1309,7 @@
}
ConstEval::Result ConstEval::Conv(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto* el_ty = ty->Elements(ty).type;
if (!el_ty) {
@@ -1327,19 +1324,19 @@
}
ConstEval::Result ConstEval::Zero(const type::Type* ty,
- utils::VectorRef<const constant::Value*>,
+ VectorRef<const constant::Value*>,
const Source&) {
return ZeroValue(ty);
}
ConstEval::Result ConstEval::Identity(const type::Type*,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source&) {
return args[0];
}
ConstEval::Result ConstEval::VecSplat(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source&) {
if (auto* arg = args[0]) {
return builder.constants.Splat(ty, arg, static_cast<const type::Vector*>(ty)->Width());
@@ -1348,15 +1345,15 @@
}
ConstEval::Result ConstEval::VecInitS(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source&) {
return builder.constants.Composite(ty, args);
}
ConstEval::Result ConstEval::VecInitM(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source&) {
- utils::Vector<const constant::Value*, 4> els;
+ Vector<const constant::Value*, 4> els;
for (auto* arg : args) {
auto* val = arg;
if (!val) {
@@ -1380,13 +1377,13 @@
}
ConstEval::Result ConstEval::MatInitS(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source&) {
auto* m = static_cast<const type::Matrix*>(ty);
- utils::Vector<const constant::Value*, 4> els;
+ Vector<const constant::Value*, 4> els;
for (uint32_t c = 0; c < m->columns(); c++) {
- utils::Vector<const constant::Value*, 4> column;
+ Vector<const constant::Value*, 4> column;
for (uint32_t r = 0; r < m->rows(); r++) {
auto i = r + c * m->rows();
column.Push(args[i]);
@@ -1397,7 +1394,7 @@
}
ConstEval::Result ConstEval::MatInitV(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source&) {
return builder.constants.Composite(ty, args);
}
@@ -1423,7 +1420,7 @@
if (use_runtime_semantics_) {
return ZeroValue(ty);
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
@@ -1446,7 +1443,7 @@
ConstEval::Result ConstEval::Swizzle(const type::Type* ty,
const sem::ValueExpression* vec_expr,
- utils::VectorRef<uint32_t> indices) {
+ VectorRef<uint32_t> indices) {
auto* vec_val = vec_expr->ConstantValue();
if (!vec_val) {
return nullptr;
@@ -1454,7 +1451,7 @@
if (indices.Length() == 1) {
return vec_val->Index(static_cast<size_t>(indices[0]));
}
- auto values = utils::Transform<4>(
+ auto values = tint::Transform<4>(
indices, [&](uint32_t i) { return vec_val->Index(static_cast<size_t>(i)); });
return builder.constants.Composite(ty, std::move(values));
}
@@ -1474,7 +1471,7 @@
TINT_ASSERT(Resolver, dst_count * dst_el_ty->Size() == src_count * src_el_ty->Size());
uint32_t total_bitwidth = dst_count * dst_el_ty->Size();
// Buffer holding the bits from source value, result value reinterpreted from it.
- utils::Vector<std::byte, 16> buffer;
+ Vector<std::byte, 16> buffer;
buffer.Reserve(total_bitwidth);
// Ensure elements are of 32-bit or 16-bit numerical scalar type.
@@ -1498,11 +1495,11 @@
push_32_bits(r);
},
[&](const type::I32*) { //
- uint32_t r = utils::Bitcast<u32>(element->ValueAs<i32>());
+ uint32_t r = tint::Bitcast<u32>(element->ValueAs<i32>());
push_32_bits(r);
},
[&](const type::F32*) { //
- uint32_t r = utils::Bitcast<u32>(element->ValueAs<f32>());
+ uint32_t r = tint::Bitcast<u32>(element->ValueAs<f32>());
push_32_bits(r);
},
[&](const type::F16*) { //
@@ -1519,7 +1516,7 @@
}
// Vector holding elements of return value
- utils::Vector<const constant::Value*, 4> els;
+ Vector<const constant::Value*, 4> els;
// Reinterprets the buffer bits as destination element and push the result into the vector.
// Return false if an error occured, otherwise return true.
@@ -1545,14 +1542,14 @@
return r;
},
[&](const type::I32*) { //
- auto r = CreateScalar(source, dst_el_ty, utils::Bitcast<i32>(v));
+ auto r = CreateScalar(source, dst_el_ty, tint::Bitcast<i32>(v));
if (r) {
els.Push(r.Get());
}
return r;
},
[&](const type::F32*) { //
- auto r = CreateScalar(source, dst_el_ty, utils::Bitcast<f32>(v));
+ auto r = CreateScalar(source, dst_el_ty, tint::Bitcast<f32>(v));
if (r) {
els.Push(r.Get());
}
@@ -1570,7 +1567,7 @@
TINT_ASSERT(Resolver, (buffer.Length() == total_bitwidth));
for (size_t i = 0; i < dst_count; i++) {
if (!push_dst_element(i * dst_el_ty->Size())) {
- return utils::Failure;
+ return tint::Failure;
}
}
@@ -1581,7 +1578,7 @@
}
ConstEval::Result ConstEval::OpComplement(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c) {
auto create = [&](auto i) {
@@ -1593,7 +1590,7 @@
}
ConstEval::Result ConstEval::OpUnaryMinus(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c) {
auto create = [&](auto i) {
@@ -1618,7 +1615,7 @@
}
ConstEval::Result ConstEval::OpNot(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c) {
auto create = [&](auto i) { return CreateScalar(source, c->Type(), decltype(i)(!i)); };
@@ -1628,7 +1625,7 @@
}
ConstEval::Result ConstEval::OpPlus(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0, const constant::Value* c1) {
return Dispatch_fia_fiu32_f16(AddFunc(source, c0->Type()), c0, c1);
@@ -1638,19 +1635,19 @@
}
ConstEval::Result ConstEval::OpMinus(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
return Sub(source, ty, args[0], args[1]);
}
ConstEval::Result ConstEval::OpMultiply(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
return Mul(source, ty, args[0], args[1]);
}
ConstEval::Result ConstEval::OpMultiplyMatVec(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto* mat_ty = args[0]->Type()->As<type::Matrix>();
auto* vec_ty = args[1]->Type()->As<type::Vector>();
@@ -1689,18 +1686,18 @@
return result;
};
- utils::Vector<const constant::Value*, 4> result;
+ Vector<const constant::Value*, 4> result;
for (size_t i = 0; i < mat_ty->rows(); ++i) {
auto r = dot(args[0], i, args[1]); // matrix row i * vector
if (!r) {
- return utils::Failure;
+ return tint::Failure;
}
result.Push(r.Get());
}
return builder.constants.Composite(ty, result);
}
ConstEval::Result ConstEval::OpMultiplyVecMat(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto* vec_ty = args[0]->Type()->As<type::Vector>();
auto* mat_ty = args[1]->Type()->As<type::Matrix>();
@@ -1739,11 +1736,11 @@
return result;
};
- utils::Vector<const constant::Value*, 4> result;
+ Vector<const constant::Value*, 4> result;
for (size_t i = 0; i < mat_ty->columns(); ++i) {
auto r = dot(args[0], args[1], i); // vector * matrix col i
if (!r) {
- return utils::Failure;
+ return tint::Failure;
}
result.Push(r.Get());
}
@@ -1751,7 +1748,7 @@
}
ConstEval::Result ConstEval::OpMultiplyMatMat(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto* mat1 = args[0];
auto* mat2 = args[1];
@@ -1796,13 +1793,13 @@
return result;
};
- utils::Vector<const constant::Value*, 4> result_mat;
+ Vector<const constant::Value*, 4> result_mat;
for (size_t c = 0; c < mat2_ty->columns(); ++c) {
- utils::Vector<const constant::Value*, 4> col_vec;
+ Vector<const constant::Value*, 4> col_vec;
for (size_t r = 0; r < mat1_ty->rows(); ++r) {
auto v = dot(mat1, r, mat2, c); // mat1 row r * mat2 col c
if (!v) {
- return utils::Failure;
+ return tint::Failure;
}
col_vec.Push(v.Get()); // mat1 row r * mat2 col c
}
@@ -1815,7 +1812,7 @@
}
ConstEval::Result ConstEval::OpDivide(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0, const constant::Value* c1) {
return Dispatch_fia_fiu32_f16(DivFunc(source, c0->Type()), c0, c1);
@@ -1825,7 +1822,7 @@
}
ConstEval::Result ConstEval::OpModulo(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0, const constant::Value* c1) {
return Dispatch_fia_fiu32_f16(ModFunc(source, c0->Type()), c0, c1);
@@ -1835,7 +1832,7 @@
}
ConstEval::Result ConstEval::OpEqual(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0, const constant::Value* c1) {
auto create = [&](auto i, auto j) -> ConstEval::Result {
@@ -1848,7 +1845,7 @@
}
ConstEval::Result ConstEval::OpNotEqual(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0, const constant::Value* c1) {
auto create = [&](auto i, auto j) -> ConstEval::Result {
@@ -1861,7 +1858,7 @@
}
ConstEval::Result ConstEval::OpLessThan(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0, const constant::Value* c1) {
auto create = [&](auto i, auto j) -> ConstEval::Result {
@@ -1874,7 +1871,7 @@
}
ConstEval::Result ConstEval::OpGreaterThan(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0, const constant::Value* c1) {
auto create = [&](auto i, auto j) -> ConstEval::Result {
@@ -1887,7 +1884,7 @@
}
ConstEval::Result ConstEval::OpLessThanEqual(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0, const constant::Value* c1) {
auto create = [&](auto i, auto j) -> ConstEval::Result {
@@ -1900,7 +1897,7 @@
}
ConstEval::Result ConstEval::OpGreaterThanEqual(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0, const constant::Value* c1) {
auto create = [&](auto i, auto j) -> ConstEval::Result {
@@ -1913,7 +1910,7 @@
}
ConstEval::Result ConstEval::OpLogicalAnd(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
// Due to short-circuiting, this function is only called if lhs is true, so we only return the
// value of the rhs.
@@ -1922,7 +1919,7 @@
}
ConstEval::Result ConstEval::OpLogicalOr(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
// Due to short-circuiting, this function is only called if lhs is false, so we only only return
// the value of the rhs.
@@ -1931,7 +1928,7 @@
}
ConstEval::Result ConstEval::OpAnd(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0, const constant::Value* c1) {
auto create = [&](auto i, auto j) -> ConstEval::Result {
@@ -1951,7 +1948,7 @@
}
ConstEval::Result ConstEval::OpOr(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0, const constant::Value* c1) {
auto create = [&](auto i, auto j) -> ConstEval::Result {
@@ -1971,7 +1968,7 @@
}
ConstEval::Result ConstEval::OpXor(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0, const constant::Value* c1) {
auto create = [&](auto i, auto j) -> ConstEval::Result {
@@ -1984,7 +1981,7 @@
}
ConstEval::Result ConstEval::OpShiftLeft(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0, const constant::Value* c1) {
auto create = [&](auto e1, auto e2) -> ConstEval::Result {
@@ -2006,7 +2003,7 @@
if ((e1u & mask) != 0 && (e1u & mask) != mask) {
AddError("shift left operation results in sign change", source);
if (!use_runtime_semantics_) {
- return utils::Failure;
+ return tint::Failure;
}
}
} else {
@@ -2014,7 +2011,7 @@
if (e1 != 0) {
AddError(OverflowErrorMessage(e1, "<<", e2), source);
if (!use_runtime_semantics_) {
- return utils::Failure;
+ return tint::Failure;
}
}
@@ -2034,7 +2031,7 @@
if (use_runtime_semantics_) {
e2u = e2u % bit_width;
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
@@ -2046,7 +2043,7 @@
if ((e1u & mask) != 0 && (e1u & mask) != mask) {
AddError("shift left operation results in sign change", source);
if (!use_runtime_semantics_) {
- return utils::Failure;
+ return tint::Failure;
}
}
} else {
@@ -2058,7 +2055,7 @@
if ((e1u & mask) != 0) {
AddError(OverflowErrorMessage(e1, "<<", e2), source);
if (!use_runtime_semantics_) {
- return utils::Failure;
+ return tint::Failure;
}
}
}
@@ -2075,14 +2072,14 @@
if (TINT_UNLIKELY(!args[1]->Type()->DeepestElement()->Is<type::U32>())) {
TINT_ICE(Resolver, builder.Diagnostics())
<< "Element type of rhs of ShiftLeft must be a u32";
- return utils::Failure;
+ return tint::Failure;
}
return TransformElements(builder, ty, transform, args[0], args[1]);
}
ConstEval::Result ConstEval::OpShiftRight(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0, const constant::Value* c1) {
auto create = [&](auto e1, auto e2) -> ConstEval::Result {
@@ -2125,7 +2122,7 @@
if (use_runtime_semantics_) {
e2u = e2u % bit_width;
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
@@ -2143,14 +2140,14 @@
if (TINT_UNLIKELY(!args[1]->Type()->DeepestElement()->Is<type::U32>())) {
TINT_ICE(Resolver, builder.Diagnostics())
<< "Element type of rhs of ShiftLeft must be a u32";
- return utils::Failure;
+ return tint::Failure;
}
return TransformElements(builder, ty, transform, args[0], args[1]);
}
ConstEval::Result ConstEval::abs(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto e) {
@@ -2175,7 +2172,7 @@
}
ConstEval::Result ConstEval::acos(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto i) -> ConstEval::Result {
@@ -2186,7 +2183,7 @@
if (use_runtime_semantics_) {
return ZeroValue(c0->Type());
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
return CreateScalar(source, c0->Type(), NumberT(std::acos(i.value)));
@@ -2197,7 +2194,7 @@
}
ConstEval::Result ConstEval::acosh(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto i) -> ConstEval::Result {
@@ -2207,7 +2204,7 @@
if (use_runtime_semantics_) {
return ZeroValue(c0->Type());
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
return CreateScalar(source, c0->Type(), NumberT(std::acosh(i.value)));
@@ -2219,19 +2216,19 @@
}
ConstEval::Result ConstEval::all(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
return CreateScalar(source, ty, !args[0]->AnyZero());
}
ConstEval::Result ConstEval::any(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
return CreateScalar(source, ty, !args[0]->AllZero());
}
ConstEval::Result ConstEval::asin(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto i) -> ConstEval::Result {
@@ -2242,7 +2239,7 @@
if (use_runtime_semantics_) {
return ZeroValue(c0->Type());
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
return CreateScalar(source, c0->Type(), NumberT(std::asin(i.value)));
@@ -2253,7 +2250,7 @@
}
ConstEval::Result ConstEval::asinh(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto i) {
@@ -2266,7 +2263,7 @@
}
ConstEval::Result ConstEval::atan(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto i) {
@@ -2278,7 +2275,7 @@
}
ConstEval::Result ConstEval::atanh(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto i) -> ConstEval::Result {
@@ -2289,7 +2286,7 @@
if (use_runtime_semantics_) {
return ZeroValue(c0->Type());
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
return CreateScalar(source, c0->Type(), NumberT(std::atanh(i.value)));
@@ -2301,7 +2298,7 @@
}
ConstEval::Result ConstEval::atan2(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0, const constant::Value* c1) {
auto create = [&](auto i, auto j) {
@@ -2313,7 +2310,7 @@
}
ConstEval::Result ConstEval::ceil(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto e) {
@@ -2325,7 +2322,7 @@
}
ConstEval::Result ConstEval::clamp(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0, const constant::Value* c1,
const constant::Value* c2) {
@@ -2335,7 +2332,7 @@
}
ConstEval::Result ConstEval::cos(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto i) -> ConstEval::Result {
@@ -2348,7 +2345,7 @@
}
ConstEval::Result ConstEval::cosh(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto i) -> ConstEval::Result {
@@ -2361,7 +2358,7 @@
}
ConstEval::Result ConstEval::countLeadingZeros(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto e) {
@@ -2376,7 +2373,7 @@
}
ConstEval::Result ConstEval::countOneBits(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto e) {
@@ -2400,7 +2397,7 @@
}
ConstEval::Result ConstEval::countTrailingZeros(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto e) {
@@ -2415,7 +2412,7 @@
}
ConstEval::Result ConstEval::cross(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto* u = args[0];
auto* v = args[1];
@@ -2442,23 +2439,23 @@
auto x = Dispatch_fa_f32_f16(Det2Func(source, elem_ty), u1, u2, v1, v2);
if (!x) {
- return utils::Failure;
+ return tint::Failure;
}
auto y = Dispatch_fa_f32_f16(Det2Func(source, elem_ty), v0, v2, u0, u2);
if (!y) {
- return utils::Failure;
+ return tint::Failure;
}
auto z = Dispatch_fa_f32_f16(Det2Func(source, elem_ty), u0, u1, v0, v1);
if (!z) {
- return utils::Failure;
+ return tint::Failure;
}
return builder.constants.Composite(
- ty, utils::Vector<const constant::Value*, 3>{x.Get(), y.Get(), z.Get()});
+ ty, Vector<const constant::Value*, 3>{x.Get(), y.Get(), z.Get()});
}
ConstEval::Result ConstEval::degrees(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto e) -> ConstEval::Result {
@@ -2469,12 +2466,12 @@
auto scale = Div(source, NumberT(180), NumberT(pi));
if (!scale) {
AddNote("when calculating degrees", source);
- return utils::Failure;
+ return tint::Failure;
}
auto result = Mul(source, e, scale.Get());
if (!result) {
AddNote("when calculating degrees", source);
- return utils::Failure;
+ return tint::Failure;
}
return CreateScalar(source, c0->Type(), result.Get());
};
@@ -2484,7 +2481,7 @@
}
ConstEval::Result ConstEval::determinant(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto calculate = [&]() -> ConstEval::Result {
auto* m = args[0];
@@ -2510,7 +2507,7 @@
me(0, 3), me(1, 3), me(2, 3), me(3, 3));
}
TINT_ICE(Resolver, builder.Diagnostics()) << "Unexpected number of matrix rows";
- return utils::Failure;
+ return tint::Failure;
};
auto r = calculate();
if (!r) {
@@ -2520,11 +2517,11 @@
}
ConstEval::Result ConstEval::distance(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto err = [&]() -> ConstEval::Result {
AddNote("when calculating distance", source);
- return utils::Failure;
+ return tint::Failure;
};
auto minus = OpMinus(args[0]->Type(), args, source);
@@ -2540,7 +2537,7 @@
}
ConstEval::Result ConstEval::dot(const type::Type*,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto r = Dot(source, args[0], args[1]);
if (!r) {
@@ -2550,7 +2547,7 @@
}
ConstEval::Result ConstEval::exp(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto e0) -> ConstEval::Result {
@@ -2561,7 +2558,7 @@
if (use_runtime_semantics_) {
return ZeroValue(c0->Type());
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
return CreateScalar(source, c0->Type(), val);
@@ -2572,7 +2569,7 @@
}
ConstEval::Result ConstEval::exp2(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto e0) -> ConstEval::Result {
@@ -2583,7 +2580,7 @@
if (use_runtime_semantics_) {
return ZeroValue(c0->Type());
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
return CreateScalar(source, c0->Type(), val);
@@ -2594,7 +2591,7 @@
}
ConstEval::Result ConstEval::extractBits(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto in_e) -> ConstEval::Result {
@@ -2620,7 +2617,7 @@
o = std::min(o, w);
c = std::min(c, w - o);
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
@@ -2654,7 +2651,7 @@
}
ConstEval::Result ConstEval::faceForward(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
// Returns e1 if dot(e2, e3) is negative, and -e1 otherwise.
auto* e1 = args[0];
@@ -2663,17 +2660,17 @@
auto r = Dot(source, e2, e3);
if (!r) {
AddNote("when calculating faceForward", source);
- return utils::Failure;
+ return tint::Failure;
}
auto is_negative = [](auto v) { return v < 0; };
if (Dispatch_fa_f32_f16(is_negative, r.Get())) {
return e1;
}
- return OpUnaryMinus(ty, utils::Vector{e1}, source);
+ return OpUnaryMinus(ty, Vector{e1}, source);
}
ConstEval::Result ConstEval::firstLeadingBit(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto e) {
@@ -2717,7 +2714,7 @@
}
ConstEval::Result ConstEval::firstTrailingBit(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto e) {
@@ -2743,7 +2740,7 @@
}
ConstEval::Result ConstEval::floor(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto e) {
@@ -2755,14 +2752,14 @@
}
ConstEval::Result ConstEval::fma(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c1, const constant::Value* c2,
const constant::Value* c3) {
auto create = [&](auto e1, auto e2, auto e3) -> ConstEval::Result {
auto err_msg = [&] {
AddNote("when calculating fma", source);
- return utils::Failure;
+ return tint::Failure;
};
auto mul = Mul(source, e1, e2);
@@ -2782,7 +2779,7 @@
}
ConstEval::Result ConstEval::fract(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c1) {
auto create = [&](auto e) -> ConstEval::Result {
@@ -2796,7 +2793,7 @@
}
ConstEval::Result ConstEval::frexp(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto* arg = args[0];
@@ -2832,17 +2829,17 @@
TINT_ICE(Resolver, builder.Diagnostics())
<< "unhandled element type for frexp() const-eval: "
<< s->Type()->FriendlyName();
- return FractExp{utils::Failure, utils::Failure};
+ return FractExp{tint::Failure, tint::Failure};
});
};
if (auto* vec = arg->Type()->As<type::Vector>()) {
- utils::Vector<const constant::Value*, 4> fract_els;
- utils::Vector<const constant::Value*, 4> exp_els;
+ Vector<const constant::Value*, 4> fract_els;
+ Vector<const constant::Value*, 4> exp_els;
for (uint32_t i = 0; i < vec->Width(); i++) {
auto fe = scalar(arg->Index(i));
if (!fe.fract || !fe.exp) {
- return utils::Failure;
+ return tint::Failure;
}
fract_els.Push(fe.fract.Get());
exp_els.Push(fe.exp.Get());
@@ -2850,16 +2847,16 @@
auto fract_ty = builder.create<type::Vector>(fract_els[0]->Type(), vec->Width());
auto exp_ty = builder.create<type::Vector>(exp_els[0]->Type(), vec->Width());
return builder.constants.Composite(
- ty, utils::Vector<const constant::Value*, 2>{
+ ty, Vector<const constant::Value*, 2>{
builder.constants.Composite(fract_ty, std::move(fract_els)),
builder.constants.Composite(exp_ty, std::move(exp_els)),
});
} else {
auto fe = scalar(arg);
if (!fe.fract || !fe.exp) {
- return utils::Failure;
+ return tint::Failure;
}
- return builder.constants.Composite(ty, utils::Vector<const constant::Value*, 2>{
+ return builder.constants.Composite(ty, Vector<const constant::Value*, 2>{
fe.fract.Get(),
fe.exp.Get(),
});
@@ -2867,7 +2864,7 @@
}
ConstEval::Result ConstEval::insertBits(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0, const constant::Value* c1) {
auto create = [&](auto in_e, auto in_newbits) -> ConstEval::Result {
@@ -2894,7 +2891,7 @@
o = std::min(o, w);
c = std::min(c, w - o);
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
@@ -2924,7 +2921,7 @@
}
ConstEval::Result ConstEval::inverseSqrt(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto e) -> ConstEval::Result {
@@ -2935,13 +2932,13 @@
if (use_runtime_semantics_) {
return ZeroValue(c0->Type());
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
auto err = [&] {
AddNote("when calculating inverseSqrt", source);
- return utils::Failure;
+ return tint::Failure;
};
auto s = Sqrt(source, e);
@@ -2962,7 +2959,7 @@
}
ConstEval::Result ConstEval::ldexp(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c1, size_t index) {
auto create = [&](auto e1) -> ConstEval::Result {
@@ -2992,7 +2989,7 @@
if (use_runtime_semantics_) {
return ZeroValue(c1->Type());
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
@@ -3008,7 +3005,7 @@
}
ConstEval::Result ConstEval::length(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto r = Length(source, ty, args[0]);
if (!r) {
@@ -3018,7 +3015,7 @@
}
ConstEval::Result ConstEval::log(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto v) -> ConstEval::Result {
@@ -3028,7 +3025,7 @@
if (use_runtime_semantics_) {
return ZeroValue(c0->Type());
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
return CreateScalar(source, c0->Type(), NumberT(std::log(v)));
@@ -3039,7 +3036,7 @@
}
ConstEval::Result ConstEval::log2(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto v) -> ConstEval::Result {
@@ -3049,7 +3046,7 @@
if (use_runtime_semantics_) {
return ZeroValue(c0->Type());
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
return CreateScalar(source, c0->Type(), NumberT(std::log2(v)));
@@ -3060,7 +3057,7 @@
}
ConstEval::Result ConstEval::max(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0, const constant::Value* c1) {
auto create = [&](auto e0, auto e1) {
@@ -3072,7 +3069,7 @@
}
ConstEval::Result ConstEval::min(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0, const constant::Value* c1) {
auto create = [&](auto e0, auto e1) {
@@ -3084,7 +3081,7 @@
}
ConstEval::Result ConstEval::mix(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0, const constant::Value* c1, size_t index) {
auto create = [&](auto e1, auto e2) -> ConstEval::Result {
@@ -3101,19 +3098,19 @@
// float precision loss when e1 and e2 significantly differ in magnitude.
auto one_sub_e3 = Sub(source, NumberT{1}, e3);
if (!one_sub_e3) {
- return utils::Failure;
+ return tint::Failure;
}
auto e1_mul_one_sub_e3 = Mul(source, e1, one_sub_e3.Get());
if (!e1_mul_one_sub_e3) {
- return utils::Failure;
+ return tint::Failure;
}
auto e2_mul_e3 = Mul(source, e2, e3);
if (!e2_mul_e3) {
- return utils::Failure;
+ return tint::Failure;
}
auto r = Add(source, e1_mul_one_sub_e3.Get(), e2_mul_e3.Get());
if (!r) {
- return utils::Failure;
+ return tint::Failure;
}
return CreateScalar(source, c0->Type(), r.Get());
};
@@ -3127,7 +3124,7 @@
}
ConstEval::Result ConstEval::modf(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform_fract = [&](const constant::Value* c) {
auto create = [&](auto e) {
@@ -3142,31 +3139,31 @@
return Dispatch_fa_f32_f16(create, c);
};
- utils::Vector<const constant::Value*, 2> fields;
+ Vector<const constant::Value*, 2> fields;
if (auto fract = TransformElements(builder, args[0]->Type(), transform_fract, args[0])) {
fields.Push(fract.Get());
} else {
- return utils::Failure;
+ return tint::Failure;
}
if (auto whole = TransformElements(builder, args[0]->Type(), transform_whole, args[0])) {
fields.Push(whole.Get());
} else {
- return utils::Failure;
+ return tint::Failure;
}
return builder.constants.Composite(ty, std::move(fields));
}
ConstEval::Result ConstEval::normalize(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto* len_ty = ty->DeepestElement();
auto len = Length(source, len_ty, args[0]);
if (!len) {
AddNote("when calculating normalize", source);
- return utils::Failure;
+ return tint::Failure;
}
auto* v = len.Get();
if (v->AllZero()) {
@@ -3174,38 +3171,38 @@
if (use_runtime_semantics_) {
return ZeroValue(ty);
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
- return OpDivide(ty, utils::Vector{args[0], v}, source);
+ return OpDivide(ty, Vector{args[0], v}, source);
}
ConstEval::Result ConstEval::pack2x16float(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
- auto convert = [&](f32 val) -> utils::Result<uint32_t> {
+ auto convert = [&](f32 val) -> tint::Result<uint32_t> {
auto conv = CheckedConvert<f16>(val);
if (!conv) {
AddError(OverflowErrorMessage(val, "f16"), source);
if (use_runtime_semantics_) {
return 0;
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
uint16_t v = conv.Get().BitsRepresentation();
- return utils::Result<uint32_t>{v};
+ return tint::Result<uint32_t>{v};
};
auto* e = args[0];
auto e0 = convert(e->Index(0)->ValueAs<f32>());
if (!e0) {
- return utils::Failure;
+ return tint::Failure;
}
auto e1 = convert(e->Index(1)->ValueAs<f32>());
if (!e1) {
- return utils::Failure;
+ return tint::Failure;
}
u32 ret = u32((e0.Get() & 0x0000'ffff) | (e1.Get() << 16));
@@ -3213,12 +3210,12 @@
}
ConstEval::Result ConstEval::pack2x16snorm(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto calc = [&](f32 val) -> u32 {
auto clamped = Clamp(source, val, f32(-1.0f), f32(1.0f)).Get();
- return u32(utils::Bitcast<uint16_t>(
- static_cast<int16_t>(std::floor(0.5f + (32767.0f * clamped)))));
+ return u32(
+ tint::Bitcast<uint16_t>(static_cast<int16_t>(std::floor(0.5f + (32767.0f * clamped)))));
};
auto* e = args[0];
@@ -3230,7 +3227,7 @@
}
ConstEval::Result ConstEval::pack2x16unorm(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto calc = [&](f32 val) -> u32 {
auto clamped = Clamp(source, val, f32(0.0f), f32(1.0f)).Get();
@@ -3246,12 +3243,12 @@
}
ConstEval::Result ConstEval::pack4x8snorm(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto calc = [&](f32 val) -> u32 {
auto clamped = Clamp(source, val, f32(-1.0f), f32(1.0f)).Get();
return u32(
- utils::Bitcast<uint8_t>(static_cast<int8_t>(std::floor(0.5f + (127.0f * clamped)))));
+ tint::Bitcast<uint8_t>(static_cast<int8_t>(std::floor(0.5f + (127.0f * clamped)))));
};
auto* e = args[0];
@@ -3266,7 +3263,7 @@
}
ConstEval::Result ConstEval::pack4x8unorm(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto calc = [&](f32 val) -> u32 {
auto clamped = Clamp(source, val, f32(0.0f), f32(1.0f)).Get();
@@ -3285,7 +3282,7 @@
}
ConstEval::Result ConstEval::pow(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0, const constant::Value* c1) {
auto create = [&](auto e1, auto e2) -> ConstEval::Result {
@@ -3295,7 +3292,7 @@
if (use_runtime_semantics_) {
return ZeroValue(c0->Type());
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
return CreateScalar(source, c0->Type(), *r);
@@ -3306,7 +3303,7 @@
}
ConstEval::Result ConstEval::radians(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto e) -> ConstEval::Result {
@@ -3317,12 +3314,12 @@
auto scale = Div(source, NumberT(pi), NumberT(180));
if (!scale) {
AddNote("when calculating radians", source);
- return utils::Failure;
+ return tint::Failure;
}
auto result = Mul(source, e, scale.Get());
if (!result) {
AddNote("when calculating radians", source);
- return utils::Failure;
+ return tint::Failure;
}
return CreateScalar(source, c0->Type(), result.Get());
};
@@ -3332,7 +3329,7 @@
}
ConstEval::Result ConstEval::reflect(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto calculate = [&]() -> ConstEval::Result {
// For the incident vector e1 and surface orientation e2, returns the reflection direction
@@ -3345,7 +3342,7 @@
// dot(e2, e1)
auto dot_e2_e1 = Dot(source, e2, e1);
if (!dot_e2_e1) {
- return utils::Failure;
+ return tint::Failure;
}
// 2 * dot(e2, e1)
@@ -3355,13 +3352,13 @@
};
auto dot_e2_e1_2 = Dispatch_fa_f32_f16(mul2, dot_e2_e1.Get());
if (!dot_e2_e1_2) {
- return utils::Failure;
+ return tint::Failure;
}
// 2 * dot(e2, e1) * e2
auto dot_e2_e1_2_e2 = Mul(source, ty, dot_e2_e1_2.Get(), e2);
if (!dot_e2_e1_2_e2) {
- return utils::Failure;
+ return tint::Failure;
}
// e1 - 2 * dot(e2, e1) * e2
@@ -3375,7 +3372,7 @@
}
ConstEval::Result ConstEval::refract(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto* vec_ty = ty->As<type::Vector>();
auto* el_ty = vec_ty->type();
@@ -3385,23 +3382,23 @@
// let k = 1.0 - e3 * e3 * (1.0 - dot(e2, e1) * dot(e2, e1))
auto e3_squared = Mul(source, e3, e3);
if (!e3_squared) {
- return utils::Failure;
+ return tint::Failure;
}
auto dot_e2_e1_squared = Mul(source, dot_e2_e1, dot_e2_e1);
if (!dot_e2_e1_squared) {
- return utils::Failure;
+ return tint::Failure;
}
auto r = Sub(source, NumberT(1), dot_e2_e1_squared.Get());
if (!r) {
- return utils::Failure;
+ return tint::Failure;
}
r = Mul(source, e3_squared.Get(), r.Get());
if (!r) {
- return utils::Failure;
+ return tint::Failure;
}
r = Sub(source, NumberT(1), r.Get());
if (!r) {
- return utils::Failure;
+ return tint::Failure;
}
return CreateScalar(source, el_ty, r.Get());
};
@@ -3410,15 +3407,15 @@
// e3 * dot(e2, e1) + sqrt(k)
auto sqrt_k = Sqrt(source, k);
if (!sqrt_k) {
- return utils::Failure;
+ return tint::Failure;
}
auto r = Mul(source, e3, dot_e2_e1);
if (!r) {
- return utils::Failure;
+ return tint::Failure;
}
r = Add(source, r.Get(), sqrt_k.Get());
if (!r) {
- return utils::Failure;
+ return tint::Failure;
}
return CreateScalar(source, el_ty, r.Get());
};
@@ -3436,13 +3433,13 @@
// dot(e2, e1)
auto dot_e2_e1 = Dot(source, e2, e1);
if (!dot_e2_e1) {
- return utils::Failure;
+ return tint::Failure;
}
// let k = 1.0 - e3 * e3 * (1.0 - dot(e2, e1) * dot(e2, e1))
auto k = Dispatch_fa_f32_f16(compute_k, e3, dot_e2_e1.Get());
if (!k) {
- return utils::Failure;
+ return tint::Failure;
}
// If k < 0.0, returns the refraction vector 0.0
@@ -3453,15 +3450,15 @@
// Otherwise return the refraction vector e3 * e1 - (e3 * dot(e2, e1) + sqrt(k)) * e2
auto e1_scaled = Mul(source, ty, e3, e1);
if (!e1_scaled) {
- return utils::Failure;
+ return tint::Failure;
}
auto e2_scale = Dispatch_fa_f32_f16(compute_e2_scale, e3, dot_e2_e1.Get(), k.Get());
if (!e2_scale) {
- return utils::Failure;
+ return tint::Failure;
}
auto e2_scaled = Mul(source, ty, e2_scale.Get(), e2);
if (!e2_scaled) {
- return utils::Failure;
+ return tint::Failure;
}
return Sub(source, ty, e1_scaled.Get(), e2_scaled.Get());
};
@@ -3473,7 +3470,7 @@
}
ConstEval::Result ConstEval::reverseBits(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto in_e) -> ConstEval::Result {
@@ -3500,7 +3497,7 @@
}
ConstEval::Result ConstEval::round(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto e) {
@@ -3536,7 +3533,7 @@
}
ConstEval::Result ConstEval::saturate(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto e) {
@@ -3550,7 +3547,7 @@
}
ConstEval::Result ConstEval::select_bool(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto cond = args[2]->ValueAs<bool>();
auto transform = [&](const constant::Value* c0, const constant::Value* c1) {
@@ -3564,7 +3561,7 @@
}
ConstEval::Result ConstEval::select_boolvec(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0, const constant::Value* c1, size_t index) {
auto create = [&](auto f, auto t) -> ConstEval::Result {
@@ -3579,7 +3576,7 @@
}
ConstEval::Result ConstEval::sign(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto e) -> ConstEval::Result {
@@ -3601,7 +3598,7 @@
}
ConstEval::Result ConstEval::sin(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto i) -> ConstEval::Result {
@@ -3614,7 +3611,7 @@
}
ConstEval::Result ConstEval::sinh(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto i) -> ConstEval::Result {
@@ -3627,7 +3624,7 @@
}
ConstEval::Result ConstEval::smoothstep(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0, const constant::Value* c1,
const constant::Value* c2) {
@@ -3636,7 +3633,7 @@
auto err = [&] {
AddNote("when calculating smoothstep", source);
- return utils::Failure;
+ return tint::Failure;
};
// t = clamp((x - low) / (high - low), 0.0, 1.0)
@@ -3678,7 +3675,7 @@
}
ConstEval::Result ConstEval::step(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0, const constant::Value* c1) {
auto create = [&](auto edge, auto x) -> ConstEval::Result {
@@ -3692,7 +3689,7 @@
}
ConstEval::Result ConstEval::sqrt(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
return Dispatch_fa_f32_f16(SqrtFunc(source, c0->Type()), c0);
@@ -3702,7 +3699,7 @@
}
ConstEval::Result ConstEval::tan(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto i) -> ConstEval::Result {
@@ -3715,7 +3712,7 @@
}
ConstEval::Result ConstEval::tanh(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto i) -> ConstEval::Result {
@@ -3728,7 +3725,7 @@
}
ConstEval::Result ConstEval::transpose(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source&) {
auto* m = args[0];
auto* mat_ty = m->Type()->As<type::Matrix>();
@@ -3736,9 +3733,9 @@
auto* result_mat_ty = ty->As<type::Matrix>();
// Produce column vectors from each row
- utils::Vector<const constant::Value*, 4> result_mat;
+ Vector<const constant::Value*, 4> result_mat;
for (size_t r = 0; r < mat_ty->rows(); ++r) {
- utils::Vector<const constant::Value*, 4> new_col_vec;
+ Vector<const constant::Value*, 4> new_col_vec;
for (size_t c = 0; c < mat_ty->columns(); ++c) {
new_col_vec.Push(me(r, c));
}
@@ -3748,7 +3745,7 @@
}
ConstEval::Result ConstEval::trunc(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c0) {
auto create = [&](auto i) {
@@ -3760,12 +3757,12 @@
}
ConstEval::Result ConstEval::unpack2x16float(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto* inner_ty = ty->DeepestElement();
auto e = args[0]->ValueAs<u32>().value;
- utils::Vector<const constant::Value*, 2> els;
+ Vector<const constant::Value*, 2> els;
els.Reserve(2);
for (size_t i = 0; i < 2; ++i) {
auto in = f16::FromBits(uint16_t((e >> (16 * i)) & 0x0000'ffff));
@@ -3775,7 +3772,7 @@
if (use_runtime_semantics_) {
val = f32(0.f);
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
auto el = CreateScalar(source, inner_ty, val.Get());
@@ -3788,12 +3785,12 @@
}
ConstEval::Result ConstEval::unpack2x16snorm(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto* inner_ty = ty->DeepestElement();
auto e = args[0]->ValueAs<u32>().value;
- utils::Vector<const constant::Value*, 2> els;
+ Vector<const constant::Value*, 2> els;
els.Reserve(2);
for (size_t i = 0; i < 2; ++i) {
auto val = f32(
@@ -3808,12 +3805,12 @@
}
ConstEval::Result ConstEval::unpack2x16unorm(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto* inner_ty = ty->DeepestElement();
auto e = args[0]->ValueAs<u32>().value;
- utils::Vector<const constant::Value*, 2> els;
+ Vector<const constant::Value*, 2> els;
els.Reserve(2);
for (size_t i = 0; i < 2; ++i) {
auto val = f32(static_cast<float>(uint16_t((e >> (16 * i)) & 0x0000'ffff)) / 65535.f);
@@ -3827,12 +3824,12 @@
}
ConstEval::Result ConstEval::unpack4x8snorm(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto* inner_ty = ty->DeepestElement();
auto e = args[0]->ValueAs<u32>().value;
- utils::Vector<const constant::Value*, 4> els;
+ Vector<const constant::Value*, 4> els;
els.Reserve(4);
for (size_t i = 0; i < 4; ++i) {
auto val =
@@ -3847,12 +3844,12 @@
}
ConstEval::Result ConstEval::unpack4x8unorm(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto* inner_ty = ty->DeepestElement();
auto e = args[0]->ValueAs<u32>().value;
- utils::Vector<const constant::Value*, 4> els;
+ Vector<const constant::Value*, 4> els;
els.Reserve(4);
for (size_t i = 0; i < 4; ++i) {
auto val = f32(static_cast<float>(uint8_t((e >> (8 * i)) & 0x0000'00ff)) / 255.f);
@@ -3866,7 +3863,7 @@
}
ConstEval::Result ConstEval::quantizeToF16(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source) {
auto transform = [&](const constant::Value* c) -> ConstEval::Result {
auto value = c->ValueAs<f32>();
@@ -3876,7 +3873,7 @@
if (use_runtime_semantics_) {
return ZeroValue(c->Type());
} else {
- return utils::Failure;
+ return tint::Failure;
}
}
return CreateScalar(source, c->Type(), conv.Get());
@@ -3892,7 +3889,7 @@
}
ConvertContext ctx{builder, source, use_runtime_semantics_};
auto* converted = ConvertInternal(value, target_ty, ctx);
- return converted ? Result(converted) : utils::Failure;
+ return converted ? Result(converted) : tint::Failure;
}
void ConstEval::AddError(const std::string& msg, const Source& source) const {
diff --git a/src/tint/lang/wgsl/resolver/const_eval.h b/src/tint/lang/wgsl/resolver/const_eval.h
index cb4bd3b..08b5d18 100644
--- a/src/tint/lang/wgsl/resolver/const_eval.h
+++ b/src/tint/lang/wgsl/resolver/const_eval.h
@@ -57,14 +57,14 @@
/// * A null constant::Value pointer. Returned when a expression cannot resolve to a creation
/// time
/// value, but is otherwise legal.
- /// * `utils::Failure`. Returned when there was a resolver error. In this situation the method
+ /// * `tint::Failure`. Returned when there was a resolver error. In this situation the method
/// will have already reported a diagnostic error message, and the caller should abort
/// resolving.
- using Result = utils::Result<const constant::Value*>;
+ using Result = tint::Result<const constant::Value*>;
/// Typedef for a constant evaluation function
using Function = Result (ConstEval::*)(const type::Type* result_ty,
- utils::VectorRef<const constant::Value*>,
+ VectorRef<const constant::Value*>,
const Source&);
/// Constructor
@@ -80,7 +80,7 @@
/// @param ty the target type - must be an array or struct
/// @param args the input arguments
/// @return the constructed value, or null if the value cannot be calculated
- Result ArrayOrStructCtor(const type::Type* ty, utils::VectorRef<const constant::Value*> args);
+ Result ArrayOrStructCtor(const type::Type* ty, VectorRef<const constant::Value*> args);
/// @param ty the target type
/// @param value the value being converted
@@ -113,7 +113,7 @@
/// @return the result of the swizzle, or null if the value cannot be calculated
Result Swizzle(const type::Type* ty,
const sem::ValueExpression* vector,
- utils::VectorRef<uint32_t> indices);
+ VectorRef<uint32_t> indices);
/// Convert the `value` to `target_type`
/// @param ty the result type
@@ -131,18 +131,14 @@
/// @param args the input arguments
/// @param source the source location
/// @return the converted value, or null if the value cannot be calculated
- Result Conv(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result Conv(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// Zero value constructor
/// @param ty the result type
/// @param args the input arguments (no arguments provided)
/// @param source the source location
/// @return the constructed value, or null if the value cannot be calculated
- Result Zero(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result Zero(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// Identity value constructor
/// @param ty the result type
@@ -150,7 +146,7 @@
/// @param source the source location
/// @return the constructed value, or null if the value cannot be calculated
Result Identity(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// Vector splat constructor
@@ -159,7 +155,7 @@
/// @param source the source location
/// @return the constructed value, or null if the value cannot be calculated
Result VecSplat(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// Vector constructor using scalars
@@ -168,7 +164,7 @@
/// @param source the source location
/// @return the constructed value, or null if the value cannot be calculated
Result VecInitS(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// Vector constructor using a mix of scalars and smaller vectors
@@ -177,7 +173,7 @@
/// @param source the source location
/// @return the constructed value, or null if the value cannot be calculated
Result VecInitM(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// Matrix constructor using scalar values
@@ -186,7 +182,7 @@
/// @param source the source location
/// @return the constructed value, or null if the value cannot be calculated
Result MatInitS(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// Matrix constructor using column vectors
@@ -195,7 +191,7 @@
/// @param source the source location
/// @return the constructed value, or null if the value cannot be calculated
Result MatInitV(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
////////////////////////////////////////////////////////////////////////////
@@ -208,7 +204,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result OpComplement(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// Unary minus operator '-'
@@ -217,7 +213,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result OpUnaryMinus(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// Unary not operator '!'
@@ -226,7 +222,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result OpNot(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
////////////////////////////////////////////////////////////////////////////
@@ -239,7 +235,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result OpPlus(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// Minus operator '-'
@@ -248,7 +244,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result OpMinus(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// Multiply operator '*' for the same type on the LHS and RHS
@@ -257,7 +253,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result OpMultiply(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// Multiply operator '*' for matCxR<T> * vecC<T>
@@ -266,7 +262,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result OpMultiplyMatVec(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// Multiply operator '*' for vecR<T> * matCxR<T>
@@ -275,7 +271,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result OpMultiplyVecMat(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// Multiply operator '*' for matKxR<T> * matCxK<T>
@@ -284,7 +280,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result OpMultiplyMatMat(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// Divide operator '/'
@@ -293,7 +289,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result OpDivide(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// Modulo operator '%'
@@ -302,7 +298,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result OpModulo(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// Equality operator '=='
@@ -311,7 +307,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result OpEqual(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// Inequality operator '!='
@@ -320,7 +316,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result OpNotEqual(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// Less than operator '<'
@@ -329,7 +325,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result OpLessThan(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// Greater than operator '>'
@@ -338,7 +334,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result OpGreaterThan(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// Less than or equal operator '<='
@@ -347,7 +343,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result OpLessThanEqual(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// Greater than or equal operator '>='
@@ -356,7 +352,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result OpGreaterThanEqual(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// Logical and operator '&&'
@@ -365,7 +361,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result OpLogicalAnd(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// Logical or operator '||'
@@ -374,7 +370,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result OpLogicalOr(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// Bitwise and operator '&'
@@ -383,7 +379,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result OpAnd(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// Bitwise or operator '|'
@@ -391,9 +387,7 @@
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result OpOr(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result OpOr(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// Bitwise xor operator '^'
/// @param ty the expression type
@@ -401,7 +395,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result OpXor(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// Bitwise shift left operator '<<'
@@ -410,7 +404,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result OpShiftLeft(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// Bitwise shift right operator '<<'
@@ -419,7 +413,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result OpShiftRight(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
////////////////////////////////////////////////////////////////////////////
@@ -431,18 +425,14 @@
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result abs(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result abs(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// acos builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result acos(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result acos(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// acosh builtin
/// @param ty the expression type
@@ -450,7 +440,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result acosh(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// all builtin
@@ -458,27 +448,21 @@
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result all(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result all(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// any builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result any(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result any(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// asin builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result asin(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result asin(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// asinh builtin
/// @param ty the expression type
@@ -486,7 +470,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result asinh(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// atan builtin
@@ -494,9 +478,7 @@
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result atan(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result atan(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// atanh builtin
/// @param ty the expression type
@@ -504,7 +486,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result atanh(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// atan2 builtin
@@ -513,7 +495,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result atan2(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// ceil builtin
@@ -521,9 +503,7 @@
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result ceil(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result ceil(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// clamp builtin
/// @param ty the expression type
@@ -531,7 +511,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result clamp(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// cos builtin
@@ -539,18 +519,14 @@
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result cos(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result cos(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// cosh builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result cosh(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result cosh(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// countLeadingZeros builtin
/// @param ty the expression type
@@ -558,7 +534,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result countLeadingZeros(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// countOneBits builtin
@@ -567,7 +543,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result countOneBits(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// countTrailingZeros builtin
@@ -576,7 +552,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result countTrailingZeros(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// cross builtin
@@ -585,7 +561,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result cross(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// degrees builtin
@@ -594,7 +570,7 @@
/// @param source the source location of the conversion
/// @return the result value, or null if the value cannot be calculated
Result degrees(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// determinant builtin
@@ -603,7 +579,7 @@
/// @param source the source location of the conversion
/// @return the result value, or null if the value cannot be calculated
Result determinant(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// distance builtin
@@ -612,7 +588,7 @@
/// @param source the source location of the conversion
/// @return the result value, or null if the value cannot be calculated
Result distance(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// dot builtin
@@ -620,27 +596,21 @@
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result dot(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result dot(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// exp builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result exp(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result exp(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// exp2 builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result exp2(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result exp2(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// extractBits builtin
/// @param ty the expression type
@@ -648,7 +618,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result extractBits(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// faceForward builtin
@@ -657,7 +627,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result faceForward(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// firstLeadingBit builtin
@@ -666,7 +636,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result firstLeadingBit(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// firstTrailingBit builtin
@@ -675,7 +645,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result firstTrailingBit(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// floor builtin
@@ -684,7 +654,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result floor(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// fma builtin
@@ -692,9 +662,7 @@
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result fma(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result fma(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// fract builtin
/// @param ty the expression type
@@ -702,7 +670,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result fract(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// frexp builtin
@@ -711,7 +679,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result frexp(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// insertBits builtin
@@ -720,7 +688,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result insertBits(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// inverseSqrt builtin
@@ -729,7 +697,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result inverseSqrt(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// ldexp builtin
@@ -738,7 +706,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result ldexp(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// length builtin
@@ -747,7 +715,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result length(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// log builtin
@@ -755,27 +723,21 @@
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result log(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result log(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// log2 builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result log2(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result log2(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// max builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result max(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result max(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// min builtin
/// @param ty the expression type
@@ -783,7 +745,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result min(const type::Type* ty, // NOLINT(build/include_what_you_use) -- confused by min
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// mix builtin
@@ -791,18 +753,14 @@
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result mix(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result mix(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// modf builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result modf(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result modf(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// normalize builtin
/// @param ty the expression type
@@ -810,7 +768,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result normalize(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// pack2x16float builtin
@@ -819,7 +777,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result pack2x16float(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// pack2x16snorm builtin
@@ -828,7 +786,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result pack2x16snorm(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// pack2x16unorm builtin
@@ -837,7 +795,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result pack2x16unorm(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// pack4x8snorm builtin
@@ -846,7 +804,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result pack4x8snorm(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// pack4x8unorm builtin
@@ -855,7 +813,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result pack4x8unorm(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// pow builtin
@@ -863,9 +821,7 @@
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result pow(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result pow(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// radians builtin
/// @param ty the expression type
@@ -873,7 +829,7 @@
/// @param source the source location of the conversion
/// @return the result value, or null if the value cannot be calculated
Result radians(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// reflect builtin
@@ -882,7 +838,7 @@
/// @param source the source location of the conversion
/// @return the result value, or null if the value cannot be calculated
Result reflect(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// refract builtin
@@ -891,7 +847,7 @@
/// @param source the source location of the conversion
/// @return the result value, or null if the value cannot be calculated
Result refract(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// reverseBits builtin
@@ -900,7 +856,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result reverseBits(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// round builtin
@@ -909,7 +865,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result round(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// saturate builtin
@@ -918,7 +874,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result saturate(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// select builtin with single bool third arg
@@ -927,7 +883,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result select_bool(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// select builtin with vector of bool third arg
@@ -936,7 +892,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result select_boolvec(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// sign builtin
@@ -944,27 +900,21 @@
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result sign(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result sign(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// sin builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result sin(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result sin(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// sinh builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result sinh(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result sinh(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// smoothstep builtin
/// @param ty the expression type
@@ -972,7 +922,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result smoothstep(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// step builtin
@@ -980,36 +930,28 @@
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result step(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result step(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// sqrt builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result sqrt(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result sqrt(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// tan builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result tan(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result tan(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// tanh builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result tanh(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
- const Source& source);
+ Result tanh(const type::Type* ty, VectorRef<const constant::Value*> args, const Source& source);
/// transpose builtin
/// @param ty the expression type
@@ -1017,7 +959,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result transpose(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// trunc builtin
@@ -1026,7 +968,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result trunc(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// unpack2x16float builtin
@@ -1035,7 +977,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result unpack2x16float(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// unpack2x16snorm builtin
@@ -1044,7 +986,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result unpack2x16snorm(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// unpack2x16unorm builtin
@@ -1053,7 +995,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result unpack2x16unorm(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// unpack4x8snorm builtin
@@ -1062,7 +1004,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result unpack4x8snorm(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// unpack4x8unorm builtin
@@ -1071,7 +1013,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result unpack4x8unorm(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
/// quantizeToF16 builtin
@@ -1080,7 +1022,7 @@
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result quantizeToF16(const type::Type* ty,
- utils::VectorRef<const constant::Value*> args,
+ VectorRef<const constant::Value*> args,
const Source& source);
private:
@@ -1110,7 +1052,7 @@
/// @param b the rhs number
/// @returns the result number on success, or logs an error and returns Failure
template <typename NumberT>
- utils::Result<NumberT> Add(const Source& source, NumberT a, NumberT b);
+ tint::Result<NumberT> Add(const Source& source, NumberT a, NumberT b);
/// Subtracts two Number<T>s
/// @param source the source location
@@ -1118,7 +1060,7 @@
/// @param b the rhs number
/// @returns the result number on success, or logs an error and returns Failure
template <typename NumberT>
- utils::Result<NumberT> Sub(const Source& source, NumberT a, NumberT b);
+ tint::Result<NumberT> Sub(const Source& source, NumberT a, NumberT b);
/// Multiplies two Number<T>s
/// @param source the source location
@@ -1126,7 +1068,7 @@
/// @param b the rhs number
/// @returns the result number on success, or logs an error and returns Failure
template <typename NumberT>
- utils::Result<NumberT> Mul(const Source& source, NumberT a, NumberT b);
+ tint::Result<NumberT> Mul(const Source& source, NumberT a, NumberT b);
/// Divides two Number<T>s
/// @param source the source location
@@ -1134,7 +1076,7 @@
/// @param b the rhs number
/// @returns the result number on success, or logs an error and returns Failure
template <typename NumberT>
- utils::Result<NumberT> Div(const Source& source, NumberT a, NumberT b);
+ tint::Result<NumberT> Div(const Source& source, NumberT a, NumberT b);
/// Returns the (signed) remainder of the division of two Number<T>s
/// @param source the source location
@@ -1142,7 +1084,7 @@
/// @param b the rhs number
/// @returns the result number on success, or logs an error and returns Failure
template <typename NumberT>
- utils::Result<NumberT> Mod(const Source& source, NumberT a, NumberT b);
+ tint::Result<NumberT> Mod(const Source& source, NumberT a, NumberT b);
/// Returns the dot product of (a1,a2) with (b1,b2)
/// @param source the source location
@@ -1152,11 +1094,11 @@
/// @param b2 component 2 of rhs vector
/// @returns the result number on success, or logs an error and returns Failure
template <typename NumberT>
- utils::Result<NumberT> Dot2(const Source& source,
- NumberT a1,
- NumberT a2,
- NumberT b1,
- NumberT b2);
+ tint::Result<NumberT> Dot2(const Source& source,
+ NumberT a1,
+ NumberT a2,
+ NumberT b1,
+ NumberT b2);
/// Returns the dot product of (a1,a2,a3) with (b1,b2,b3)
/// @param source the source location
@@ -1168,13 +1110,13 @@
/// @param b3 component 3 of rhs vector
/// @returns the result number on success, or logs an error and returns Failure
template <typename NumberT>
- utils::Result<NumberT> Dot3(const Source& source,
- NumberT a1,
- NumberT a2,
- NumberT a3,
- NumberT b1,
- NumberT b2,
- NumberT b3);
+ tint::Result<NumberT> Dot3(const Source& source,
+ NumberT a1,
+ NumberT a2,
+ NumberT a3,
+ NumberT b1,
+ NumberT b2,
+ NumberT b3);
/// Returns the dot product of (a1,b1,c1,d1) with (a2,b2,c2,d2)
/// @param source the source location
@@ -1188,15 +1130,15 @@
/// @param b4 component 4 of rhs vector
/// @returns the result number on success, or logs an error and returns Failure
template <typename NumberT>
- utils::Result<NumberT> Dot4(const Source& source,
- NumberT a1,
- NumberT a2,
- NumberT a3,
- NumberT a4,
- NumberT b1,
- NumberT b2,
- NumberT b3,
- NumberT b4);
+ tint::Result<NumberT> Dot4(const Source& source,
+ NumberT a1,
+ NumberT a2,
+ NumberT a3,
+ NumberT a4,
+ NumberT b1,
+ NumberT b2,
+ NumberT b3,
+ NumberT b4);
/// Returns the determinant of the 2x2 matrix:
/// | a c |
@@ -1207,11 +1149,11 @@
/// @param c component 1 of the second column vector
/// @param d component 2 of the second column vector
template <typename NumberT>
- utils::Result<NumberT> Det2(const Source& source, //
- NumberT a,
- NumberT b,
- NumberT c,
- NumberT d);
+ tint::Result<NumberT> Det2(const Source& source, //
+ NumberT a,
+ NumberT b,
+ NumberT c,
+ NumberT d);
/// Returns the determinant of the 3x3 matrix:
/// | a d g |
@@ -1228,16 +1170,16 @@
/// @param h component 2 of the third column vector
/// @param i component 3 of the third column vector
template <typename NumberT>
- utils::Result<NumberT> Det3(const Source& source,
- NumberT a,
- NumberT b,
- NumberT c,
- NumberT d,
- NumberT e,
- NumberT f,
- NumberT g,
- NumberT h,
- NumberT i);
+ tint::Result<NumberT> Det3(const Source& source,
+ NumberT a,
+ NumberT b,
+ NumberT c,
+ NumberT d,
+ NumberT e,
+ NumberT f,
+ NumberT g,
+ NumberT h,
+ NumberT i);
/// Returns the determinant of the 4x4 matrix:
/// | a e i m |
@@ -1262,26 +1204,26 @@
/// @param o component 3 of the fourth column vector
/// @param p component 4 of the fourth column vector
template <typename NumberT>
- utils::Result<NumberT> Det4(const Source& source,
- NumberT a,
- NumberT b,
- NumberT c,
- NumberT d,
- NumberT e,
- NumberT f,
- NumberT g,
- NumberT h,
- NumberT i,
- NumberT j,
- NumberT k,
- NumberT l,
- NumberT m,
- NumberT n,
- NumberT o,
- NumberT p);
+ tint::Result<NumberT> Det4(const Source& source,
+ NumberT a,
+ NumberT b,
+ NumberT c,
+ NumberT d,
+ NumberT e,
+ NumberT f,
+ NumberT g,
+ NumberT h,
+ NumberT i,
+ NumberT j,
+ NumberT k,
+ NumberT l,
+ NumberT m,
+ NumberT n,
+ NumberT o,
+ NumberT p);
template <typename NumberT>
- utils::Result<NumberT> Sqrt(const Source& source, NumberT v);
+ tint::Result<NumberT> Sqrt(const Source& source, NumberT v);
/// Clamps e between low and high
/// @param source the source location
@@ -1290,7 +1232,7 @@
/// @param high the upper bound
/// @returns the result number on success, or logs an error and returns Failure
template <typename NumberT>
- utils::Result<NumberT> Clamp(const Source& source, NumberT e, NumberT low, NumberT high);
+ tint::Result<NumberT> Clamp(const Source& source, NumberT e, NumberT low, NumberT high);
/// Returns a callable that calls Add, and creates a Constant with its result of type `elem_ty`
/// if successful, or returns Failure otherwise.
diff --git a/src/tint/lang/wgsl/resolver/const_eval_binary_op_test.cc b/src/tint/lang/wgsl/resolver/const_eval_binary_op_test.cc
index bca5f9c..2bd91fb 100644
--- a/src/tint/lang/wgsl/resolver/const_eval_binary_op_test.cc
+++ b/src/tint/lang/wgsl/resolver/const_eval_binary_op_test.cc
@@ -34,7 +34,7 @@
Value lhs;
Value rhs;
- utils::Result<Success, Failure> expected;
+ tint::Result<Success, Failure> expected;
};
struct ErrorCase {
@@ -771,8 +771,8 @@
auto* value = Sem().Get(expr)->ConstantValue();
ASSERT_NE(value, nullptr);
- CheckConstant(value, Value::Create<bool>(utils::Vector{builder::Scalar(params.expected_0),
- builder::Scalar(params.expected_1)}));
+ CheckConstant(value, Value::Create<bool>(Vector{builder::Scalar(params.expected_0),
+ builder::Scalar(params.expected_1)}));
}
INSTANTIATE_TEST_SUITE_P(
HighestLowest,
@@ -2015,7 +2015,7 @@
// }
// const one = 1;
// const result = (one == 0) && Foo(1, true).a == 0;
- Structure("S", utils::Vector{Member("a", ty.i32()), Member("b", ty.f32())});
+ Structure("S", Vector{Member("a", ty.i32()), Member("b", ty.f32())});
GlobalConst("one", Expr(1_a));
auto* lhs = Equal("one", 0_a);
auto* rhs = Equal(MemberAccessor(Call("S", Expr(1_a), Expr(Source{{12, 34}}, true)), "a"), 0_a);
@@ -2034,7 +2034,7 @@
// }
// const one = 1;
// const result = (one == 1) || Foo(1, true).a == 0;
- Structure("S", utils::Vector{Member("a", ty.i32()), Member("b", ty.f32())});
+ Structure("S", Vector{Member("a", ty.i32()), Member("b", ty.f32())});
GlobalConst("one", Expr(1_a));
auto* lhs = Equal("one", 1_a);
auto* rhs = Equal(MemberAccessor(Call("S", Expr(1_a), Expr(Source{{12, 34}}, true)), "a"), 0_a);
@@ -2240,7 +2240,7 @@
// const s = S(1, 2.0);
// const one = 1;
// const result = (one == 0) && (s.c == 0);
- Structure("S", utils::Vector{Member("a", ty.i32()), Member("b", ty.f32())});
+ Structure("S", Vector{Member("a", ty.i32()), Member("b", ty.f32())});
GlobalConst("s", Call("S", Expr(1_a), Expr(2.0_a)));
GlobalConst("one", Expr(1_a));
auto* lhs = Equal("one", 0_a);
@@ -2259,7 +2259,7 @@
// const s = S(1, 2.0);
// const one = 1;
// const result = (one == 1) || (s.c == 0);
- Structure("S", utils::Vector{Member("a", ty.i32()), Member("b", ty.f32())});
+ Structure("S", Vector{Member("a", ty.i32()), Member("b", ty.f32())});
GlobalConst("s", Call("S", Expr(1_a), Expr(2.0_a)));
GlobalConst("one", Expr(1_a));
auto* lhs = Equal("one", 1_a);
diff --git a/src/tint/lang/wgsl/resolver/const_eval_bitcast_test.cc b/src/tint/lang/wgsl/resolver/const_eval_bitcast_test.cc
index a739823..b2e124d 100644
--- a/src/tint/lang/wgsl/resolver/const_eval_bitcast_test.cc
+++ b/src/tint/lang/wgsl/resolver/const_eval_bitcast_test.cc
@@ -28,7 +28,7 @@
struct Failure {
builder::CreatePtrs create_ptrs;
};
- utils::Result<Success, Failure> expected;
+ tint::Result<Success, Failure> expected;
};
static std::ostream& operator<<(std::ostream& o, const Case& c) {
@@ -93,12 +93,12 @@
}
}
-const u32 nan_as_u32 = utils::Bitcast<u32>(std::numeric_limits<float>::quiet_NaN());
-const i32 nan_as_i32 = utils::Bitcast<i32>(std::numeric_limits<float>::quiet_NaN());
-const u32 inf_as_u32 = utils::Bitcast<u32>(std::numeric_limits<float>::infinity());
-const i32 inf_as_i32 = utils::Bitcast<i32>(std::numeric_limits<float>::infinity());
-const u32 neg_inf_as_u32 = utils::Bitcast<u32>(-std::numeric_limits<float>::infinity());
-const i32 neg_inf_as_i32 = utils::Bitcast<i32>(-std::numeric_limits<float>::infinity());
+const u32 nan_as_u32 = tint::Bitcast<u32>(std::numeric_limits<float>::quiet_NaN());
+const i32 nan_as_i32 = tint::Bitcast<i32>(std::numeric_limits<float>::quiet_NaN());
+const u32 inf_as_u32 = tint::Bitcast<u32>(std::numeric_limits<float>::infinity());
+const i32 inf_as_i32 = tint::Bitcast<i32>(std::numeric_limits<float>::infinity());
+const u32 neg_inf_as_u32 = tint::Bitcast<u32>(-std::numeric_limits<float>::infinity());
+const i32 neg_inf_as_i32 = tint::Bitcast<i32>(-std::numeric_limits<float>::infinity());
INSTANTIATE_TEST_SUITE_P(Bitcast,
ResolverConstEvalBitcastTest,
diff --git a/src/tint/lang/wgsl/resolver/const_eval_builtin_test.cc b/src/tint/lang/wgsl/resolver/const_eval_builtin_test.cc
index 5f4a41b..39a55df 100644
--- a/src/tint/lang/wgsl/resolver/const_eval_builtin_test.cc
+++ b/src/tint/lang/wgsl/resolver/const_eval_builtin_test.cc
@@ -23,11 +23,11 @@
namespace {
struct Case {
- Case(utils::VectorRef<Value> in_args, utils::VectorRef<Value> expected_values)
+ Case(VectorRef<Value> in_args, VectorRef<Value> expected_values)
: args(std::move(in_args)),
expected(Success{std::move(expected_values), CheckConstantFlags{}}) {}
- Case(utils::VectorRef<Value> in_args, std::string expected_err)
+ Case(VectorRef<Value> in_args, std::string expected_err)
: args(std::move(in_args)), expected(Failure{std::move(expected_err)}) {}
/// Expected value may be positive or negative
@@ -49,15 +49,15 @@
}
struct Success {
- utils::Vector<Value, 2> values;
+ Vector<Value, 2> values;
CheckConstantFlags flags;
};
struct Failure {
std::string error;
};
- utils::Vector<Value, 8> args;
- utils::Result<Success, Failure> expected;
+ Vector<Value, 8> args;
+ tint::Result<Success, Failure> expected;
};
static std::ostream& operator<<(std::ostream& o, const Case& c) {
@@ -92,33 +92,33 @@
/// Creates a Case with Values for args and result
static Case C(std::initializer_list<Value> args, Value result) {
- return Case{utils::Vector<Value, 8>{args}, utils::Vector<Value, 2>{std::move(result)}};
+ return Case{Vector<Value, 8>{args}, Vector<Value, 2>{std::move(result)}};
}
/// Creates a Case with Values for args and result
static Case C(std::initializer_list<Value> args, std::initializer_list<Value> results) {
- return Case{utils::Vector<Value, 8>{args}, utils::Vector<Value, 2>{results}};
+ return Case{Vector<Value, 8>{args}, Vector<Value, 2>{results}};
}
/// Convenience overload that creates a Case with just scalars
static Case C(std::initializer_list<ScalarTypes> sargs, ScalarTypes sresult) {
- utils::Vector<Value, 8> args;
+ Vector<Value, 8> args;
for (auto& sa : sargs) {
std::visit([&](auto&& v) { return args.Push(Val(v)); }, sa);
}
Value result = Val(0_a);
std::visit([&](auto&& v) { result = Val(v); }, sresult);
- return Case{std::move(args), utils::Vector<Value, 2>{std::move(result)}};
+ return Case{std::move(args), Vector<Value, 2>{std::move(result)}};
}
/// Creates a Case with Values for args and result
static Case C(std::initializer_list<ScalarTypes> sargs,
std::initializer_list<ScalarTypes> sresults) {
- utils::Vector<Value, 8> args;
+ Vector<Value, 8> args;
for (auto& sa : sargs) {
std::visit([&](auto&& v) { return args.Push(Val(v)); }, sa);
}
- utils::Vector<Value, 2> results;
+ Vector<Value, 2> results;
for (auto& sa : sresults) {
std::visit([&](auto&& v) { return results.Push(Val(v)); }, sa);
}
@@ -127,12 +127,12 @@
/// Creates a Case with Values for args and expected error
static Case E(std::initializer_list<Value> args, std::string err) {
- return Case{utils::Vector<Value, 8>{args}, std::move(err)};
+ return Case{Vector<Value, 8>{args}, std::move(err)};
}
/// Convenience overload that creates an expected-error Case with just scalars
static Case E(std::initializer_list<ScalarTypes> sargs, std::string err) {
- utils::Vector<Value, 8> args;
+ Vector<Value, 8> args;
for (auto& sa : sargs) {
std::visit([&](auto&& v) { return args.Push(Val(v)); }, sa);
}
@@ -147,7 +147,7 @@
auto builtin = std::get<0>(GetParam());
auto& c = std::get<1>(GetParam());
- utils::Vector<const ast::Expression*, 8> args;
+ Vector<const ast::Expression*, 8> args;
for (auto& a : c.args) {
args.Push(a.Expr(*this));
}
@@ -488,7 +488,7 @@
template <typename T>
std::vector<Case> ClampCases() {
auto error_msg = [&](T low, T high) {
- utils::StringStream ss;
+ StringStream ss;
ss << "12:34 error: clamp called with 'low' (" << low << ") greater than 'high' (" << high
<< ")";
return ss.str();
diff --git a/src/tint/lang/wgsl/resolver/const_eval_construction_test.cc b/src/tint/lang/wgsl/resolver/const_eval_construction_test.cc
index f3e0836..a815414 100644
--- a/src/tint/lang/wgsl/resolver/const_eval_construction_test.cc
+++ b/src/tint/lang/wgsl/resolver/const_eval_construction_test.cc
@@ -1433,7 +1433,7 @@
}
TEST_F(ResolverConstEvalTest, Array_Struct_f32_Zero) {
- Structure("S", utils::Vector{
+ Structure("S", Vector{
Member("m1", ty.f32()),
Member("m2", ty.f32()),
});
@@ -1648,7 +1648,7 @@
}
TEST_F(ResolverConstEvalTest, Array_Struct_f32_Elements) {
- Structure("S", utils::Vector{
+ Structure("S", Vector{
Member("m1", ty.f32()),
Member("m2", ty.f32()),
});
@@ -1687,7 +1687,7 @@
TEST_F(ResolverConstEvalTest, Struct_ZeroInit) {
Enable(builtin::Extension::kF16);
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("a", ty.i32()),
Member("b", ty.u32()),
Member("c", ty.f32()),
@@ -1730,7 +1730,7 @@
TEST_F(ResolverConstEvalTest, Struct_Nested_ZeroInit) {
Enable(builtin::Extension::kF16);
- auto* inner = Structure("Inner", utils::Vector{
+ auto* inner = Structure("Inner", Vector{
Member("a", ty.i32()),
Member("b", ty.u32()),
Member("c", ty.f32()),
@@ -1738,7 +1738,7 @@
Member("e", ty.bool_()),
});
auto* s = Structure("s", //
- utils::Vector{
+ Vector{
Member("inner", ty.Of(inner)),
});
@@ -1779,8 +1779,7 @@
}
TEST_F(ResolverConstEvalTest, Struct_I32s_ZeroInit) {
- Structure(
- "S", utils::Vector{Member("m1", ty.i32()), Member("m2", ty.i32()), Member("m3", ty.i32())});
+ Structure("S", Vector{Member("m1", ty.i32()), Member("m2", ty.i32()), Member("m3", ty.i32())});
auto* expr = Call("S");
WrapInFunction(expr);
@@ -1815,7 +1814,7 @@
TEST_F(ResolverConstEvalTest, Struct_MixedScalars_ZeroInit) {
Enable(builtin::Extension::kF16);
- Structure("S", utils::Vector{
+ Structure("S", Vector{
Member("m1", ty.i32()),
Member("m2", ty.u32()),
Member("m3", ty.f32()),
@@ -1864,7 +1863,7 @@
}
TEST_F(ResolverConstEvalTest, Struct_VectorF32s_ZeroInit) {
- Structure("S", utils::Vector{
+ Structure("S", Vector{
Member("m1", ty.vec3<f32>()),
Member("m2", ty.vec3<f32>()),
Member("m3", ty.vec3<f32>()),
@@ -1915,7 +1914,7 @@
TEST_F(ResolverConstEvalTest, Struct_MixedVectors_ZeroInit) {
Enable(builtin::Extension::kF16);
- Structure("S", utils::Vector{
+ Structure("S", Vector{
Member("m1", ty.vec2<i32>()),
Member("m2", ty.vec3<u32>()),
Member("m3", ty.vec4<f32>()),
@@ -1983,13 +1982,13 @@
}
TEST_F(ResolverConstEvalTest, Struct_Struct_ZeroInit) {
- Structure("Inner", utils::Vector{
+ Structure("Inner", Vector{
Member("m1", ty.i32()),
Member("m2", ty.u32()),
Member("m3", ty.f32()),
});
- Structure("Outer", utils::Vector{
+ Structure("Outer", Vector{
Member("m1", ty("Inner")),
Member("m2", ty("Inner")),
});
@@ -2026,7 +2025,7 @@
TEST_F(ResolverConstEvalTest, Struct_MixedScalars_Construct) {
Enable(builtin::Extension::kF16);
- Structure("S", utils::Vector{
+ Structure("S", Vector{
Member("m1", ty.i32()),
Member("m2", ty.u32()),
Member("m3", ty.f32()),
@@ -2077,7 +2076,7 @@
TEST_F(ResolverConstEvalTest, Struct_MixedVectors_Construct) {
Enable(builtin::Extension::kF16);
- Structure("S", utils::Vector{
+ Structure("S", Vector{
Member("m1", ty.vec2<i32>()),
Member("m2", ty.vec3<u32>()),
Member("m3", ty.vec4<f32>()),
@@ -2146,13 +2145,13 @@
}
TEST_F(ResolverConstEvalTest, Struct_Struct_Construct) {
- Structure("Inner", utils::Vector{
+ Structure("Inner", Vector{
Member("m1", ty.i32()),
Member("m2", ty.u32()),
Member("m3", ty.f32()),
});
- Structure("Outer", utils::Vector{
+ Structure("Outer", Vector{
Member("m1", ty("Inner")),
Member("m2", ty("Inner")),
});
@@ -2188,7 +2187,7 @@
}
TEST_F(ResolverConstEvalTest, Struct_Array_Construct) {
- Structure("S", utils::Vector{
+ Structure("S", Vector{
Member("m1", ty.array<i32, 2>()),
Member("m2", ty.array<f32, 3>()),
});
diff --git a/src/tint/lang/wgsl/resolver/const_eval_member_access_test.cc b/src/tint/lang/wgsl/resolver/const_eval_member_access_test.cc
index fc6566d..b0a3de5 100644
--- a/src/tint/lang/wgsl/resolver/const_eval_member_access_test.cc
+++ b/src/tint/lang/wgsl/resolver/const_eval_member_access_test.cc
@@ -21,14 +21,14 @@
using namespace tint::number_suffixes; // NOLINT
TEST_F(ResolverConstEvalTest, StructMemberAccess) {
- Structure("Inner", utils::Vector{
+ Structure("Inner", Vector{
Member("i1", ty.i32()),
Member("i2", ty.u32()),
Member("i3", ty.f32()),
Member("i4", ty.bool_()),
});
- Structure("Outer", utils::Vector{
+ Structure("Outer", Vector{
Member("o1", ty("Inner")),
Member("o2", ty("Inner")),
});
@@ -264,13 +264,13 @@
auto* expr = param.input.Expr(*this);
auto* a = Const("a", expr);
- utils::Vector<const ast::IndexAccessorExpression*, 4> index_accessors;
+ Vector<const ast::IndexAccessorExpression*, 4> index_accessors;
for (size_t i = 0; i < param.input.args.Length(); ++i) {
auto* index = IndexAccessor("a", Expr(i32(i)));
index_accessors.Push(index);
}
- utils::Vector<const ast::Statement*, 5> stmts;
+ Vector<const ast::Statement*, 5> stmts;
stmts.Push(WrapInStatement(a));
for (auto* ia : index_accessors) {
stmts.Push(WrapInStatement(ia));
@@ -339,13 +339,13 @@
auto* expr = param.input.Expr(*this);
auto* a = Const("a", expr);
- utils::Vector<const ast::IndexAccessorExpression*, 4> index_accessors;
+ Vector<const ast::IndexAccessorExpression*, 4> index_accessors;
for (size_t i = 0; i < param.input.args.Length(); ++i) {
auto* index = IndexAccessor("a", Expr(i32(i)));
index_accessors.Push(index);
}
- utils::Vector<const ast::Statement*, 5> stmts;
+ Vector<const ast::Statement*, 5> stmts;
stmts.Push(WrapInStatement(a));
for (auto* ia : index_accessors) {
stmts.Push(WrapInStatement(ia));
diff --git a/src/tint/lang/wgsl/resolver/const_eval_runtime_semantics_test.cc b/src/tint/lang/wgsl/resolver/const_eval_runtime_semantics_test.cc
index 6414eb6..7e6bede 100644
--- a/src/tint/lang/wgsl/resolver/const_eval_runtime_semantics_test.cc
+++ b/src/tint/lang/wgsl/resolver/const_eval_runtime_semantics_test.cc
@@ -37,7 +37,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Add_AInt_Overflow) {
auto* a = constants.Get(AInt::Highest());
auto* b = constants.Get(AInt(1));
- auto result = const_eval.OpPlus(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.OpPlus(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<AInt>(), 0);
EXPECT_EQ(error(),
@@ -47,7 +47,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Add_AFloat_Overflow) {
auto* a = constants.Get(AFloat::Highest());
auto* b = constants.Get(AFloat::Highest());
- auto result = const_eval.OpPlus(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.OpPlus(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<AFloat>(), 0.f);
EXPECT_EQ(
@@ -58,7 +58,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Add_F32_Overflow) {
auto* a = constants.Get(f32::Highest());
auto* b = constants.Get(f32::Highest());
- auto result = const_eval.OpPlus(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.OpPlus(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<f32>(), 0.f);
EXPECT_EQ(
@@ -69,7 +69,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Sub_AInt_Overflow) {
auto* a = constants.Get(AInt::Lowest());
auto* b = constants.Get(AInt(1));
- auto result = const_eval.OpMinus(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.OpMinus(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<AInt>(), 0);
EXPECT_EQ(error(),
@@ -79,7 +79,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Sub_AFloat_Overflow) {
auto* a = constants.Get(AFloat::Lowest());
auto* b = constants.Get(AFloat::Highest());
- auto result = const_eval.OpMinus(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.OpMinus(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<AFloat>(), 0.f);
EXPECT_EQ(
@@ -90,7 +90,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Sub_F32_Overflow) {
auto* a = constants.Get(f32::Lowest());
auto* b = constants.Get(f32::Highest());
- auto result = const_eval.OpMinus(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.OpMinus(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<f32>(), 0.f);
EXPECT_EQ(
@@ -101,7 +101,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Mul_AInt_Overflow) {
auto* a = constants.Get(AInt::Highest());
auto* b = constants.Get(AInt(2));
- auto result = const_eval.OpMultiply(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.OpMultiply(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<AInt>(), 0);
EXPECT_EQ(error(),
@@ -111,7 +111,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Mul_AFloat_Overflow) {
auto* a = constants.Get(AFloat::Highest());
auto* b = constants.Get(AFloat::Highest());
- auto result = const_eval.OpMultiply(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.OpMultiply(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<AFloat>(), 0.f);
EXPECT_EQ(
@@ -122,7 +122,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Mul_F32_Overflow) {
auto* a = constants.Get(f32::Highest());
auto* b = constants.Get(f32::Highest());
- auto result = const_eval.OpMultiply(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.OpMultiply(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<f32>(), 0.f);
EXPECT_EQ(
@@ -133,7 +133,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Div_AInt_ZeroDenominator) {
auto* a = constants.Get(AInt(42));
auto* b = constants.Get(AInt(0));
- auto result = const_eval.OpDivide(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.OpDivide(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<AInt>(), 42);
EXPECT_EQ(error(), R"(warning: '42 / 0' cannot be represented as 'abstract-int')");
@@ -142,7 +142,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Div_I32_ZeroDenominator) {
auto* a = constants.Get(i32(42));
auto* b = constants.Get(i32(0));
- auto result = const_eval.OpDivide(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.OpDivide(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<i32>(), 42);
EXPECT_EQ(error(), R"(warning: '42 / 0' cannot be represented as 'i32')");
@@ -151,7 +151,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Div_U32_ZeroDenominator) {
auto* a = constants.Get(u32(42));
auto* b = constants.Get(u32(0));
- auto result = const_eval.OpDivide(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.OpDivide(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<u32>(), 42);
EXPECT_EQ(error(), R"(warning: '42 / 0' cannot be represented as 'u32')");
@@ -160,7 +160,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Div_AFloat_ZeroDenominator) {
auto* a = constants.Get(AFloat(42));
auto* b = constants.Get(AFloat(0));
- auto result = const_eval.OpDivide(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.OpDivide(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<AFloat>(), 42.f);
EXPECT_EQ(error(), R"(warning: '42.0 / 0.0' cannot be represented as 'abstract-float')");
@@ -169,7 +169,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Div_F32_ZeroDenominator) {
auto* a = constants.Get(f32(42));
auto* b = constants.Get(f32(0));
- auto result = const_eval.OpDivide(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.OpDivide(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<f32>(), 42.f);
EXPECT_EQ(error(), R"(warning: '42.0 / 0.0' cannot be represented as 'f32')");
@@ -178,7 +178,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Div_I32_MostNegativeByMinInt) {
auto* a = constants.Get(i32::Lowest());
auto* b = constants.Get(i32(-1));
- auto result = const_eval.OpDivide(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.OpDivide(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<i32>(), i32::Lowest());
EXPECT_EQ(error(), R"(warning: '-2147483648 / -1' cannot be represented as 'i32')");
@@ -187,7 +187,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Mod_AInt_ZeroDenominator) {
auto* a = constants.Get(AInt(42));
auto* b = constants.Get(AInt(0));
- auto result = const_eval.OpModulo(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.OpModulo(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<AInt>(), 0);
EXPECT_EQ(error(), R"(warning: '42 % 0' cannot be represented as 'abstract-int')");
@@ -196,7 +196,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Mod_I32_ZeroDenominator) {
auto* a = constants.Get(i32(42));
auto* b = constants.Get(i32(0));
- auto result = const_eval.OpModulo(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.OpModulo(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<i32>(), 0);
EXPECT_EQ(error(), R"(warning: '42 % 0' cannot be represented as 'i32')");
@@ -205,7 +205,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Mod_U32_ZeroDenominator) {
auto* a = constants.Get(u32(42));
auto* b = constants.Get(u32(0));
- auto result = const_eval.OpModulo(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.OpModulo(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<u32>(), 0);
EXPECT_EQ(error(), R"(warning: '42 % 0' cannot be represented as 'u32')");
@@ -214,7 +214,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Mod_AFloat_ZeroDenominator) {
auto* a = constants.Get(AFloat(42));
auto* b = constants.Get(AFloat(0));
- auto result = const_eval.OpModulo(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.OpModulo(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<AFloat>(), 0.f);
EXPECT_EQ(error(), R"(warning: '42.0 % 0.0' cannot be represented as 'abstract-float')");
@@ -223,7 +223,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Mod_F32_ZeroDenominator) {
auto* a = constants.Get(f32(42));
auto* b = constants.Get(f32(0));
- auto result = const_eval.OpModulo(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.OpModulo(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<f32>(), 0.f);
EXPECT_EQ(error(), R"(warning: '42.0 % 0.0' cannot be represented as 'f32')");
@@ -232,7 +232,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Mod_I32_MostNegativeByMinInt) {
auto* a = constants.Get(i32::Lowest());
auto* b = constants.Get(i32(-1));
- auto result = const_eval.OpModulo(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.OpModulo(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<i32>(), 0);
EXPECT_EQ(error(), R"(warning: '-2147483648 % -1' cannot be represented as 'i32')");
@@ -241,7 +241,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, ShiftLeft_AInt_SignChange) {
auto* a = constants.Get(AInt(0x0FFFFFFFFFFFFFFFll));
auto* b = constants.Get(u32(9));
- auto result = const_eval.OpShiftLeft(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.OpShiftLeft(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<AInt>(), static_cast<AInt>(0x0FFFFFFFFFFFFFFFull << 9));
EXPECT_EQ(error(), R"(warning: shift left operation results in sign change)");
@@ -250,7 +250,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, ShiftLeft_I32_SignChange) {
auto* a = constants.Get(i32(0x0FFFFFFF));
auto* b = constants.Get(u32(9));
- auto result = const_eval.OpShiftLeft(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.OpShiftLeft(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<i32>(), static_cast<i32>(0x0FFFFFFFu << 9));
EXPECT_EQ(error(), R"(warning: shift left operation results in sign change)");
@@ -259,7 +259,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, ShiftLeft_I32_MoreThanBitWidth) {
auto* a = constants.Get(i32(0x1));
auto* b = constants.Get(u32(33));
- auto result = const_eval.OpShiftLeft(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.OpShiftLeft(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<i32>(), 2);
EXPECT_EQ(
@@ -270,7 +270,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, ShiftLeft_U32_MoreThanBitWidth) {
auto* a = constants.Get(u32(0x1));
auto* b = constants.Get(u32(33));
- auto result = const_eval.OpShiftLeft(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.OpShiftLeft(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<u32>(), 2);
EXPECT_EQ(
@@ -281,7 +281,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, ShiftRight_I32_MoreThanBitWidth) {
auto* a = constants.Get(i32(0x2));
auto* b = constants.Get(u32(33));
- auto result = const_eval.OpShiftRight(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.OpShiftRight(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<i32>(), 1);
EXPECT_EQ(
@@ -292,7 +292,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, ShiftRight_U32_MoreThanBitWidth) {
auto* a = constants.Get(u32(0x2));
auto* b = constants.Get(u32(33));
- auto result = const_eval.OpShiftRight(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.OpShiftRight(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<u32>(), 1);
EXPECT_EQ(
@@ -302,7 +302,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Acos_F32_OutOfRange) {
auto* a = constants.Get(f32(2));
- auto result = const_eval.acos(a->Type(), utils::Vector{a}, {});
+ auto result = const_eval.acos(a->Type(), Vector{a}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<f32>(), 0.f);
EXPECT_EQ(error(),
@@ -311,7 +311,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Acosh_F32_OutOfRange) {
auto* a = constants.Get(f32(-1));
- auto result = const_eval.acosh(a->Type(), utils::Vector{a}, {});
+ auto result = const_eval.acosh(a->Type(), Vector{a}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<f32>(), 0.f);
EXPECT_EQ(error(), R"(warning: acosh must be called with a value >= 1.0)");
@@ -319,7 +319,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Asin_F32_OutOfRange) {
auto* a = constants.Get(f32(2));
- auto result = const_eval.asin(a->Type(), utils::Vector{a}, {});
+ auto result = const_eval.asin(a->Type(), Vector{a}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<f32>(), 0.f);
EXPECT_EQ(error(),
@@ -328,7 +328,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Atanh_F32_OutOfRange) {
auto* a = constants.Get(f32(2));
- auto result = const_eval.atanh(a->Type(), utils::Vector{a}, {});
+ auto result = const_eval.atanh(a->Type(), Vector{a}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<f32>(), 0.f);
EXPECT_EQ(error(),
@@ -337,7 +337,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Exp_F32_Overflow) {
auto* a = constants.Get(f32(1000));
- auto result = const_eval.exp(a->Type(), utils::Vector{a}, {});
+ auto result = const_eval.exp(a->Type(), Vector{a}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<f32>(), 0.f);
EXPECT_EQ(error(), R"(warning: e^1000.0 cannot be represented as 'f32')");
@@ -345,7 +345,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Exp2_F32_Overflow) {
auto* a = constants.Get(f32(1000));
- auto result = const_eval.exp2(a->Type(), utils::Vector{a}, {});
+ auto result = const_eval.exp2(a->Type(), Vector{a}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<f32>(), 0.f);
EXPECT_EQ(error(), R"(warning: 2^1000.0 cannot be represented as 'f32')");
@@ -355,7 +355,7 @@
auto* a = constants.Get(i32(0x12345678));
auto* offset = constants.Get(u32(24));
auto* count = constants.Get(u32(16));
- auto result = const_eval.extractBits(a->Type(), utils::Vector{a, offset, count}, {});
+ auto result = const_eval.extractBits(a->Type(), Vector{a, offset, count}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<i32>(), 0x12);
EXPECT_EQ(error(),
@@ -366,7 +366,7 @@
auto* a = constants.Get(u32(0x12345678));
auto* offset = constants.Get(u32(24));
auto* count = constants.Get(u32(16));
- auto result = const_eval.extractBits(a->Type(), utils::Vector{a, offset, count}, {});
+ auto result = const_eval.extractBits(a->Type(), Vector{a, offset, count}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<u32>(), 0x12);
EXPECT_EQ(error(),
@@ -378,7 +378,7 @@
auto* b = constants.Get(i32(0x12));
auto* offset = constants.Get(u32(24));
auto* count = constants.Get(u32(16));
- auto result = const_eval.insertBits(a->Type(), utils::Vector{a, b, offset, count}, {});
+ auto result = const_eval.insertBits(a->Type(), Vector{a, b, offset, count}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<i32>(), 0x12345678);
EXPECT_EQ(error(),
@@ -390,7 +390,7 @@
auto* b = constants.Get(u32(0x12));
auto* offset = constants.Get(u32(24));
auto* count = constants.Get(u32(16));
- auto result = const_eval.insertBits(a->Type(), utils::Vector{a, b, offset, count}, {});
+ auto result = const_eval.insertBits(a->Type(), Vector{a, b, offset, count}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<u32>(), 0x12345678);
EXPECT_EQ(error(),
@@ -399,7 +399,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, InverseSqrt_F32_OutOfRange) {
auto* a = constants.Get(f32(-1));
- auto result = const_eval.inverseSqrt(a->Type(), utils::Vector{a}, {});
+ auto result = const_eval.inverseSqrt(a->Type(), Vector{a}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<f32>(), 0.f);
EXPECT_EQ(error(), R"(warning: inverseSqrt must be called with a value > 0)");
@@ -408,7 +408,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, LDExpr_F32_OutOfRange) {
auto* a = constants.Get(f32(42.f));
auto* b = constants.Get(f32(200));
- auto result = const_eval.ldexp(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.ldexp(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<f32>(), 0.f);
EXPECT_EQ(error(), R"(warning: e2 must be less than or equal to 128)");
@@ -416,7 +416,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Log_F32_OutOfRange) {
auto* a = constants.Get(f32(-1));
- auto result = const_eval.log(a->Type(), utils::Vector{a}, {});
+ auto result = const_eval.log(a->Type(), Vector{a}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<f32>(), 0.f);
EXPECT_EQ(error(), R"(warning: log must be called with a value > 0)");
@@ -424,7 +424,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Log2_F32_OutOfRange) {
auto* a = constants.Get(f32(-1));
- auto result = const_eval.log2(a->Type(), utils::Vector{a}, {});
+ auto result = const_eval.log2(a->Type(), Vector{a}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<f32>(), 0.f);
EXPECT_EQ(error(), R"(warning: log2 must be called with a value > 0)");
@@ -433,9 +433,8 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Normalize_ZeroLength) {
auto* zero = constants.Get(f32(0));
auto* vec =
- const_eval.VecSplat(create<type::Vector>(create<type::F32>(), 4u), utils::Vector{zero}, {})
- .Get();
- auto result = const_eval.normalize(vec->Type(), utils::Vector{vec}, {});
+ const_eval.VecSplat(create<type::Vector>(create<type::F32>(), 4u), Vector{zero}, {}).Get();
+ auto result = const_eval.normalize(vec->Type(), Vector{vec}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->Index(0)->ValueAs<f32>(), 0.f);
EXPECT_EQ(result.Get()->Index(1)->ValueAs<f32>(), 0.f);
@@ -448,9 +447,8 @@
auto* a = constants.Get(f32(75250.f));
auto* b = constants.Get(f32(42.1f));
auto* vec =
- const_eval.VecInitS(create<type::Vector>(create<type::F32>(), 2u), utils::Vector{a, b}, {})
- .Get();
- auto result = const_eval.pack2x16float(create<type::U32>(), utils::Vector{vec}, {});
+ const_eval.VecInitS(create<type::Vector>(create<type::F32>(), 2u), Vector{a, b}, {}).Get();
+ auto result = const_eval.pack2x16float(create<type::U32>(), Vector{vec}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<u32>(), 0x51430000);
EXPECT_EQ(error(), R"(warning: value 75250.0 cannot be represented as 'f16')");
@@ -459,7 +457,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Pow_F32_Overflow) {
auto* a = constants.Get(f32(2));
auto* b = constants.Get(f32(1000));
- auto result = const_eval.pow(a->Type(), utils::Vector{a, b}, {});
+ auto result = const_eval.pow(a->Type(), Vector{a, b}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<f32>(), 0.f);
EXPECT_EQ(error(), R"(warning: '2.0 ^ 1000.0' cannot be represented as 'f32')");
@@ -467,7 +465,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Unpack2x16Float_OutOfRange) {
auto* a = constants.Get(u32(0x51437C00));
- auto result = const_eval.unpack2x16float(create<type::U32>(), utils::Vector{a}, {});
+ auto result = const_eval.unpack2x16float(create<type::U32>(), Vector{a}, {});
ASSERT_TRUE(result);
EXPECT_FLOAT_EQ(result.Get()->Index(0)->ValueAs<f32>(), 0.f);
EXPECT_FLOAT_EQ(result.Get()->Index(1)->ValueAs<f32>(), 42.09375f);
@@ -476,7 +474,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, QuantizeToF16_OutOfRange) {
auto* a = constants.Get(f32(75250.f));
- auto result = const_eval.quantizeToF16(create<type::U32>(), utils::Vector{a}, {});
+ auto result = const_eval.quantizeToF16(create<type::U32>(), Vector{a}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<u32>(), 0);
EXPECT_EQ(error(), R"(warning: value 75250.0 cannot be represented as 'f16')");
@@ -484,7 +482,7 @@
TEST_F(ResolverConstEvalRuntimeSemanticsTest, Sqrt_F32_OutOfRange) {
auto* a = constants.Get(f32(-1));
- auto result = const_eval.sqrt(a->Type(), utils::Vector{a}, {});
+ auto result = const_eval.sqrt(a->Type(), Vector{a}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<f32>(), 0.f);
EXPECT_EQ(error(), R"(warning: sqrt must be called with a value >= 0)");
@@ -494,7 +492,7 @@
auto* e = constants.Get(f32(-1));
auto* low = constants.Get(f32(2));
auto* high = constants.Get(f32(1));
- auto result = const_eval.clamp(e->Type(), utils::Vector{e, low, high}, {});
+ auto result = const_eval.clamp(e->Type(), Vector{e, low, high}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<f32>(), 1.f);
EXPECT_EQ(error(), R"(warning: clamp called with 'low' (2.0) greater than 'high' (1.0))");
@@ -557,7 +555,7 @@
auto* vec4f = create<type::Vector>(create<type::F32>(), 4u);
auto* a = const_eval
.VecInitS(vec4f,
- utils::Vector{
+ Vector{
constants.Get(f32(1)),
constants.Get(f32(4)),
constants.Get(f32(-1)),
@@ -565,7 +563,7 @@
},
{})
.Get();
- auto result = const_eval.sqrt(a->Type(), utils::Vector{a}, {});
+ auto result = const_eval.sqrt(a->Type(), Vector{a}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->Index(0)->ValueAs<f32>(), 1);
EXPECT_EQ(result.Get()->Index(1)->ValueAs<f32>(), 2);
diff --git a/src/tint/lang/wgsl/resolver/const_eval_test.h b/src/tint/lang/wgsl/resolver/const_eval_test.h
index 6e6ea37..78adadc 100644
--- a/src/tint/lang/wgsl/resolver/const_eval_test.h
+++ b/src/tint/lang/wgsl/resolver/const_eval_test.h
@@ -40,7 +40,7 @@
/// Walks the constant::Value @p c, accumulating all the inner-most scalar values into @p args
template <size_t N>
-inline void CollectScalars(const constant::Value* c, utils::Vector<builder::Scalar, N>& scalars) {
+inline void CollectScalars(const constant::Value* c, Vector<builder::Scalar, N>& scalars) {
Switch(
c->Type(), //
[&](const type::AbstractInt*) { scalars.Push(c->ValueAs<AInt>()); },
@@ -59,8 +59,8 @@
}
/// Walks the constant::Value @p c, returning all the inner-most scalar values.
-inline utils::Vector<builder::Scalar, 16> ScalarsFrom(const constant::Value* c) {
- utils::Vector<builder::Scalar, 16> out;
+inline Vector<builder::Scalar, 16> ScalarsFrom(const constant::Value* c) {
+ Vector<builder::Scalar, 16> out;
CollectScalars(c, out);
return out;
}
@@ -220,7 +220,7 @@
/// Returns the overflow error message for binary ops
template <typename NumberT>
inline std::string OverflowErrorMessage(NumberT lhs, const char* op, NumberT rhs) {
- utils::StringStream ss;
+ StringStream ss;
ss << "'" << lhs.value << " " << op << " " << rhs.value << "' cannot be represented as '"
<< FriendlyName<NumberT>() << "'";
return ss.str();
@@ -229,7 +229,7 @@
/// Returns the overflow error message for conversions
template <typename VALUE_TY>
std::string OverflowErrorMessage(VALUE_TY value, std::string_view target_ty) {
- utils::StringStream ss;
+ StringStream ss;
ss << "value " << value << " cannot be represented as "
<< "'" << target_ty << "'";
return ss.str();
@@ -238,7 +238,7 @@
/// Returns the overflow error message for exponentiation
template <typename NumberT>
std::string OverflowExpErrorMessage(std::string_view base, NumberT exp) {
- utils::StringStream ss;
+ StringStream ss;
ss << base << "^" << exp << " cannot be represented as "
<< "'" << FriendlyName<NumberT>() << "'";
return ss.str();
diff --git a/src/tint/lang/wgsl/resolver/control_block_validation_test.cc b/src/tint/lang/wgsl/resolver/control_block_validation_test.cc
index 9abf473..f0a7d4d 100644
--- a/src/tint/lang/wgsl/resolver/control_block_validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/control_block_validation_test.cc
@@ -107,11 +107,11 @@
// }
auto* var = Var("a", ty.i32(), Expr(2_i));
- auto* block = Block(
- Decl(var), //
- Switch("a", //
- Case(utils::Vector{CaseSelector(1_i), DefaultCaseSelector(Source{{9, 2}})}), //
- DefaultCase(Source{{12, 34}})));
+ auto* block =
+ Block(Decl(var), //
+ Switch("a", //
+ Case(Vector{CaseSelector(1_i), DefaultCaseSelector(Source{{9, 2}})}), //
+ DefaultCase(Source{{12, 34}})));
WrapInFunction(block);
@@ -127,11 +127,10 @@
// }
auto* var = Var("a", ty.i32(), Expr(2_i));
- auto* block =
- Block(Decl(var), //
- Switch("a", //
- Case(utils::Vector{DefaultCaseSelector(Source{{9, 2}}), CaseSelector(1_i),
- DefaultCaseSelector(Source{{12, 34}})})));
+ auto* block = Block(Decl(var), //
+ Switch("a", //
+ Case(Vector{DefaultCaseSelector(Source{{9, 2}}), CaseSelector(1_i),
+ DefaultCaseSelector(Source{{12, 34}})})));
WrapInFunction(block);
@@ -148,11 +147,11 @@
// }
auto* var = Var("a", ty.i32(), Expr(2_i));
- auto* block = Block(
- Decl(var), //
- Switch("a", //
- Case(utils::Vector{CaseSelector(1_i), DefaultCaseSelector(Source{{9, 2}})}),
- Case(utils::Vector{DefaultCaseSelector(Source{{12, 34}}), CaseSelector(2_i)})));
+ auto* block =
+ Block(Decl(var), //
+ Switch("a", //
+ Case(Vector{CaseSelector(1_i), DefaultCaseSelector(Source{{9, 2}})}),
+ Case(Vector{DefaultCaseSelector(Source{{12, 34}}), CaseSelector(2_i)})));
WrapInFunction(block);
@@ -336,7 +335,7 @@
auto* block = Block(Decl(var), //
Switch("a", //
Case(CaseSelector(0_u)),
- Case(utils::Vector{
+ Case(Vector{
CaseSelector(Source{{12, 34}}, 2_u),
CaseSelector(3_u),
CaseSelector(Source{{56, 78}}, 2_u),
@@ -362,7 +361,7 @@
auto* block = Block(Decl(var), //
Switch("a", //
Case(CaseSelector(Source{{12, 34}}, -10_i)),
- Case(utils::Vector{
+ Case(Vector{
CaseSelector(0_i),
CaseSelector(1_i),
CaseSelector(2_i),
@@ -453,12 +452,11 @@
// }
auto* var = Var("a", Expr(2_u));
- auto* block =
- Block(Decl(var), //
- Switch("a", //
- DefaultCase(Source{{12, 34}}), //
- Case(utils::Vector{CaseSelector(Add(5_u, 6_u)), CaseSelector(Add(7_u, 9_u)),
- CaseSelector(Mul(2_u, 4_u))})));
+ auto* block = Block(Decl(var), //
+ Switch("a", //
+ DefaultCase(Source{{12, 34}}), //
+ Case(Vector{CaseSelector(Add(5_u, 6_u)), CaseSelector(Add(7_u, 9_u)),
+ CaseSelector(Mul(2_u, 4_u))})));
WrapInFunction(block);
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -512,8 +510,8 @@
auto* block = Block(Decl(var), //
Switch("a", //
- Case(utils::Vector{CaseSelector(Source{{56, 78}}, Add(5_i, 5_i)),
- CaseSelector(Source{{12, 34}}, Add(6_i, 4_i))}),
+ Case(Vector{CaseSelector(Source{{56, 78}}, Add(5_i, 5_i)),
+ CaseSelector(Source{{12, 34}}, Add(6_i, 4_i))}),
DefaultCase()));
WrapInFunction(block);
@@ -533,8 +531,8 @@
auto* block = Block(Decl(var), //
Switch("a", //
- Case(utils::Vector{CaseSelector(Source{{56, 78}}, Add(5_i, 5_i)),
- CaseSelector(Source{{12, 34}}, 10_i)}),
+ Case(Vector{CaseSelector(Source{{56, 78}}, Add(5_i, 5_i)),
+ CaseSelector(Source{{12, 34}}, 10_i)}),
DefaultCase()));
WrapInFunction(block);
@@ -564,7 +562,7 @@
constexpr size_t kMaxSwitchCaseSelectors = 16383;
TEST_F(ResolverControlBlockValidationTest, Switch_MaxSelectors_Valid) {
- utils::Vector<const ast::CaseStatement*, 0> cases;
+ Vector<const ast::CaseStatement*, 0> cases;
for (size_t i = 0; i < kMaxSwitchCaseSelectors - 1; ++i) {
cases.Push(Case(CaseSelector(Expr(i32(i)))));
}
@@ -578,7 +576,7 @@
}
TEST_F(ResolverControlBlockValidationTest, Switch_MaxSelectors_Invalid) {
- utils::Vector<const ast::CaseStatement*, 0> cases;
+ Vector<const ast::CaseStatement*, 0> cases;
for (size_t i = 0; i < kMaxSwitchCaseSelectors; ++i) {
cases.Push(Case(CaseSelector(Expr(i32(i)))));
}
diff --git a/src/tint/lang/wgsl/resolver/dependency_graph.cc b/src/tint/lang/wgsl/resolver/dependency_graph.cc
index a9b48c1..d5ceb40 100644
--- a/src/tint/lang/wgsl/resolver/dependency_graph.cc
+++ b/src/tint/lang/wgsl/resolver/dependency_graph.cc
@@ -103,14 +103,12 @@
return lhs.from == rhs.from && lhs.to == rhs.to;
}
/// Hashing operator
- inline std::size_t operator()(const DependencyEdge& d) const {
- return utils::Hash(d.from, d.to);
- }
+ inline std::size_t operator()(const DependencyEdge& d) const { return Hash(d.from, d.to); }
};
/// A map of DependencyEdge to DependencyInfo
using DependencyEdges =
- utils::Hashmap<DependencyEdge, DependencyInfo, 64, DependencyEdgeCmp, DependencyEdgeCmp>;
+ Hashmap<DependencyEdge, DependencyInfo, 64, DependencyEdgeCmp, DependencyEdgeCmp>;
/// Global describes a module-scope variable, type or function.
struct Global {
@@ -119,11 +117,11 @@
/// The declaration ast::Node
const ast::Node* node;
/// A list of dependencies that this global depends on
- utils::Vector<Global*, 8> deps;
+ Vector<Global*, 8> deps;
};
/// A map of global name to Global
-using GlobalMap = utils::Hashmap<Symbol, Global*, 16>;
+using GlobalMap = Hashmap<Symbol, Global*, 16>;
/// Raises an ICE that a global ast::Node type was not handled by this system.
void UnhandledNode(diag::List& diagnostics, const ast::Node* node) {
@@ -242,7 +240,7 @@
/// Traverses the statements, performing symbol resolution and determining
/// global dependencies.
- void TraverseStatements(utils::VectorRef<const ast::Statement*> stmts) {
+ void TraverseStatements(VectorRef<const ast::Statement*> stmts) {
for (auto* s : stmts) {
TraverseStatement(s);
}
@@ -343,7 +341,7 @@
return;
}
- utils::Vector<const ast::Expression*, 8> pending{root_expr};
+ Vector<const ast::Expression*, 8> pending{root_expr};
while (!pending.IsEmpty()) {
ast::TraverseExpressions(pending.Pop(), diagnostics_, [&](const ast::Expression* expr) {
Switch(
@@ -365,7 +363,7 @@
/// Traverses the attribute list, performing symbol resolution and
/// determining global dependencies.
- void TraverseAttributes(utils::VectorRef<const ast::Attribute*> attrs) {
+ void TraverseAttributes(VectorRef<const ast::Attribute*> attrs) {
for (auto* attr : attrs) {
TraverseAttribute(attr);
}
@@ -579,7 +577,7 @@
graph_.resolved_identifiers.Add(from, ResolvedIdentifier(resolved));
}
- using VariableMap = utils::Hashmap<Symbol, const ast::Variable*, 32>;
+ using VariableMap = Hashmap<Symbol, const ast::Variable*, 32>;
const GlobalMap& globals_;
diag::List& diagnostics_;
DependencyGraph& graph_;
@@ -588,7 +586,7 @@
ScopeStack<Symbol, const ast::Node*> scope_stack_;
Global* current_global_ = nullptr;
- utils::Hashmap<Symbol, BuiltinInfo, 64> builtin_info_map;
+ Hashmap<Symbol, BuiltinInfo, 64> builtin_info_map;
};
/// The global dependency analysis system
@@ -709,7 +707,7 @@
return;
}
- utils::Vector<Entry, 16> stack{Entry{root, 0}};
+ Vector<Entry, 16> stack{Entry{root, 0}};
while (true) {
auto& entry = stack.Back();
// Have we exhausted the dependencies of entry.global?
@@ -755,7 +753,7 @@
// Skip directives here, as they are already added.
continue;
}
- utils::UniqueVector<const Global*, 8> stack;
+ UniqueVector<const Global*, 8> stack;
TraverseDependencies(
global,
[&](const Global* g) { // Enter
@@ -805,8 +803,8 @@
/// @param root is the global that starts the cyclic dependency, which must be
/// found in `stack`.
/// @param stack is the global dependency stack that contains a loop.
- void CyclicDependencyFound(const Global* root, utils::VectorRef<const Global*> stack) {
- utils::StringStream msg;
+ void CyclicDependencyFound(const Global* root, VectorRef<const Global*> stack) {
+ StringStream msg;
msg << "cyclic dependency found: ";
constexpr size_t kLoopNotStarted = ~0u;
size_t loop_start = kLoopNotStarted;
@@ -862,7 +860,7 @@
DependencyGraph& graph_;
/// Allocator of Globals
- utils::BlockAllocator<Global> allocator_;
+ BlockAllocator<Global> allocator_;
/// Global map, keyed by name. Populated by GatherGlobals().
GlobalMap globals_;
@@ -871,10 +869,10 @@
DependencyEdges dependency_edges_;
/// Globals in declaration order. Populated by GatherGlobals().
- utils::Vector<Global*, 64> declaration_order_;
+ Vector<Global*, 64> declaration_order_;
/// Globals in sorted dependency order. Populated by SortGlobals().
- utils::UniqueVector<const ast::Node*, 64> sorted_;
+ UniqueVector<const ast::Node*, 64> sorted_;
};
} // namespace
@@ -922,28 +920,28 @@
});
}
if (auto builtin_fn = BuiltinFunction(); builtin_fn != builtin::Function::kNone) {
- return "builtin function '" + utils::ToString(builtin_fn) + "'";
+ return "builtin function '" + tint::ToString(builtin_fn) + "'";
}
if (auto builtin_ty = BuiltinType(); builtin_ty != builtin::Builtin::kUndefined) {
- return "builtin type '" + utils::ToString(builtin_ty) + "'";
+ return "builtin type '" + tint::ToString(builtin_ty) + "'";
}
if (auto builtin_val = BuiltinValue(); builtin_val != builtin::BuiltinValue::kUndefined) {
- return "builtin value '" + utils::ToString(builtin_val) + "'";
+ return "builtin value '" + tint::ToString(builtin_val) + "'";
}
if (auto access = Access(); access != builtin::Access::kUndefined) {
- return "access '" + utils::ToString(access) + "'";
+ return "access '" + tint::ToString(access) + "'";
}
if (auto addr = AddressSpace(); addr != builtin::AddressSpace::kUndefined) {
- return "address space '" + utils::ToString(addr) + "'";
+ return "address space '" + tint::ToString(addr) + "'";
}
if (auto type = InterpolationType(); type != builtin::InterpolationType::kUndefined) {
- return "interpolation type '" + utils::ToString(type) + "'";
+ return "interpolation type '" + tint::ToString(type) + "'";
}
if (auto smpl = InterpolationSampling(); smpl != builtin::InterpolationSampling::kUndefined) {
- return "interpolation sampling '" + utils::ToString(smpl) + "'";
+ return "interpolation sampling '" + tint::ToString(smpl) + "'";
}
if (auto fmt = TexelFormat(); fmt != builtin::TexelFormat::kUndefined) {
- return "texel format '" + utils::ToString(fmt) + "'";
+ return "texel format '" + tint::ToString(fmt) + "'";
}
if (auto* unresolved = Unresolved()) {
return "unresolved identifier '" + unresolved->name + "'";
diff --git a/src/tint/lang/wgsl/resolver/dependency_graph.h b/src/tint/lang/wgsl/resolver/dependency_graph.h
index 9b71b2c..e555c09 100644
--- a/src/tint/lang/wgsl/resolver/dependency_graph.h
+++ b/src/tint/lang/wgsl/resolver/dependency_graph.h
@@ -200,16 +200,16 @@
static bool Build(const ast::Module& module, diag::List& diagnostics, DependencyGraph& output);
/// All globals in dependency-sorted order.
- utils::Vector<const ast::Node*, 32> ordered_globals;
+ Vector<const ast::Node*, 32> ordered_globals;
/// Map of ast::Identifier to a ResolvedIdentifier
- utils::Hashmap<const ast::Identifier*, ResolvedIdentifier, 64> resolved_identifiers;
+ Hashmap<const ast::Identifier*, ResolvedIdentifier, 64> resolved_identifiers;
/// Map of ast::Variable to a type, function, or variable that is shadowed by
/// the variable key. A declaration (X) shadows another (Y) if X and Y use
/// the same symbol, and X is declared in a sub-scope of the scope that
/// declares Y.
- utils::Hashmap<const ast::Variable*, const ast::Node*, 16> shadows;
+ Hashmap<const ast::Variable*, const ast::Node*, 16> shadows;
};
} // namespace tint::resolver
diff --git a/src/tint/lang/wgsl/resolver/dependency_graph_test.cc b/src/tint/lang/wgsl/resolver/dependency_graph_test.cc
index 4f6a899..2459649 100644
--- a/src/tint/lang/wgsl/resolver/dependency_graph_test.cc
+++ b/src/tint/lang/wgsl/resolver/dependency_graph_test.cc
@@ -378,13 +378,13 @@
/// The program builder
ProgramBuilder* const builder;
/// Parameters to a function that may need to be built
- utils::Vector<const ast::Parameter*, 8> parameters;
+ Vector<const ast::Parameter*, 8> parameters;
/// Shallow function var / let declaration statements
- utils::Vector<const ast::Statement*, 8> statements;
+ Vector<const ast::Statement*, 8> statements;
/// Nested function local var / let declaration statements
- utils::Vector<const ast::Statement*, 8> nested_statements;
+ Vector<const ast::Statement*, 8> nested_statements;
/// Function attributes
- utils::Vector<const ast::Attribute*, 8> func_attrs;
+ Vector<const ast::Attribute*, 8> func_attrs;
/// Constructor
/// @param builder the program builder
@@ -425,9 +425,9 @@
case SymbolDeclKind::Alias:
return b.Alias(source, symbol, b.ty.i32());
case SymbolDeclKind::Struct:
- return b.Structure(source, symbol, utils::Vector{b.Member("m", b.ty.i32())});
+ return b.Structure(source, symbol, Vector{b.Member("m", b.ty.i32())});
case SymbolDeclKind::Function:
- return b.Func(source, symbol, utils::Empty, b.ty.void_(), utils::Empty);
+ return b.Func(source, symbol, tint::Empty, b.ty.void_(), tint::Empty);
case SymbolDeclKind::Parameter: {
auto* node = b.Param(source, symbol, b.ty.i32());
parameters.Push(node);
@@ -539,7 +539,7 @@
}
case SymbolUseKind::StructMemberType: {
auto node = b.ty(source, symbol);
- b.Structure(b.Sym(), utils::Vector{b.Member("m", node)});
+ b.Structure(b.Sym(), Vector{b.Member("m", node)});
return node->identifier;
}
case SymbolUseKind::CallFunction: {
@@ -646,9 +646,8 @@
// fn A() { B(); }
// fn B() {}
- Func("A", utils::Empty, ty.void_(),
- utils::Vector{CallStmt(Call(Ident(Source{{12, 34}}, "B")))});
- Func(Source{{56, 78}}, "B", utils::Empty, ty.void_(), utils::Vector{Return()});
+ Func("A", tint::Empty, ty.void_(), Vector{CallStmt(Call(Ident(Source{{12, 34}}, "B")))});
+ Func(Source{{56, 78}}, "B", tint::Empty, ty.void_(), Vector{Return()});
Build();
}
@@ -659,8 +658,7 @@
// }
// type T = i32;
- Func("F", utils::Empty, ty.void_(),
- utils::Vector{Block(Ignore(Call(Ident(Source{{12, 34}}, "T"))))});
+ Func("F", tint::Empty, ty.void_(), Vector{Block(Ignore(Call(Ident(Source{{12, 34}}, "T"))))});
Alias(Source{{56, 78}}, "T", ty.i32());
Build();
@@ -672,8 +670,7 @@
// }
// type T = i32;
- Func("F", utils::Empty, ty.void_(),
- utils::Vector{Block(Decl(Var("v", ty(Source{{12, 34}}, "T"))))});
+ Func("F", tint::Empty, ty.void_(), Vector{Block(Decl(Var("v", ty(Source{{12, 34}}, "T"))))});
Alias(Source{{56, 78}}, "T", ty.i32());
Build();
@@ -683,7 +680,7 @@
// fn F(p : T) {}
// type T = i32;
- Func("F", utils::Vector{Param("p", ty(Source{{12, 34}}, "T"))}, ty.void_(), utils::Empty);
+ Func("F", Vector{Param("p", ty(Source{{12, 34}}, "T"))}, ty.void_(), tint::Empty);
Alias(Source{{56, 78}}, "T", ty.i32());
Build();
@@ -693,7 +690,7 @@
// fn F() -> T {}
// type T = i32;
- Func("F", utils::Empty, ty(Source{{12, 34}}, "T"), utils::Empty);
+ Func("F", tint::Empty, ty(Source{{12, 34}}, "T"), tint::Empty);
Alias(Source{{56, 78}}, "T", ty.i32());
Build();
@@ -703,7 +700,7 @@
// struct S { m : T };
// type T = i32;
- Structure("S", utils::Vector{Member("m", ty(Source{{12, 34}}, "T"))});
+ Structure("S", Vector{Member("m", ty(Source{{12, 34}}, "T"))});
Alias(Source{{56, 78}}, "T", ty.i32());
Build();
@@ -715,8 +712,8 @@
// }
// var G: f32 = 2.1;
- Func("F", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("F", tint::Empty, ty.void_(),
+ Vector{
Block(Assign(Expr(Source{{12, 34}}, "G"), 3.14_f)),
});
@@ -826,8 +823,8 @@
TEST_F(ResolverDependencyGraphCyclicRefTest, DirectCall) {
// fn main() { main(); }
- Func(Source{{12, 34}}, "main", utils::Empty, ty.void_(),
- utils::Vector{CallStmt(Call(Ident(Source{{56, 78}}, "main")))});
+ Func(Source{{12, 34}}, "main", tint::Empty, ty.void_(),
+ Vector{CallStmt(Call(Ident(Source{{56, 78}}, "main")))});
Build(R"(12:34 error: cyclic dependency found: 'main' -> 'main'
56:78 note: function 'main' references function 'main' here)");
@@ -840,18 +837,18 @@
// 4: fn c() { d(); }
// 5: fn b() { c(); }
- Func(Source{{1, 1}}, "a", utils::Empty, ty.void_(),
- utils::Vector{CallStmt(Call(Ident(Source{{1, 10}}, "b")))});
- Func(Source{{2, 1}}, "e", utils::Empty, ty.void_(), utils::Empty);
- Func(Source{{3, 1}}, "d", utils::Empty, ty.void_(),
- utils::Vector{
+ Func(Source{{1, 1}}, "a", tint::Empty, ty.void_(),
+ Vector{CallStmt(Call(Ident(Source{{1, 10}}, "b")))});
+ Func(Source{{2, 1}}, "e", tint::Empty, ty.void_(), tint::Empty);
+ Func(Source{{3, 1}}, "d", tint::Empty, ty.void_(),
+ Vector{
CallStmt(Call(Ident(Source{{3, 10}}, "e"))),
CallStmt(Call(Ident(Source{{3, 10}}, "b"))),
});
- Func(Source{{4, 1}}, "c", utils::Empty, ty.void_(),
- utils::Vector{CallStmt(Call(Ident(Source{{4, 10}}, "d")))});
- Func(Source{{5, 1}}, "b", utils::Empty, ty.void_(),
- utils::Vector{CallStmt(Call(Ident(Source{{5, 10}}, "c")))});
+ Func(Source{{4, 1}}, "c", tint::Empty, ty.void_(),
+ Vector{CallStmt(Call(Ident(Source{{4, 10}}, "d")))});
+ Func(Source{{5, 1}}, "b", tint::Empty, ty.void_(),
+ Vector{CallStmt(Call(Ident(Source{{5, 10}}, "c")))});
Build(R"(5:1 error: cyclic dependency found: 'b' -> 'c' -> 'd' -> 'b'
5:10 note: function 'b' references function 'c' here
@@ -892,7 +889,7 @@
// a: S;
// };
- Structure(Source{{12, 34}}, "S", utils::Vector{Member("a", ty(Source{{56, 78}}, "S"))});
+ Structure(Source{{12, 34}}, "S", Vector{Member("a", ty(Source{{56, 78}}, "S"))});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
@@ -905,9 +902,9 @@
// 2: struct X { y: Y; };
// 3: struct Z { x: X; };
- Structure(Source{{1, 1}}, "Y", utils::Vector{Member("z", ty(Source{{1, 10}}, "Z"))});
- Structure(Source{{2, 1}}, "X", utils::Vector{Member("y", ty(Source{{2, 10}}, "Y"))});
- Structure(Source{{3, 1}}, "Z", utils::Vector{Member("x", ty(Source{{3, 10}}, "X"))});
+ Structure(Source{{1, 1}}, "Y", Vector{Member("z", ty(Source{{1, 10}}, "Z"))});
+ Structure(Source{{2, 1}}, "X", Vector{Member("y", ty(Source{{2, 10}}, "Y"))});
+ Structure(Source{{3, 1}}, "Z", Vector{Member("x", ty(Source{{3, 10}}, "X"))});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
@@ -981,10 +978,10 @@
// 5: type R = A;
// 6: const L : S = Z;
- Func(Source{{1, 1}}, "F", utils::Empty, ty(Source{{1, 5}}, "R"),
- utils::Vector{Return(Expr(Source{{1, 10}}, "Z"))});
+ Func(Source{{1, 1}}, "F", tint::Empty, ty(Source{{1, 5}}, "R"),
+ Vector{Return(Expr(Source{{1, 10}}, "Z"))});
Alias(Source{{2, 1}}, "A", ty(Source{{2, 10}}, "S"));
- Structure(Source{{3, 1}}, "S", utils::Vector{Member("a", ty(Source{{3, 10}}, "A"))});
+ Structure(Source{{3, 1}}, "S", Vector{Member("a", ty(Source{{3, 10}}, "A"))});
GlobalVar(Source{{4, 1}}, "Z", Expr(Source{{4, 10}}, "L"));
Alias(Source{{5, 1}}, "R", ty(Source{{5, 10}}, "A"));
GlobalConst(Source{{6, 1}}, "L", ty(Source{{5, 5}}, "S"), Expr(Source{{5, 10}}, "Z"));
@@ -1185,7 +1182,7 @@
TEST_P(ResolverDependencyGraphResolveToBuiltinFunc, Resolve) {
const auto use = std::get<0>(GetParam());
const auto builtin = std::get<1>(GetParam());
- const auto symbol = Symbols().New(utils::ToString(builtin));
+ const auto symbol = Symbols().New(tint::ToString(builtin));
SymbolTestHelper helper(this);
auto* ident = helper.Add(use, symbol);
@@ -1544,7 +1541,7 @@
TEST_P(ResolverDependencyGraphShadowKindTest, ShadowedByGlobalVar) {
const auto use = std::get<0>(GetParam());
const std::string_view name = std::get<1>(GetParam());
- const auto symbol = Symbols().New(utils::ToString(name));
+ const auto symbol = Symbols().New(tint::ToString(name));
SymbolTestHelper helper(this);
auto* decl = GlobalVar(
@@ -1562,10 +1559,10 @@
TEST_P(ResolverDependencyGraphShadowKindTest, ShadowedByStruct) {
const auto use = std::get<0>(GetParam());
const std::string_view name = std::get<1>(GetParam());
- const auto symbol = Symbols().New(utils::ToString(name));
+ const auto symbol = Symbols().New(tint::ToString(name));
SymbolTestHelper helper(this);
- auto* decl = Structure(symbol, utils::Vector{
+ auto* decl = Structure(symbol, Vector{
Member("m", name == "i32" ? ty.u32() : ty.i32()),
});
auto* ident = helper.Add(use, symbol);
@@ -1579,7 +1576,7 @@
TEST_P(ResolverDependencyGraphShadowKindTest, ShadowedByFunc) {
const auto use = std::get<0>(GetParam());
const auto name = std::get<1>(GetParam());
- const auto symbol = Symbols().New(utils::ToString(name));
+ const auto symbol = Symbols().New(tint::ToString(name));
SymbolTestHelper helper(this);
auto* decl = helper.Add(SymbolDeclKind::Function, symbol);
@@ -1651,7 +1648,7 @@
const auto* value_decl = GlobalVar(value_sym, ty.i32(), builtin::AddressSpace::kPrivate);
const auto* type_decl = Alias(type_sym, ty.i32());
- const auto* func_decl = Func(func_sym, utils::Empty, ty.void_(), utils::Empty);
+ const auto* func_decl = Func(func_sym, tint::Empty, ty.void_(), tint::Empty);
struct SymbolUse {
const ast::Node* decl = nullptr;
@@ -1659,7 +1656,7 @@
std::string where;
};
- utils::Vector<SymbolUse, 64> symbol_uses;
+ Vector<SymbolUse, 64> symbol_uses;
auto add_use = [&](const ast::Node* decl, auto use, int line, const char* kind) {
symbol_uses.Push(
@@ -1674,17 +1671,17 @@
Alias(Sym(), T);
Structure(Sym(), //
- utils::Vector{Member(Sym(), T,
- utils::Vector{
- //
- MemberAlign(V), MemberSize(V) //
- })});
+ Vector{Member(Sym(), T,
+ Vector{
+ //
+ MemberAlign(V), MemberSize(V) //
+ })});
GlobalVar(Sym(), T, V);
GlobalConst(Sym(), T, V);
Func(Sym(),
- utils::Vector{
+ Vector{
Param(Sym(), T,
- utils::Vector{
+ Vector{
Location(V), // Parameter attributes
Builtin(V),
Interpolate(V),
@@ -1692,7 +1689,7 @@
}),
},
T, // Return type
- utils::Vector{
+ Vector{
Decl(Var(Sym(), T, V)), //
Decl(Let(Sym(), T, V)), //
CallStmt(Call(F, V)), //
@@ -1721,8 +1718,8 @@
Break(), //
Discard(), //
},
- utils::Empty, // function attributes
- utils::Vector{Location(V)}); // return attributes
+ tint::Empty, // function attributes
+ Vector{Location(V)}); // return attributes
// Exercise type traversal
GlobalVar(Sym(), ty.atomic(T));
GlobalVar(Sym(), ty.bool_());
@@ -1742,11 +1739,11 @@
builtin::TexelFormat::kR32Float, builtin::Access::kRead));
GlobalVar(Sym(), ty.sampler(type::SamplerKind::kSampler));
- GlobalVar(Sym(), ty.i32(), utils::Vector{Binding(V), Group(V)});
- GlobalVar(Sym(), ty.i32(), utils::Vector{Location(V)});
- Override(Sym(), ty.i32(), utils::Vector{Id(V)});
+ GlobalVar(Sym(), ty.i32(), Vector{Binding(V), Group(V)});
+ GlobalVar(Sym(), ty.i32(), Vector{Location(V)});
+ Override(Sym(), ty.i32(), Vector{Id(V)});
- Func(Sym(), utils::Empty, ty.void_(), utils::Empty);
+ Func(Sym(), tint::Empty, ty.void_(), tint::Empty);
#undef V
#undef T
#undef F
@@ -1772,10 +1769,10 @@
// DependencyAnalysis::SortGlobals(), found by clusterfuzz.
// See: crbug.com/chromium/1273451
TEST_F(ResolverDependencyGraphTraversalTest, chromium_1273451) {
- Structure("A", utils::Vector{Member("a", ty.i32())});
- Structure("B", utils::Vector{Member("b", ty.i32())});
- Func("f", utils::Vector{Param("a", ty("A"))}, ty("B"),
- utils::Vector{
+ Structure("A", Vector{Member("a", ty.i32())});
+ Structure("B", Vector{Member("b", ty.i32())});
+ Func("f", Vector{Param("a", ty("A"))}, ty("B"),
+ Vector{
Return(Call("B")),
});
Build();
diff --git a/src/tint/lang/wgsl/resolver/diagnostic_control_test.cc b/src/tint/lang/wgsl/resolver/diagnostic_control_test.cc
index ea717a1..e77bde1 100644
--- a/src/tint/lang/wgsl/resolver/diagnostic_control_test.cc
+++ b/src/tint/lang/wgsl/resolver/diagnostic_control_test.cc
@@ -24,7 +24,7 @@
using ResolverDiagnosticControlTest = ResolverTest;
TEST_F(ResolverDiagnosticControlTest, UnreachableCode_DefaultSeverity) {
- auto stmts = utils::Vector{Return(), Return()};
+ auto stmts = Vector{Return(), Return()};
Func("foo", {}, ty.void_(), stmts);
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -34,7 +34,7 @@
TEST_F(ResolverDiagnosticControlTest, UnreachableCode_ErrorViaDirective) {
DiagnosticDirective(builtin::DiagnosticSeverity::kError, "chromium", "unreachable_code");
- auto stmts = utils::Vector{Return(), Return()};
+ auto stmts = Vector{Return(), Return()};
Func("foo", {}, ty.void_(), stmts);
EXPECT_FALSE(r()->Resolve());
@@ -44,7 +44,7 @@
TEST_F(ResolverDiagnosticControlTest, UnreachableCode_WarningViaDirective) {
DiagnosticDirective(builtin::DiagnosticSeverity::kWarning, "chromium", "unreachable_code");
- auto stmts = utils::Vector{Return(), Return()};
+ auto stmts = Vector{Return(), Return()};
Func("foo", {}, ty.void_(), stmts);
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -54,7 +54,7 @@
TEST_F(ResolverDiagnosticControlTest, UnreachableCode_InfoViaDirective) {
DiagnosticDirective(builtin::DiagnosticSeverity::kInfo, "chromium", "unreachable_code");
- auto stmts = utils::Vector{Return(), Return()};
+ auto stmts = Vector{Return(), Return()};
Func("foo", {}, ty.void_(), stmts);
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -64,7 +64,7 @@
TEST_F(ResolverDiagnosticControlTest, UnreachableCode_OffViaDirective) {
DiagnosticDirective(builtin::DiagnosticSeverity::kOff, "chromium", "unreachable_code");
- auto stmts = utils::Vector{Return(), Return()};
+ auto stmts = Vector{Return(), Return()};
Func("foo", {}, ty.void_(), stmts);
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -75,8 +75,8 @@
auto* attr =
DiagnosticAttribute(builtin::DiagnosticSeverity::kError, "chromium", "unreachable_code");
- auto stmts = utils::Vector{Return(), Return()};
- Func("foo", {}, ty.void_(), stmts, utils::Vector{attr});
+ auto stmts = Vector{Return(), Return()};
+ Func("foo", {}, ty.void_(), stmts, Vector{attr});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), R"(error: code is unreachable)");
@@ -86,8 +86,8 @@
auto* attr =
DiagnosticAttribute(builtin::DiagnosticSeverity::kWarning, "chromium", "unreachable_code");
- auto stmts = utils::Vector{Return(), Return()};
- Func("foo", {}, ty.void_(), stmts, utils::Vector{attr});
+ auto stmts = Vector{Return(), Return()};
+ Func("foo", {}, ty.void_(), stmts, Vector{attr});
EXPECT_TRUE(r()->Resolve()) << r()->error();
EXPECT_EQ(r()->error(), R"(warning: code is unreachable)");
@@ -97,8 +97,8 @@
auto* attr =
DiagnosticAttribute(builtin::DiagnosticSeverity::kInfo, "chromium", "unreachable_code");
- auto stmts = utils::Vector{Return(), Return()};
- Func("foo", {}, ty.void_(), stmts, utils::Vector{attr});
+ auto stmts = Vector{Return(), Return()};
+ Func("foo", {}, ty.void_(), stmts, Vector{attr});
EXPECT_TRUE(r()->Resolve()) << r()->error();
EXPECT_EQ(r()->error(), R"(note: code is unreachable)");
@@ -108,8 +108,8 @@
auto* attr =
DiagnosticAttribute(builtin::DiagnosticSeverity::kOff, "chromium", "unreachable_code");
- auto stmts = utils::Vector{Return(), Return()};
- Func("foo", {}, ty.void_(), stmts, utils::Vector{attr});
+ auto stmts = Vector{Return(), Return()};
+ Func("foo", {}, ty.void_(), stmts, Vector{attr});
EXPECT_TRUE(r()->Resolve()) << r()->error();
EXPECT_TRUE(r()->error().empty());
@@ -126,8 +126,8 @@
auto* attr =
DiagnosticAttribute(builtin::DiagnosticSeverity::kWarning, "chromium", "unreachable_code");
- auto stmts = utils::Vector{Return(), Return()};
- Func("foo", {}, ty.void_(), stmts, utils::Vector{attr});
+ auto stmts = Vector{Return(), Return()};
+ Func("foo", {}, ty.void_(), stmts, Vector{attr});
EXPECT_TRUE(r()->Resolve()) << r()->error();
EXPECT_EQ(r()->error(), R"(warning: code is unreachable)");
@@ -152,15 +152,15 @@
auto* attr =
DiagnosticAttribute(builtin::DiagnosticSeverity::kOff, "chromium", "unreachable_code");
Func("foo", {}, ty.void_(),
- utils::Vector{
+ Vector{
Return(),
Return(Source{{12, 34}}),
},
- utils::Vector{attr});
+ Vector{attr});
}
{
Func("bar", {}, ty.void_(),
- utils::Vector{
+ Vector{
Return(),
Return(Source{{45, 67}}),
});
@@ -169,11 +169,11 @@
auto* attr =
DiagnosticAttribute(builtin::DiagnosticSeverity::kInfo, "chromium", "unreachable_code");
Func("zoo", {}, ty.void_(),
- utils::Vector{
+ Vector{
Return(),
Return(Source{{89, 10}}),
},
- utils::Vector{attr});
+ Vector{attr});
}
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -203,30 +203,29 @@
// }
auto attr = [&](auto severity) {
- return utils::Vector{DiagnosticAttribute(severity, "chromium", "unreachable_code")};
+ return Vector{DiagnosticAttribute(severity, "chromium", "unreachable_code")};
};
Func("foo", {}, ty.void_(),
- utils::Vector{
+ Vector{
Return(),
Return(Source{{12, 21}}),
- Block(utils::Vector{
+ Block(Vector{
Block(
- utils::Vector{
+ Vector{
If(Expr(true),
Block(
- utils::Vector{
+ Vector{
Return(),
Return(Source{{34, 43}}),
},
attr(builtin::DiagnosticSeverity::kInfo)),
- Else(Block(utils::Vector{
- While(
- Expr(true), Block(
- utils::Vector{
- Return(),
- Return(Source{{56, 65}}),
- },
- attr(builtin::DiagnosticSeverity::kOff))),
+ Else(Block(Vector{
+ While(Expr(true), Block(
+ Vector{
+ Return(),
+ Return(Source{{56, 65}}),
+ },
+ attr(builtin::DiagnosticSeverity::kOff))),
Return(),
Return(Source{{78, 87}}),
}))),
@@ -254,7 +253,7 @@
TEST_F(ResolverDiagnosticControlTest, UnrecognizedCoreRuleName_Attribute) {
auto* attr = DiagnosticAttribute(builtin::DiagnosticSeverity::kError,
DiagnosticRuleName(Source{{12, 34}}, "derivative_uniform"));
- Func("foo", {}, ty.void_(), {}, utils::Vector{attr});
+ Func("foo", {}, ty.void_(), {}, Vector{attr});
EXPECT_TRUE(r()->Resolve()) << r()->error();
EXPECT_EQ(r()->error(),
R"(12:34 warning: unrecognized diagnostic rule 'derivative_uniform'
@@ -276,7 +275,7 @@
auto* attr =
DiagnosticAttribute(builtin::DiagnosticSeverity::kError,
DiagnosticRuleName(Source{{12, 34}}, "chromium", "unreachable_cod"));
- Func("foo", {}, ty.void_(), {}, utils::Vector{attr});
+ Func("foo", {}, ty.void_(), {}, Vector{attr});
EXPECT_TRUE(r()->Resolve()) << r()->error();
EXPECT_EQ(r()->error(),
R"(12:34 warning: unrecognized diagnostic rule 'chromium.unreachable_cod'
@@ -295,7 +294,7 @@
auto* attr =
DiagnosticAttribute(builtin::DiagnosticSeverity::kError,
DiagnosticRuleName(Source{{12, 34}}, "unknown", "unreachable_cod"));
- Func("foo", {}, ty.void_(), {}, utils::Vector{attr});
+ Func("foo", {}, ty.void_(), {}, Vector{attr});
EXPECT_TRUE(r()->Resolve()) << r()->error();
EXPECT_EQ(r()->error(), "");
}
@@ -349,7 +348,7 @@
auto* attr2 =
DiagnosticAttribute(builtin::DiagnosticSeverity::kError,
DiagnosticRuleName(Source{{56, 78}}, "chromium", "unreachable_code"));
- Func("foo", {}, ty.void_(), {}, utils::Vector{attr1, attr2});
+ Func("foo", {}, ty.void_(), {}, Vector{attr1, attr2});
EXPECT_TRUE(r()->Resolve()) << r()->error();
}
@@ -360,7 +359,7 @@
auto* attr2 =
DiagnosticAttribute(builtin::DiagnosticSeverity::kOff,
DiagnosticRuleName(Source{{56, 78}}, "chromium", "unreachable_code"));
- Func("foo", {}, ty.void_(), {}, utils::Vector{attr1, attr2});
+ Func("foo", {}, ty.void_(), {}, Vector{attr1, attr2});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
R"(56:78 error: conflicting diagnostic attribute
@@ -374,7 +373,7 @@
auto* attr2 =
DiagnosticAttribute(builtin::DiagnosticSeverity::kOff,
DiagnosticRuleName(Source{{56, 78}}, "chromium", "unreachable_codes"));
- Func("foo", {}, ty.void_(), {}, utils::Vector{attr1, attr2});
+ Func("foo", {}, ty.void_(), {}, Vector{attr1, attr2});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
R"(12:34 warning: unrecognized diagnostic rule 'chromium.unreachable_codes'
@@ -392,7 +391,7 @@
DiagnosticAttribute(builtin::DiagnosticSeverity::kError, "chromium", "unreachable_codes");
auto* attr2 =
DiagnosticAttribute(builtin::DiagnosticSeverity::kOff, "chromium", "unreachable_codex");
- Func("foo", {}, ty.void_(), {}, utils::Vector{attr1, attr2});
+ Func("foo", {}, ty.void_(), {}, Vector{attr1, attr2});
EXPECT_TRUE(r()->Resolve()) << r()->error();
}
diff --git a/src/tint/lang/wgsl/resolver/dual_source_blending_extension_test.cc b/src/tint/lang/wgsl/resolver/dual_source_blending_extension_test.cc
index 4809ec2..05aec9f 100644
--- a/src/tint/lang/wgsl/resolver/dual_source_blending_extension_test.cc
+++ b/src/tint/lang/wgsl/resolver/dual_source_blending_extension_test.cc
@@ -26,10 +26,10 @@
// Using the @index attribute without chromium_internal_dual_source_blending enabled should fail.
TEST_F(DualSourceBlendingExtensionTest, UseIndexAttribWithoutExtensionError) {
- Structure("Output", utils::Vector{
- Member("a", ty.vec4<f32>(),
- utils::Vector{Location(0_a), Index(Source{{12, 34}}, 0_a)}),
- });
+ Structure("Output",
+ Vector{
+ Member("a", ty.vec4<f32>(), Vector{Location(0_a), Index(Source{{12, 34}}, 0_a)}),
+ });
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
@@ -46,9 +46,9 @@
// Using an F32 as an index value should fail.
TEST_F(DualSourceBlendingExtensionTests, IndexF32Error) {
- Structure("Output", utils::Vector{
+ Structure("Output", Vector{
Member(Source{{12, 34}}, "a", ty.vec4<f32>(),
- utils::Vector{Location(0_a), Index(Source{{12, 34}}, 0_f)}),
+ Vector{Location(0_a), Index(Source{{12, 34}}, 0_f)}),
});
EXPECT_FALSE(r()->Resolve());
@@ -57,9 +57,9 @@
// Using a floating point number as an index value should fail.
TEST_F(DualSourceBlendingExtensionTests, IndexFloatValueError) {
- Structure("Output", utils::Vector{
+ Structure("Output", Vector{
Member(Source{{12, 34}}, "a", ty.vec4<f32>(),
- utils::Vector{Location(0_a), Index(Source{{12, 34}}, 1.0_a)}),
+ Vector{Location(0_a), Index(Source{{12, 34}}, 1.0_a)}),
});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), "12:34 error: @location must be an i32 or u32 value");
@@ -67,9 +67,9 @@
// Using a number less than zero as an index value should fail.
TEST_F(DualSourceBlendingExtensionTests, IndexNegativeValue) {
- Structure("Output", utils::Vector{
+ Structure("Output", Vector{
Member(Source{{12, 34}}, "a", ty.vec4<f32>(),
- utils::Vector{Location(0_a), Index(Source{{12, 34}}, -1_a)}),
+ Vector{Location(0_a), Index(Source{{12, 34}}, -1_a)}),
});
EXPECT_FALSE(r()->Resolve());
@@ -78,9 +78,9 @@
// Using a number greater than one as an index value should fail.
TEST_F(DualSourceBlendingExtensionTests, IndexValueAboveOne) {
- Structure("Output", utils::Vector{
+ Structure("Output", Vector{
Member(Source{{12, 34}}, "a", ty.vec4<f32>(),
- utils::Vector{Location(0_a), Index(Source{{12, 34}}, 2_a)}),
+ Vector{Location(0_a), Index(Source{{12, 34}}, 2_a)}),
});
EXPECT_FALSE(r()->Resolve());
@@ -89,10 +89,10 @@
// Using an index value at the same location multiple times should fail.
TEST_F(DualSourceBlendingExtensionTests, DuplicateIndexes) {
- Structure("Output", utils::Vector{
- Member("a", ty.vec4<f32>(), utils::Vector{Location(0_a), Index(0_a)}),
+ Structure("Output", Vector{
+ Member("a", ty.vec4<f32>(), Vector{Location(0_a), Index(0_a)}),
Member(Source{{12, 34}}, "b", ty.vec4<f32>(),
- utils::Vector{Location(0_a), Index(Source{{12, 34}}, 0_a)}),
+ Vector{Location(0_a), Index(Source{{12, 34}}, 0_a)}),
});
EXPECT_FALSE(r()->Resolve());
@@ -101,9 +101,9 @@
// Using the index attribute without a location attribute should fail.
TEST_F(DualSourceBlendingExtensionTests, IndexWithMissingLocationAttribute) {
- Structure("Output", utils::Vector{
+ Structure("Output", Vector{
Member(Source{{12, 34}}, "a", ty.vec4<f32>(),
- utils::Vector{Index(Source{{12, 34}}, 1_a)}),
+ Vector{Index(Source{{12, 34}}, 1_a)}),
});
EXPECT_FALSE(r()->Resolve());
@@ -112,10 +112,10 @@
// Using an index attribute on a struct member should pass.
TEST_F(DualSourceBlendingExtensionTests, StructMemberIndexAttribute) {
- Structure("Output", utils::Vector{
- Member("a", ty.vec4<f32>(),
- utils::Vector{Location(0_a), Index(Source{{12, 34}}, 0_a)}),
- });
+ Structure("Output",
+ Vector{
+ Member("a", ty.vec4<f32>(), Vector{Location(0_a), Index(Source{{12, 34}}, 0_a)}),
+ });
EXPECT_TRUE(r()->Resolve()) << r()->error();
}
@@ -124,20 +124,20 @@
// @index with the canonicalize_entry_point transform. This test uses an internal attribute to
// ignore address space, which is how it is used with the canonicalize_entry_point transform.
TEST_F(DualSourceBlendingExtensionTests, GlobalVariableIndexAttribute) {
- GlobalVar("var", ty.vec4<f32>(),
- utils::Vector{Location(0_a), Index(0_a),
- Disable(ast::DisabledValidation::kIgnoreAddressSpace)},
- builtin::AddressSpace::kOut);
+ GlobalVar(
+ "var", ty.vec4<f32>(),
+ Vector{Location(0_a), Index(0_a), Disable(ast::DisabledValidation::kIgnoreAddressSpace)},
+ builtin::AddressSpace::kOut);
EXPECT_TRUE(r()->Resolve()) << r()->error();
}
// Using the index attribute with a non-zero location should fail.
TEST_F(DualSourceBlendingExtensionTests, IndexWithNonZeroLocation) {
- Structure("Output", utils::Vector{
- Member("a", ty.vec4<f32>(),
- utils::Vector{Location(1_a), Index(Source{{12, 34}}, 0_a)}),
- });
+ Structure("Output",
+ Vector{
+ Member("a", ty.vec4<f32>(), Vector{Location(1_a), Index(Source{{12, 34}}, 0_a)}),
+ });
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), "12:34 error: index attribute must only be used with @location(0)");
diff --git a/src/tint/lang/wgsl/resolver/entry_point_validation_test.cc b/src/tint/lang/wgsl/resolver/entry_point_validation_test.cc
index 00d4b29..575572a 100644
--- a/src/tint/lang/wgsl/resolver/entry_point_validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/entry_point_validation_test.cc
@@ -39,14 +39,14 @@
TEST_F(ResolverEntryPointValidationTest, ReturnTypeAttribute_Location) {
// @fragment
// fn main() -> @location(0) f32 { return 1.0; }
- Func(Source{{12, 34}}, "main", utils::Empty, ty.f32(),
- utils::Vector{
+ Func(Source{{12, 34}}, "main", tint::Empty, ty.f32(),
+ Vector{
Return(1_f),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(0_a),
});
@@ -56,14 +56,14 @@
TEST_F(ResolverEntryPointValidationTest, ReturnTypeAttribute_Builtin) {
// @vertex
// fn main() -> @builtin(position) vec4<f32> { return vec4<f32>(); }
- Func(Source{{12, 34}}, "main", utils::Empty, ty.vec4<f32>(),
- utils::Vector{
+ Func(Source{{12, 34}}, "main", tint::Empty, ty.vec4<f32>(),
+ Vector{
Return(Call<vec4<f32>>()),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kVertex),
},
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kPosition),
});
@@ -75,11 +75,11 @@
// fn main() -> f32 {
// return 1.0;
// }
- Func(Source{{12, 34}}, "main", utils::Empty, ty.vec4<f32>(),
- utils::Vector{
+ Func(Source{{12, 34}}, "main", tint::Empty, ty.vec4<f32>(),
+ Vector{
Return(Call<vec4<f32>>()),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kVertex),
});
@@ -92,14 +92,14 @@
// fn main() -> @location(0) @builtin(position) vec4<f32> {
// return vec4<f32>();
// }
- Func(Source{{12, 34}}, "main", utils::Empty, ty.vec4<f32>(),
- utils::Vector{
+ Func(Source{{12, 34}}, "main", tint::Empty, ty.vec4<f32>(),
+ Vector{
Return(Call<vec4<f32>>()),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kVertex),
},
- utils::Vector{
+ Vector{
Location(Source{{13, 43}}, 0_a),
Builtin(Source{{14, 52}}, builtin::BuiltinValue::kPosition),
});
@@ -119,16 +119,15 @@
// return Output();
// }
auto* output = Structure(
- "Output",
- utils::Vector{
- Member("a", ty.f32(), utils::Vector{Location(0_a)}),
- Member("b", ty.f32(), utils::Vector{Builtin(builtin::BuiltinValue::kFragDepth)}),
- });
- Func(Source{{12, 34}}, "main", utils::Empty, ty.Of(output),
- utils::Vector{
+ "Output", Vector{
+ Member("a", ty.f32(), Vector{Location(0_a)}),
+ Member("b", ty.f32(), Vector{Builtin(builtin::BuiltinValue::kFragDepth)}),
+ });
+ Func(Source{{12, 34}}, "main", tint::Empty, ty.Of(output),
+ Vector{
Return(Call(ty.Of(output))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -144,17 +143,16 @@
// return Output();
// }
auto* output = Structure(
- "Output",
- utils::Vector{
- Member("a", ty.f32(),
- utils::Vector{Location(Source{{13, 43}}, 0_a),
- Builtin(Source{{14, 52}}, builtin::BuiltinValue::kFragDepth)}),
- });
- Func(Source{{12, 34}}, "main", utils::Empty, ty.Of(output),
- utils::Vector{
+ "Output", Vector{
+ Member("a", ty.f32(),
+ Vector{Location(Source{{13, 43}}, 0_a),
+ Builtin(Source{{14, 52}}, builtin::BuiltinValue::kFragDepth)}),
+ });
+ Func(Source{{12, 34}}, "main", tint::Empty, ty.Of(output),
+ Vector{
Return(Call(ty.Of(output))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -173,16 +171,16 @@
// fn main() -> Output {
// return Output();
// }
- auto* output = Structure(
- "Output", utils::Vector{
- Member(Source{{13, 43}}, "a", ty.f32(), utils::Vector{Location(0_a)}),
- Member(Source{{14, 52}}, "b", ty.f32(), {}),
- });
- Func(Source{{12, 34}}, "main", utils::Empty, ty.Of(output),
- utils::Vector{
+ auto* output =
+ Structure("Output", Vector{
+ Member(Source{{13, 43}}, "a", ty.f32(), Vector{Location(0_a)}),
+ Member(Source{{14, 52}}, "b", ty.f32(), {}),
+ });
+ Func(Source{{12, 34}}, "main", tint::Empty, ty.Of(output),
+ Vector{
Return(Call(ty.Of(output))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -202,16 +200,15 @@
// return Output();
// }
auto* output = Structure(
- "Output",
- utils::Vector{
- Member("a", ty.f32(), utils::Vector{Builtin(builtin::BuiltinValue::kFragDepth)}),
- Member("b", ty.f32(), utils::Vector{Builtin(builtin::BuiltinValue::kFragDepth)}),
- });
- Func(Source{{12, 34}}, "main", utils::Empty, ty.Of(output),
- utils::Vector{
+ "Output", Vector{
+ Member("a", ty.f32(), Vector{Builtin(builtin::BuiltinValue::kFragDepth)}),
+ Member("b", ty.f32(), Vector{Builtin(builtin::BuiltinValue::kFragDepth)}),
+ });
+ Func(Source{{12, 34}}, "main", tint::Empty, ty.Of(output),
+ Vector{
Return(Call(ty.Of(output))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -225,15 +222,15 @@
// @fragment
// fn main(@location(0) param : f32) {}
auto* param = Param("param", ty.f32(),
- utils::Vector{
+ Vector{
Location(0_a),
});
Func(Source{{12, 34}}, "main",
- utils::Vector{
+ Vector{
param,
},
- ty.void_(), utils::Empty,
- utils::Vector{
+ ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -245,11 +242,11 @@
// fn main(param : f32) {}
auto* param = Param(Source{{13, 43}}, "param", ty.vec4<f32>());
Func(Source{{12, 34}}, "main",
- utils::Vector{
+ Vector{
param,
},
- ty.void_(), utils::Empty,
- utils::Vector{
+ ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -261,16 +258,16 @@
// @fragment
// fn main(@location(0) @builtin(sample_index) param : u32) {}
auto* param = Param("param", ty.u32(),
- utils::Vector{
+ Vector{
Location(Source{{13, 43}}, 0_a),
Builtin(Source{{14, 52}}, builtin::BuiltinValue::kSampleIndex),
});
Func(Source{{12, 34}}, "main",
- utils::Vector{
+ Vector{
param,
},
- ty.void_(), utils::Empty,
- utils::Vector{
+ ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -287,18 +284,17 @@
// @fragment
// fn main(param : Input) {}
auto* input = Structure(
- "Input",
- utils::Vector{
- Member("a", ty.f32(), utils::Vector{Location(0_a)}),
- Member("b", ty.u32(), utils::Vector{Builtin(builtin::BuiltinValue::kSampleIndex)}),
- });
+ "Input", Vector{
+ Member("a", ty.f32(), Vector{Location(0_a)}),
+ Member("b", ty.u32(), Vector{Builtin(builtin::BuiltinValue::kSampleIndex)}),
+ });
auto* param = Param("param", ty.Of(input));
Func(Source{{12, 34}}, "main",
- utils::Vector{
+ Vector{
param,
},
- ty.void_(), utils::Empty,
- utils::Vector{
+ ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -312,19 +308,18 @@
// @fragment
// fn main(param : Input) {}
auto* input = Structure(
- "Input",
- utils::Vector{
- Member("a", ty.u32(),
- utils::Vector{Location(Source{{13, 43}}, 0_a),
- Builtin(Source{{14, 52}}, builtin::BuiltinValue::kSampleIndex)}),
- });
+ "Input", Vector{
+ Member("a", ty.u32(),
+ Vector{Location(Source{{13, 43}}, 0_a),
+ Builtin(Source{{14, 52}}, builtin::BuiltinValue::kSampleIndex)}),
+ });
auto* param = Param("param", ty.Of(input));
Func(Source{{12, 34}}, "main",
- utils::Vector{
+ Vector{
param,
},
- ty.void_(), utils::Empty,
- utils::Vector{
+ ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -341,18 +336,18 @@
// };
// @fragment
// fn main(param : Input) {}
- auto* input = Structure(
- "Input", utils::Vector{
- Member(Source{{13, 43}}, "a", ty.f32(), utils::Vector{Location(0_a)}),
- Member(Source{{14, 52}}, "b", ty.f32(), {}),
- });
+ auto* input =
+ Structure("Input", Vector{
+ Member(Source{{13, 43}}, "a", ty.f32(), Vector{Location(0_a)}),
+ Member(Source{{14, 52}}, "b", ty.f32(), {}),
+ });
auto* param = Param("param", ty.Of(input));
Func(Source{{12, 34}}, "main",
- utils::Vector{
+ Vector{
param,
},
- ty.void_(), utils::Empty,
- utils::Vector{
+ ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -366,20 +361,20 @@
// fn main(@builtin(sample_index) param_a : u32,
// @builtin(sample_index) param_b : u32) {}
auto* param_a = Param("param_a", ty.u32(),
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kSampleIndex),
});
auto* param_b = Param("param_b", ty.u32(),
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kSampleIndex),
});
Func(Source{{12, 34}}, "main",
- utils::Vector{
+ Vector{
param_a,
param_b,
},
- ty.void_(), utils::Empty,
- utils::Vector{
+ ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -398,24 +393,22 @@
// @fragment
// fn main(param_a : InputA, param_b : InputB) {}
auto* input_a = Structure(
- "InputA",
- utils::Vector{
- Member("a", ty.u32(), utils::Vector{Builtin(builtin::BuiltinValue::kSampleIndex)}),
- });
+ "InputA", Vector{
+ Member("a", ty.u32(), Vector{Builtin(builtin::BuiltinValue::kSampleIndex)}),
+ });
auto* input_b = Structure(
- "InputB",
- utils::Vector{
- Member("a", ty.u32(), utils::Vector{Builtin(builtin::BuiltinValue::kSampleIndex)}),
- });
+ "InputB", Vector{
+ Member("a", ty.u32(), Vector{Builtin(builtin::BuiltinValue::kSampleIndex)}),
+ });
auto* param_a = Param("param_a", ty.Of(input_a));
auto* param_b = Param("param_b", ty.Of(input_b));
Func(Source{{12, 34}}, "main",
- utils::Vector{
+ Vector{
param_a,
param_b,
},
- ty.void_(), utils::Empty,
- utils::Vector{
+ ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -428,8 +421,8 @@
TEST_F(ResolverEntryPointValidationTest, VertexShaderMustReturnPosition) {
// @vertex
// fn main() {}
- Func(Source{{12, 34}}, "main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func(Source{{12, 34}}, "main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kVertex),
});
@@ -461,7 +454,7 @@
TEST_F(ResolverEntryPointValidationTest, PushConstantAllowedWithIgnoreAddressSpaceAttribute) {
// var<push_constant> a : u32; // With ast::DisabledValidation::kIgnoreAddressSpace
GlobalVar("a", ty.u32(), builtin::AddressSpace::kPushConstant,
- utils::Vector{Disable(ast::DisabledValidation::kIgnoreAddressSpace)});
+ Vector{Disable(ast::DisabledValidation::kIgnoreAddressSpace)});
EXPECT_TRUE(r()->Resolve());
}
@@ -475,9 +468,8 @@
Enable(builtin::Extension::kChromiumExperimentalPushConstant);
GlobalVar("a", ty.u32(), builtin::AddressSpace::kPushConstant);
- Func("main", {}, ty.void_(), utils::Vector{Assign(Phony(), "a")},
- utils::Vector{Stage(ast::PipelineStage::kCompute),
- create<ast::WorkgroupAttribute>(Expr(1_i))});
+ Func("main", {}, ty.void_(), Vector{Assign(Phony(), "a")},
+ Vector{Stage(ast::PipelineStage::kCompute), create<ast::WorkgroupAttribute>(Expr(1_i))});
EXPECT_TRUE(r()->Resolve());
}
@@ -494,10 +486,8 @@
GlobalVar(Source{{1, 2}}, "a", ty.u32(), builtin::AddressSpace::kPushConstant);
GlobalVar(Source{{3, 4}}, "b", ty.u32(), builtin::AddressSpace::kPushConstant);
- Func(Source{{5, 6}}, "main", {}, ty.void_(),
- utils::Vector{Assign(Phony(), "a"), Assign(Phony(), "b")},
- utils::Vector{Stage(ast::PipelineStage::kCompute),
- create<ast::WorkgroupAttribute>(Expr(1_i))});
+ Func(Source{{5, 6}}, "main", {}, ty.void_(), Vector{Assign(Phony(), "a"), Assign(Phony(), "b")},
+ Vector{Stage(ast::PipelineStage::kCompute), create<ast::WorkgroupAttribute>(Expr(1_i))});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
@@ -525,13 +515,12 @@
GlobalVar(Source{{1, 2}}, "a", ty.u32(), builtin::AddressSpace::kPushConstant);
GlobalVar(Source{{3, 4}}, "b", ty.u32(), builtin::AddressSpace::kPushConstant);
- Func(Source{{5, 6}}, "uses_a", {}, ty.void_(), utils::Vector{Assign(Phony(), "a")});
- Func(Source{{7, 8}}, "uses_b", {}, ty.void_(), utils::Vector{Assign(Phony(), "b")});
+ Func(Source{{5, 6}}, "uses_a", {}, ty.void_(), Vector{Assign(Phony(), "a")});
+ Func(Source{{7, 8}}, "uses_b", {}, ty.void_(), Vector{Assign(Phony(), "b")});
Func(Source{{9, 10}}, "main", {}, ty.void_(),
- utils::Vector{CallStmt(Call("uses_a")), CallStmt(Call("uses_b"))},
- utils::Vector{Stage(ast::PipelineStage::kCompute),
- create<ast::WorkgroupAttribute>(Expr(1_i))});
+ Vector{CallStmt(Call("uses_a")), CallStmt(Call("uses_b"))},
+ Vector{Stage(ast::PipelineStage::kCompute), create<ast::WorkgroupAttribute>(Expr(1_i))});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
@@ -558,12 +547,10 @@
GlobalVar("a", ty.u32(), builtin::AddressSpace::kPushConstant);
GlobalVar("b", ty.u32(), builtin::AddressSpace::kPushConstant);
- Func("uses_a", {}, ty.void_(), utils::Vector{Assign(Phony(), "a")},
- utils::Vector{Stage(ast::PipelineStage::kCompute),
- create<ast::WorkgroupAttribute>(Expr(1_i))});
- Func("uses_b", {}, ty.void_(), utils::Vector{Assign(Phony(), "b")},
- utils::Vector{Stage(ast::PipelineStage::kCompute),
- create<ast::WorkgroupAttribute>(Expr(1_i))});
+ Func("uses_a", {}, ty.void_(), Vector{Assign(Phony(), "a")},
+ Vector{Stage(ast::PipelineStage::kCompute), create<ast::WorkgroupAttribute>(Expr(1_i))});
+ Func("uses_b", {}, ty.void_(), Vector{Assign(Phony(), "b")},
+ Vector{Stage(ast::PipelineStage::kCompute), create<ast::WorkgroupAttribute>(Expr(1_i))});
EXPECT_TRUE(r()->Resolve());
}
@@ -614,16 +601,16 @@
Enable(builtin::Extension::kF16);
auto* a = Param("a", params.create_ast_type(*this),
- utils::Vector{
+ Vector{
Location(0_a),
Flat(),
});
Func(Source{{12, 34}}, "main",
- utils::Vector{
+ Vector{
a,
},
- ty.void_(), utils::Empty,
- utils::Vector{
+ ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -644,17 +631,17 @@
Enable(builtin::Extension::kF16);
- auto* input = Structure("Input", utils::Vector{
- Member("a", params.create_ast_type(*this),
- utils::Vector{Location(0_a), Flat()}),
- });
+ auto* input = Structure(
+ "Input", Vector{
+ Member("a", params.create_ast_type(*this), Vector{Location(0_a), Flat()}),
+ });
auto* a = Param("a", ty.Of(input), {});
Func(Source{{12, 34}}, "main",
- utils::Vector{
+ Vector{
a,
},
- ty.void_(), utils::Empty,
- utils::Vector{
+ ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -674,14 +661,14 @@
Enable(builtin::Extension::kF16);
- Func(Source{{12, 34}}, "main", utils::Empty, params.create_ast_type(*this),
- utils::Vector{
+ Func(Source{{12, 34}}, "main", tint::Empty, params.create_ast_type(*this),
+ Vector{
Return(Call(params.create_ast_type(*this))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(0_a),
});
@@ -704,15 +691,15 @@
Enable(builtin::Extension::kF16);
- auto* output = Structure(
- "Output", utils::Vector{
- Member("a", params.create_ast_type(*this), utils::Vector{Location(0_a)}),
- });
- Func(Source{{12, 34}}, "main", utils::Empty, ty.Of(output),
- utils::Vector{
+ auto* output =
+ Structure("Output", Vector{
+ Member("a", params.create_ast_type(*this), Vector{Location(0_a)}),
+ });
+ Func(Source{{12, 34}}, "main", tint::Empty, ty.Of(output),
+ Vector{
Return(Call(ty.Of(output))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -737,16 +724,16 @@
// fn frag_main(@location(0) @interpolate(flat) a: i32) {}
auto* p = Param(Source{{12, 34}}, "a", ty.i32(),
- utils::Vector{
+ Vector{
Location(0_a),
Flat(),
});
Func("frag_main",
- utils::Vector{
+ Vector{
p,
},
- ty.void_(), utils::Empty,
- utils::Vector{
+ ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -758,15 +745,15 @@
// fn frag_main(@location(0) a: bool) {}
auto* p = Param(Source{{12, 34}}, "a", ty.bool_(),
- utils::Vector{
+ Vector{
Location(Source{{34, 56}}, 0_a),
});
Func("frag_main",
- utils::Vector{
+ Vector{
p,
},
- ty.void_(), utils::Empty,
- utils::Vector{
+ ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -780,14 +767,14 @@
// @fragment
// fn frag_main()->@location(0) array<f32, 2> { return array<f32, 2>(); }
- Func(Source{{12, 34}}, "frag_main", utils::Empty, ty.array<f32, 2>(),
- utils::Vector{
+ Func(Source{{12, 34}}, "frag_main", tint::Empty, ty.array<f32, 2>(),
+ Vector{
Return(Call<array<f32, 2>>()),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(Source{{34, 56}}, 0_a),
});
@@ -803,19 +790,19 @@
// };
// @fragment
// fn main(@location(0) param : Input) {}
- auto* input = Structure("Input", utils::Vector{
+ auto* input = Structure("Input", Vector{
Member("a", ty.f32()),
});
auto* param = Param(Source{{12, 34}}, "param", ty.Of(input),
- utils::Vector{
+ Vector{
Location(Source{{13, 43}}, 0_a),
});
Func(Source{{12, 34}}, "main",
- utils::Vector{
+ Vector{
param,
},
- ty.void_(), utils::Empty,
- utils::Vector{
+ ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -834,20 +821,20 @@
// };
// @fragment
// fn main(param : Input) {}
- auto* inner = Structure(
- "Inner", utils::Vector{
- Member(Source{{13, 43}}, "a", ty.f32(), utils::Vector{Location(0_a)}),
- });
- auto* input = Structure("Input", utils::Vector{
+ auto* inner =
+ Structure("Inner", Vector{
+ Member(Source{{13, 43}}, "a", ty.f32(), Vector{Location(0_a)}),
+ });
+ auto* input = Structure("Input", Vector{
Member(Source{{14, 52}}, "a", ty.Of(inner)),
});
auto* param = Param("param", ty.Of(input));
Func(Source{{12, 34}}, "main",
- utils::Vector{
+ Vector{
param,
},
- ty.void_(), utils::Empty,
- utils::Vector{
+ ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -864,16 +851,16 @@
// @fragment
// fn main(param : Input) {}
auto* input = Structure(
- "Input", utils::Vector{
- Member(Source{{13, 43}}, "a", ty.array<f32>(), utils::Vector{Location(0_a)}),
+ "Input", Vector{
+ Member(Source{{13, 43}}, "a", ty.array<f32>(), Vector{Location(0_a)}),
});
auto* param = Param("param", ty.Of(input));
Func(Source{{12, 34}}, "main",
- utils::Vector{
+ Vector{
param,
},
- ty.void_(), utils::Empty,
- utils::Vector{
+ ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -889,18 +876,18 @@
// fn frag_main( a: S) {}
auto* m = Member(Source{{34, 56}}, "m", ty.array<i32>(),
- utils::Vector{
+ Vector{
Location(Source{{12, 34}}, 0_u),
});
- auto* s = Structure("S", utils::Vector{m});
+ auto* s = Structure("S", Vector{m});
auto* p = Param("a", ty.Of(s));
Func("frag_main",
- utils::Vector{
+ Vector{
p,
},
- ty.void_(), utils::Empty,
- utils::Vector{
+ ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -915,16 +902,16 @@
// @fragment
// fn frag_main() -> S {}
auto* m = Member(Source{{34, 56}}, "m", ty.atomic<i32>(),
- utils::Vector{
+ Vector{
Location(Source{{12, 34}}, 0_u),
});
- auto* s = Structure("S", utils::Vector{m});
+ auto* s = Structure("S", Vector{m});
- Func("frag_main", utils::Empty, ty.Of(s),
- utils::Vector{
+ Func("frag_main", tint::Empty, ty.Of(s),
+ Vector{
Return(Call(ty.Of(s))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
{});
@@ -939,10 +926,10 @@
// struct S { @location(0) m: mat3x2<f32>; };
auto* m = Member(Source{{34, 56}}, "m", ty.mat3x2<f32>(),
- utils::Vector{
+ Vector{
Location(Source{{12, 34}}, 0_u),
});
- Structure("S", utils::Vector{m});
+ Structure("S", Vector{m});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
@@ -960,16 +947,15 @@
// return Output();
// }
auto* output = Structure(
- "Output",
- utils::Vector{
- Member("a", ty.f32(), utils::Vector{Location(0_a)}),
- Member("b", ty.f32(), utils::Vector{Builtin(builtin::BuiltinValue::kFragDepth)}),
- });
- Func(Source{{12, 34}}, "main", utils::Empty, ty.Of(output),
- utils::Vector{
+ "Output", Vector{
+ Member("a", ty.f32(), Vector{Location(0_a)}),
+ Member("b", ty.f32(), Vector{Builtin(builtin::BuiltinValue::kFragDepth)}),
+ });
+ Func(Source{{12, 34}}, "main", tint::Empty, ty.Of(output),
+ Vector{
Return(Call(ty.Of(output))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -984,17 +970,17 @@
// fn main() -> @location(0) Output {
// return Output();
// }
- auto* output = Structure("Output", utils::Vector{
+ auto* output = Structure("Output", Vector{
Member("a", ty.f32()),
});
- Func(Source{{12, 34}}, "main", utils::Empty, ty.Of(output),
- utils::Vector{
+ Func(Source{{12, 34}}, "main", tint::Empty, ty.Of(output),
+ Vector{
Return(Call(ty.Of(output))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kVertex),
},
- utils::Vector{
+ Vector{
Location(Source{{13, 43}}, 0_a),
});
@@ -1012,18 +998,18 @@
// };
// @fragment
// fn main() -> Output { return Output(); }
- auto* inner = Structure(
- "Inner", utils::Vector{
- Member(Source{{13, 43}}, "a", ty.f32(), utils::Vector{Location(0_a)}),
- });
- auto* output = Structure("Output", utils::Vector{
+ auto* inner =
+ Structure("Inner", Vector{
+ Member(Source{{13, 43}}, "a", ty.f32(), Vector{Location(0_a)}),
+ });
+ auto* output = Structure("Output", Vector{
Member(Source{{14, 52}}, "a", ty.Of(inner)),
});
- Func(Source{{12, 34}}, "main", utils::Empty, ty.Of(output),
- utils::Vector{
+ Func(Source{{12, 34}}, "main", tint::Empty, ty.Of(output),
+ Vector{
Return(Call(ty.Of(output))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1041,15 +1027,15 @@
// fn main() -> Output {
// return Output();
// }
- auto* output = Structure("Output", utils::Vector{
+ auto* output = Structure("Output", Vector{
Member(Source{{13, 43}}, "a", ty.array<f32>(),
- utils::Vector{Location(Source{{12, 34}}, 0_a)}),
+ Vector{Location(Source{{12, 34}}, 0_a)}),
});
- Func(Source{{12, 34}}, "main", utils::Empty, ty.Of(output),
- utils::Vector{
+ Func(Source{{12, 34}}, "main", tint::Empty, ty.Of(output),
+ Vector{
Return(Call(ty.Of(output))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1060,15 +1046,15 @@
}
TEST_F(LocationAttributeTests, ComputeShaderLocation_Input) {
- Func("main", utils::Empty, ty.i32(),
- utils::Vector{
+ Func("main", tint::Empty, ty.i32(),
+ Vector{
Return(Expr(1_i)),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
create<ast::WorkgroupAttribute>(Source{{12, 34}}, Expr(1_i)),
},
- utils::Vector{
+ Vector{
Location(Source{{12, 34}}, 1_a),
});
@@ -1078,11 +1064,11 @@
TEST_F(LocationAttributeTests, ComputeShaderLocation_Output) {
auto* input = Param("input", ty.i32(),
- utils::Vector{
+ Vector{
Location(Source{{12, 34}}, 0_u),
});
- Func("main", utils::Vector{input}, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", Vector{input}, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
create<ast::WorkgroupAttribute>(Source{{12, 34}}, Expr(1_i)),
});
@@ -1093,15 +1079,15 @@
TEST_F(LocationAttributeTests, ComputeShaderLocationStructMember_Output) {
auto* m = Member("m", ty.i32(),
- utils::Vector{
+ Vector{
Location(Source{{12, 34}}, 0_u),
});
- auto* s = Structure("S", utils::Vector{m});
- Func(Source{{56, 78}}, "main", utils::Empty, ty.Of(s),
- utils::Vector{
+ auto* s = Structure("S", Vector{m});
+ Func(Source{{56, 78}}, "main", tint::Empty, ty.Of(s),
+ Vector{
Return(Expr(Call(ty.Of(s)))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
create<ast::WorkgroupAttribute>(Source{{12, 34}}, Expr(1_i)),
});
@@ -1114,13 +1100,13 @@
TEST_F(LocationAttributeTests, ComputeShaderLocationStructMember_Input) {
auto* m = Member("m", ty.i32(),
- utils::Vector{
+ Vector{
Location(Source{{12, 34}}, 0_u),
});
- auto* s = Structure("S", utils::Vector{m});
+ auto* s = Structure("S", Vector{m});
auto* input = Param("input", ty.Of(s));
- Func(Source{{56, 78}}, "main", utils::Vector{input}, ty.void_(), utils::Empty,
- utils::Vector{
+ Func(Source{{56, 78}}, "main", Vector{input}, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
create<ast::WorkgroupAttribute>(Source{{12, 34}}, Expr(1_i)),
});
@@ -1136,20 +1122,20 @@
// fn main(@location(1) param_a : f32,
// @location(1) param_b : f32) {}
auto* param_a = Param("param_a", ty.f32(),
- utils::Vector{
+ Vector{
Location(1_a),
});
auto* param_b = Param("param_b", ty.f32(),
- utils::Vector{
+ Vector{
Location(Source{{12, 34}}, 1_a),
});
Func(Source{{12, 34}}, "main",
- utils::Vector{
+ Vector{
param_a,
param_b,
},
- ty.void_(), utils::Empty,
- utils::Vector{
+ ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -1166,22 +1152,22 @@
// };
// @fragment
// fn main(param_a : InputA, param_b : InputB) {}
- auto* input_a = Structure("InputA", utils::Vector{
- Member("a", ty.f32(), utils::Vector{Location(1_a)}),
+ auto* input_a = Structure("InputA", Vector{
+ Member("a", ty.f32(), Vector{Location(1_a)}),
});
- auto* input_b = Structure(
- "InputB", utils::Vector{
- Member("a", ty.f32(), utils::Vector{Location(Source{{34, 56}}, 1_a)}),
- });
+ auto* input_b =
+ Structure("InputB", Vector{
+ Member("a", ty.f32(), Vector{Location(Source{{34, 56}}, 1_a)}),
+ });
auto* param_a = Param("param_a", ty.Of(input_a));
auto* param_b = Param("param_b", ty.Of(input_b));
Func(Source{{12, 34}}, "main",
- utils::Vector{
+ Vector{
param_a,
param_b,
},
- ty.void_(), utils::Empty,
- utils::Vector{
+ ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
diff --git a/src/tint/lang/wgsl/resolver/evaluation_stage_test.cc b/src/tint/lang/wgsl/resolver/evaluation_stage_test.cc
index dfd4feb..e83eb7b 100644
--- a/src/tint/lang/wgsl/resolver/evaluation_stage_test.cc
+++ b/src/tint/lang/wgsl/resolver/evaluation_stage_test.cc
@@ -270,7 +270,7 @@
// struct S { m : i32 };
// const str = S();
// str.m
- Structure("S", utils::Vector{Member("m", ty.i32())});
+ Structure("S", Vector{Member("m", ty.i32())});
auto* str = Const("str", Call("S"));
auto* expr = MemberAccessor(str, "m");
WrapInFunction(str, expr);
@@ -284,7 +284,7 @@
// struct S { m : i32 };
// var str = S();
// str.m
- Structure("S", utils::Vector{Member("m", ty.i32())});
+ Structure("S", Vector{Member("m", ty.i32())});
auto* str = Var("str", Call("S"));
auto* expr = MemberAccessor(str, "m");
WrapInFunction(str, expr);
diff --git a/src/tint/lang/wgsl/resolver/expression_kind_test.cc b/src/tint/lang/wgsl/resolver/expression_kind_test.cc
index a402d6a..68a258e 100644
--- a/src/tint/lang/wgsl/resolver/expression_kind_test.cc
+++ b/src/tint/lang/wgsl/resolver/expression_kind_test.cc
@@ -142,9 +142,9 @@
Symbol sym;
std::function<void(const sem::Expression*)> check_expr;
- utils::Vector<const ast::Parameter*, 2> fn_params;
- utils::Vector<const ast::Statement*, 2> fn_stmts;
- utils::Vector<const ast::Attribute*, 2> fn_attrs;
+ Vector<const ast::Parameter*, 2> fn_params;
+ Vector<const ast::Statement*, 2> fn_stmts;
+ Vector<const ast::Attribute*, 2> fn_attrs;
switch (GetParam().def) {
case Def::kAccess: {
@@ -194,7 +194,7 @@
}
case Def::kFunction: {
sym = Sym("FUNCTION");
- auto* fn = Func(kDefSource, sym, utils::Empty, ty.i32(), Return(1_i));
+ auto* fn = Func(kDefSource, sym, tint::Empty, ty.i32(), Return(1_i));
check_expr = [fn](const sem::Expression* expr) {
ASSERT_NE(expr, nullptr);
auto* fn_expr = expr->As<sem::FunctionExpression>();
@@ -239,7 +239,7 @@
}
case Def::kStruct: {
sym = Sym("STRUCT");
- auto* s = Structure(kDefSource, sym, utils::Vector{Member("m", ty.i32())});
+ auto* s = Structure(kDefSource, sym, Vector{Member("m", ty.i32())});
check_expr = [s](const sem::Expression* expr) {
ASSERT_NE(expr, nullptr);
auto* ty_expr = expr->As<sem::TypeExpression>();
@@ -291,8 +291,8 @@
break;
case Use::kAddressSpace:
Enable(builtin::Extension::kChromiumExperimentalFullPtrParameters);
- Func(Symbols().New(), utils::Vector{Param("p", ty("ptr", expr, ty.f32()))}, ty.void_(),
- utils::Empty);
+ Func(Symbols().New(), Vector{Param("p", ty("ptr", expr, ty.f32()))}, ty.void_(),
+ tint::Empty);
break;
case Use::kCallExpr:
fn_stmts.Push(Decl(Var("v", Call(expr))));
@@ -304,16 +304,15 @@
fn_stmts.Push(Decl(Var("v", Mul(1_a, expr))));
break;
case Use::kBuiltinValue:
- Func(Symbols().New(),
- utils::Vector{Param("p", ty.vec4<f32>(), utils::Vector{Builtin(expr)})},
- ty.void_(), utils::Empty, utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func(Symbols().New(), Vector{Param("p", ty.vec4<f32>(), Vector{Builtin(expr)})},
+ ty.void_(), tint::Empty, Vector{Stage(ast::PipelineStage::kFragment)});
break;
case Use::kFunctionReturnType:
- Func(Symbols().New(), utils::Empty, ty(expr), Return(Call(sym)));
+ Func(Symbols().New(), tint::Empty, ty(expr), Return(Call(sym)));
break;
case Use::kInterpolationSampling: {
fn_params.Push(Param("p", ty.vec4<f32>(),
- utils::Vector{
+ Vector{
Location(0_a),
Interpolate(builtin::InterpolationType::kLinear, expr),
}));
@@ -322,7 +321,7 @@
}
case Use::kInterpolationType: {
fn_params.Push(Param("p", ty.vec4<f32>(),
- utils::Vector{
+ Vector{
Location(0_a),
Interpolate(expr, builtin::InterpolationSampling::kCenter),
}));
@@ -330,7 +329,7 @@
break;
}
case Use::kMemberType:
- Structure(Symbols().New(), utils::Vector{Member("m", ty(expr))});
+ Structure(Symbols().New(), Vector{Member("m", ty(expr))});
break;
case Use::kTexelFormat:
GlobalVar(Symbols().New(), ty("texture_storage_2d", ty(expr), "write"), Group(0_u),
diff --git a/src/tint/lang/wgsl/resolver/function_validation_test.cc b/src/tint/lang/wgsl/resolver/function_validation_test.cc
index 846315d..6821533 100644
--- a/src/tint/lang/wgsl/resolver/function_validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/function_validation_test.cc
@@ -33,8 +33,8 @@
TEST_F(ResolverFunctionValidationTest, DuplicateParameterName) {
// fn func_a(common_name : f32) { }
// fn func_b(common_name : f32) { }
- Func("func_a", utils::Vector{Param("common_name", ty.f32())}, ty.void_(), utils::Empty);
- Func("func_b", utils::Vector{Param("common_name", ty.f32())}, ty.void_(), utils::Empty);
+ Func("func_a", Vector{Param("common_name", ty.f32())}, ty.void_(), tint::Empty);
+ Func("func_b", Vector{Param("common_name", ty.f32())}, ty.void_(), tint::Empty);
ASSERT_TRUE(r()->Resolve()) << r()->error();
}
@@ -43,7 +43,7 @@
// var<private> common_name : f32;
// fn func(common_name : f32) { }
GlobalVar("common_name", ty.f32(), builtin::AddressSpace::kPrivate);
- Func("func", utils::Vector{Param("common_name", ty.f32())}, ty.void_(), utils::Empty);
+ Func("func", Vector{Param("common_name", ty.f32())}, ty.void_(), tint::Empty);
ASSERT_TRUE(r()->Resolve()) << r()->error();
}
@@ -52,8 +52,8 @@
// fn func(common_name : f32) {
// let common_name = 1i;
// }
- Func("func", utils::Vector{Param(Source{{12, 34}}, "common_name", ty.f32())}, ty.void_(),
- utils::Vector{
+ Func("func", Vector{Param(Source{{12, 34}}, "common_name", ty.f32())}, ty.void_(),
+ Vector{
Decl(Let(Source{{56, 78}}, "common_name", Expr(1_i))),
});
@@ -64,12 +64,12 @@
TEST_F(ResolverFunctionValidationTest, NestedLocalMayShadowParameter) {
// fn func(common_name : f32) {
- // utils::Vector {
+ // Vector {
// let common_name = 1i;
// }
// }
- Func("func", utils::Vector{Param(Source{{12, 34}}, "common_name", ty.f32())}, ty.void_(),
- utils::Vector{
+ Func("func", Vector{Param(Source{{12, 34}}, "common_name", ty.f32())}, ty.void_(),
+ Vector{
Block(Decl(Let(Source{{56, 78}}, "common_name", Expr(1_i)))),
});
@@ -80,8 +80,8 @@
// fn func { var a:i32 = 2i; }
auto* var = Var("a", ty.i32(), Expr(2_i));
- Func(Source{{12, 34}}, "func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func(Source{{12, 34}}, "func", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
});
@@ -95,8 +95,8 @@
// }
auto* var = Var("func", ty.i32(), Expr(0_i));
- Func("func", utils::Empty, ty.i32(),
- utils::Vector{
+ Func("func", tint::Empty, ty.i32(),
+ Vector{
Decl(var),
Return(Source{{12, 34}}, Expr("func")),
});
@@ -109,13 +109,13 @@
// fn b() -> i32 { return 2; }
auto* var = Var("b", ty.i32(), Expr(0_i));
- Func("a", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
});
- Func(Source{{12, 34}}, "b", utils::Empty, ty.i32(),
- utils::Vector{
+ Func(Source{{12, 34}}, "b", tint::Empty, ty.i32(),
+ Vector{
Return(2_i),
});
@@ -133,7 +133,7 @@
auto* ret = Return();
auto* assign_a = Assign(Source{{12, 34}}, "a", 2_i);
- Func("func", utils::Empty, ty.void_(), utils::Vector{decl_a, ret, assign_a});
+ Func("func", tint::Empty, ty.void_(), Vector{decl_a, ret, assign_a});
ASSERT_TRUE(r()->Resolve());
@@ -154,8 +154,7 @@
auto* ret = Return();
auto* assign_a = Assign(Source{{12, 34}}, "a", 2_i);
- Func("func", utils::Empty, ty.void_(),
- utils::Vector{decl_a, Block(Block(Block(ret))), assign_a});
+ Func("func", tint::Empty, ty.void_(), Vector{decl_a, Block(Block(Block(ret))), assign_a});
ASSERT_TRUE(r()->Resolve());
EXPECT_EQ(r()->error(), "12:34 warning: code is unreachable");
@@ -175,7 +174,7 @@
auto* discard = Discard();
auto* assign_a = Assign(Source{{12, 34}}, "a", 2_i);
- Func("func", utils::Empty, ty.void_(), utils::Vector{decl_a, discard, assign_a});
+ Func("func", tint::Empty, ty.void_(), Vector{decl_a, discard, assign_a});
ASSERT_TRUE(r()->Resolve());
EXPECT_TRUE(Sem().Get(decl_a)->IsReachable());
@@ -185,13 +184,13 @@
TEST_F(ResolverFunctionValidationTest, DiscardCalledDirectlyFromVertexEntryPoint) {
// @vertex() fn func() -> @position(0) vec4<f32> { discard; return; }
- Func(Source{{1, 2}}, "func", utils::Empty, ty.vec4<f32>(),
- utils::Vector{
+ Func(Source{{1, 2}}, "func", tint::Empty, ty.vec4<f32>(),
+ Vector{
Discard(Source{{12, 34}}),
Return(Call<vec4<f32>>()),
},
- utils::Vector{Stage(ast::PipelineStage::kVertex)},
- utils::Vector{Builtin(builtin::BuiltinValue::kPosition)});
+ Vector{Stage(ast::PipelineStage::kVertex)},
+ Vector{Builtin(builtin::BuiltinValue::kPosition)});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
@@ -204,26 +203,26 @@
// fn f2 { f1(); }
// @compute @workgroup_size(1) fn main { return f2(); }
- Func(Source{{1, 2}}, "f0", utils::Empty, ty.void_(),
- utils::Vector{
+ Func(Source{{1, 2}}, "f0", tint::Empty, ty.void_(),
+ Vector{
Discard(Source{{12, 34}}),
});
- Func(Source{{3, 4}}, "f1", utils::Empty, ty.void_(),
- utils::Vector{
+ Func(Source{{3, 4}}, "f1", tint::Empty, ty.void_(),
+ Vector{
CallStmt(Call("f0")),
});
- Func(Source{{5, 6}}, "f2", utils::Empty, ty.void_(),
- utils::Vector{
+ Func(Source{{5, 6}}, "f2", tint::Empty, ty.void_(),
+ Vector{
CallStmt(Call("f1")),
});
- Func(Source{{7, 8}}, "main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func(Source{{7, 8}}, "main", tint::Empty, ty.void_(),
+ Vector{
CallStmt(Call("f2")),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -242,8 +241,8 @@
auto* var = Var("a", ty.i32(), Expr(2_i));
- Func(Source{{12, 34}}, "func", utils::Empty, ty.i32(),
- utils::Vector{
+ Func(Source{{12, 34}}, "func", tint::Empty, ty.i32(),
+ Vector{
Decl(var),
});
@@ -254,7 +253,7 @@
TEST_F(ResolverFunctionValidationTest, VoidFunctionEndWithoutReturnStatementEmptyBody_Pass) {
// fn func {}
- Func(Source{{12, 34}}, "func", utils::Empty, ty.void_(), utils::Empty);
+ Func(Source{{12, 34}}, "func", tint::Empty, ty.void_(), tint::Empty);
ASSERT_TRUE(r()->Resolve()) << r()->error();
}
@@ -262,7 +261,7 @@
TEST_F(ResolverFunctionValidationTest, FunctionEndWithoutReturnStatementEmptyBody_Fail) {
// fn func() -> int {}
- Func(Source{{12, 34}}, "func", utils::Empty, ty.i32(), utils::Empty);
+ Func(Source{{12, 34}}, "func", tint::Empty, ty.i32(), tint::Empty);
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), "12:34 error: missing return at end of function");
@@ -271,8 +270,8 @@
TEST_F(ResolverFunctionValidationTest, FunctionTypeMustMatchReturnStatementType_Pass) {
// fn func { return; }
- Func("func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("func", tint::Empty, ty.void_(),
+ Vector{
Return(),
});
@@ -281,8 +280,8 @@
TEST_F(ResolverFunctionValidationTest, VoidFunctionReturnsAInt) {
// fn func { return 2; }
- Func("func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("func", tint::Empty, ty.void_(),
+ Vector{
Return(Source{{12, 34}}, Expr(2_a)),
});
@@ -294,8 +293,8 @@
TEST_F(ResolverFunctionValidationTest, VoidFunctionReturnsAFloat) {
// fn func { return 2.0; }
- Func("func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("func", tint::Empty, ty.void_(),
+ Vector{
Return(Source{{12, 34}}, Expr(2.0_a)),
});
@@ -307,8 +306,8 @@
TEST_F(ResolverFunctionValidationTest, VoidFunctionReturnsI32) {
// fn func { return 2i; }
- Func("func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("func", tint::Empty, ty.void_(),
+ Vector{
Return(Source{{12, 34}}, Expr(2_i)),
});
@@ -321,12 +320,12 @@
TEST_F(ResolverFunctionValidationTest, FunctionTypeMustMatchReturnStatementType_void_fail) {
// fn v { return; }
// fn func { return v(); }
- Func("v", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("v", tint::Empty, ty.void_(),
+ Vector{
Return(),
});
- Func("func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("func", tint::Empty, ty.void_(),
+ Vector{
Return(Call(Source{{12, 34}}, "v")),
});
@@ -336,8 +335,8 @@
TEST_F(ResolverFunctionValidationTest, FunctionTypeMustMatchReturnStatementTypeMissing_fail) {
// fn func() -> f32 { return; }
- Func("func", utils::Empty, ty.f32(),
- utils::Vector{
+ Func("func", tint::Empty, ty.f32(),
+ Vector{
Return(Source{{12, 34}}, nullptr),
});
@@ -349,8 +348,8 @@
TEST_F(ResolverFunctionValidationTest, FunctionTypeMustMatchReturnStatementTypeF32_pass) {
// fn func() -> f32 { return 2.0; }
- Func("func", utils::Empty, ty.f32(),
- utils::Vector{
+ Func("func", tint::Empty, ty.f32(),
+ Vector{
Return(Source{{12, 34}}, Expr(2_f)),
});
@@ -359,8 +358,8 @@
TEST_F(ResolverFunctionValidationTest, FunctionTypeMustMatchReturnStatementTypeF32_fail) {
// fn func() -> f32 { return 2i; }
- Func("func", utils::Empty, ty.f32(),
- utils::Vector{
+ Func("func", tint::Empty, ty.f32(),
+ Vector{
Return(Source{{12, 34}}, Expr(2_i)),
});
@@ -374,8 +373,8 @@
// type myf32 = f32;
// fn func() -> myf32 { return 2.0; }
auto* myf32 = Alias("myf32", ty.f32());
- Func("func", utils::Empty, ty.Of(myf32),
- utils::Vector{
+ Func("func", tint::Empty, ty.Of(myf32),
+ Vector{
Return(Source{{12, 34}}, Expr(2_f)),
});
@@ -386,8 +385,8 @@
// type myf32 = f32;
// fn func() -> myf32 { return 2u; }
auto* myf32 = Alias("myf32", ty.f32());
- Func("func", utils::Empty, ty.Of(myf32),
- utils::Vector{
+ Func("func", tint::Empty, ty.Of(myf32),
+ Vector{
Return(Source{{12, 34}}, Expr(2_u)),
});
@@ -400,14 +399,14 @@
TEST_F(ResolverFunctionValidationTest, CannotCallEntryPoint) {
// @compute @workgroup_size(1) fn entrypoint() {}
// fn func() { return entrypoint(); }
- Func("entrypoint", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("entrypoint", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
- Func("func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("func", tint::Empty, ty.void_(),
+ Vector{
CallStmt(Call(Source{{12, 34}}, "entrypoint")),
});
@@ -419,8 +418,8 @@
TEST_F(ResolverFunctionValidationTest, CannotCallFunctionAtModuleScope) {
// fn F() -> i32 { return 1; }
// var x = F();
- Func("F", utils::Empty, ty.i32(),
- utils::Vector{
+ Func("F", tint::Empty, ty.i32(),
+ Vector{
Return(1_i),
});
GlobalVar("x", Call(Source{{12, 34}}, "F"), builtin::AddressSpace::kPrivate);
@@ -433,11 +432,11 @@
// @fragment
// @vertex
// fn main() { return; }
- Func(Source{{12, 34}}, "main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func(Source{{12, 34}}, "main", tint::Empty, ty.void_(),
+ Vector{
Return(),
},
- utils::Vector{
+ Vector{
Stage(Source{{12, 34}}, ast::PipelineStage::kVertex),
Stage(Source{{56, 78}}, ast::PipelineStage::kFragment),
});
@@ -449,8 +448,8 @@
}
TEST_F(ResolverFunctionValidationTest, NoPipelineEntryPoints) {
- Func("vtx_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("vtx_func", tint::Empty, ty.void_(),
+ Vector{
Return(),
});
@@ -465,8 +464,8 @@
auto* bar = Param("bar", ty.f32());
auto* baz = Var("baz", ty.f32(), Expr("bar"));
- Func("foo", utils::Vector{bar}, ty.void_(),
- utils::Vector{
+ Func("foo", Vector{bar}, ty.void_(),
+ Vector{
Decl(baz),
});
@@ -481,8 +480,8 @@
auto* bar = Param("bar", ty.f32());
auto* baz = Let("baz", ty.f32(), Expr("bar"));
- Func("foo", utils::Vector{bar}, ty.void_(),
- utils::Vector{
+ Func("foo", Vector{bar}, ty.void_(),
+ Vector{
Decl(baz),
});
@@ -496,8 +495,8 @@
// fn main() {}
auto* x = GlobalConst("x", ty.u32(), Expr(4_u));
auto* y = GlobalConst("y", ty.u32(), Expr(8_u));
- auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ auto* func = Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize("x", "y", 16_u),
});
@@ -521,8 +520,8 @@
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Cast) {
// @compute @workgroup_size(i32(5))
// fn main() {}
- auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ auto* func = Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(Call(Source{{12, 34}}, ty.i32(), 5_a)),
});
@@ -539,8 +538,8 @@
// @compute @workgroup_size(1i, 2i, 3i)
// fn main() {}
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(Source{{12, 34}}, 1_i, 2_i, 3_i),
});
@@ -552,8 +551,8 @@
// @compute @workgroup_size(1u, 2u, 3u)
// fn main() {}
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(Source{{12, 34}}, 1_u, 2_u, 3_u),
});
@@ -565,8 +564,8 @@
// @compute @workgroup_size(1, 2i, 3)
// fn main() {}
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(Source{{12, 34}}, 1_a, 2_i, 3_a),
});
@@ -578,8 +577,8 @@
// @compute @workgroup_size(1u, 2, 3u)
// fn main() {}
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(Source{{12, 34}}, 1_u, 2_a, 3_u),
});
@@ -591,8 +590,8 @@
// @compute @workgroup_size(1 + 2)
// fn main() {}
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(Source{{12, 34}}, Add(1_u, 2_u)),
});
@@ -604,8 +603,8 @@
// @compute @workgroup_size(1u, 2, 3_i)
// fn main() {}
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(Source{{12, 34}}, 1_u, 2_a, 3_i),
});
@@ -619,8 +618,8 @@
// @compute @workgroup_size(1_i, 2u, 3)
// fn main() {}
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(Source{{12, 34}}, 1_i, 2_u, 3_a),
});
@@ -635,8 +634,8 @@
// @compute @workgroup_size(1i, x)
// fn main() {}
GlobalConst("x", ty.u32(), Expr(64_u));
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(Source{{12, 34}}, 1_i, "x"),
});
@@ -653,8 +652,8 @@
// fn main() {}
GlobalConst("x", ty.u32(), Expr(64_u));
GlobalConst("y", ty.i32(), Expr(32_i));
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(Source{{12, 34}}, "x", "y"),
});
@@ -671,8 +670,8 @@
// fn main() {}
GlobalConst("x", ty.u32(), Expr(4_u));
GlobalConst("y", ty.u32(), Expr(8_u));
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(Source{{12, 34}}, "x", "y", 16_i),
});
@@ -686,8 +685,8 @@
// @compute @workgroup_size(64.0)
// fn main() {}
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(Expr(Source{{12, 34}}, 64_f)),
});
@@ -703,8 +702,8 @@
// @compute @workgroup_size(-2i)
// fn main() {}
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(Expr(Source{{12, 34}}, -2_i)),
});
@@ -717,8 +716,8 @@
// @compute @workgroup_size(0i)
// fn main() {}
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(Expr(Source{{12, 34}}, 0_i)),
});
@@ -732,8 +731,8 @@
// @compute @workgroup_size(x)
// fn main() {}
GlobalConst("x", ty.f32(), Expr(64_f));
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(Expr(Source{{12, 34}}, "x")),
});
@@ -750,8 +749,8 @@
// @compute @workgroup_size(x)
// fn main() {}
GlobalConst("x", ty.i32(), Expr(-2_i));
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(Expr(Source{{12, 34}}, "x")),
});
@@ -765,8 +764,8 @@
// @compute @workgroup_size(x)
// fn main() {}
GlobalConst("x", ty.i32(), Expr(0_i));
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(Expr(Source{{12, 34}}, "x")),
});
@@ -780,8 +779,8 @@
// @compute @workgroup_size(x)
// fn main() {}
GlobalConst("x", ty.i32(), Call<i32>(Call<i32>(Call<i32>())));
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(Expr(Source{{12, 34}}, "x")),
});
@@ -793,8 +792,8 @@
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_OverflowsU32_0x10000_0x100_0x100) {
// @compute @workgroup_size(0x10000, 0x100, 0x100)
// fn main() {}
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(0x10000_a, 0x100_a, Expr(Source{{12, 34}}, 0x100_a)),
});
@@ -806,8 +805,8 @@
TEST_F(ResolverFunctionValidationTest, WorkgroupSize_OverflowsU32_0x10000_0x10000) {
// @compute @workgroup_size(0x10000, 0x10000)
// fn main() {}
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(0x10000_a, Expr(Source{{12, 34}}, 0x10000_a)),
});
@@ -821,8 +820,8 @@
// @compute @workgroup_size(0x10000, C, 0x10000)
// fn main() {}
GlobalConst("C", ty.u32(), Expr(1_a));
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(0x10000_a, "C", Expr(Source{{12, 34}}, 0x10000_a)),
});
@@ -836,8 +835,8 @@
// @compute @workgroup_size(0x10000, C)
// fn main() {}
GlobalConst("C", ty.u32(), Expr(0x10000_a));
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(0x10000_a, Expr(Source{{12, 34}}, "C")),
});
@@ -851,8 +850,8 @@
// @compute @workgroup_size(0x10000, O, 0x10000)
// fn main() {}
Override("O", ty.u32(), Expr(0_a));
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(0x10000_a, "O", Expr(Source{{12, 34}}, 0x10000_a)),
});
@@ -866,8 +865,8 @@
// @compute @workgroup_size(x)
// fn main() {}
GlobalVar("x", ty.i32(), builtin::AddressSpace::kPrivate, Expr(64_i));
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(Expr(Source{{12, 34}}, "x")),
});
@@ -882,8 +881,8 @@
// @compute @workgroup_size(1 << 2 + 4)
// fn main() {}
GlobalVar("x", ty.i32(), builtin::AddressSpace::kPrivate, Expr(0_i));
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(Call(Source{{12, 34}}, ty.i32(), "x")),
});
@@ -898,8 +897,8 @@
// @compute @workgroup_size(1, 1 << 2 + 4)
// fn main() {}
GlobalVar("x", ty.i32(), builtin::AddressSpace::kPrivate, Expr(0_i));
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(Call(Source{{12, 34}}, ty.i32(), "x")),
});
@@ -914,8 +913,8 @@
// @compute @workgroup_size(1, 1, 1 << 2 + 4)
// fn main() {}
GlobalVar("x", ty.i32(), builtin::AddressSpace::kPrivate, Expr(0_i));
- Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(Call(Source{{12, 34}}, ty.i32(), "x")),
});
@@ -928,7 +927,7 @@
TEST_F(ResolverFunctionValidationTest, ReturnIsConstructible_NonPlain) {
auto ret_type = ty.ptr<function, i32>(Source{{12, 34}});
- Func("f", utils::Empty, ret_type, utils::Empty);
+ Func("f", tint::Empty, ret_type, tint::Empty);
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), "12:34 error: function return type must be a constructible type");
@@ -936,7 +935,7 @@
TEST_F(ResolverFunctionValidationTest, ReturnIsConstructible_AtomicInt) {
auto ret_type = ty.atomic(Source{{12, 34}}, ty.i32());
- Func("f", utils::Empty, ret_type, utils::Empty);
+ Func("f", tint::Empty, ret_type, tint::Empty);
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), "12:34 error: function return type must be a constructible type");
@@ -944,18 +943,18 @@
TEST_F(ResolverFunctionValidationTest, ReturnIsConstructible_ArrayOfAtomic) {
auto ret_type = ty.array(Source{{12, 34}}, ty.atomic(ty.i32()), 10_u);
- Func("f", utils::Empty, ret_type, utils::Empty);
+ Func("f", tint::Empty, ret_type, tint::Empty);
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), "12:34 error: function return type must be a constructible type");
}
TEST_F(ResolverFunctionValidationTest, ReturnIsConstructible_StructOfAtomic) {
- Structure("S", utils::Vector{
+ Structure("S", Vector{
Member("m", ty.atomic(ty.i32())),
});
auto ret_type = ty(Source{{12, 34}}, "S");
- Func("f", utils::Empty, ret_type, utils::Empty);
+ Func("f", tint::Empty, ret_type, tint::Empty);
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), "12:34 error: function return type must be a constructible type");
@@ -963,51 +962,51 @@
TEST_F(ResolverFunctionValidationTest, ReturnIsConstructible_RuntimeArray) {
auto ret_type = ty.array(Source{{12, 34}}, ty.i32());
- Func("f", utils::Empty, ret_type, utils::Empty);
+ Func("f", tint::Empty, ret_type, tint::Empty);
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), "12:34 error: function return type must be a constructible type");
}
TEST_F(ResolverFunctionValidationTest, ParameterStoreType_NonAtomicFree) {
- Structure("S", utils::Vector{
+ Structure("S", Vector{
Member("m", ty.atomic(ty.i32())),
});
auto ret_type = ty(Source{{12, 34}}, "S");
auto* bar = Param("bar", ret_type);
- Func("f", utils::Vector{bar}, ty.void_(), utils::Empty);
+ Func("f", Vector{bar}, ty.void_(), tint::Empty);
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), "12:34 error: type of function parameter must be constructible");
}
TEST_F(ResolverFunctionValidationTest, ParameterStoreType_AtomicFree) {
- Structure("S", utils::Vector{
+ Structure("S", Vector{
Member("m", ty.i32()),
});
auto ret_type = ty(Source{{12, 34}}, "S");
auto* bar = Param(Source{{12, 34}}, "bar", ret_type);
- Func("f", utils::Vector{bar}, ty.void_(), utils::Empty);
+ Func("f", Vector{bar}, ty.void_(), tint::Empty);
ASSERT_TRUE(r()->Resolve()) << r()->error();
}
TEST_F(ResolverFunctionValidationTest, ParametersAtLimit) {
- utils::Vector<const ast::Parameter*, 256> params;
+ Vector<const ast::Parameter*, 256> params;
for (int i = 0; i < 255; i++) {
params.Push(Param("param_" + std::to_string(i), ty.i32()));
}
- Func(Source{{12, 34}}, "f", params, ty.void_(), utils::Empty);
+ Func(Source{{12, 34}}, "f", params, ty.void_(), tint::Empty);
ASSERT_TRUE(r()->Resolve()) << r()->error();
}
TEST_F(ResolverFunctionValidationTest, ParametersOverLimit) {
- utils::Vector<const ast::Parameter*, 256> params;
+ Vector<const ast::Parameter*, 256> params;
for (int i = 0; i < 256; i++) {
params.Push(Param("param_" + std::to_string(i), ty.i32()));
}
- Func(Source{{12, 34}}, "f", params, ty.void_(), utils::Empty);
+ Func(Source{{12, 34}}, "f", params, ty.void_(), tint::Empty);
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), "12:34 error: function declares 256 parameters, maximum is 255");
@@ -1016,8 +1015,8 @@
TEST_F(ResolverFunctionValidationTest, ParameterVectorNoType) {
// fn f(p : vec3) {}
- Func(Source{{12, 34}}, "f", utils::Vector{Param("p", ty.vec3<Infer>(Source{{12, 34}}))},
- ty.void_(), utils::Empty);
+ Func(Source{{12, 34}}, "f", Vector{Param("p", ty.vec3<Infer>(Source{{12, 34}}))}, ty.void_(),
+ tint::Empty);
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), "12:34 error: expected '<' for 'vec3'");
@@ -1026,8 +1025,8 @@
TEST_F(ResolverFunctionValidationTest, ParameterMatrixNoType) {
// fn f(p : mat3x3) {}
- Func(Source{{12, 34}}, "f", utils::Vector{Param("p", ty.mat3x3<Infer>(Source{{12, 34}}))},
- ty.void_(), utils::Empty);
+ Func(Source{{12, 34}}, "f", Vector{Param("p", ty.mat3x3<Infer>(Source{{12, 34}}))}, ty.void_(),
+ tint::Empty);
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), "12:34 error: expected '<' for 'mat3x3'");
@@ -1051,23 +1050,23 @@
auto& param = GetParam();
auto ptr_type = ty("ptr", Ident(Source{{12, 34}}, param.address_space), ty.i32());
auto* arg = Param(Source{{12, 34}}, "p", ptr_type);
- Func("f", utils::Vector{arg}, ty.void_(), utils::Empty);
+ Func("f", Vector{arg}, ty.void_(), tint::Empty);
if (param.expectation == Expectation::kAlwaysPass) {
ASSERT_TRUE(r()->Resolve()) << r()->error();
} else {
- utils::StringStream ss;
+ StringStream ss;
ss << param.address_space;
EXPECT_FALSE(r()->Resolve());
if (param.expectation == Expectation::kInvalid) {
std::string err = R"(12:34 error: unresolved address space '${addr_space}'
12:34 note: Possible values: 'function', 'private', 'push_constant', 'storage', 'uniform', 'workgroup')";
- err = utils::ReplaceAll(err, "${addr_space}", utils::ToString(param.address_space));
+ err = tint::ReplaceAll(err, "${addr_space}", tint::ToString(param.address_space));
EXPECT_EQ(r()->error(), err);
} else {
EXPECT_EQ(r()->error(),
"12:34 error: function parameter of pointer type cannot be in '" +
- utils::ToString(param.address_space) + "' address space");
+ tint::ToString(param.address_space) + "' address space");
}
}
}
@@ -1076,7 +1075,7 @@
auto ptr_type = ty("ptr", Ident(Source{{12, 34}}, param.address_space), ty.i32());
auto* arg = Param(Source{{12, 34}}, "p", ptr_type);
Enable(builtin::Extension::kChromiumExperimentalFullPtrParameters);
- Func("f", utils::Vector{arg}, ty.void_(), utils::Empty);
+ Func("f", Vector{arg}, ty.void_(), tint::Empty);
if (param.expectation == Expectation::kAlwaysPass ||
param.expectation == Expectation::kPassWithFullPtrParameterExtension) {
@@ -1086,12 +1085,12 @@
if (param.expectation == Expectation::kInvalid) {
std::string err = R"(12:34 error: unresolved address space '${addr_space}'
12:34 note: Possible values: 'function', 'private', 'push_constant', 'storage', 'uniform', 'workgroup')";
- err = utils::ReplaceAll(err, "${addr_space}", utils::ToString(param.address_space));
+ err = tint::ReplaceAll(err, "${addr_space}", tint::ToString(param.address_space));
EXPECT_EQ(r()->error(), err);
} else {
EXPECT_EQ(r()->error(),
"12:34 error: function parameter of pointer type cannot be in '" +
- utils::ToString(param.address_space) + "' address space");
+ tint::ToString(param.address_space) + "' address space");
}
}
}
diff --git a/src/tint/lang/wgsl/resolver/host_shareable_validation_test.cc b/src/tint/lang/wgsl/resolver/host_shareable_validation_test.cc
index 4f4d304..7f43830 100644
--- a/src/tint/lang/wgsl/resolver/host_shareable_validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/host_shareable_validation_test.cc
@@ -26,8 +26,7 @@
using ResolverHostShareableValidationTest = ResolverTest;
TEST_F(ResolverHostShareableValidationTest, BoolMember) {
- auto* s =
- Structure("S", utils::Vector{Member(Source{{56, 78}}, "x", ty.bool_(Source{{12, 34}}))});
+ auto* s = Structure("S", Vector{Member(Source{{56, 78}}, "x", ty.bool_(Source{{12, 34}}))});
GlobalVar(Source{{90, 12}}, "g", ty.Of(s), builtin::AddressSpace::kStorage,
builtin::Access::kRead, Binding(0_a), Group(0_a));
@@ -42,8 +41,8 @@
}
TEST_F(ResolverHostShareableValidationTest, BoolVectorMember) {
- auto* s = Structure(
- "S", utils::Vector{Member(Source{{56, 78}}, "x", ty.vec3<bool>(Source{{12, 34}}))});
+ auto* s =
+ Structure("S", Vector{Member(Source{{56, 78}}, "x", ty.vec3<bool>(Source{{12, 34}}))});
GlobalVar(Source{{90, 12}}, "g", ty.Of(s), builtin::AddressSpace::kStorage,
builtin::Access::kRead, Binding(0_a), Group(0_a));
@@ -59,8 +58,7 @@
TEST_F(ResolverHostShareableValidationTest, Aliases) {
Alias("a1", ty.bool_());
- auto* s =
- Structure("S", utils::Vector{Member(Source{{56, 78}}, "x", ty(Source{{12, 34}}, "a1"))});
+ auto* s = Structure("S", Vector{Member(Source{{56, 78}}, "x", ty(Source{{12, 34}}, "a1"))});
auto* a2 = Alias("a2", ty.Of(s));
GlobalVar(Source{{90, 12}}, "g", ty.Of(a2), builtin::AddressSpace::kStorage,
builtin::Access::kRead, Binding(0_a), Group(0_a));
@@ -75,11 +73,11 @@
}
TEST_F(ResolverHostShareableValidationTest, NestedStructures) {
- auto* i1 = Structure("I1", utils::Vector{Member(Source{{1, 2}}, "x", ty.bool_())});
- auto* i2 = Structure("I2", utils::Vector{Member(Source{{3, 4}}, "y", ty.Of(i1))});
- auto* i3 = Structure("I3", utils::Vector{Member(Source{{5, 6}}, "z", ty.Of(i2))});
+ auto* i1 = Structure("I1", Vector{Member(Source{{1, 2}}, "x", ty.bool_())});
+ auto* i2 = Structure("I2", Vector{Member(Source{{3, 4}}, "y", ty.Of(i1))});
+ auto* i3 = Structure("I3", Vector{Member(Source{{5, 6}}, "z", ty.Of(i2))});
- auto* s = Structure("S", utils::Vector{Member(Source{{7, 8}}, "m", ty.Of(i3))});
+ auto* s = Structure("S", Vector{Member(Source{{7, 8}}, "m", ty.Of(i3))});
GlobalVar(Source{{9, 10}}, "g", ty.Of(s), builtin::AddressSpace::kStorage,
builtin::Access::kRead, Binding(0_a), Group(0_a));
@@ -99,26 +97,26 @@
TEST_F(ResolverHostShareableValidationTest, NoError) {
Enable(builtin::Extension::kF16);
- auto* i1 = Structure("I1", utils::Vector{
+ auto* i1 = Structure("I1", Vector{
Member(Source{{1, 1}}, "w1", ty.f32()),
Member(Source{{2, 1}}, "x1", ty.f32()),
Member(Source{{3, 1}}, "y1", ty.vec3<f32>()),
Member(Source{{4, 1}}, "z1", ty.array<i32, 4>()),
});
auto* a1 = Alias("a1", ty.Of(i1));
- auto* i2 = Structure("I2", utils::Vector{
+ auto* i2 = Structure("I2", Vector{
Member(Source{{5, 1}}, "x2", ty.mat2x2<f32>()),
Member(Source{{6, 1}}, "w2", ty.mat3x4<f32>()),
Member(Source{{7, 1}}, "z2", ty.Of(i1)),
});
auto* a2 = Alias("a2", ty.Of(i2));
- auto* i3 = Structure("I3", utils::Vector{
+ auto* i3 = Structure("I3", Vector{
Member(Source{{4, 1}}, "x3", ty.Of(a1)),
Member(Source{{5, 1}}, "y3", ty.Of(i2)),
Member(Source{{6, 1}}, "z3", ty.Of(a2)),
});
- auto* s = Structure("S", utils::Vector{Member(Source{{7, 8}}, "m", ty.Of(i3))});
+ auto* s = Structure("S", Vector{Member(Source{{7, 8}}, "m", ty.Of(i3))});
GlobalVar(Source{{9, 10}}, "g", ty.Of(s), builtin::AddressSpace::kStorage,
builtin::Access::kRead, Binding(0_a), Group(0_a));
diff --git a/src/tint/lang/wgsl/resolver/increment_decrement_validation_test.cc b/src/tint/lang/wgsl/resolver/increment_decrement_validation_test.cc
index 568809e..70d2aab 100644
--- a/src/tint/lang/wgsl/resolver/increment_decrement_validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/increment_decrement_validation_test.cc
@@ -162,8 +162,8 @@
// a++;
// }
auto* a = Param(Source{{12, 34}}, "a", ty.i32());
- Func("func", utils::Vector{a}, ty.void_(),
- utils::Vector{
+ Func("func", Vector{a}, ty.void_(),
+ Vector{
Increment(Expr(Source{{56, 78}}, "a")),
});
@@ -179,8 +179,8 @@
// {
// a++;
// }
- Func("func", utils::Empty, ty.i32(),
- utils::Vector{
+ Func("func", tint::Empty, ty.i32(),
+ Vector{
Return(0_i),
});
WrapInFunction(Increment(Call(Source{{56, 78}}, "func")));
diff --git a/src/tint/lang/wgsl/resolver/inferred_type_test.cc b/src/tint/lang/wgsl/resolver/inferred_type_test.cc
index 01f5e55..5f67305 100644
--- a/src/tint/lang/wgsl/resolver/inferred_type_test.cc
+++ b/src/tint/lang/wgsl/resolver/inferred_type_test.cc
@@ -137,12 +137,12 @@
TEST_F(ResolverInferredTypeTest, InferStruct_Pass) {
auto* member = Member("x", ty.i32());
- auto* str = Structure("S", utils::Vector{member});
+ auto* str = Structure("S", Vector{member});
auto* expected_type = create<sem::Struct>(
str, str->name->symbol,
- utils::Vector{create<sem::StructMember>(member, member->name->symbol, create<type::I32>(),
- 0u, 0u, 0u, 4u, type::StructMemberAttributes{})},
+ Vector{create<sem::StructMember>(member, member->name->symbol, create<type::I32>(), 0u, 0u,
+ 0u, 4u, type::StructMemberAttributes{})},
0u, 4u, 4u);
auto* ctor_expr = Call(ty.Of(str));
diff --git a/src/tint/lang/wgsl/resolver/intrinsic_table.cc b/src/tint/lang/wgsl/resolver/intrinsic_table.cc
index b16111d..c28013a 100644
--- a/src/tint/lang/wgsl/resolver/intrinsic_table.cc
+++ b/src/tint/lang/wgsl/resolver/intrinsic_table.cc
@@ -52,14 +52,14 @@
class NumberMatcher;
class TypeMatcher;
-/// The utils::Vector `N` template argument value for arrays of parameters.
+/// The Vector `N` template argument value for arrays of parameters.
constexpr static const size_t kNumFixedParams = 8;
-/// The utils::Vector `N` template argument value for arrays of overload candidates.
+/// The Vector `N` template argument value for arrays of overload candidates.
constexpr static const size_t kNumFixedCandidates = 8;
/// A special type that matches all TypeMatchers
-class Any final : public utils::Castable<Any, type::Type> {
+class Any final : public Castable<Any, type::Type> {
public:
Any() : Base(0u, type::Flags{}) {}
~Any() override = default;
@@ -135,7 +135,7 @@
t = ty;
return ty;
}
- ty = type::Type::Common(utils::Vector{t, ty});
+ ty = type::Type::Common(Vector{t, ty});
if (ty) {
t = ty;
}
@@ -185,8 +185,8 @@
size_t Count() const { return types_.Length() + numbers_.Length(); }
private:
- utils::Vector<const type::Type*, 4> types_;
- utils::Vector<Number, 2> numbers_;
+ Vector<const type::Type*, 4> types_;
+ Vector<Number, 2> numbers_;
};
/// Index type used for matcher indices
@@ -354,7 +354,7 @@
};
// An enum set of OverloadFlag, used by OperatorInfo
-using OverloadFlags = utils::EnumSet<OverloadFlag>;
+using OverloadFlags = tint::EnumSet<OverloadFlag>;
bool match_bool(MatchState&, const type::Type* ty) {
return ty->IsAnyOf<Any, type::Bool>();
@@ -922,17 +922,17 @@
/// @param i the IntrinsicPrototype to create a hash for
/// @return the hash value
inline std::size_t operator()(const IntrinsicPrototype& i) const {
- size_t hash = utils::Hash(i.parameters.Length());
+ size_t hash = Hash(i.parameters.Length());
for (auto& p : i.parameters) {
- hash = utils::HashCombine(hash, p.type, p.usage);
+ hash = HashCombine(hash, p.type, p.usage);
}
- return utils::Hash(hash, i.overload, i.return_type);
+ return Hash(hash, i.overload, i.return_type);
}
};
const OverloadInfo* overload = nullptr;
type::Type const* return_type = nullptr;
- utils::Vector<Parameter, kNumFixedParams> parameters;
+ Vector<Parameter, kNumFixedParams> parameters;
};
/// Equality operator for IntrinsicPrototype
@@ -957,7 +957,7 @@
explicit Impl(ProgramBuilder& builder);
Builtin Lookup(builtin::Function builtin_type,
- utils::VectorRef<const type::Type*> args,
+ VectorRef<const type::Type*> args,
sem::EvaluationStage earliest_eval_stage,
const Source& source) override;
@@ -975,7 +975,7 @@
CtorOrConv Lookup(CtorConvIntrinsic type,
const type::Type* template_arg,
- utils::VectorRef<const type::Type*> args,
+ VectorRef<const type::Type*> args,
sem::EvaluationStage earliest_eval_stage,
const Source& source) override;
@@ -987,7 +987,7 @@
/// The template types and numbers
TemplateState templates;
/// The parameter types for the candidate overload
- utils::Vector<IntrinsicPrototype::Parameter, kNumFixedParams> parameters;
+ Vector<IntrinsicPrototype::Parameter, kNumFixedParams> parameters;
/// The match-score of the candidate overload.
/// A score of zero indicates an exact match.
/// Non-zero scores are used for diagnostics when no overload matches.
@@ -996,10 +996,10 @@
};
/// A list of candidates
- using Candidates = utils::Vector<Candidate, kNumFixedCandidates>;
+ using Candidates = Vector<Candidate, kNumFixedCandidates>;
/// Callback function when no overloads match.
- using OnNoMatch = std::function<void(utils::VectorRef<Candidate>)>;
+ using OnNoMatch = std::function<void(VectorRef<Candidate>)>;
/// Sorts the candidates based on their score, with the lowest (best-ranking) scores first.
static inline void SortCandidates(Candidates& candidates) {
@@ -1021,7 +1021,7 @@
/// IntrinsicPrototype::return_type.
IntrinsicPrototype MatchIntrinsic(const IntrinsicInfo& intrinsic,
const char* intrinsic_name,
- utils::VectorRef<const type::Type*> args,
+ VectorRef<const type::Type*> args,
sem::EvaluationStage earliest_eval_stage,
TemplateState templates,
const OnNoMatch& on_no_match) const;
@@ -1034,7 +1034,7 @@
/// template as `f32`.
/// @returns the evaluated Candidate information.
Candidate ScoreOverload(const OverloadInfo* overload,
- utils::VectorRef<const type::Type*> args,
+ VectorRef<const type::Type*> args,
sem::EvaluationStage earliest_eval_stage,
const TemplateState& templates) const;
@@ -1050,7 +1050,7 @@
/// @returns the resolved Candidate.
Candidate ResolveCandidate(Candidates&& candidates,
const char* intrinsic_name,
- utils::VectorRef<const type::Type*> args,
+ VectorRef<const type::Type*> args,
TemplateState templates) const;
/// Match constructs a new MatchState
@@ -1063,36 +1063,35 @@
sem::EvaluationStage earliest_eval_stage) const;
// Prints the overload for emitting diagnostics
- void PrintOverload(utils::StringStream& ss,
+ void PrintOverload(StringStream& ss,
const OverloadInfo* overload,
const char* intrinsic_name) const;
// Prints the list of candidates for emitting diagnostics
- void PrintCandidates(utils::StringStream& ss,
- utils::VectorRef<Candidate> candidates,
+ void PrintCandidates(StringStream& ss,
+ VectorRef<Candidate> candidates,
const char* intrinsic_name) const;
/// Raises an error when no overload is a clear winner of overload resolution
void ErrAmbiguousOverload(const char* intrinsic_name,
- utils::VectorRef<const type::Type*> args,
+ VectorRef<const type::Type*> args,
TemplateState templates,
- utils::VectorRef<Candidate> candidates) const;
+ VectorRef<Candidate> candidates) const;
ProgramBuilder& builder;
Matchers matchers;
- utils::Hashmap<IntrinsicPrototype, sem::Builtin*, 64, IntrinsicPrototype::Hasher> builtins;
- utils::Hashmap<IntrinsicPrototype, sem::ValueConstructor*, 16, IntrinsicPrototype::Hasher>
+ Hashmap<IntrinsicPrototype, sem::Builtin*, 64, IntrinsicPrototype::Hasher> builtins;
+ Hashmap<IntrinsicPrototype, sem::ValueConstructor*, 16, IntrinsicPrototype::Hasher>
constructors;
- utils::Hashmap<IntrinsicPrototype, sem::ValueConversion*, 16, IntrinsicPrototype::Hasher>
- converters;
+ Hashmap<IntrinsicPrototype, sem::ValueConversion*, 16, IntrinsicPrototype::Hasher> converters;
};
/// @return a string representing a call to a builtin with the given argument
/// types.
std::string CallSignature(const char* intrinsic_name,
- utils::VectorRef<const type::Type*> args,
+ VectorRef<const type::Type*> args,
const type::Type* template_arg = nullptr) {
- utils::StringStream ss;
+ StringStream ss;
ss << intrinsic_name;
if (template_arg) {
ss << "<" << template_arg->FriendlyName() << ">";
@@ -1124,14 +1123,14 @@
Impl::Impl(ProgramBuilder& b) : builder(b) {}
Impl::Builtin Impl::Lookup(builtin::Function builtin_type,
- utils::VectorRef<const type::Type*> args,
+ VectorRef<const type::Type*> args,
sem::EvaluationStage earliest_eval_stage,
const Source& source) {
const char* intrinsic_name = builtin::str(builtin_type);
// Generates an error when no overloads match the provided arguments
- auto on_no_match = [&](utils::VectorRef<Candidate> candidates) {
- utils::StringStream ss;
+ auto on_no_match = [&](VectorRef<Candidate> candidates) {
+ StringStream ss;
ss << "no matching call to " << CallSignature(intrinsic_name, args) << std::endl;
if (!candidates.IsEmpty()) {
ss << std::endl
@@ -1151,7 +1150,7 @@
// De-duplicate builtins that are identical.
auto* sem = builtins.GetOrCreate(match, [&] {
- utils::Vector<sem::Parameter*, kNumFixedParams> params;
+ Vector<sem::Parameter*, kNumFixedParams> params;
params.Reserve(match.parameters.Length());
for (auto& p : match.parameters) {
params.Push(builder.create<sem::Parameter>(
@@ -1196,11 +1195,11 @@
}
}();
- utils::Vector args{arg};
+ Vector args{arg};
// Generates an error when no overloads match the provided arguments
- auto on_no_match = [&, name = intrinsic_name](utils::VectorRef<Candidate> candidates) {
- utils::StringStream ss;
+ auto on_no_match = [&, name = intrinsic_name](VectorRef<Candidate> candidates) {
+ StringStream ss;
ss << "no matching overload for " << CallSignature(name, args) << std::endl;
if (!candidates.IsEmpty()) {
ss << std::endl
@@ -1274,11 +1273,11 @@
}
}();
- utils::Vector args{lhs, rhs};
+ Vector args{lhs, rhs};
// Generates an error when no overloads match the provided arguments
- auto on_no_match = [&, name = intrinsic_name](utils::VectorRef<Candidate> candidates) {
- utils::StringStream ss;
+ auto on_no_match = [&, name = intrinsic_name](VectorRef<Candidate> candidates) {
+ StringStream ss;
ss << "no matching overload for " << CallSignature(name, args) << std::endl;
if (!candidates.IsEmpty()) {
ss << std::endl
@@ -1306,14 +1305,14 @@
IntrinsicTable::CtorOrConv Impl::Lookup(CtorConvIntrinsic type,
const type::Type* template_arg,
- utils::VectorRef<const type::Type*> args,
+ VectorRef<const type::Type*> args,
sem::EvaluationStage earliest_eval_stage,
const Source& source) {
auto name = str(type);
// Generates an error when no overloads match the provided arguments
- auto on_no_match = [&](utils::VectorRef<Candidate> candidates) {
- utils::StringStream ss;
+ auto on_no_match = [&](VectorRef<Candidate> candidates) {
+ StringStream ss;
ss << "no matching constructor for " << CallSignature(name, args, template_arg)
<< std::endl;
Candidates ctor, conv;
@@ -1354,7 +1353,7 @@
// Was this overload a constructor or conversion?
if (match.overload->flags.Contains(OverloadFlag::kIsConstructor)) {
- utils::Vector<sem::Parameter*, 8> params;
+ Vector<sem::Parameter*, 8> params;
params.Reserve(match.parameters.Length());
for (auto& p : match.parameters) {
params.Push(builder.create<sem::Parameter>(
@@ -1384,13 +1383,13 @@
IntrinsicPrototype Impl::MatchIntrinsic(const IntrinsicInfo& intrinsic,
const char* intrinsic_name,
- utils::VectorRef<const type::Type*> args,
+ VectorRef<const type::Type*> args,
sem::EvaluationStage earliest_eval_stage,
TemplateState templates,
const OnNoMatch& on_no_match) const {
size_t num_matched = 0;
size_t match_idx = 0;
- utils::Vector<Candidate, kNumFixedCandidates> candidates;
+ Vector<Candidate, kNumFixedCandidates> candidates;
candidates.Reserve(intrinsic.num_overloads);
for (size_t overload_idx = 0; overload_idx < static_cast<size_t>(intrinsic.num_overloads);
overload_idx++) {
@@ -1441,7 +1440,7 @@
}
Impl::Candidate Impl::ScoreOverload(const OverloadInfo* overload,
- utils::VectorRef<const type::Type*> args,
+ VectorRef<const type::Type*> args,
sem::EvaluationStage earliest_eval_stage,
const TemplateState& in_templates) const {
// Penalty weights for overload mismatching.
@@ -1538,7 +1537,7 @@
}
// Now that all the template types have been finalized, we can construct the parameters.
- utils::Vector<IntrinsicPrototype::Parameter, kNumFixedParams> parameters;
+ Vector<IntrinsicPrototype::Parameter, kNumFixedParams> parameters;
if (score == 0) {
parameters.Reserve(num_params);
for (size_t p = 0; p < num_params; p++) {
@@ -1555,9 +1554,9 @@
Impl::Candidate Impl::ResolveCandidate(Impl::Candidates&& candidates,
const char* intrinsic_name,
- utils::VectorRef<const type::Type*> args,
+ VectorRef<const type::Type*> args,
TemplateState templates) const {
- utils::Vector<uint32_t, kNumFixedParams> best_ranks;
+ Vector<uint32_t, kNumFixedParams> best_ranks;
best_ranks.Resize(args.Length(), 0xffffffff);
size_t num_matched = 0;
Candidate* best = nullptr;
@@ -1625,7 +1624,7 @@
return MatchState(builder, templates, matchers, overload, matcher_indices, earliest_eval_stage);
}
-void Impl::PrintOverload(utils::StringStream& ss,
+void Impl::PrintOverload(StringStream& ss,
const OverloadInfo* overload,
const char* intrinsic_name) const {
TemplateState templates;
@@ -1697,8 +1696,8 @@
}
}
-void Impl::PrintCandidates(utils::StringStream& ss,
- utils::VectorRef<Candidate> candidates,
+void Impl::PrintCandidates(StringStream& ss,
+ VectorRef<Candidate> candidates,
const char* intrinsic_name) const {
for (auto& candidate : candidates) {
ss << " ";
@@ -1732,10 +1731,10 @@
}
void Impl::ErrAmbiguousOverload(const char* intrinsic_name,
- utils::VectorRef<const type::Type*> args,
+ VectorRef<const type::Type*> args,
TemplateState templates,
- utils::VectorRef<Candidate> candidates) const {
- utils::StringStream ss;
+ VectorRef<Candidate> candidates) const {
+ StringStream ss;
ss << "ambiguous overload while attempting to match " << intrinsic_name;
for (size_t i = 0; i < std::numeric_limits<size_t>::max(); i++) {
if (auto* ty = templates.Type(i)) {
diff --git a/src/tint/lang/wgsl/resolver/intrinsic_table.h b/src/tint/lang/wgsl/resolver/intrinsic_table.h
index 5737ae7..0f8cf05 100644
--- a/src/tint/lang/wgsl/resolver/intrinsic_table.h
+++ b/src/tint/lang/wgsl/resolver/intrinsic_table.h
@@ -93,7 +93,7 @@
/// @param source the source of the builtin call
/// @return the semantic builtin if found, otherwise nullptr
virtual Builtin Lookup(builtin::Function type,
- utils::VectorRef<const type::Type*> args,
+ VectorRef<const type::Type*> args,
sem::EvaluationStage earliest_eval_stage,
const Source& source) = 0;
@@ -152,7 +152,7 @@
/// @return a sem::ValueConstructor, sem::ValueConversion or nullptr if nothing matched
virtual CtorOrConv Lookup(CtorConvIntrinsic type,
const type::Type* template_arg,
- utils::VectorRef<const type::Type*> args,
+ VectorRef<const type::Type*> args,
sem::EvaluationStage earliest_eval_stage,
const Source& source) = 0;
};
diff --git a/src/tint/lang/wgsl/resolver/intrinsic_table.inl b/src/tint/lang/wgsl/resolver/intrinsic_table.inl
index 81424cb..1e01f78 100644
--- a/src/tint/lang/wgsl/resolver/intrinsic_table.inl
+++ b/src/tint/lang/wgsl/resolver/intrinsic_table.inl
@@ -71,7 +71,7 @@
}
std::string Ia::String(MatchState*) const {
- utils::StringStream ss;
+ StringStream ss;
ss << "abstract-int";
return ss.str();
}
@@ -99,7 +99,7 @@
}
std::string Fa::String(MatchState*) const {
- utils::StringStream ss;
+ StringStream ss;
ss << "abstract-float";
return ss.str();
}
@@ -627,7 +627,7 @@
std::string Vec::String(MatchState* state) const {
const std::string N = state->NumName();
const std::string T = state->TypeName();
- utils::StringStream ss;
+ StringStream ss;
ss << "vec" << N << "<" << T << ">";
return ss.str();
}
@@ -673,7 +673,7 @@
const std::string N = state->NumName();
const std::string M = state->NumName();
const std::string T = state->TypeName();
- utils::StringStream ss;
+ StringStream ss;
ss << "mat" << N << "x" << M << "<" << T << ">";
return ss.str();
}
@@ -1431,7 +1431,7 @@
std::string ModfResult::String(MatchState* state) const {
const std::string T = state->TypeName();
- utils::StringStream ss;
+ StringStream ss;
ss << "__modf_result_" << T;
return ss.str();
}
@@ -1471,7 +1471,7 @@
std::string ModfResultVec::String(MatchState* state) const {
const std::string N = state->NumName();
const std::string T = state->TypeName();
- utils::StringStream ss;
+ StringStream ss;
ss << "__modf_result_vec" << N << "_" << T;
return ss.str();
}
@@ -1505,7 +1505,7 @@
std::string FrexpResult::String(MatchState* state) const {
const std::string T = state->TypeName();
- utils::StringStream ss;
+ StringStream ss;
ss << "__frexp_result_" << T;
return ss.str();
}
@@ -1545,7 +1545,7 @@
std::string FrexpResultVec::String(MatchState* state) const {
const std::string N = state->NumName();
const std::string T = state->TypeName();
- utils::StringStream ss;
+ StringStream ss;
ss << "__frexp_result_vec" << N << "_" << T;
return ss.str();
}
@@ -1624,7 +1624,7 @@
}
std::string Scalar::String(MatchState*) const {
- utils::StringStream ss;
+ StringStream ss;
// Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support
// template arguments, nor can they match sub-types. As such, they have no use for the MatchState.
ss << Ia().String(nullptr) << ", " << Fa().String(nullptr) << ", " << F32().String(nullptr) << ", " << F16().String(nullptr) << ", " << I32().String(nullptr) << ", " << U32().String(nullptr) << " or " << Bool().String(nullptr);
@@ -1667,7 +1667,7 @@
}
std::string ConcreteScalar::String(MatchState*) const {
- utils::StringStream ss;
+ StringStream ss;
// Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support
// template arguments, nor can they match sub-types. As such, they have no use for the MatchState.
ss << F32().String(nullptr) << ", " << F16().String(nullptr) << ", " << I32().String(nullptr) << ", " << U32().String(nullptr) << " or " << Bool().String(nullptr);
@@ -1713,7 +1713,7 @@
}
std::string ScalarNoF32::String(MatchState*) const {
- utils::StringStream ss;
+ StringStream ss;
// Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support
// template arguments, nor can they match sub-types. As such, they have no use for the MatchState.
ss << Ia().String(nullptr) << ", " << Fa().String(nullptr) << ", " << I32().String(nullptr) << ", " << F16().String(nullptr) << ", " << U32().String(nullptr) << " or " << Bool().String(nullptr);
@@ -1759,7 +1759,7 @@
}
std::string ScalarNoF16::String(MatchState*) const {
- utils::StringStream ss;
+ StringStream ss;
// Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support
// template arguments, nor can they match sub-types. As such, they have no use for the MatchState.
ss << Ia().String(nullptr) << ", " << Fa().String(nullptr) << ", " << F32().String(nullptr) << ", " << I32().String(nullptr) << ", " << U32().String(nullptr) << " or " << Bool().String(nullptr);
@@ -1805,7 +1805,7 @@
}
std::string ScalarNoI32::String(MatchState*) const {
- utils::StringStream ss;
+ StringStream ss;
// Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support
// template arguments, nor can they match sub-types. As such, they have no use for the MatchState.
ss << Ia().String(nullptr) << ", " << Fa().String(nullptr) << ", " << F32().String(nullptr) << ", " << F16().String(nullptr) << ", " << U32().String(nullptr) << " or " << Bool().String(nullptr);
@@ -1851,7 +1851,7 @@
}
std::string ScalarNoU32::String(MatchState*) const {
- utils::StringStream ss;
+ StringStream ss;
// Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support
// template arguments, nor can they match sub-types. As such, they have no use for the MatchState.
ss << Ia().String(nullptr) << ", " << Fa().String(nullptr) << ", " << F32().String(nullptr) << ", " << F16().String(nullptr) << ", " << I32().String(nullptr) << " or " << Bool().String(nullptr);
@@ -1897,7 +1897,7 @@
}
std::string ScalarNoBool::String(MatchState*) const {
- utils::StringStream ss;
+ StringStream ss;
// Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support
// template arguments, nor can they match sub-types. As such, they have no use for the MatchState.
ss << Ia().String(nullptr) << ", " << Fa().String(nullptr) << ", " << F32().String(nullptr) << ", " << F16().String(nullptr) << ", " << I32().String(nullptr) << " or " << U32().String(nullptr);
@@ -1943,7 +1943,7 @@
}
std::string FiaFiu32F16::String(MatchState*) const {
- utils::StringStream ss;
+ StringStream ss;
// Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support
// template arguments, nor can they match sub-types. As such, they have no use for the MatchState.
ss << Fa().String(nullptr) << ", " << Ia().String(nullptr) << ", " << F32().String(nullptr) << ", " << I32().String(nullptr) << ", " << U32().String(nullptr) << " or " << F16().String(nullptr);
@@ -1986,7 +1986,7 @@
}
std::string FiaFi32F16::String(MatchState*) const {
- utils::StringStream ss;
+ StringStream ss;
// Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support
// template arguments, nor can they match sub-types. As such, they have no use for the MatchState.
ss << Fa().String(nullptr) << ", " << Ia().String(nullptr) << ", " << F32().String(nullptr) << ", " << I32().String(nullptr) << " or " << F16().String(nullptr);
@@ -2029,7 +2029,7 @@
}
std::string FiaFiu32::String(MatchState*) const {
- utils::StringStream ss;
+ StringStream ss;
// Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support
// template arguments, nor can they match sub-types. As such, they have no use for the MatchState.
ss << Fa().String(nullptr) << ", " << Ia().String(nullptr) << ", " << F32().String(nullptr) << ", " << I32().String(nullptr) << " or " << U32().String(nullptr);
@@ -2063,7 +2063,7 @@
}
std::string FaF32::String(MatchState*) const {
- utils::StringStream ss;
+ StringStream ss;
// Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support
// template arguments, nor can they match sub-types. As such, they have no use for the MatchState.
ss << Fa().String(nullptr) << " or " << F32().String(nullptr);
@@ -2100,7 +2100,7 @@
}
std::string FaF32F16::String(MatchState*) const {
- utils::StringStream ss;
+ StringStream ss;
// Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support
// template arguments, nor can they match sub-types. As such, they have no use for the MatchState.
ss << Fa().String(nullptr) << ", " << F32().String(nullptr) << " or " << F16().String(nullptr);
@@ -2137,7 +2137,7 @@
}
std::string IaIu32::String(MatchState*) const {
- utils::StringStream ss;
+ StringStream ss;
// Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support
// template arguments, nor can they match sub-types. As such, they have no use for the MatchState.
ss << Ia().String(nullptr) << ", " << I32().String(nullptr) << " or " << U32().String(nullptr);
@@ -2171,7 +2171,7 @@
}
std::string IaI32::String(MatchState*) const {
- utils::StringStream ss;
+ StringStream ss;
// Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support
// template arguments, nor can they match sub-types. As such, they have no use for the MatchState.
ss << Ia().String(nullptr) << " or " << I32().String(nullptr);
@@ -2211,7 +2211,7 @@
}
std::string Fiu32F16::String(MatchState*) const {
- utils::StringStream ss;
+ StringStream ss;
// Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support
// template arguments, nor can they match sub-types. As such, they have no use for the MatchState.
ss << F32().String(nullptr) << ", " << I32().String(nullptr) << ", " << U32().String(nullptr) << " or " << F16().String(nullptr);
@@ -2248,7 +2248,7 @@
}
std::string Fiu32::String(MatchState*) const {
- utils::StringStream ss;
+ StringStream ss;
// Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support
// template arguments, nor can they match sub-types. As such, they have no use for the MatchState.
ss << F32().String(nullptr) << ", " << I32().String(nullptr) << " or " << U32().String(nullptr);
@@ -2285,7 +2285,7 @@
}
std::string Fi32F16::String(MatchState*) const {
- utils::StringStream ss;
+ StringStream ss;
// Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support
// template arguments, nor can they match sub-types. As such, they have no use for the MatchState.
ss << F32().String(nullptr) << ", " << I32().String(nullptr) << " or " << F16().String(nullptr);
@@ -2319,7 +2319,7 @@
}
std::string Fi32::String(MatchState*) const {
- utils::StringStream ss;
+ StringStream ss;
// Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support
// template arguments, nor can they match sub-types. As such, they have no use for the MatchState.
ss << F32().String(nullptr) << " or " << I32().String(nullptr);
@@ -2353,7 +2353,7 @@
}
std::string F32F16::String(MatchState*) const {
- utils::StringStream ss;
+ StringStream ss;
// Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support
// template arguments, nor can they match sub-types. As such, they have no use for the MatchState.
ss << F32().String(nullptr) << " or " << F16().String(nullptr);
@@ -2387,7 +2387,7 @@
}
std::string Iu32::String(MatchState*) const {
- utils::StringStream ss;
+ StringStream ss;
// Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support
// template arguments, nor can they match sub-types. As such, they have no use for the MatchState.
ss << I32().String(nullptr) << " or " << U32().String(nullptr);
diff --git a/src/tint/lang/wgsl/resolver/intrinsic_table.inl.tmpl b/src/tint/lang/wgsl/resolver/intrinsic_table.inl.tmpl
index 4769a3c..2410b07 100644
--- a/src/tint/lang/wgsl/resolver/intrinsic_table.inl.tmpl
+++ b/src/tint/lang/wgsl/resolver/intrinsic_table.inl.tmpl
@@ -221,7 +221,7 @@
{{- end }}
{{- if .DisplayName }}
- utils::StringStream ss;
+ StringStream ss;
ss{{range SplitDisplayName .DisplayName}} << {{.}}{{end}};
return ss.str();
{{- else if .TemplateParams }}
@@ -264,7 +264,7 @@
}
std::string {{$class}}::String(MatchState*) const {
- utils::StringStream ss;
+ StringStream ss;
// Note: We pass nullptr to the TypeMatcher::String() functions, as 'matcher's do not support
// template arguments, nor can they match sub-types. As such, they have no use for the MatchState.
ss
diff --git a/src/tint/lang/wgsl/resolver/intrinsic_table_test.cc b/src/tint/lang/wgsl/resolver/intrinsic_table_test.cc
index e2e6a2d..fbfe9b7 100644
--- a/src/tint/lang/wgsl/resolver/intrinsic_table_test.cc
+++ b/src/tint/lang/wgsl/resolver/intrinsic_table_test.cc
@@ -54,7 +54,7 @@
TEST_F(IntrinsicTableTest, MatchF32) {
auto* f32 = create<type::F32>();
- auto result = table->Lookup(builtin::Function::kCos, utils::Vector{f32},
+ auto result = table->Lookup(builtin::Function::kCos, Vector{f32},
sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
@@ -66,7 +66,7 @@
TEST_F(IntrinsicTableTest, MismatchF32) {
auto* i32 = create<type::I32>();
- auto result = table->Lookup(builtin::Function::kCos, utils::Vector{i32},
+ auto result = table->Lookup(builtin::Function::kCos, Vector{i32},
sem::EvaluationStage::kConstant, Source{});
ASSERT_EQ(result.sem, nullptr);
ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call"));
@@ -76,7 +76,7 @@
auto* f32 = create<type::F32>();
auto* u32 = create<type::U32>();
auto* vec2_f32 = create<type::Vector>(f32, 2u);
- auto result = table->Lookup(builtin::Function::kUnpack2X16Float, utils::Vector{u32},
+ auto result = table->Lookup(builtin::Function::kUnpack2X16Float, Vector{u32},
sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
@@ -88,7 +88,7 @@
TEST_F(IntrinsicTableTest, MismatchU32) {
auto* f32 = create<type::F32>();
- auto result = table->Lookup(builtin::Function::kUnpack2X16Float, utils::Vector{f32},
+ auto result = table->Lookup(builtin::Function::kUnpack2X16Float, Vector{f32},
sem::EvaluationStage::kConstant, Source{});
ASSERT_EQ(result.sem, nullptr);
ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call"));
@@ -99,7 +99,7 @@
auto* i32 = create<type::I32>();
auto* vec4_f32 = create<type::Vector>(f32, 4u);
auto* tex = create<type::SampledTexture>(type::TextureDimension::k1d, f32);
- auto result = table->Lookup(builtin::Function::kTextureLoad, utils::Vector{tex, i32, i32},
+ auto result = table->Lookup(builtin::Function::kTextureLoad, Vector{tex, i32, i32},
sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
@@ -117,7 +117,7 @@
TEST_F(IntrinsicTableTest, MismatchI32) {
auto* f32 = create<type::F32>();
auto* tex = create<type::SampledTexture>(type::TextureDimension::k1d, f32);
- auto result = table->Lookup(builtin::Function::kTextureLoad, utils::Vector{tex, f32},
+ auto result = table->Lookup(builtin::Function::kTextureLoad, Vector{tex, f32},
sem::EvaluationStage::kConstant, Source{});
ASSERT_EQ(result.sem, nullptr);
ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call"));
@@ -125,7 +125,7 @@
TEST_F(IntrinsicTableTest, MatchIU32AsI32) {
auto* i32 = create<type::I32>();
- auto result = table->Lookup(builtin::Function::kCountOneBits, utils::Vector{i32},
+ auto result = table->Lookup(builtin::Function::kCountOneBits, Vector{i32},
sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
@@ -137,7 +137,7 @@
TEST_F(IntrinsicTableTest, MatchIU32AsU32) {
auto* u32 = create<type::U32>();
- auto result = table->Lookup(builtin::Function::kCountOneBits, utils::Vector{u32},
+ auto result = table->Lookup(builtin::Function::kCountOneBits, Vector{u32},
sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
@@ -149,7 +149,7 @@
TEST_F(IntrinsicTableTest, MismatchIU32) {
auto* f32 = create<type::F32>();
- auto result = table->Lookup(builtin::Function::kCountOneBits, utils::Vector{f32},
+ auto result = table->Lookup(builtin::Function::kCountOneBits, Vector{f32},
sem::EvaluationStage::kConstant, Source{});
ASSERT_EQ(result.sem, nullptr);
ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call"));
@@ -157,7 +157,7 @@
TEST_F(IntrinsicTableTest, MatchFIU32AsI32) {
auto* i32 = create<type::I32>();
- auto result = table->Lookup(builtin::Function::kClamp, utils::Vector{i32, i32, i32},
+ auto result = table->Lookup(builtin::Function::kClamp, Vector{i32, i32, i32},
sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
@@ -171,7 +171,7 @@
TEST_F(IntrinsicTableTest, MatchFIU32AsU32) {
auto* u32 = create<type::U32>();
- auto result = table->Lookup(builtin::Function::kClamp, utils::Vector{u32, u32, u32},
+ auto result = table->Lookup(builtin::Function::kClamp, Vector{u32, u32, u32},
sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
@@ -185,7 +185,7 @@
TEST_F(IntrinsicTableTest, MatchFIU32AsF32) {
auto* f32 = create<type::F32>();
- auto result = table->Lookup(builtin::Function::kClamp, utils::Vector{f32, f32, f32},
+ auto result = table->Lookup(builtin::Function::kClamp, Vector{f32, f32, f32},
sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
@@ -199,7 +199,7 @@
TEST_F(IntrinsicTableTest, MismatchFIU32) {
auto* bool_ = create<type::Bool>();
- auto result = table->Lookup(builtin::Function::kClamp, utils::Vector{bool_, bool_, bool_},
+ auto result = table->Lookup(builtin::Function::kClamp, Vector{bool_, bool_, bool_},
sem::EvaluationStage::kConstant, Source{});
ASSERT_EQ(result.sem, nullptr);
ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call"));
@@ -208,7 +208,7 @@
TEST_F(IntrinsicTableTest, MatchBool) {
auto* f32 = create<type::F32>();
auto* bool_ = create<type::Bool>();
- auto result = table->Lookup(builtin::Function::kSelect, utils::Vector{f32, f32, bool_},
+ auto result = table->Lookup(builtin::Function::kSelect, Vector{f32, f32, bool_},
sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
@@ -222,7 +222,7 @@
TEST_F(IntrinsicTableTest, MismatchBool) {
auto* f32 = create<type::F32>();
- auto result = table->Lookup(builtin::Function::kSelect, utils::Vector{f32, f32, f32},
+ auto result = table->Lookup(builtin::Function::kSelect, Vector{f32, f32, f32},
sem::EvaluationStage::kConstant, Source{});
ASSERT_EQ(result.sem, nullptr);
ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call"));
@@ -233,7 +233,7 @@
auto* atomicI32 = create<type::Atomic>(i32);
auto* ptr = create<type::Pointer>(builtin::AddressSpace::kWorkgroup, atomicI32,
builtin::Access::kReadWrite);
- auto result = table->Lookup(builtin::Function::kAtomicLoad, utils::Vector{ptr},
+ auto result = table->Lookup(builtin::Function::kAtomicLoad, Vector{ptr},
sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
@@ -246,7 +246,7 @@
TEST_F(IntrinsicTableTest, MismatchPointer) {
auto* i32 = create<type::I32>();
auto* atomicI32 = create<type::Atomic>(i32);
- auto result = table->Lookup(builtin::Function::kAtomicLoad, utils::Vector{atomicI32},
+ auto result = table->Lookup(builtin::Function::kAtomicLoad, Vector{atomicI32},
sem::EvaluationStage::kConstant, Source{});
ASSERT_EQ(result.sem, nullptr);
ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call"));
@@ -257,7 +257,7 @@
create<type::Array>(create<type::U32>(), create<type::RuntimeArrayCount>(), 4u, 4u, 4u, 4u);
auto* arr_ptr =
create<type::Pointer>(builtin::AddressSpace::kStorage, arr, builtin::Access::kReadWrite);
- auto result = table->Lookup(builtin::Function::kArrayLength, utils::Vector{arr_ptr},
+ auto result = table->Lookup(builtin::Function::kArrayLength, Vector{arr_ptr},
sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
@@ -271,7 +271,7 @@
TEST_F(IntrinsicTableTest, MismatchArray) {
auto* f32 = create<type::F32>();
- auto result = table->Lookup(builtin::Function::kArrayLength, utils::Vector{f32},
+ auto result = table->Lookup(builtin::Function::kArrayLength, Vector{f32},
sem::EvaluationStage::kConstant, Source{});
ASSERT_EQ(result.sem, nullptr);
ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call"));
@@ -283,9 +283,8 @@
auto* vec4_f32 = create<type::Vector>(f32, 4u);
auto* tex = create<type::SampledTexture>(type::TextureDimension::k2d, f32);
auto* sampler = create<type::Sampler>(type::SamplerKind::kSampler);
- auto result =
- table->Lookup(builtin::Function::kTextureSample, utils::Vector{tex, sampler, vec2_f32},
- sem::EvaluationStage::kConstant, Source{});
+ auto result = table->Lookup(builtin::Function::kTextureSample, Vector{tex, sampler, vec2_f32},
+ sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
EXPECT_EQ(result.sem->Type(), builtin::Function::kTextureSample);
@@ -303,9 +302,8 @@
auto* f32 = create<type::F32>();
auto* vec2_f32 = create<type::Vector>(f32, 2u);
auto* tex = create<type::SampledTexture>(type::TextureDimension::k2d, f32);
- auto result =
- table->Lookup(builtin::Function::kTextureSample, utils::Vector{tex, f32, vec2_f32},
- sem::EvaluationStage::kConstant, Source{});
+ auto result = table->Lookup(builtin::Function::kTextureSample, Vector{tex, f32, vec2_f32},
+ sem::EvaluationStage::kConstant, Source{});
ASSERT_EQ(result.sem, nullptr);
ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call"));
}
@@ -316,7 +314,7 @@
auto* vec2_i32 = create<type::Vector>(i32, 2u);
auto* vec4_f32 = create<type::Vector>(f32, 4u);
auto* tex = create<type::SampledTexture>(type::TextureDimension::k2d, f32);
- auto result = table->Lookup(builtin::Function::kTextureLoad, utils::Vector{tex, vec2_i32, i32},
+ auto result = table->Lookup(builtin::Function::kTextureLoad, Vector{tex, vec2_i32, i32},
sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
@@ -337,7 +335,7 @@
auto* vec2_i32 = create<type::Vector>(i32, 2u);
auto* vec4_f32 = create<type::Vector>(f32, 4u);
auto* tex = create<type::MultisampledTexture>(type::TextureDimension::k2d, f32);
- auto result = table->Lookup(builtin::Function::kTextureLoad, utils::Vector{tex, vec2_i32, i32},
+ auto result = table->Lookup(builtin::Function::kTextureLoad, Vector{tex, vec2_i32, i32},
sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
@@ -357,7 +355,7 @@
auto* i32 = create<type::I32>();
auto* vec2_i32 = create<type::Vector>(i32, 2u);
auto* tex = create<type::DepthTexture>(type::TextureDimension::k2d);
- auto result = table->Lookup(builtin::Function::kTextureLoad, utils::Vector{tex, vec2_i32, i32},
+ auto result = table->Lookup(builtin::Function::kTextureLoad, Vector{tex, vec2_i32, i32},
sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
@@ -377,7 +375,7 @@
auto* i32 = create<type::I32>();
auto* vec2_i32 = create<type::Vector>(i32, 2u);
auto* tex = create<type::DepthMultisampledTexture>(type::TextureDimension::k2d);
- auto result = table->Lookup(builtin::Function::kTextureLoad, utils::Vector{tex, vec2_i32, i32},
+ auto result = table->Lookup(builtin::Function::kTextureLoad, Vector{tex, vec2_i32, i32},
sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
@@ -398,7 +396,7 @@
auto* vec2_i32 = create<type::Vector>(i32, 2u);
auto* vec4_f32 = create<type::Vector>(f32, 4u);
auto* tex = create<type::ExternalTexture>();
- auto result = table->Lookup(builtin::Function::kTextureLoad, utils::Vector{tex, vec2_i32},
+ auto result = table->Lookup(builtin::Function::kTextureLoad, Vector{tex, vec2_i32},
sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
@@ -421,9 +419,8 @@
create<type::StorageTexture>(type::TextureDimension::k2d, builtin::TexelFormat::kR32Float,
builtin::Access::kWrite, subtype);
- auto result =
- table->Lookup(builtin::Function::kTextureStore, utils::Vector{tex, vec2_i32, vec4_f32},
- sem::EvaluationStage::kConstant, Source{});
+ auto result = table->Lookup(builtin::Function::kTextureStore, Vector{tex, vec2_i32, vec4_f32},
+ sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
EXPECT_EQ(result.sem->Type(), builtin::Function::kTextureStore);
@@ -441,7 +438,7 @@
auto* f32 = create<type::F32>();
auto* i32 = create<type::I32>();
auto* vec2_i32 = create<type::Vector>(i32, 2u);
- auto result = table->Lookup(builtin::Function::kTextureLoad, utils::Vector{f32, vec2_i32},
+ auto result = table->Lookup(builtin::Function::kTextureLoad, Vector{f32, vec2_i32},
sem::EvaluationStage::kConstant, Source{});
ASSERT_EQ(result.sem, nullptr);
ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call"));
@@ -450,7 +447,7 @@
TEST_F(IntrinsicTableTest, ImplicitLoadOnReference) {
auto* f32 = create<type::F32>();
auto result = table->Lookup(builtin::Function::kCos,
- utils::Vector{
+ Vector{
create<type::Reference>(builtin::AddressSpace::kFunction, f32,
builtin::Access::kReadWrite),
},
@@ -465,7 +462,7 @@
TEST_F(IntrinsicTableTest, MatchTemplateType) {
auto* f32 = create<type::F32>();
- auto result = table->Lookup(builtin::Function::kClamp, utils::Vector{f32, f32, f32},
+ auto result = table->Lookup(builtin::Function::kClamp, Vector{f32, f32, f32},
sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
@@ -479,7 +476,7 @@
TEST_F(IntrinsicTableTest, MismatchTemplateType) {
auto* f32 = create<type::F32>();
auto* u32 = create<type::U32>();
- auto result = table->Lookup(builtin::Function::kClamp, utils::Vector{f32, u32, f32},
+ auto result = table->Lookup(builtin::Function::kClamp, Vector{f32, u32, f32},
sem::EvaluationStage::kConstant, Source{});
ASSERT_EQ(result.sem, nullptr);
ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call"));
@@ -488,9 +485,8 @@
TEST_F(IntrinsicTableTest, MatchOpenSizeVector) {
auto* f32 = create<type::F32>();
auto* vec2_f32 = create<type::Vector>(f32, 2u);
- auto result =
- table->Lookup(builtin::Function::kClamp, utils::Vector{vec2_f32, vec2_f32, vec2_f32},
- sem::EvaluationStage::kConstant, Source{});
+ auto result = table->Lookup(builtin::Function::kClamp, Vector{vec2_f32, vec2_f32, vec2_f32},
+ sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
EXPECT_EQ(result.sem->Type(), builtin::Function::kClamp);
@@ -505,7 +501,7 @@
auto* f32 = create<type::F32>();
auto* u32 = create<type::U32>();
auto* vec2_f32 = create<type::Vector>(f32, 2u);
- auto result = table->Lookup(builtin::Function::kClamp, utils::Vector{vec2_f32, u32, vec2_f32},
+ auto result = table->Lookup(builtin::Function::kClamp, Vector{vec2_f32, u32, vec2_f32},
sem::EvaluationStage::kConstant, Source{});
ASSERT_EQ(result.sem, nullptr);
ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call"));
@@ -515,7 +511,7 @@
auto* f32 = create<type::F32>();
auto* vec3_f32 = create<type::Vector>(f32, 3u);
auto* mat3_f32 = create<type::Matrix>(vec3_f32, 3u);
- auto result = table->Lookup(builtin::Function::kDeterminant, utils::Vector{mat3_f32},
+ auto result = table->Lookup(builtin::Function::kDeterminant, Vector{mat3_f32},
sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
@@ -529,7 +525,7 @@
auto* f32 = create<type::F32>();
auto* vec2_f32 = create<type::Vector>(f32, 2u);
auto* mat3x2_f32 = create<type::Matrix>(vec2_f32, 3u);
- auto result = table->Lookup(builtin::Function::kDeterminant, utils::Vector{mat3x2_f32},
+ auto result = table->Lookup(builtin::Function::kDeterminant, Vector{mat3x2_f32},
sem::EvaluationStage::kConstant, Source{});
ASSERT_EQ(result.sem, nullptr);
ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call"));
@@ -538,7 +534,7 @@
TEST_F(IntrinsicTableTest, MatchDifferentArgsElementType_Builtin_ConstantEval) {
auto* af = create<type::AbstractFloat>();
auto* bool_ = create<type::Bool>();
- auto result = table->Lookup(builtin::Function::kSelect, utils::Vector{af, af, bool_},
+ auto result = table->Lookup(builtin::Function::kSelect, Vector{af, af, bool_},
sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
@@ -555,7 +551,7 @@
auto* af = create<type::AbstractFloat>();
auto* bool_ref = create<type::Reference>(builtin::AddressSpace::kFunction, create<type::Bool>(),
builtin::Access::kReadWrite);
- auto result = table->Lookup(builtin::Function::kSelect, utils::Vector{af, af, bool_ref},
+ auto result = table->Lookup(builtin::Function::kSelect, Vector{af, af, bool_ref},
sem::EvaluationStage::kRuntime, Source{});
ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
@@ -598,7 +594,7 @@
// None of the arguments match, so expect the overloads with 2 parameters to
// come first
auto* bool_ = create<type::Bool>();
- table->Lookup(builtin::Function::kTextureDimensions, utils::Vector{bool_, bool_},
+ table->Lookup(builtin::Function::kTextureDimensions, Vector{bool_, bool_},
sem::EvaluationStage::kConstant, Source{});
ASSERT_EQ(Diagnostics().str(),
R"(error: no matching call to textureDimensions(bool, bool)
@@ -637,7 +633,7 @@
TEST_F(IntrinsicTableTest, OverloadOrderByMatchingParameter) {
auto* tex = create<type::DepthTexture>(type::TextureDimension::k2d);
auto* bool_ = create<type::Bool>();
- table->Lookup(builtin::Function::kTextureDimensions, utils::Vector{tex, bool_},
+ table->Lookup(builtin::Function::kTextureDimensions, Vector{tex, bool_},
sem::EvaluationStage::kConstant, Source{});
ASSERT_EQ(Diagnostics().str(),
R"(error: no matching call to textureDimensions(texture_depth_2d, bool)
@@ -677,16 +673,16 @@
auto* f32 = create<type::F32>();
auto* vec2_f32 = create<type::Vector>(create<type::F32>(), 2u);
auto* bool_ = create<type::Bool>();
- auto a = table->Lookup(builtin::Function::kSelect, utils::Vector{f32, f32, bool_},
+ auto a = table->Lookup(builtin::Function::kSelect, Vector{f32, f32, bool_},
sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(a.sem, nullptr) << Diagnostics().str();
- auto b = table->Lookup(builtin::Function::kSelect, utils::Vector{f32, f32, bool_},
+ auto b = table->Lookup(builtin::Function::kSelect, Vector{f32, f32, bool_},
sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(b.sem, nullptr) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
- auto c = table->Lookup(builtin::Function::kSelect, utils::Vector{vec2_f32, vec2_f32, bool_},
+ auto c = table->Lookup(builtin::Function::kSelect, Vector{vec2_f32, vec2_f32, bool_},
sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(c.sem, nullptr) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
@@ -806,7 +802,7 @@
TEST_F(IntrinsicTableTest, MatchTypeInitializerImplicit) {
auto* i32 = create<type::I32>();
auto* vec3_i32 = create<type::Vector>(i32, 3u);
- auto result = table->Lookup(CtorConvIntrinsic::kVec3, nullptr, utils::Vector{i32, i32, i32},
+ auto result = table->Lookup(CtorConvIntrinsic::kVec3, nullptr, Vector{i32, i32, i32},
sem::EvaluationStage::kConstant, Source{{12, 34}});
ASSERT_NE(result.target, nullptr);
EXPECT_EQ(result.target->ReturnType(), vec3_i32);
@@ -821,7 +817,7 @@
TEST_F(IntrinsicTableTest, MatchTypeInitializerExplicit) {
auto* i32 = create<type::I32>();
auto* vec3_i32 = create<type::Vector>(i32, 3u);
- auto result = table->Lookup(CtorConvIntrinsic::kVec3, i32, utils::Vector{i32, i32, i32},
+ auto result = table->Lookup(CtorConvIntrinsic::kVec3, i32, Vector{i32, i32, i32},
sem::EvaluationStage::kConstant, Source{{12, 34}});
ASSERT_NE(result.target, nullptr);
EXPECT_EQ(result.target->ReturnType(), vec3_i32);
@@ -836,7 +832,7 @@
TEST_F(IntrinsicTableTest, MismatchTypeInitializerImplicit) {
auto* i32 = create<type::I32>();
auto* f32 = create<type::F32>();
- auto result = table->Lookup(CtorConvIntrinsic::kVec3, nullptr, utils::Vector{i32, f32, i32},
+ auto result = table->Lookup(CtorConvIntrinsic::kVec3, nullptr, Vector{i32, f32, i32},
sem::EvaluationStage::kConstant, Source{{12, 34}});
ASSERT_EQ(result.target, nullptr);
EXPECT_EQ(Diagnostics().str(),
@@ -863,7 +859,7 @@
TEST_F(IntrinsicTableTest, MismatchTypeInitializerExplicit) {
auto* i32 = create<type::I32>();
auto* f32 = create<type::F32>();
- auto result = table->Lookup(CtorConvIntrinsic::kVec3, i32, utils::Vector{i32, f32, i32},
+ auto result = table->Lookup(CtorConvIntrinsic::kVec3, i32, Vector{i32, f32, i32},
sem::EvaluationStage::kConstant, Source{{12, 34}});
ASSERT_EQ(result.target, nullptr);
EXPECT_EQ(Diagnostics().str(),
@@ -890,7 +886,7 @@
TEST_F(IntrinsicTableTest, MatchTypeInitializerImplicitVecFromVecAbstract) {
auto* ai = create<type::AbstractInt>();
auto* vec3_ai = create<type::Vector>(ai, 3u);
- auto result = table->Lookup(CtorConvIntrinsic::kVec3, nullptr, utils::Vector{vec3_ai},
+ auto result = table->Lookup(CtorConvIntrinsic::kVec3, nullptr, Vector{vec3_ai},
sem::EvaluationStage::kConstant, Source{{12, 34}});
ASSERT_NE(result.target, nullptr);
EXPECT_EQ(result.target->ReturnType(), vec3_ai);
@@ -905,9 +901,8 @@
auto* vec2_ai = create<type::Vector>(create<type::AbstractInt>(), 2u);
auto* vec2_af = create<type::Vector>(af, 2u);
auto* mat2x2_af = create<type::Matrix>(vec2_af, 2u);
- auto result =
- table->Lookup(CtorConvIntrinsic::kMat2x2, nullptr, utils::Vector{vec2_ai, vec2_ai},
- sem::EvaluationStage::kConstant, Source{{12, 34}});
+ auto result = table->Lookup(CtorConvIntrinsic::kMat2x2, nullptr, Vector{vec2_ai, vec2_ai},
+ sem::EvaluationStage::kConstant, Source{{12, 34}});
ASSERT_NE(result.target, nullptr);
EXPECT_TYPE(result.target->ReturnType(), mat2x2_af);
EXPECT_TRUE(result.target->Is<sem::ValueConstructor>());
@@ -920,7 +915,7 @@
TEST_F(IntrinsicTableTest, MatchTypeInitializer_ConstantEval) {
auto* ai = create<type::AbstractInt>();
auto* vec3_ai = create<type::Vector>(ai, 3u);
- auto result = table->Lookup(CtorConvIntrinsic::kVec3, nullptr, utils::Vector{ai, ai, ai},
+ auto result = table->Lookup(CtorConvIntrinsic::kVec3, nullptr, Vector{ai, ai, ai},
sem::EvaluationStage::kConstant, Source{{12, 34}});
ASSERT_NE(result.target, nullptr);
EXPECT_EQ(result.target->Stage(), sem::EvaluationStage::kConstant);
@@ -935,7 +930,7 @@
TEST_F(IntrinsicTableTest, MatchTypeInitializer_RuntimeEval) {
auto* ai = create<type::AbstractInt>();
- auto result = table->Lookup(CtorConvIntrinsic::kVec3, nullptr, utils::Vector{ai, ai, ai},
+ auto result = table->Lookup(CtorConvIntrinsic::kVec3, nullptr, Vector{ai, ai, ai},
sem::EvaluationStage::kRuntime, Source{{12, 34}});
auto* i32 = create<type::I32>();
auto* vec3_i32 = create<type::Vector>(i32, 3u);
@@ -955,7 +950,7 @@
auto* vec3_i32 = create<type::Vector>(i32, 3u);
auto* f32 = create<type::F32>();
auto* vec3_f32 = create<type::Vector>(f32, 3u);
- auto result = table->Lookup(CtorConvIntrinsic::kVec3, i32, utils::Vector{vec3_f32},
+ auto result = table->Lookup(CtorConvIntrinsic::kVec3, i32, Vector{vec3_f32},
sem::EvaluationStage::kConstant, Source{{12, 34}});
ASSERT_NE(result.target, nullptr);
EXPECT_EQ(result.target->ReturnType(), vec3_i32);
@@ -968,7 +963,7 @@
auto* arr =
create<type::Array>(create<type::U32>(), create<type::RuntimeArrayCount>(), 4u, 4u, 4u, 4u);
auto* f32 = create<type::F32>();
- auto result = table->Lookup(CtorConvIntrinsic::kVec3, f32, utils::Vector{arr},
+ auto result = table->Lookup(CtorConvIntrinsic::kVec3, f32, Vector{arr},
sem::EvaluationStage::kConstant, Source{{12, 34}});
ASSERT_EQ(result.target, nullptr);
EXPECT_EQ(Diagnostics().str(),
@@ -998,7 +993,7 @@
auto* vec3_ai = create<type::Vector>(ai, 3u);
auto* f32 = create<type::F32>();
auto* vec3_f32 = create<type::Vector>(f32, 3u);
- auto result = table->Lookup(CtorConvIntrinsic::kVec3, af, utils::Vector{vec3_ai},
+ auto result = table->Lookup(CtorConvIntrinsic::kVec3, af, Vector{vec3_ai},
sem::EvaluationStage::kConstant, Source{{12, 34}});
ASSERT_NE(result.target, nullptr);
EXPECT_EQ(result.target->Stage(), sem::EvaluationStage::kConstant);
@@ -1015,7 +1010,7 @@
auto* vec3_ai = create<type::Vector>(ai, 3u);
auto* vec3_f32 = create<type::Vector>(create<type::F32>(), 3u);
auto* vec3_i32 = create<type::Vector>(create<type::I32>(), 3u);
- auto result = table->Lookup(CtorConvIntrinsic::kVec3, af, utils::Vector{vec3_ai},
+ auto result = table->Lookup(CtorConvIntrinsic::kVec3, af, Vector{vec3_ai},
sem::EvaluationStage::kRuntime, Source{{12, 34}});
ASSERT_NE(result.target, nullptr);
EXPECT_EQ(result.target->Stage(), sem::EvaluationStage::kConstant);
@@ -1027,7 +1022,7 @@
TEST_F(IntrinsicTableTest, Err257Arguments) { // crbug.com/1323605
auto* f32 = create<type::F32>();
- utils::Vector<const type::Type*, 0> arg_tys;
+ Vector<const type::Type*, 0> arg_tys;
arg_tys.Resize(257, f32);
auto result = table->Lookup(builtin::Function::kAbs, std::move(arg_tys),
sem::EvaluationStage::kConstant, Source{});
@@ -1042,7 +1037,7 @@
// The first should win overload resolution.
auto* ai = create<type::AbstractInt>();
auto* i32 = create<type::I32>();
- auto result = table->Lookup(CtorConvIntrinsic::kI32, nullptr, utils::Vector{ai},
+ auto result = table->Lookup(CtorConvIntrinsic::kI32, nullptr, Vector{ai},
sem::EvaluationStage::kConstant, Source{});
ASSERT_NE(result.target, nullptr);
EXPECT_EQ(result.target->ReturnType(), i32);
@@ -1268,7 +1263,7 @@
auto* arg_a = GetParam().arg_a(*this);
auto* arg_b = GetParam().arg_b(*this);
auto* arg_c = GetParam().arg_c(*this);
- auto builtin = table->Lookup(builtin::Function::kClamp, utils::Vector{arg_a, arg_b, arg_c},
+ auto builtin = table->Lookup(builtin::Function::kClamp, Vector{arg_a, arg_b, arg_c},
sem::EvaluationStage::kConstant, Source{{12, 34}});
bool matched = builtin.sem != nullptr;
diff --git a/src/tint/lang/wgsl/resolver/is_storeable_test.cc b/src/tint/lang/wgsl/resolver/is_storeable_test.cc
index ac11d45..348514a 100644
--- a/src/tint/lang/wgsl/resolver/is_storeable_test.cc
+++ b/src/tint/lang/wgsl/resolver/is_storeable_test.cc
@@ -103,7 +103,7 @@
}
TEST_F(ResolverIsStorableTest, Struct_AllMembersStorable) {
- Structure("S", utils::Vector{
+ Structure("S", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
});
@@ -112,7 +112,7 @@
}
TEST_F(ResolverIsStorableTest, Struct_SomeMembersNonStorable) {
- Structure("S", utils::Vector{
+ Structure("S", Vector{
Member("a", ty.i32()),
Member("b", ty.ptr<private_, i32>()),
});
@@ -124,11 +124,11 @@
}
TEST_F(ResolverIsStorableTest, Struct_NestedStorable) {
- auto* storable = Structure("Storable", utils::Vector{
+ auto* storable = Structure("Storable", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
});
- Structure("S", utils::Vector{
+ Structure("S", Vector{
Member("a", ty.i32()),
Member("b", ty.Of(storable)),
});
@@ -137,11 +137,11 @@
}
TEST_F(ResolverIsStorableTest, Struct_NestedNonStorable) {
- auto* non_storable = Structure("nonstorable", utils::Vector{
+ auto* non_storable = Structure("nonstorable", Vector{
Member("a", ty.i32()),
Member("b", ty.ptr<private_, i32>()),
});
- Structure("S", utils::Vector{
+ Structure("S", Vector{
Member("a", ty.i32()),
Member("b", ty.Of(non_storable)),
});
diff --git a/src/tint/lang/wgsl/resolver/load_test.cc b/src/tint/lang/wgsl/resolver/load_test.cc
index 60fc9ff..137a32e 100644
--- a/src/tint/lang/wgsl/resolver/load_test.cc
+++ b/src/tint/lang/wgsl/resolver/load_test.cc
@@ -200,7 +200,7 @@
// fn f(x : f32) {}
// var ref = 1f;
// f(ref);
- Func("f", utils::Vector{Param("x", ty.f32())}, ty.void_(), utils::Empty);
+ Func("f", Vector{Param("x", ty.f32())}, ty.void_(), tint::Empty);
auto* ident = Expr("ref");
WrapInFunction(Var("ref", Expr(1_f)), //
CallStmt(Call("f", ident)));
@@ -221,16 +221,15 @@
// }
// f(t, s);
GlobalVar("t", ty.sampled_texture(type::TextureDimension::k2d, ty.f32()),
- utils::Vector{Group(0_a), Binding(0_a)});
- GlobalVar("s", ty.sampler(type::SamplerKind::kSampler),
- utils::Vector{Group(0_a), Binding(1_a)});
+ Vector{Group(0_a), Binding(0_a)});
+ GlobalVar("s", ty.sampler(type::SamplerKind::kSampler), Vector{Group(0_a), Binding(1_a)});
Func("f",
- utils::Vector{
+ Vector{
Param("tp", ty.sampled_texture(type::TextureDimension::k2d, ty.f32())),
Param("sp", ty.sampler(type::SamplerKind::kSampler)),
},
ty.vec4<f32>(),
- utils::Vector{
+ Vector{
Return(Call("textureSampleLevel", "tp", "sp", Call<vec2<f32>>(), 0_a)),
});
auto* t_ident = Expr("t");
@@ -259,8 +258,8 @@
// var ref = 1f;
// return ref;
auto* ident = Expr("ref");
- Func("f", utils::Empty, ty.f32(),
- utils::Vector{
+ Func("f", tint::Empty, ty.f32(),
+ Vector{
Decl(Var("ref", Expr(1_f))),
Return(ident),
});
diff --git a/src/tint/lang/wgsl/resolver/materialize_test.cc b/src/tint/lang/wgsl/resolver/materialize_test.cc
index 00e4038..bdd0c70 100644
--- a/src/tint/lang/wgsl/resolver/materialize_test.cc
+++ b/src/tint/lang/wgsl/resolver/materialize_test.cc
@@ -342,20 +342,20 @@
WrapInFunction(Assign(Phony(), abstract_expr));
break;
case Method::kFnArg:
- Func("F", utils::Vector{Param("P", target_ty())}, ty.void_(), utils::Empty);
+ Func("F", Vector{Param("P", target_ty())}, ty.void_(), tint::Empty);
WrapInFunction(CallStmt(Call("F", abstract_expr)));
break;
case Method::kBuiltinArg:
WrapInFunction(Assign(Phony(), Call("min", target_expr(), abstract_expr)));
break;
case Method::kReturn:
- Func("F", utils::Empty, target_ty(), utils::Vector{Return(abstract_expr)});
+ Func("F", tint::Empty, target_ty(), Vector{Return(abstract_expr)});
break;
case Method::kArray:
WrapInFunction(Call(ty.array(target_ty(), 1_i), abstract_expr));
break;
case Method::kStruct:
- Structure("S", utils::Vector{Member("v", target_ty())});
+ Structure("S", Vector{Member("v", target_ty())});
WrapInFunction(Call("S", abstract_expr));
break;
case Method::kBinaryOp: {
@@ -390,9 +390,9 @@
DefaultCase()));
break;
case Method::kWorkgroupSize:
- Func("f", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{WorkgroupSize(target_expr(), abstract_expr, Expr(123_a)),
- Stage(ast::PipelineStage::kCompute)});
+ Func("f", tint::Empty, ty.void_(), tint::Empty,
+ Vector{WorkgroupSize(target_expr(), abstract_expr, Expr(123_a)),
+ Stage(ast::PipelineStage::kCompute)});
break;
case Method::kRuntimeIndex: {
auto* runtime_index = Var("runtime_index", Expr(1_i));
@@ -903,7 +903,7 @@
const auto& method = std::get<1>(param);
const auto& data = std::get<2>(param);
- utils::Vector<const ast::Expression*, 4> abstract_exprs;
+ Vector<const ast::Expression*, 4> abstract_exprs;
auto abstract_expr = [&] {
auto* expr = data.abstract_expr(*this, data.literal_value);
abstract_exprs.Push(expr);
@@ -938,9 +938,8 @@
break;
}
case Method::kWorkgroupSize: {
- Func(
- "f", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{WorkgroupSize(abstract_expr()), Stage(ast::PipelineStage::kCompute)});
+ Func("f", tint::Empty, ty.void_(), tint::Empty,
+ Vector{WorkgroupSize(abstract_expr()), Stage(ast::PipelineStage::kCompute)});
break;
}
case Method::kIndex: {
@@ -1232,7 +1231,7 @@
using MaterializeAbstractNumericToUnrelatedType = resolver::ResolverTest;
TEST_F(MaterializeAbstractNumericToUnrelatedType, AIntToStructVarInit) {
- Structure("S", utils::Vector{Member("a", ty.i32())});
+ Structure("S", Vector{Member("a", ty.i32())});
WrapInFunction(Decl(Var("v", ty("S"), Expr(Source{{12, 34}}, 1_a))));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(
@@ -1241,7 +1240,7 @@
}
TEST_F(MaterializeAbstractNumericToUnrelatedType, AIntToStructLetInit) {
- Structure("S", utils::Vector{Member("a", ty.i32())});
+ Structure("S", Vector{Member("a", ty.i32())});
WrapInFunction(Decl(Let("v", ty("S"), Expr(Source{{12, 34}}, 1_a))));
EXPECT_FALSE(r()->Resolve());
EXPECT_THAT(
diff --git a/src/tint/lang/wgsl/resolver/override_test.cc b/src/tint/lang/wgsl/resolver/override_test.cc
index ab0de10..875bd19 100644
--- a/src/tint/lang/wgsl/resolver/override_test.cc
+++ b/src/tint/lang/wgsl/resolver/override_test.cc
@@ -108,8 +108,8 @@
auto* a = Override("a", ty.f32());
auto* b = Override("b", ty.f32(), Expr(1_f));
Override("unused", ty.f32(), Expr(1_f));
- auto* func = Func("foo", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("foo", tint::Empty, ty.void_(),
+ Vector{
Assign(Phony(), "a"),
Assign(Phony(), "b"),
});
@@ -126,8 +126,8 @@
auto* a = Override("a", ty.f32());
auto* b = Override("b", ty.f32(), Mul(2_a, "a"));
Override("unused", ty.f32(), Expr(1_f));
- auto* func = Func("foo", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("foo", tint::Empty, ty.void_(),
+ Vector{
Assign(Phony(), "b"),
});
@@ -153,8 +153,8 @@
auto* a = Override("a", ty.f32());
auto* b = GlobalVar("b", builtin::AddressSpace::kPrivate, ty.f32(), Mul(2_a, "a"));
Override("unused", ty.f32(), Expr(1_f));
- auto* func = Func("foo", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("foo", tint::Empty, ty.void_(),
+ Vector{
Assign(Phony(), "b"),
});
@@ -180,11 +180,11 @@
auto* a = Override("a", ty.i32());
auto* b = Override("b", ty.i32(), Mul(2_a, "a"));
Override("unused", ty.i32(), Expr(1_a));
- auto* func = Func("foo", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("foo", tint::Empty, ty.void_(),
+ Vector{
Assign(Phony(), "b"),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(Mul(2_a, "b")),
});
@@ -204,8 +204,8 @@
GlobalVar("arr", builtin::AddressSpace::kWorkgroup, ty.array(ty.i32(), Mul(2_a, "b")));
auto arr_ty = arr->type;
Override("unused", ty.i32(), Expr(1_a));
- auto* func = Func("foo", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("foo", tint::Empty, ty.void_(),
+ Vector{
Assign(IndexAccessor("arr", 0_a), 42_a),
});
@@ -245,8 +245,8 @@
auto* arr = GlobalVar("arr", builtin::AddressSpace::kWorkgroup, ty("arr_ty"));
auto arr_ty = arr->type;
Override("unused", ty.i32(), Expr(1_a));
- auto* func = Func("foo", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("foo", tint::Empty, ty.void_(),
+ Vector{
Assign(IndexAccessor("arr", 0_a), 42_a),
});
@@ -291,19 +291,19 @@
auto* arr1 = GlobalVar("arr1", builtin::AddressSpace::kWorkgroup, ty("arr_ty1"));
auto* arr2 = GlobalVar("arr2", builtin::AddressSpace::kWorkgroup, ty("arr_ty2"));
Override("unused", ty.i32(), Expr(1_a));
- auto* func1 = Func("foo1", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func1 = Func("foo1", tint::Empty, ty.void_(),
+ Vector{
Assign(IndexAccessor("arr1", 0_a), 42_a),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(Mul(2_a, "d")),
});
- auto* func2 = Func("foo2", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func2 = Func("foo2", tint::Empty, ty.void_(),
+ Vector{
Assign(IndexAccessor("arr2", 0_a), 42_a),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(64_a),
});
diff --git a/src/tint/lang/wgsl/resolver/ptr_ref_test.cc b/src/tint/lang/wgsl/resolver/ptr_ref_test.cc
index 13cf70a..729c25d 100644
--- a/src/tint/lang/wgsl/resolver/ptr_ref_test.cc
+++ b/src/tint/lang/wgsl/resolver/ptr_ref_test.cc
@@ -66,7 +66,7 @@
TEST_F(ResolverPtrRefTest, DefaultPtrAddressSpace) {
// https://gpuweb.github.io/gpuweb/wgsl/#storage-class
- auto* buf = Structure("S", utils::Vector{Member("m", ty.i32())});
+ auto* buf = Structure("S", Vector{Member("m", ty.i32())});
auto* function = Var("f", ty.i32());
auto* private_ = GlobalVar("p", ty.i32(), builtin::AddressSpace::kPrivate);
auto* workgroup = GlobalVar("w", ty.i32(), builtin::AddressSpace::kWorkgroup);
diff --git a/src/tint/lang/wgsl/resolver/ptr_ref_validation_test.cc b/src/tint/lang/wgsl/resolver/ptr_ref_validation_test.cc
index 3fd5099..83d3cd8 100644
--- a/src/tint/lang/wgsl/resolver/ptr_ref_validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/ptr_ref_validation_test.cc
@@ -142,8 +142,8 @@
// fn f() {
// let p : pointer<storage, i32> = &s.inner.arr[2i];
// }
- auto* inner = Structure("Inner", utils::Vector{Member("arr", ty.array<i32, 4>())});
- auto* buf = Structure("S", utils::Vector{Member("inner", ty.Of(inner))});
+ auto* inner = Structure("Inner", Vector{Member("arr", ty.array<i32, 4>())});
+ auto* buf = Structure("S", Vector{Member("inner", ty.Of(inner))});
auto* var = GlobalVar("s", ty.Of(buf), builtin::AddressSpace::kStorage,
builtin::Access::kReadWrite, Binding(0_a), Group(0_a));
diff --git a/src/tint/lang/wgsl/resolver/resolver.cc b/src/tint/lang/wgsl/resolver/resolver.cc
index 60b5219..4fb716d 100644
--- a/src/tint/lang/wgsl/resolver/resolver.cc
+++ b/src/tint/lang/wgsl/resolver/resolver.cc
@@ -164,7 +164,7 @@
Mark(&builder_->AST());
// Process all module-scope declarations in dependency order.
- utils::Vector<const ast::DiagnosticControl*, 4> diagnostic_controls;
+ Vector<const ast::DiagnosticControl*, 4> diagnostic_controls;
for (auto* decl : dependencies_.ordered_globals) {
Mark(decl);
if (!Switch<bool>(
@@ -874,7 +874,7 @@
void Resolver::SetShadows() {
for (auto it : dependencies_.shadows) {
- utils::CastableBase* b = sem_.Get(it.value);
+ CastableBase* b = sem_.Get(it.value);
if (TINT_UNLIKELY(!b)) {
TINT_ICE(Resolver, diagnostics_)
<< "AST node '" << it.value->TypeInfo().name << "' had no semantic info\n"
@@ -890,7 +890,7 @@
}
sem::GlobalVariable* Resolver::GlobalVariable(const ast::Variable* v) {
- utils::UniqueVector<const sem::GlobalVariable*, 4> transitively_referenced_overrides;
+ UniqueVector<const sem::GlobalVariable*, 4> transitively_referenced_overrides;
TINT_SCOPED_ASSIGNMENT(resolved_overrides_, &transitively_referenced_overrides);
auto* sem = As<sem::GlobalVariable>(Variable(v, /* is_global */ true));
@@ -986,7 +986,7 @@
// Resolve all the parameters
uint32_t parameter_index = 0;
- utils::Hashmap<Symbol, Source, 8> parameter_names;
+ Hashmap<Symbol, Source, 8> parameter_names;
for (auto* param : decl->params) {
Mark(param);
@@ -1186,7 +1186,7 @@
return func;
}
-bool Resolver::Statements(utils::VectorRef<const ast::Statement*> stmts) {
+bool Resolver::Statements(VectorRef<const ast::Statement*> stmts) {
sem::Behaviors behaviors{sem::Behavior::kNext};
bool reachable = true;
@@ -1463,7 +1463,7 @@
}
sem::Expression* Resolver::Expression(const ast::Expression* root) {
- utils::Vector<const ast::Expression*, 64> sorted;
+ Vector<const ast::Expression*, 64> sorted;
constexpr size_t kMaxExpressionDepth = 512U;
bool failed = false;
if (!ast::TraverseExpressions<ast::TraverseOrder::RightToLeft>(
@@ -1494,7 +1494,7 @@
return nullptr;
}
- for (auto* expr : utils::Reverse(sorted)) {
+ for (auto* expr : tint::Reverse(sorted)) {
auto* sem_expr = Switch(
expr, //
[&](const ast::IndexAccessorExpression* array) { return IndexAccessor(array); },
@@ -1865,7 +1865,7 @@
}
template <size_t N>
-bool Resolver::MaybeMaterializeAndLoadArguments(utils::Vector<const sem::ValueExpression*, N>& args,
+bool Resolver::MaybeMaterializeAndLoadArguments(Vector<const sem::ValueExpression*, N>& args,
const sem::CallTarget* target) {
for (size_t i = 0, n = std::min(args.Length(), target->Parameters().Length()); i < n; i++) {
const auto* param_ty = target->Parameters()[i]->Type();
@@ -1904,14 +1904,14 @@
}
template <size_t N>
-utils::Result<utils::Vector<const constant::Value*, N>> Resolver::ConvertArguments(
- const utils::Vector<const sem::ValueExpression*, N>& args,
+tint::Result<Vector<const constant::Value*, N>> Resolver::ConvertArguments(
+ const Vector<const sem::ValueExpression*, N>& args,
const sem::CallTarget* target) {
- auto const_args = utils::Transform(args, [](auto* arg) { return arg->ConstantValue(); });
+ auto const_args = tint::Transform(args, [](auto* arg) { return arg->ConstantValue(); });
for (size_t i = 0, n = std::min(args.Length(), target->Parameters().Length()); i < n; i++) {
if (!Convert(const_args[i], target->Parameters()[i]->Type(),
args[i]->Declaration()->source)) {
- return utils::Failure;
+ return tint::Failure;
}
}
return const_args;
@@ -2026,7 +2026,7 @@
Mark(ident);
// Resolve all of the arguments, their types and the set of behaviors.
- utils::Vector<const sem::ValueExpression*, 8> args;
+ Vector<const sem::ValueExpression*, 8> args;
args.Reserve(expr->args.Length());
auto args_stage = sem::EvaluationStage::kConstant;
sem::Behaviors arg_behaviors;
@@ -2048,7 +2048,7 @@
// ctor_or_conv is a helper for building either a sem::ValueConstructor or
// sem::ValueConversion call for a CtorConvIntrinsic with an optional template argument type.
auto ctor_or_conv = [&](CtorConvIntrinsic ty, const type::Type* template_arg) -> sem::Call* {
- auto arg_tys = utils::Transform(args, [](auto* arg) { return arg->Type(); });
+ auto arg_tys = tint::Transform(args, [](auto* arg) { return arg->Type(); });
auto entry = intrinsic_table_->Lookup(ty, template_arg, arg_tys, args_stage, expr->source);
if (!entry.target) {
return nullptr;
@@ -2092,7 +2092,7 @@
stage = sem::EvaluationStage::kNotEvaluated;
}
if (stage == sem::EvaluationStage::kConstant) {
- auto els = utils::Transform(args, [&](auto* arg) { return arg->ConstantValue(); });
+ auto els = tint::Transform(args, [&](auto* arg) { return arg->ConstantValue(); });
if (auto r = const_eval_.ArrayOrStructCtor(ty, std::move(els))) {
value = r.Get();
} else {
@@ -2138,7 +2138,7 @@
auto* call_target = array_ctors_.GetOrCreate(
ArrayConstructorSig{{arr, args.Length(), args_stage}},
[&]() -> sem::ValueConstructor* {
- auto params = utils::Transform(args, [&](auto, size_t i) {
+ auto params = tint::Transform(args, [&](auto, size_t i) {
return builder_->create<sem::Parameter>(
nullptr, // declaration
static_cast<uint32_t>(i), // index
@@ -2165,7 +2165,7 @@
auto* call_target = struct_ctors_.GetOrCreate(
StructConstructorSig{{str, args.Length(), args_stage}},
[&]() -> sem::ValueConstructor* {
- utils::Vector<sem::Parameter*, 8> params;
+ Vector<sem::Parameter*, 8> params;
params.Resize(std::min(args.Length(), str->Members().Length()));
for (size_t i = 0, n = params.Length(); i < n; i++) {
params[i] = builder_->create<sem::Parameter>(
@@ -2199,12 +2199,12 @@
auto inferred_array = [&]() -> tint::sem::Call* {
auto el_count =
builder_->create<type::ConstantArrayCount>(static_cast<uint32_t>(args.Length()));
- auto arg_tys = utils::Transform(args, [](auto* arg) { return arg->Type()->UnwrapRef(); });
+ auto arg_tys = tint::Transform(args, [](auto* arg) { return arg->Type()->UnwrapRef(); });
auto el_ty = type::Type::Common(arg_tys);
if (!el_ty) {
AddError("cannot infer common array element type from constructor arguments",
expr->source);
- utils::Hashset<const type::Type*, 8> types;
+ Hashset<const type::Type*, 8> types;
for (size_t i = 0; i < args.Length(); i++) {
if (types.Add(args[i]->Type())) {
AddNote("argument " + std::to_string(i) + " is of type '" +
@@ -2326,7 +2326,7 @@
template <size_t N>
sem::Call* Resolver::BuiltinCall(const ast::CallExpression* expr,
builtin::Function builtin_type,
- utils::Vector<const sem::ValueExpression*, N>& args) {
+ Vector<const sem::ValueExpression*, N>& args) {
auto arg_stage = sem::EvaluationStage::kConstant;
for (auto* arg : args) {
arg_stage = sem::EarliestStage(arg_stage, arg->Stage());
@@ -2334,7 +2334,7 @@
IntrinsicTable::Builtin builtin;
{
- auto arg_tys = utils::Transform(args, [](auto* arg) { return arg->Type(); });
+ auto arg_tys = tint::Transform(args, [](auto* arg) { return arg->Type(); });
builtin = intrinsic_table_->Lookup(builtin_type, arg_tys, arg_stage, expr->source);
if (!builtin.sem) {
return nullptr;
@@ -2507,7 +2507,7 @@
return mat(const_cast<type::Type*>(ty), num_columns, num_rows);
};
auto array = [&]() -> type::Array* {
- utils::UniqueVector<const sem::GlobalVariable*, 4> transitively_referenced_overrides;
+ UniqueVector<const sem::GlobalVariable*, 4> transitively_referenced_overrides;
TINT_SCOPED_ASSIGNMENT(resolved_overrides_, &transitively_referenced_overrides);
auto* tmpl_ident = templated_identifier(1, 2);
@@ -2899,9 +2899,8 @@
});
}
-void Resolver::CollectTextureSamplerPairs(
- const sem::Builtin* builtin,
- utils::VectorRef<const sem::ValueExpression*> args) const {
+void Resolver::CollectTextureSamplerPairs(const sem::Builtin* builtin,
+ VectorRef<const sem::ValueExpression*> args) const {
// Collect a texture/sampler pair for this builtin.
const auto& signature = builtin->Signature();
int texture_index = signature.IndexOf(sem::ParameterUsage::kTexture);
@@ -2927,7 +2926,7 @@
template <size_t N>
sem::Call* Resolver::FunctionCall(const ast::CallExpression* expr,
sem::Function* target,
- utils::Vector<const sem::ValueExpression*, N>& args,
+ Vector<const sem::ValueExpression*, N>& args,
sem::Behaviors arg_behaviors) {
if (!MaybeMaterializeAndLoadArguments(args, target)) {
return nullptr;
@@ -2979,9 +2978,8 @@
return call;
}
-void Resolver::CollectTextureSamplerPairs(
- sem::Function* func,
- utils::VectorRef<const sem::ValueExpression*> args) const {
+void Resolver::CollectTextureSamplerPairs(sem::Function* func,
+ VectorRef<const sem::ValueExpression*> args) const {
// Map all texture/sampler pairs from the target function to the
// current function. These can only be global or parameter
// variables. Resolve any parameter variables to the corresponding
@@ -3238,15 +3236,15 @@
expr->source);
if (!identifier_resolve_hint_.suggestions.IsEmpty()) {
// Filter out suggestions that have a leading underscore.
- utils::Vector<const char*, 8> filtered;
+ Vector<const char*, 8> filtered;
for (auto* str : identifier_resolve_hint_.suggestions) {
if (str[0] != '_') {
filtered.Push(str);
}
}
- utils::StringStream msg;
- utils::SuggestAlternatives(unresolved->name,
- filtered.Slice().Reinterpret<char const* const>(), msg);
+ StringStream msg;
+ tint::SuggestAlternatives(unresolved->name,
+ filtered.Slice().Reinterpret<char const* const>(), msg);
AddNote(msg.str(), expr->source);
}
} else {
@@ -3315,7 +3313,7 @@
[&](const type::Vector* vec) -> sem::ValueExpression* {
std::string s = expr->member->symbol.Name();
auto size = s.size();
- utils::Vector<uint32_t, 4> swizzle;
+ Vector<uint32_t, 4> swizzle;
swizzle.Reserve(s.size());
for (auto c : s) {
@@ -3448,7 +3446,7 @@
if (op.const_eval_fn) { // Do we have a @const operator?
// Yes. Perform any required abstract argument values implicit conversions to the
// overload parameter types, and const-eval.
- utils::Vector const_args{lhs->ConstantValue(), rhs->ConstantValue()};
+ Vector const_args{lhs->ConstantValue(), rhs->ConstantValue()};
// Implicit conversion (e.g. AInt -> AFloat)
if (!Convert(const_args[0], op.lhs, lhs->Declaration()->source)) {
return nullptr;
@@ -3550,9 +3548,8 @@
stage = expr->Stage();
if (stage == sem::EvaluationStage::kConstant) {
if (op.const_eval_fn) {
- if (auto r = (const_eval_.*op.const_eval_fn)(
- ty, utils::Vector{expr->ConstantValue()},
- expr->Declaration()->source)) {
+ if (auto r = (const_eval_.*op.const_eval_fn)(ty, Vector{expr->ConstantValue()},
+ expr->Declaration()->source)) {
value = r.Get();
} else {
return nullptr;
@@ -3571,100 +3568,99 @@
return sem;
}
-utils::Result<uint32_t> Resolver::LocationAttribute(const ast::LocationAttribute* attr) {
+tint::Result<uint32_t> Resolver::LocationAttribute(const ast::LocationAttribute* attr) {
ExprEvalStageConstraint constraint{sem::EvaluationStage::kConstant, "@location value"};
TINT_SCOPED_ASSIGNMENT(expr_eval_stage_constraint_, constraint);
auto* materialized = Materialize(ValueExpression(attr->expr));
if (!materialized) {
- return utils::Failure;
+ return tint::Failure;
}
if (!materialized->Type()->IsAnyOf<type::I32, type::U32>()) {
AddError("@location must be an i32 or u32 value", attr->source);
- return utils::Failure;
+ return tint::Failure;
}
auto const_value = materialized->ConstantValue();
auto value = const_value->ValueAs<AInt>();
if (value < 0) {
AddError("@location value must be non-negative", attr->source);
- return utils::Failure;
+ return tint::Failure;
}
return static_cast<uint32_t>(value);
}
-utils::Result<uint32_t> Resolver::IndexAttribute(const ast::IndexAttribute* attr) {
+tint::Result<uint32_t> Resolver::IndexAttribute(const ast::IndexAttribute* attr) {
ExprEvalStageConstraint constraint{sem::EvaluationStage::kConstant, "@index value"};
TINT_SCOPED_ASSIGNMENT(expr_eval_stage_constraint_, constraint);
auto* materialized = Materialize(ValueExpression(attr->expr));
if (!materialized) {
- return utils::Failure;
+ return tint::Failure;
}
if (!materialized->Type()->IsAnyOf<type::I32, type::U32>()) {
AddError("@location must be an i32 or u32 value", attr->source);
- return utils::Failure;
+ return tint::Failure;
}
auto const_value = materialized->ConstantValue();
auto value = const_value->ValueAs<AInt>();
if (value != 0 && value != 1) {
AddError("@index value must be zero or one", attr->source);
- return utils::Failure;
+ return tint::Failure;
}
return static_cast<uint32_t>(value);
}
-utils::Result<uint32_t> Resolver::BindingAttribute(const ast::BindingAttribute* attr) {
+tint::Result<uint32_t> Resolver::BindingAttribute(const ast::BindingAttribute* attr) {
ExprEvalStageConstraint constraint{sem::EvaluationStage::kConstant, "@binding"};
TINT_SCOPED_ASSIGNMENT(expr_eval_stage_constraint_, constraint);
auto* materialized = Materialize(ValueExpression(attr->expr));
if (!materialized) {
- return utils::Failure;
+ return tint::Failure;
}
if (!materialized->Type()->IsAnyOf<type::I32, type::U32>()) {
AddError("@binding must be an i32 or u32 value", attr->source);
- return utils::Failure;
+ return tint::Failure;
}
auto const_value = materialized->ConstantValue();
auto value = const_value->ValueAs<AInt>();
if (value < 0) {
AddError("@binding value must be non-negative", attr->source);
- return utils::Failure;
+ return tint::Failure;
}
return static_cast<uint32_t>(value);
}
-utils::Result<uint32_t> Resolver::GroupAttribute(const ast::GroupAttribute* attr) {
+tint::Result<uint32_t> Resolver::GroupAttribute(const ast::GroupAttribute* attr) {
ExprEvalStageConstraint constraint{sem::EvaluationStage::kConstant, "@group"};
TINT_SCOPED_ASSIGNMENT(expr_eval_stage_constraint_, constraint);
auto* materialized = Materialize(ValueExpression(attr->expr));
if (!materialized) {
- return utils::Failure;
+ return tint::Failure;
}
if (!materialized->Type()->IsAnyOf<type::I32, type::U32>()) {
AddError("@group must be an i32 or u32 value", attr->source);
- return utils::Failure;
+ return tint::Failure;
}
auto const_value = materialized->ConstantValue();
auto value = const_value->ValueAs<AInt>();
if (value < 0) {
AddError("@group value must be non-negative", attr->source);
- return utils::Failure;
+ return tint::Failure;
}
return static_cast<uint32_t>(value);
}
-utils::Result<sem::WorkgroupSize> Resolver::WorkgroupAttribute(
- const ast::WorkgroupAttribute* attr) {
+tint::Result<sem::WorkgroupSize> Resolver::WorkgroupAttribute(const ast::WorkgroupAttribute* attr) {
// Set work-group size defaults.
sem::WorkgroupSize ws;
for (size_t i = 0; i < 3; i++) {
@@ -3672,8 +3668,8 @@
}
auto values = attr->Values();
- utils::Vector<const sem::ValueExpression*, 3> args;
- utils::Vector<const type::Type*, 3> arg_tys;
+ Vector<const sem::ValueExpression*, 3> args;
+ Vector<const type::Type*, 3> arg_tys;
constexpr const char* kErrBadExpr =
"workgroup_size argument must be a constant or override-expression of type "
@@ -3688,18 +3684,18 @@
}
const auto* expr = ValueExpression(value);
if (!expr) {
- return utils::Failure;
+ return tint::Failure;
}
auto* ty = expr->Type();
if (!ty->IsAnyOf<type::I32, type::U32, type::AbstractInt>()) {
AddError(kErrBadExpr, value->source);
- return utils::Failure;
+ return tint::Failure;
}
if (expr->Stage() != sem::EvaluationStage::kConstant &&
expr->Stage() != sem::EvaluationStage::kOverride) {
AddError(kErrBadExpr, value->source);
- return utils::Failure;
+ return tint::Failure;
}
args.Push(expr);
@@ -3710,7 +3706,7 @@
if (!common_ty) {
AddError("workgroup_size arguments must be of the same type, either i32 or u32",
attr->source);
- return utils::Failure;
+ return tint::Failure;
}
// If all arguments are abstract-integers, then materialize to i32.
@@ -3721,12 +3717,12 @@
for (size_t i = 0; i < args.Length(); i++) {
auto* materialized = Materialize(args[i], common_ty);
if (!materialized) {
- return utils::Failure;
+ return tint::Failure;
}
if (auto* value = materialized->ConstantValue()) {
if (value->ValueAs<AInt>() < 1) {
AddError("workgroup_size argument must be at least 1", values[i]->source);
- return utils::Failure;
+ return tint::Failure;
}
ws[i] = value->ValueAs<u32>();
} else {
@@ -3739,18 +3735,18 @@
total_size *= static_cast<uint64_t>(ws[i].value_or(1));
if (total_size > 0xffffffff) {
AddError("total workgroup grid size cannot exceed 0xffffffff", values[i]->source);
- return utils::Failure;
+ return tint::Failure;
}
}
return ws;
}
-utils::Result<tint::builtin::BuiltinValue> Resolver::BuiltinAttribute(
+tint::Result<tint::builtin::BuiltinValue> Resolver::BuiltinAttribute(
const ast::BuiltinAttribute* attr) {
auto* builtin_expr = BuiltinValueExpression(attr->builtin);
if (!builtin_expr) {
- return utils::Failure;
+ return tint::Failure;
}
// Apply the resolved tint::sem::BuiltinEnumExpression<tint::builtin::BuiltinValue> to the
// attribute.
@@ -3778,18 +3774,18 @@
return true;
}
-utils::Result<builtin::Interpolation> Resolver::InterpolateAttribute(
+tint::Result<builtin::Interpolation> Resolver::InterpolateAttribute(
const ast::InterpolateAttribute* attr) {
builtin::Interpolation out;
auto* type = InterpolationType(attr->type);
if (!type) {
- return utils::Failure;
+ return tint::Failure;
}
out.type = type->Value();
if (attr->sampling) {
auto* sampling = InterpolationSampling(attr->sampling);
if (!sampling) {
- return utils::Failure;
+ return tint::Failure;
}
out.sampling = sampling->Value();
}
@@ -3817,11 +3813,11 @@
if (rule != builtin::ChromiumDiagnosticRule::kUndefined) {
validator_.DiagnosticFilters().Set(rule, control.severity);
} else {
- utils::StringStream ss;
+ StringStream ss;
ss << "unrecognized diagnostic rule 'chromium." << name << "'\n";
- utils::SuggestAlternativeOptions opts;
+ tint::SuggestAlternativeOptions opts;
opts.prefix = "chromium.";
- utils::SuggestAlternatives(name, builtin::kChromiumDiagnosticRuleStrings, ss, opts);
+ tint::SuggestAlternatives(name, builtin::kChromiumDiagnosticRuleStrings, ss, opts);
AddWarning(ss.str(), control.rule_name->source);
}
}
@@ -3832,9 +3828,9 @@
if (rule != builtin::CoreDiagnosticRule::kUndefined) {
validator_.DiagnosticFilters().Set(rule, control.severity);
} else {
- utils::StringStream ss;
+ StringStream ss;
ss << "unrecognized diagnostic rule '" << name << "'\n";
- utils::SuggestAlternatives(name, builtin::kCoreDiagnosticRuleStrings, ss);
+ tint::SuggestAlternatives(name, builtin::kCoreDiagnosticRuleStrings, ss);
AddWarning(ss.str(), control.rule_name->source);
}
return true;
@@ -3910,7 +3906,7 @@
return builder_->create<type::ConstantArrayCount>(static_cast<uint32_t>(count));
}
-bool Resolver::ArrayAttributes(utils::VectorRef<const ast::Attribute*> attributes,
+bool Resolver::ArrayAttributes(VectorRef<const ast::Attribute*> attributes,
const type::Type* el_ty,
uint32_t& explicit_stride) {
if (!validator_.NoDuplicateAttributes(attributes)) {
@@ -3954,14 +3950,14 @@
uint32_t explicit_stride) {
uint32_t el_align = el_ty->Align();
uint32_t el_size = el_ty->Size();
- uint64_t implicit_stride = el_size ? utils::RoundUp<uint64_t>(el_align, el_size) : 0;
+ uint64_t implicit_stride = el_size ? tint::RoundUp<uint64_t>(el_align, el_size) : 0;
uint64_t stride = explicit_stride ? explicit_stride : implicit_stride;
uint64_t size = 0;
if (auto const_count = el_count->As<type::ConstantArrayCount>()) {
size = const_count->value * stride;
if (size > std::numeric_limits<uint32_t>::max()) {
- utils::StringStream msg;
+ StringStream msg;
msg << "array byte size (0x" << std::hex << size
<< ") must not exceed 0xffffffff bytes";
AddError(msg.str(), count_source);
@@ -4038,7 +4034,7 @@
}
}
- utils::Vector<const sem::StructMember*, 8> sem_members;
+ Vector<const sem::StructMember*, 8> sem_members;
sem_members.Reserve(str->members.Length());
// Calculate the effective size and alignment of each field, and the overall size of the
@@ -4049,7 +4045,7 @@
// of the structure, and so is performed as part of the variable validation.
uint64_t struct_size = 0;
uint64_t struct_align = 1;
- utils::Hashmap<Symbol, const ast::StructMember*, 8> member_map;
+ Hashmap<Symbol, const ast::StructMember*, 8> member_map;
size_t members_nest_depth = 0;
for (auto* member : str->members) {
@@ -4138,7 +4134,7 @@
}
auto value = const_value->ValueAs<AInt>();
- if (value <= 0 || !utils::IsPowerOfTwo(value)) {
+ if (value <= 0 || !tint::IsPowerOfTwo(value)) {
AddError("@align value must be a positive, power-of-two integer",
attr->source);
return false;
@@ -4245,9 +4241,9 @@
return nullptr;
}
- offset = utils::RoundUp(align, offset);
+ offset = tint::RoundUp(align, offset);
if (offset > std::numeric_limits<uint32_t>::max()) {
- utils::StringStream msg;
+ StringStream msg;
msg << "struct member offset (0x" << std::hex << offset << ") must not exceed 0x"
<< std::hex << std::numeric_limits<uint32_t>::max() << " bytes";
AddError(msg.str(), member->source);
@@ -4266,10 +4262,10 @@
}
uint64_t size_no_padding = struct_size;
- struct_size = utils::RoundUp(struct_align, struct_size);
+ struct_size = tint::RoundUp(struct_align, struct_size);
if (struct_size > std::numeric_limits<uint32_t>::max()) {
- utils::StringStream msg;
+ StringStream msg;
msg << "struct size (0x" << std::hex << struct_size << ") must not exceed 0xffffffff bytes";
AddError(msg.str(), str->source);
return nullptr;
@@ -4368,7 +4364,7 @@
// Determine the common type across all selectors and the switch expression
// This must materialize to an integer scalar (non-abstract).
- utils::Vector<const type::Type*, 8> types;
+ Vector<const type::Type*, 8> types;
types.Push(cond_ty);
for (auto* case_stmt : stmt->body) {
for (auto* sel : case_stmt->selectors) {
@@ -4411,7 +4407,7 @@
return false;
}
- utils::Vector<sem::CaseStatement*, 4> cases;
+ Vector<sem::CaseStatement*, 4> cases;
cases.Reserve(stmt->body.Length());
for (auto* case_stmt : stmt->body) {
Mark(case_stmt);
@@ -4635,7 +4631,7 @@
if (decl &&
!ApplyAddressSpaceUsageToType(
address_space, const_cast<type::Type*>(member->Type()), decl->type->source)) {
- utils::StringStream err;
+ StringStream err;
err << "while analyzing structure member " << sem_.TypeNameOf(str) << "."
<< member->Name().Name();
AddNote(err.str(), member->Declaration()->source);
@@ -4666,7 +4662,7 @@
}
if (builtin::IsHostShareable(address_space) && !validator_.IsHostShareable(ty)) {
- utils::StringStream err;
+ StringStream err;
err << "Type '" << sem_.TypeNameOf(ty) << "' cannot be used in address space '"
<< address_space << "' as it is non-host-shareable";
AddError(err.str(), usage);
@@ -4681,7 +4677,7 @@
builder_->Sem().Add(ast, sem);
auto* as_compound =
- As<sem::CompoundStatement, utils::CastFlags::kDontErrorOnImpossibleCast>(sem);
+ As<sem::CompoundStatement, tint::CastFlags::kDontErrorOnImpossibleCast>(sem);
// Helper to handle attributes that are supported on certain types of statement.
auto handle_attributes = [&](auto* stmt, sem::Statement* sem_stmt, const char* use) {
diff --git a/src/tint/lang/wgsl/resolver/resolver.h b/src/tint/lang/wgsl/resolver/resolver.h
index 26d2fd4..64008a6 100644
--- a/src/tint/lang/wgsl/resolver/resolver.h
+++ b/src/tint/lang/wgsl/resolver/resolver.h
@@ -202,13 +202,13 @@
template <size_t N>
sem::Call* FunctionCall(const ast::CallExpression*,
sem::Function* target,
- utils::Vector<const sem::ValueExpression*, N>& args,
+ Vector<const sem::ValueExpression*, N>& args,
sem::Behaviors arg_behaviors);
sem::Expression* Identifier(const ast::IdentifierExpression*);
template <size_t N>
sem::Call* BuiltinCall(const ast::CallExpression*,
builtin::Function,
- utils::Vector<const sem::ValueExpression*, N>& args);
+ Vector<const sem::ValueExpression*, N>& args);
sem::ValueExpression* Literal(const ast::LiteralExpression*);
sem::ValueExpression* MemberAccessor(const ast::MemberAccessorExpression*);
sem::ValueExpression* UnaryOp(const ast::UnaryOpExpression*);
@@ -247,7 +247,7 @@
/// reference type.
/// @returns true on success, false on failure.
template <size_t N>
- bool MaybeMaterializeAndLoadArguments(utils::Vector<const sem::ValueExpression*, N>& args,
+ bool MaybeMaterializeAndLoadArguments(Vector<const sem::ValueExpression*, N>& args,
const sem::CallTarget* target);
/// @returns true if an argument of an abstract numeric type, passed to a parameter of type
@@ -260,10 +260,10 @@
/// Transforms `args` to a vector of constants, and converts each constant to the call target's
/// parameter type.
- /// @returns the vector of constants, `utils::Failure` on failure.
+ /// @returns the vector of constants, `tint::Failure` on failure.
template <size_t N>
- utils::Result<utils::Vector<const constant::Value*, N>> ConvertArguments(
- const utils::Vector<const sem::ValueExpression*, N>& args,
+ tint::Result<Vector<const constant::Value*, N>> ConvertArguments(
+ const Vector<const sem::ValueExpression*, N>& args,
const sem::CallTarget* target);
/// @param ty the type that may hold abstract numeric types
@@ -299,14 +299,14 @@
sem::Statement* Statement(const ast::Statement*);
sem::SwitchStatement* SwitchStatement(const ast::SwitchStatement* s);
sem::Statement* VariableDeclStatement(const ast::VariableDeclStatement*);
- bool Statements(utils::VectorRef<const ast::Statement*>);
+ bool Statements(VectorRef<const ast::Statement*>);
// CollectTextureSamplerPairs() collects all the texture/sampler pairs from the target function
// / builtin, and records these on the current function by calling AddTextureSamplerPair().
void CollectTextureSamplerPairs(sem::Function* func,
- utils::VectorRef<const sem::ValueExpression*> args) const;
+ VectorRef<const sem::ValueExpression*> args) const;
void CollectTextureSamplerPairs(const sem::Builtin* builtin,
- utils::VectorRef<const sem::ValueExpression*> args) const;
+ VectorRef<const sem::ValueExpression*> args) const;
/// Resolves the WorkgroupSize for the given function, assigning it to
/// current_function_
@@ -314,27 +314,27 @@
/// Resolves the `@builtin` attribute @p attr
/// @returns the builtin value on success
- utils::Result<tint::builtin::BuiltinValue> BuiltinAttribute(const ast::BuiltinAttribute* attr);
+ tint::Result<tint::builtin::BuiltinValue> BuiltinAttribute(const ast::BuiltinAttribute* attr);
/// Resolves the `@location` attribute @p attr
/// @returns the location value on success.
- utils::Result<uint32_t> LocationAttribute(const ast::LocationAttribute* attr);
+ tint::Result<uint32_t> LocationAttribute(const ast::LocationAttribute* attr);
/// Resolves the `@index` attribute @p attr
/// @returns the index value on success.
- utils::Result<uint32_t> IndexAttribute(const ast::IndexAttribute* attr);
+ tint::Result<uint32_t> IndexAttribute(const ast::IndexAttribute* attr);
/// Resolves the `@binding` attribute @p attr
/// @returns the binding value on success.
- utils::Result<uint32_t> BindingAttribute(const ast::BindingAttribute* attr);
+ tint::Result<uint32_t> BindingAttribute(const ast::BindingAttribute* attr);
/// Resolves the `@group` attribute @p attr
/// @returns the group value on success.
- utils::Result<uint32_t> GroupAttribute(const ast::GroupAttribute* attr);
+ tint::Result<uint32_t> GroupAttribute(const ast::GroupAttribute* attr);
/// Resolves the `@workgroup_size` attribute @p attr
/// @returns the workgroup size on success.
- utils::Result<sem::WorkgroupSize> WorkgroupAttribute(const ast::WorkgroupAttribute* attr);
+ tint::Result<sem::WorkgroupSize> WorkgroupAttribute(const ast::WorkgroupAttribute* attr);
/// Resolves the `@diagnostic` attribute @p attr
/// @returns true on success, false on failure
@@ -358,7 +358,7 @@
/// Resolves the `@interpolate` attribute @p attr
/// @returns true on success, false on failure
- utils::Result<builtin::Interpolation> InterpolateAttribute(
+ tint::Result<builtin::Interpolation> InterpolateAttribute(
const ast::InterpolateAttribute* attr);
/// Resolves the internal attribute @p attr
@@ -387,7 +387,7 @@
/// @param el_ty the element type of the array.
/// @param explicit_stride assigned the specified stride of the array in bytes.
/// @returns true on success, false on failure
- bool ArrayAttributes(utils::VectorRef<const ast::Attribute*> attributes,
+ bool ArrayAttributes(VectorRef<const ast::Attribute*> attributes,
const type::Type* el_ty,
uint32_t& explicit_stride);
@@ -558,13 +558,13 @@
// ArrayConstructorSig represents a unique array constructor signature.
// It is a tuple of the array type, number of arguments provided and earliest evaluation stage.
using ArrayConstructorSig =
- utils::UnorderedKeyWrapper<std::tuple<const type::Array*, size_t, sem::EvaluationStage>>;
+ tint::UnorderedKeyWrapper<std::tuple<const type::Array*, size_t, sem::EvaluationStage>>;
// StructConstructorSig represents a unique structure constructor signature.
// It is a tuple of the structure type, number of arguments provided and earliest evaluation
// stage.
using StructConstructorSig =
- utils::UnorderedKeyWrapper<std::tuple<const type::Struct*, size_t, sem::EvaluationStage>>;
+ tint::UnorderedKeyWrapper<std::tuple<const type::Struct*, size_t, sem::EvaluationStage>>;
/// ExprEvalStageConstraint describes a constraint on when expressions can be evaluated.
struct ExprEvalStageConstraint {
@@ -596,7 +596,7 @@
/// The usage of the identifier.
const char* usage = "identifier";
/// Suggested strings if the identifier failed to resolve
- utils::Slice<char const* const> suggestions = utils::Empty;
+ tint::Slice<char const* const> suggestions = tint::Empty;
};
ProgramBuilder* const builder_;
@@ -607,25 +607,24 @@
SemHelper sem_;
Validator validator_;
builtin::Extensions enabled_extensions_;
- utils::Vector<sem::Function*, 8> entry_points_;
- utils::Hashmap<const type::Type*, const Source*, 8> atomic_composite_info_;
- utils::Bitset<0> marked_;
+ Vector<sem::Function*, 8> entry_points_;
+ Hashmap<const type::Type*, const Source*, 8> atomic_composite_info_;
+ tint::Bitset<0> marked_;
ExprEvalStageConstraint expr_eval_stage_constraint_;
std::unordered_map<const sem::Function*, AliasAnalysisInfo> alias_analysis_infos_;
- utils::Hashmap<OverrideId, const sem::Variable*, 8> override_ids_;
- utils::Hashmap<ArrayConstructorSig, sem::CallTarget*, 8> array_ctors_;
- utils::Hashmap<StructConstructorSig, sem::CallTarget*, 8> struct_ctors_;
+ Hashmap<OverrideId, const sem::Variable*, 8> override_ids_;
+ Hashmap<ArrayConstructorSig, sem::CallTarget*, 8> array_ctors_;
+ Hashmap<StructConstructorSig, sem::CallTarget*, 8> struct_ctors_;
sem::Function* current_function_ = nullptr;
sem::Statement* current_statement_ = nullptr;
sem::CompoundStatement* current_compound_statement_ = nullptr;
uint32_t current_scoping_depth_ = 0;
- utils::UniqueVector<const sem::GlobalVariable*, 4>* resolved_overrides_ = nullptr;
- utils::Hashset<TypeAndAddressSpace, 8> valid_type_storage_layouts_;
- utils::Hashmap<const ast::Expression*, const ast::BinaryExpression*, 8>
- logical_binary_lhs_to_parent_;
- utils::Hashset<const ast::Expression*, 8> skip_const_eval_;
+ UniqueVector<const sem::GlobalVariable*, 4>* resolved_overrides_ = nullptr;
+ Hashset<TypeAndAddressSpace, 8> valid_type_storage_layouts_;
+ Hashmap<const ast::Expression*, const ast::BinaryExpression*, 8> logical_binary_lhs_to_parent_;
+ Hashset<const ast::Expression*, 8> skip_const_eval_;
IdentifierResolveHint identifier_resolve_hint_;
- utils::Hashmap<const type::Type*, size_t, 8> nest_depth_;
+ Hashmap<const type::Type*, size_t, 8> nest_depth_;
};
} // namespace tint::resolver
diff --git a/src/tint/lang/wgsl/resolver/resolver_behavior_test.cc b/src/tint/lang/wgsl/resolver/resolver_behavior_test.cc
index 65b1c41..13e6fb7 100644
--- a/src/tint/lang/wgsl/resolver/resolver_behavior_test.cc
+++ b/src/tint/lang/wgsl/resolver/resolver_behavior_test.cc
@@ -35,8 +35,8 @@
// which when called, will have the behavior {Next}.
// It contains a discard statement, which should not affect the behavior analysis or any
// related validation.
- Func("Next", utils::Empty, ty.i32(),
- utils::Vector{
+ Func("Next", tint::Empty, ty.i32(),
+ Vector{
If(true, Block(Discard())),
Return(1_i),
});
@@ -46,8 +46,7 @@
TEST_F(ResolverBehaviorTest, ExprBinaryOp_LHS) {
auto* stmt = Decl(Var("lhs", ty.i32(), Add(Call("Next"), 1_i)));
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -58,8 +57,7 @@
TEST_F(ResolverBehaviorTest, ExprBinaryOp_RHS) {
auto* stmt = Decl(Var("lhs", ty.i32(), Add(1_i, Call("Next"))));
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -70,8 +68,7 @@
TEST_F(ResolverBehaviorTest, ExprBitcastOp) {
auto* stmt = Decl(Var("lhs", ty.u32(), Bitcast<u32>(Call("Next"))));
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -80,16 +77,15 @@
}
TEST_F(ResolverBehaviorTest, ExprIndex_Arr) {
- Func("ArrayDiscardOrNext", utils::Empty, ty.array<i32, 4>(),
- utils::Vector{
+ Func("ArrayDiscardOrNext", tint::Empty, ty.array<i32, 4>(),
+ Vector{
If(true, Block(Discard())),
Return(Call<array<i32, 4>>()),
});
auto* stmt = Decl(Var("lhs", ty.i32(), IndexAccessor(Call("ArrayDiscardOrNext"), 1_i)));
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -100,12 +96,12 @@
TEST_F(ResolverBehaviorTest, ExprIndex_Idx) {
auto* stmt = Decl(Var("lhs", ty.i32(), IndexAccessor("arr", Call("Next"))));
- Func("F", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("F", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("arr", ty.array<i32, 4>())), //
stmt,
},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -117,8 +113,7 @@
auto* stmt = Decl(Var("lhs", ty.i32(),
create<ast::UnaryOpExpression>(ast::UnaryOp::kComplement, Call("Next"))));
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -141,12 +136,12 @@
TEST_F(ResolverBehaviorTest, StmtAssign_LHSDiscardOrNext) {
auto* stmt = Assign(IndexAccessor("lhs", Call("Next")), 1_i);
- Func("F", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("F", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("lhs", ty.array<i32, 4>())), //
stmt,
},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -157,12 +152,12 @@
TEST_F(ResolverBehaviorTest, StmtAssign_RHSDiscardOrNext) {
auto* stmt = Assign("lhs", Call("Next"));
- Func("F", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("F", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("lhs", ty.i32())), //
stmt,
},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -183,8 +178,7 @@
TEST_F(ResolverBehaviorTest, StmtBlockSingleStmt) {
auto* stmt = Block(Return());
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -193,7 +187,7 @@
}
TEST_F(ResolverBehaviorTest, StmtCallReturn) {
- Func("f", utils::Empty, ty.void_(), utils::Vector{Return()});
+ Func("f", tint::Empty, ty.void_(), Vector{Return()});
auto* stmt = CallStmt(Call("f"));
WrapInFunction(stmt);
@@ -204,11 +198,10 @@
}
TEST_F(ResolverBehaviorTest, StmtCallFuncDiscard) {
- Func("f", utils::Empty, ty.void_(), utils::Vector{Discard()});
+ Func("f", tint::Empty, ty.void_(), Vector{Discard()});
auto* stmt = CallStmt(Call("f"));
- Func("g", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("g", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -219,8 +212,7 @@
TEST_F(ResolverBehaviorTest, StmtCallFuncMayDiscard) {
auto* stmt = For(Decl(Var("v", ty.i32(), Call("Next"))), nullptr, nullptr, Block(Break()));
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -252,8 +244,7 @@
TEST_F(ResolverBehaviorTest, StmtDiscard) {
auto* stmt = Discard();
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -290,8 +281,7 @@
TEST_F(ResolverBehaviorTest, StmtForLoopDiscard) {
auto* stmt = For(nullptr, nullptr, nullptr, Block(Discard(), Break()));
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -312,8 +302,7 @@
TEST_F(ResolverBehaviorTest, StmtForLoopBreak_InitCallFuncMayDiscard) {
auto* stmt = For(Decl(Var("v", ty.i32(), Call("Next"))), nullptr, nullptr, Block(Break()));
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -324,8 +313,7 @@
TEST_F(ResolverBehaviorTest, StmtForLoopEmpty_InitCallFuncMayDiscard) {
auto* stmt = For(Decl(Var("v", ty.i32(), Call("Next"))), nullptr, nullptr, Block(Break()));
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -346,8 +334,7 @@
TEST_F(ResolverBehaviorTest, StmtForLoopEmpty_CondCallFuncMayDiscard) {
auto* stmt = For(nullptr, Equal(Call("Next"), 1_i), nullptr, Block());
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -368,8 +355,7 @@
TEST_F(ResolverBehaviorTest, StmtWhileDiscard) {
auto* stmt = While(Expr(true), Block(Discard()));
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -400,8 +386,7 @@
TEST_F(ResolverBehaviorTest, StmtWhileEmpty_CondCallFuncMayDiscard) {
auto* stmt = While(Equal(Call("Next"), 1_i), Block());
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -422,8 +407,7 @@
TEST_F(ResolverBehaviorTest, StmtIfTrue_ThenDiscard) {
auto* stmt = If(true, Block(Discard()));
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -434,8 +418,7 @@
TEST_F(ResolverBehaviorTest, StmtIfTrue_ThenEmptyBlock_ElseDiscard) {
auto* stmt = If(true, Block(), Else(Block(Discard())));
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -446,8 +429,7 @@
TEST_F(ResolverBehaviorTest, StmtIfTrue_ThenDiscard_ElseDiscard) {
auto* stmt = If(true, Block(Discard()), Else(Block(Discard())));
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -458,8 +440,7 @@
TEST_F(ResolverBehaviorTest, StmtIfCallFuncMayDiscard_ThenEmptyBlock) {
auto* stmt = If(Equal(Call("Next"), 1_i), Block());
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -471,8 +452,7 @@
auto* stmt = If(true, Block(), //
Else(If(Equal(Call("Next"), 1_i), Block())));
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -493,8 +473,7 @@
TEST_F(ResolverBehaviorTest, StmtLetDecl_RHSDiscardOrNext) {
auto* stmt = Decl(Let("lhs", ty.i32(), Call("Next")));
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -531,8 +510,7 @@
TEST_F(ResolverBehaviorTest, StmtLoopDiscard) {
auto* stmt = Loop(Block(Discard(), Break()));
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -581,7 +559,7 @@
TEST_F(ResolverBehaviorTest, StmtReturn_DiscardOrNext) {
auto* stmt = Return(Call("Next"));
- Func("F", utils::Empty, ty.i32(), utils::Vector{stmt});
+ Func("F", tint::Empty, ty.i32(), Vector{stmt});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -612,8 +590,7 @@
TEST_F(ResolverBehaviorTest, StmtSwitch_CondLiteral_DefaultDiscard) {
auto* stmt = Switch(1_i, DefaultCase(Block(Discard())));
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -644,8 +621,7 @@
TEST_F(ResolverBehaviorTest, StmtSwitch_CondLiteral_Case0Empty_DefaultDiscard) {
auto* stmt = Switch(1_i, Case(CaseSelector(0_i), Block()), DefaultCase(Block(Discard())));
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -666,8 +642,7 @@
TEST_F(ResolverBehaviorTest, StmtSwitch_CondLiteral_Case0Discard_DefaultEmpty) {
auto* stmt = Switch(1_i, Case(CaseSelector(0_i), Block(Discard())), DefaultCase(Block()));
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -679,8 +654,7 @@
auto* stmt =
Switch(1_i, Case(CaseSelector(0_i), Block(Discard())), DefaultCase(Block(Discard())));
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -692,8 +666,7 @@
auto* stmt =
Switch(1_i, Case(CaseSelector(0_i), Block(Discard())), DefaultCase(Block(Return())));
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -707,8 +680,7 @@
Case(CaseSelector(1_i), Block(Return())), //
DefaultCase(Block()));
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -719,8 +691,7 @@
TEST_F(ResolverBehaviorTest, StmtSwitch_CondCallFuncMayDiscard_DefaultEmpty) {
auto* stmt = Switch(Call("Next"), DefaultCase(Block()));
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -741,8 +712,7 @@
TEST_F(ResolverBehaviorTest, StmtVarDecl_RHSDiscardOrNext) {
auto* stmt = Decl(Var("lhs", ty.i32(), Call("Next")));
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
diff --git a/src/tint/lang/wgsl/resolver/resolver_test.cc b/src/tint/lang/wgsl/resolver/resolver_test.cc
index 4a66ece..913175d 100644
--- a/src/tint/lang/wgsl/resolver/resolver_test.cc
+++ b/src/tint/lang/wgsl/resolver/resolver_test.cc
@@ -225,7 +225,7 @@
auto* cond = Expr(2_i);
auto* ret = Return(cond);
- Func("test", utils::Empty, ty.i32(), utils::Vector{ret}, utils::Empty);
+ Func("test", tint::Empty, ty.i32(), Vector{ret}, tint::Empty);
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -262,8 +262,8 @@
}
TEST_F(ResolverTest, Stmt_Call) {
- Func("my_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("my_func", tint::Empty, ty.void_(),
+ Vector{
Return(),
});
@@ -349,7 +349,7 @@
auto* bar_f32_init = bar_f32->initializer;
auto* bar_f32_decl = Decl(bar_f32);
- Func("func", utils::Empty, ty.void_(), utils::Vector{inner, foo_f32_decl, bar_f32_decl});
+ Func("func", tint::Empty, ty.void_(), Vector{inner, foo_f32_decl, bar_f32_decl});
EXPECT_TRUE(r()->Resolve()) << r()->error();
ASSERT_NE(TypeOf(foo_i32_init), nullptr);
@@ -364,8 +364,8 @@
EXPECT_EQ(StmtOf(bar_i32_init), bar_i32_decl);
EXPECT_EQ(StmtOf(foo_f32_init), foo_f32_decl);
EXPECT_EQ(StmtOf(bar_f32_init), bar_f32_decl);
- EXPECT_TRUE(CheckVarUsers(foo_i32, utils::Vector{bar_i32->initializer}));
- EXPECT_TRUE(CheckVarUsers(foo_f32, utils::Vector{bar_f32->initializer}));
+ EXPECT_TRUE(CheckVarUsers(foo_i32, Vector{bar_i32->initializer}));
+ EXPECT_TRUE(CheckVarUsers(foo_f32, Vector{bar_f32->initializer}));
ASSERT_NE(VarOf(bar_i32->initializer), nullptr);
EXPECT_EQ(VarOf(bar_i32->initializer)->Declaration(), foo_i32);
ASSERT_NE(VarOf(bar_f32->initializer), nullptr);
@@ -385,7 +385,7 @@
auto* fn_i32 = Var("foo", ty.i32(), Expr(2_i));
auto* fn_i32_init = fn_i32->initializer;
auto* fn_i32_decl = Decl(fn_i32);
- Func("func_i32", utils::Empty, ty.void_(), utils::Vector{fn_i32_decl});
+ Func("func_i32", tint::Empty, ty.void_(), Vector{fn_i32_decl});
// Declare f32 "foo" at module scope
auto* mod_f32 = Var("foo", ty.f32(), builtin::AddressSpace::kPrivate, Expr(2_f));
@@ -396,7 +396,7 @@
auto* fn_f32 = Var("bar", ty.f32(), Expr("foo"));
auto* fn_f32_init = fn_f32->initializer;
auto* fn_f32_decl = Decl(fn_f32);
- Func("func_f32", utils::Empty, ty.void_(), utils::Vector{fn_f32_decl});
+ Func("func_f32", tint::Empty, ty.void_(), Vector{fn_f32_decl});
EXPECT_TRUE(r()->Resolve()) << r()->error();
ASSERT_NE(TypeOf(mod_init), nullptr);
@@ -408,8 +408,8 @@
EXPECT_EQ(StmtOf(fn_i32_init), fn_i32_decl);
EXPECT_EQ(StmtOf(mod_init), nullptr);
EXPECT_EQ(StmtOf(fn_f32_init), fn_f32_decl);
- EXPECT_TRUE(CheckVarUsers(fn_i32, utils::Empty));
- EXPECT_TRUE(CheckVarUsers(mod_f32, utils::Vector{fn_f32->initializer}));
+ EXPECT_TRUE(CheckVarUsers(fn_i32, tint::Empty));
+ EXPECT_TRUE(CheckVarUsers(mod_f32, Vector{fn_f32->initializer}));
ASSERT_NE(VarOf(fn_f32->initializer), nullptr);
EXPECT_EQ(VarOf(fn_f32->initializer)->Declaration(), mod_f32);
}
@@ -574,7 +574,7 @@
}
TEST_F(ResolverTest, Expr_Call) {
- Func("my_func", utils::Empty, ty.f32(), utils::Vector{Return(0_f)});
+ Func("my_func", tint::Empty, ty.f32(), Vector{Return(0_f)});
auto* call = Call("my_func");
WrapInFunction(call);
@@ -586,7 +586,7 @@
}
TEST_F(ResolverTest, Expr_Call_InBinaryOp) {
- Func("func", utils::Empty, ty.f32(), utils::Vector{Return(0_f)});
+ Func("func", tint::Empty, ty.f32(), Vector{Return(0_f)});
auto* expr = Add(Call("func"), Call("func"));
WrapInFunction(expr);
@@ -598,8 +598,8 @@
}
TEST_F(ResolverTest, Expr_Call_WithParams) {
- Func("my_func", utils::Vector{Param(Sym(), ty.f32())}, ty.f32(),
- utils::Vector{
+ Func("my_func", Vector{Param(Sym(), ty.f32())}, ty.f32(),
+ Vector{
Return(1.2_f),
});
@@ -692,7 +692,7 @@
ASSERT_NE(TypeOf(ident), nullptr);
EXPECT_TRUE(TypeOf(ident)->Is<type::F32>());
- EXPECT_TRUE(CheckVarUsers(my_var, utils::Vector{ident}));
+ EXPECT_TRUE(CheckVarUsers(my_var, Vector{ident}));
ASSERT_NE(VarOf(ident), nullptr);
EXPECT_EQ(VarOf(ident)->Declaration(), my_var);
}
@@ -707,7 +707,7 @@
ASSERT_NE(TypeOf(ident), nullptr);
EXPECT_TRUE(TypeOf(ident)->Is<type::F32>());
- EXPECT_TRUE(CheckVarUsers(my_var, utils::Vector{ident}));
+ EXPECT_TRUE(CheckVarUsers(my_var, Vector{ident}));
ASSERT_NE(VarOf(ident), nullptr);
EXPECT_EQ(VarOf(ident)->Declaration(), my_var);
}
@@ -717,8 +717,8 @@
auto* var = Let("my_var", ty.f32(), Call<f32>());
auto* decl = Decl(Var("b", ty.f32(), my_var_a));
- Func("my_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("my_func", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
decl,
});
@@ -728,7 +728,7 @@
ASSERT_NE(TypeOf(my_var_a), nullptr);
EXPECT_TRUE(TypeOf(my_var_a)->Is<type::F32>());
EXPECT_EQ(StmtOf(my_var_a), decl);
- EXPECT_TRUE(CheckVarUsers(var, utils::Vector{my_var_a}));
+ EXPECT_TRUE(CheckVarUsers(var, Vector{my_var_a}));
ASSERT_NE(VarOf(my_var_a), nullptr);
EXPECT_EQ(VarOf(my_var_a)->Declaration(), var);
}
@@ -740,8 +740,8 @@
auto* a = Var("a", ty.array<bool, 10>(), Call<array<bool, 10>>());
auto* idx = Var("idx", ty.f32(), Call<f32>());
auto* f = Var("f", ty.f32(), IndexAccessor("a", Expr(Source{{12, 34}}, idx)));
- Func("my_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("my_func", tint::Empty, ty.void_(),
+ Vector{
Decl(a),
Decl(idx),
Decl(f),
@@ -758,8 +758,8 @@
auto* var = Var("my_var", ty.f32());
- Func("my_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("my_func", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
assign,
});
@@ -773,7 +773,7 @@
ASSERT_NE(TypeOf(my_var_b), nullptr);
EXPECT_TRUE(TypeOf(my_var_b)->Is<type::F32>());
EXPECT_EQ(StmtOf(my_var_b), assign);
- EXPECT_TRUE(CheckVarUsers(var, utils::Vector{my_var_a, my_var_b}));
+ EXPECT_TRUE(CheckVarUsers(var, Vector{my_var_a, my_var_b}));
ASSERT_NE(VarOf(my_var_a), nullptr);
EXPECT_EQ(VarOf(my_var_a)->Declaration(), var);
ASSERT_NE(VarOf(my_var_b), nullptr);
@@ -786,8 +786,8 @@
auto* v_decl = Decl(Var("v", ty.f32()));
auto* p_decl = Decl(Let("p", ty.ptr<function, f32>(), AddressOf(v)));
auto* assign = Assign(Deref(p), 1.23_f);
- Func("my_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("my_func", tint::Empty, ty.void_(),
+ Vector{
v_decl,
p_decl,
assign,
@@ -806,8 +806,8 @@
}
TEST_F(ResolverTest, Expr_Call_Function) {
- Func("my_func", utils::Empty, ty.f32(),
- utils::Vector{
+ Func("my_func", tint::Empty, ty.f32(),
+ Vector{
Return(0_f),
});
@@ -833,12 +833,12 @@
auto* param_c = Param("c", ty.u32());
auto* func = Func("my_func",
- utils::Vector{
+ Vector{
param_a,
param_b,
param_c,
},
- ty.void_(), utils::Empty);
+ ty.void_(), tint::Empty);
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -855,26 +855,25 @@
}
TEST_F(ResolverTest, Function_Parameters_Locations) {
- auto* param_a = Param("a", ty.f32(), utils::Vector{Location(3_a)});
- auto* param_b =
- Param("b", ty.u32(), utils::Vector{Builtin(builtin::BuiltinValue::kVertexIndex)});
- auto* param_c = Param("c", ty.u32(), utils::Vector{Location(1_a)});
+ auto* param_a = Param("a", ty.f32(), Vector{Location(3_a)});
+ auto* param_b = Param("b", ty.u32(), Vector{Builtin(builtin::BuiltinValue::kVertexIndex)});
+ auto* param_c = Param("c", ty.u32(), Vector{Location(1_a)});
GlobalVar("my_vec", ty.vec4<f32>(), builtin::AddressSpace::kPrivate);
auto* func = Func("my_func",
- utils::Vector{
+ Vector{
param_a,
param_b,
param_c,
},
ty.vec4<f32>(),
- utils::Vector{
+ Vector{
Return("my_vec"),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kVertex),
},
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kPosition),
});
@@ -889,9 +888,9 @@
}
TEST_F(ResolverTest, Function_GlobalVariable_Location) {
- auto* var = GlobalVar(
- "my_vec", ty.vec4<f32>(), builtin::AddressSpace::kIn,
- utils::Vector{Location(3_a), Disable(ast::DisabledValidation::kIgnoreAddressSpace)});
+ auto* var =
+ GlobalVar("my_vec", ty.vec4<f32>(), builtin::AddressSpace::kIn,
+ Vector{Location(3_a), Disable(ast::DisabledValidation::kIgnoreAddressSpace)});
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -901,15 +900,15 @@
}
TEST_F(ResolverTest, Function_RegisterInputOutputVariables) {
- auto* s = Structure("S", utils::Vector{Member("m", ty.u32())});
+ auto* s = Structure("S", Vector{Member("m", ty.u32())});
auto* sb_var = GlobalVar("sb_var", ty.Of(s), builtin::AddressSpace::kStorage,
builtin::Access::kReadWrite, Binding(0_a), Group(0_a));
auto* wg_var = GlobalVar("wg_var", ty.f32(), builtin::AddressSpace::kWorkgroup);
auto* priv_var = GlobalVar("priv_var", ty.f32(), builtin::AddressSpace::kPrivate);
- auto* func = Func("my_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("my_func", tint::Empty, ty.void_(),
+ Vector{
Assign("wg_var", "wg_var"),
Assign("sb_var", "sb_var"),
Assign("priv_var", "priv_var"),
@@ -930,14 +929,14 @@
}
TEST_F(ResolverTest, Function_ReturnType_Location) {
- auto* func = Func("my_func", utils::Empty, ty.f32(),
- utils::Vector{
+ auto* func = Func("my_func", tint::Empty, ty.f32(),
+ Vector{
Return(1_f),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(2_a),
});
@@ -950,14 +949,14 @@
TEST_F(ResolverTest, Function_ReturnType_NoLocation) {
GlobalVar("my_vec", ty.vec4<f32>(), builtin::AddressSpace::kPrivate);
- auto* func = Func("my_func", utils::Empty, ty.vec4<f32>(),
- utils::Vector{
+ auto* func = Func("my_func", tint::Empty, ty.vec4<f32>(),
+ Vector{
Return("my_vec"),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kVertex),
},
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kPosition),
});
@@ -969,22 +968,22 @@
}
TEST_F(ResolverTest, Function_RegisterInputOutputVariables_SubFunction) {
- auto* s = Structure("S", utils::Vector{Member("m", ty.u32())});
+ auto* s = Structure("S", Vector{Member("m", ty.u32())});
auto* sb_var = GlobalVar("sb_var", ty.Of(s), builtin::AddressSpace::kStorage,
builtin::Access::kReadWrite, Binding(0_a), Group(0_a));
auto* wg_var = GlobalVar("wg_var", ty.f32(), builtin::AddressSpace::kWorkgroup);
auto* priv_var = GlobalVar("priv_var", ty.f32(), builtin::AddressSpace::kPrivate);
- Func("my_func", utils::Empty, ty.f32(),
- utils::Vector{Assign("wg_var", "wg_var"), Assign("sb_var", "sb_var"),
- Assign("priv_var", "priv_var"), Return(0_f)});
+ Func("my_func", tint::Empty, ty.f32(),
+ Vector{Assign("wg_var", "wg_var"), Assign("sb_var", "sb_var"),
+ Assign("priv_var", "priv_var"), Return(0_f)});
- auto* func2 = Func("func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func2 = Func("func", tint::Empty, ty.void_(),
+ Vector{
WrapInStatement(Call("my_func")),
},
- utils::Empty);
+ tint::Empty);
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -1000,8 +999,8 @@
}
TEST_F(ResolverTest, Function_NotRegisterFunctionVariable) {
- auto* func = Func("my_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("my_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("var", ty.f32())),
Assign("var", 1_f),
});
@@ -1016,8 +1015,8 @@
}
TEST_F(ResolverTest, Function_NotRegisterFunctionConstant) {
- auto* func = Func("my_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("my_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("var", ty.f32(), Call<f32>())),
});
@@ -1031,7 +1030,7 @@
}
TEST_F(ResolverTest, Function_NotRegisterFunctionParams) {
- auto* func = Func("my_func", utils::Vector{Param("var", ty.f32())}, ty.void_(), utils::Empty);
+ auto* func = Func("my_func", Vector{Param("var", ty.f32())}, ty.void_(), tint::Empty);
EXPECT_TRUE(r()->Resolve()) << r()->error();
auto* func_sem = Sem().Get(func);
@@ -1042,12 +1041,12 @@
}
TEST_F(ResolverTest, Function_CallSites) {
- auto* foo = Func("foo", utils::Empty, ty.void_(), utils::Empty);
+ auto* foo = Func("foo", tint::Empty, ty.void_(), tint::Empty);
auto* call_1 = Call("foo");
auto* call_2 = Call("foo");
- auto* bar = Func("bar", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* bar = Func("bar", tint::Empty, ty.void_(),
+ Vector{
CallStmt(call_1),
CallStmt(call_2),
});
@@ -1068,7 +1067,7 @@
TEST_F(ResolverTest, Function_WorkgroupSize_NotSet) {
// @compute @workgroup_size(1)
// fn main() {}
- auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty);
+ auto* func = Func("main", tint::Empty, ty.void_(), tint::Empty);
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -1083,8 +1082,8 @@
TEST_F(ResolverTest, Function_WorkgroupSize_Literals) {
// @compute @workgroup_size(8, 2, 3)
// fn main() {}
- auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ auto* func = Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(8_i, 2_i, 3_i),
});
@@ -1108,8 +1107,8 @@
GlobalConst("width", ty.i32(), Expr(16_i));
GlobalConst("height", ty.i32(), Expr(8_i));
GlobalConst("depth", ty.i32(), Expr(2_i));
- auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ auto* func = Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize("width", "height", "depth"),
});
@@ -1131,8 +1130,8 @@
// fn main() {}
GlobalConst("width", ty.i32(), Call<i32>(Call<i32>(Call<i32>(8_i))));
GlobalConst("height", ty.i32(), Call<i32>(Call<i32>(Call<i32>(4_i))));
- auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ auto* func = Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize("width", "height"),
});
@@ -1156,8 +1155,8 @@
Override("width", ty.i32(), Expr(16_i), Id(0_a));
Override("height", ty.i32(), Expr(8_i), Id(1_a));
Override("depth", ty.i32(), Expr(2_i), Id(2_a));
- auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ auto* func = Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize("width", "height", "depth"),
});
@@ -1181,8 +1180,8 @@
Override("width", ty.i32(), Id(0_a));
Override("height", ty.i32(), Id(1_a));
Override("depth", ty.i32(), Id(2_a));
- auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ auto* func = Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize("width", "height", "depth"),
});
@@ -1204,8 +1203,8 @@
// fn main() {}
Override("height", ty.i32(), Expr(2_i), Id(0_a));
GlobalConst("depth", ty.i32(), Expr(3_i));
- auto* func = Func("main", utils::Empty, ty.void_(), utils::Empty,
- utils::Vector{
+ auto* func = Func("main", tint::Empty, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(8_i, "height", "depth"),
});
@@ -1230,8 +1229,8 @@
}
TEST_F(ResolverTest, Expr_MemberAccessor_Struct) {
- auto* st = Structure(
- "S", utils::Vector{Member("first_member", ty.i32()), Member("second_member", ty.f32())});
+ auto* st =
+ Structure("S", Vector{Member("first_member", ty.i32()), Member("second_member", ty.f32())});
GlobalVar("my_struct", ty.Of(st), builtin::AddressSpace::kPrivate);
auto* mem = MemberAccessor("my_struct", "second_member");
@@ -1250,8 +1249,8 @@
}
TEST_F(ResolverTest, Expr_MemberAccessor_Struct_Alias) {
- auto* st = Structure(
- "S", utils::Vector{Member("first_member", ty.i32()), Member("second_member", ty.f32())});
+ auto* st =
+ Structure("S", Vector{Member("first_member", ty.i32()), Member("second_member", ty.f32())});
auto* alias = Alias("alias", ty.Of(st));
GlobalVar("my_struct", ty.Of(alias), builtin::AddressSpace::kPrivate);
@@ -1319,8 +1318,8 @@
// }
//
- auto* stB = Structure("B", utils::Vector{Member("foo", ty.vec4<f32>())});
- auto* stA = Structure("A", utils::Vector{Member("mem", ty.array(ty.Of(stB), 3_i))});
+ auto* stB = Structure("B", Vector{Member("foo", ty.vec4<f32>())});
+ auto* stA = Structure("A", Vector{Member("mem", ty.array(ty.Of(stB), 3_i))});
GlobalVar("c", ty.Of(stA), builtin::AddressSpace::kPrivate);
auto* mem =
@@ -1337,8 +1336,8 @@
}
TEST_F(ResolverTest, Expr_MemberAccessor_InBinaryOp) {
- auto* st = Structure(
- "S", utils::Vector{Member("first_member", ty.f32()), Member("second_member", ty.f32())});
+ auto* st =
+ Structure("S", Vector{Member("first_member", ty.f32()), Member("second_member", ty.f32())});
GlobalVar("my_struct", ty.Of(st), builtin::AddressSpace::kPrivate);
auto* expr = Add(MemberAccessor("my_struct", "first_member"),
@@ -1638,7 +1637,7 @@
ast::Type rhs_type = params.create_rhs_type(*this);
auto* result_type = params.create_result_type(*this);
- utils::StringStream ss;
+ StringStream ss;
ss << FriendlyName(lhs_type) << " " << params.op << " " << FriendlyName(rhs_type);
SCOPED_TRACE(ss.str());
@@ -1670,7 +1669,7 @@
ast::Type lhs_type = create_lhs_type(*this);
ast::Type rhs_type = create_rhs_type(*this);
- utils::StringStream ss;
+ StringStream ss;
ss << FriendlyName(lhs_type) << " " << params.op << " " << FriendlyName(rhs_type);
ss << ", After aliasing: " << FriendlyName(lhs_type) << " " << params.op << " "
@@ -1719,7 +1718,7 @@
ast::Type lhs_type = lhs_create_type_func(*this);
ast::Type rhs_type = rhs_create_type_func(*this);
- utils::StringStream ss;
+ StringStream ss;
ss << FriendlyName(lhs_type) << " " << op << " " << FriendlyName(rhs_type);
SCOPED_TRACE(ss.str());
@@ -1861,7 +1860,7 @@
auto* var = Var("var", ty.i32());
auto* stmt = Decl(var);
- Func("func", utils::Empty, ty.void_(), utils::Vector{stmt});
+ Func("func", tint::Empty, ty.void_(), Vector{stmt});
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -1889,7 +1888,7 @@
TEST_F(ResolverTest, AddressSpace_DoesNotSetOnConst) {
auto* var = Let("var", ty.i32(), Call<i32>());
auto* stmt = Decl(var);
- Func("func", utils::Empty, ty.void_(), utils::Vector{stmt});
+ Func("func", tint::Empty, ty.void_(), Vector{stmt});
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -1899,7 +1898,7 @@
TEST_F(ResolverTest, Access_SetForStorageBuffer) {
// struct S { x : i32 };
// var<storage> g : S;
- auto* s = Structure("S", utils::Vector{Member(Source{{12, 34}}, "x", ty.i32())});
+ auto* s = Structure("S", Vector{Member(Source{{12, 34}}, "x", ty.i32())});
auto* var = GlobalVar(Source{{56, 78}}, "g", ty.Of(s), builtin::AddressSpace::kStorage,
Binding(0_a), Group(0_a));
@@ -1939,37 +1938,37 @@
GlobalVar("call_b", ty.f32(), builtin::AddressSpace::kPrivate);
GlobalVar("call_c", ty.f32(), builtin::AddressSpace::kPrivate);
- auto* func_b = Func("b", utils::Empty, ty.f32(),
- utils::Vector{
+ auto* func_b = Func("b", tint::Empty, ty.f32(),
+ Vector{
Return(0_f),
});
- auto* func_c = Func("c", utils::Empty, ty.f32(),
- utils::Vector{
+ auto* func_c = Func("c", tint::Empty, ty.f32(),
+ Vector{
Assign("second", Call("b")),
Return(0_f),
});
- auto* func_a = Func("a", utils::Empty, ty.f32(),
- utils::Vector{
+ auto* func_a = Func("a", tint::Empty, ty.f32(),
+ Vector{
Assign("first", Call("c")),
Return(0_f),
});
- auto* ep_1 = Func("ep_1", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* ep_1 = Func("ep_1", tint::Empty, ty.void_(),
+ Vector{
Assign("call_a", Call("a")),
Assign("call_b", Call("b")),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
- auto* ep_2 = Func("ep_2", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* ep_2 = Func("ep_2", tint::Empty, ty.void_(),
+ Vector{
Assign("call_c", Call("c")),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -2026,38 +2025,38 @@
auto fn_a = [](int level) { return "l" + std::to_string(level + 1) + "a"; };
auto fn_b = [](int level) { return "l" + std::to_string(level + 1) + "b"; };
- Func(fn_a(levels), utils::Empty, ty.void_(), utils::Empty);
- Func(fn_b(levels), utils::Empty, ty.void_(), utils::Empty);
+ Func(fn_a(levels), tint::Empty, ty.void_(), tint::Empty);
+ Func(fn_b(levels), tint::Empty, ty.void_(), tint::Empty);
for (int i = levels - 1; i >= 0; i--) {
- Func(fn_a(i), utils::Empty, ty.void_(),
- utils::Vector{
+ Func(fn_a(i), tint::Empty, ty.void_(),
+ Vector{
CallStmt(Call(fn_a(i + 1))),
CallStmt(Call(fn_b(i + 1))),
},
- utils::Empty);
- Func(fn_b(i), utils::Empty, ty.void_(),
- utils::Vector{
+ tint::Empty);
+ Func(fn_b(i), tint::Empty, ty.void_(),
+ Vector{
CallStmt(Call(fn_a(i + 1))),
CallStmt(Call(fn_b(i + 1))),
},
- utils::Empty);
+ tint::Empty);
}
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
CallStmt(Call(fn_a(0))),
CallStmt(Call(fn_b(0))),
},
- utils::Vector{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)});
+ Vector{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
}
// Test for crbug.com/tint/728
TEST_F(ResolverTest, ASTNodesAreReached) {
- Structure("A", utils::Vector{Member("x", ty.array<f32, 4>(utils::Vector{Stride(4)}))});
- Structure("B", utils::Vector{Member("x", ty.array<f32, 4>(utils::Vector{Stride(4)}))});
+ Structure("A", Vector{Member("x", ty.array<f32, 4>(Vector{Stride(4)}))});
+ Structure("B", Vector{Member("x", ty.array<f32, 4>(Vector{Stride(4)}))});
ASSERT_TRUE(r()->Resolve()) << r()->error();
}
@@ -2121,8 +2120,8 @@
auto* call = Call("textureSample", "t", "s", Call<vec2<f32>>(1_f, 2_f));
const ast::Function* f =
- Func("test_function", utils::Empty, ty.void_(), utils::Vector{Assign(Phony(), call)},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("test_function", tint::Empty, ty.void_(), Vector{Assign(Phony(), call)},
+ Vector{Stage(ast::PipelineStage::kFragment)});
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -2140,11 +2139,11 @@
auto* inner_call = Assign(Phony(), Call("textureSample", "t", "s", Call<vec2<f32>>(1_f, 2_f)));
const ast::Function* inner_func =
- Func("inner_func", utils::Empty, ty.void_(), utils::Vector{inner_call});
+ Func("inner_func", tint::Empty, ty.void_(), Vector{inner_call});
auto* outer_call = CallStmt(Call("inner_func"));
const ast::Function* outer_func =
- Func("outer_func", utils::Empty, ty.void_(), utils::Vector{outer_call},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("outer_func", tint::Empty, ty.void_(), Vector{outer_call},
+ Vector{Stage(ast::PipelineStage::kFragment)});
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -2167,16 +2166,16 @@
auto* inner_call_1 =
Assign(Phony(), Call("textureSample", "t", "s", Call<vec2<f32>>(1_f, 2_f)));
const ast::Function* inner_func_1 =
- Func("inner_func_1", utils::Empty, ty.void_(), utils::Vector{inner_call_1});
+ Func("inner_func_1", tint::Empty, ty.void_(), Vector{inner_call_1});
auto* inner_call_2 =
Assign(Phony(), Call("textureSample", "t", "s", Call<vec2<f32>>(3_f, 4_f)));
const ast::Function* inner_func_2 =
- Func("inner_func_2", utils::Empty, ty.void_(), utils::Vector{inner_call_2});
+ Func("inner_func_2", tint::Empty, ty.void_(), Vector{inner_call_2});
auto* outer_call_1 = CallStmt(Call("inner_func_1"));
auto* outer_call_2 = CallStmt(Call("inner_func_2"));
const ast::Function* outer_func =
- Func("outer_func", utils::Empty, ty.void_(), utils::Vector{outer_call_1, outer_call_2},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("outer_func", tint::Empty, ty.void_(), Vector{outer_call_1, outer_call_2},
+ Vector{Stage(ast::PipelineStage::kFragment)});
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -2206,16 +2205,16 @@
auto* inner_call_1 =
Assign(Phony(), Call("textureSample", "t1", "s", Call<vec2<f32>>(1_f, 2_f)));
const ast::Function* inner_func_1 =
- Func("inner_func_1", utils::Empty, ty.void_(), utils::Vector{inner_call_1});
+ Func("inner_func_1", tint::Empty, ty.void_(), Vector{inner_call_1});
auto* inner_call_2 =
Assign(Phony(), Call("textureSample", "t2", "s", Call<vec2<f32>>(3_f, 4_f)));
const ast::Function* inner_func_2 =
- Func("inner_func_2", utils::Empty, ty.void_(), utils::Vector{inner_call_2});
+ Func("inner_func_2", tint::Empty, ty.void_(), Vector{inner_call_2});
auto* outer_call_1 = CallStmt(Call("inner_func_1"));
auto* outer_call_2 = CallStmt(Call("inner_func_2"));
const ast::Function* outer_func =
- Func("outer_func", utils::Empty, ty.void_(), utils::Vector{outer_call_1, outer_call_2},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("outer_func", tint::Empty, ty.void_(), Vector{outer_call_1, outer_call_2},
+ Vector{Stage(ast::PipelineStage::kFragment)});
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -2271,25 +2270,25 @@
Binding(1_a));
GlobalVar("c", ty.vec2<f32>(), builtin::AddressSpace::kUniform, Group(0_a), Binding(2_a));
- Func("main", utils::Empty, ty.vec4<f32>(),
- utils::Vector{
+ Func("main", tint::Empty, ty.vec4<f32>(),
+ Vector{
Return(Call("helper", AddressOf("s"), AddressOf("t"))),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(0_u),
});
Func("helper",
- utils::Vector{
+ Vector{
Param("sl", ty.ptr<function>(ty.sampler(type::SamplerKind::kSampler))),
Param("tl",
ty.ptr<function>(ty.sampled_texture(type::TextureDimension::k2d, ty.f32()))),
},
ty.vec4<f32>(),
- utils::Vector{
+ Vector{
Return(Call("textureSampleLevel", Deref("tl"), Deref("sl"), "c", 0.0_a)),
});
@@ -2298,18 +2297,18 @@
}
TEST_F(ResolverTest, ModuleDependencyOrderedDeclarations) {
- auto* f0 = Func("f0", utils::Empty, ty.void_(), utils::Empty);
+ auto* f0 = Func("f0", tint::Empty, ty.void_(), tint::Empty);
auto* v0 = GlobalVar("v0", ty.i32(), builtin::AddressSpace::kPrivate);
auto* a0 = Alias("a0", ty.i32());
- auto* s0 = Structure("s0", utils::Vector{Member("m", ty.i32())});
- auto* f1 = Func("f1", utils::Empty, ty.void_(), utils::Empty);
+ auto* s0 = Structure("s0", Vector{Member("m", ty.i32())});
+ auto* f1 = Func("f1", tint::Empty, ty.void_(), tint::Empty);
auto* v1 = GlobalVar("v1", ty.i32(), builtin::AddressSpace::kPrivate);
auto* a1 = Alias("a1", ty.i32());
- auto* s1 = Structure("s1", utils::Vector{Member("m", ty.i32())});
- auto* f2 = Func("f2", utils::Empty, ty.void_(), utils::Empty);
+ auto* s1 = Structure("s1", Vector{Member("m", ty.i32())});
+ auto* f2 = Func("f2", tint::Empty, ty.void_(), tint::Empty);
auto* v2 = GlobalVar("v2", ty.i32(), builtin::AddressSpace::kPrivate);
auto* a2 = Alias("a2", ty.i32());
- auto* s2 = Structure("s2", utils::Vector{Member("m", ty.i32())});
+ auto* s2 = Structure("s2", Vector{Member("m", ty.i32())});
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -2391,7 +2390,7 @@
const size_t kMaxNumStructMembers = 16383;
TEST_F(ResolverTest, MaxNumStructMembers_Valid) {
- utils::Vector<const ast::StructMember*, 0> members;
+ Vector<const ast::StructMember*, 0> members;
members.Reserve(kMaxNumStructMembers);
for (size_t i = 0; i < kMaxNumStructMembers; ++i) {
members.Push(Member("m" + std::to_string(i), ty.i32()));
@@ -2401,7 +2400,7 @@
}
TEST_F(ResolverTest, MaxNumStructMembers_Invalid) {
- utils::Vector<const ast::StructMember*, 0> members;
+ Vector<const ast::StructMember*, 0> members;
members.Reserve(kMaxNumStructMembers + 1);
for (size_t i = 0; i < kMaxNumStructMembers + 1; ++i) {
members.Push(Member("m" + std::to_string(i), ty.i32()));
@@ -2412,7 +2411,7 @@
}
TEST_F(ResolverTest, MaxNumStructMembers_WithIgnoreStructMemberLimit_Valid) {
- utils::Vector<const ast::StructMember*, 0> members;
+ Vector<const ast::StructMember*, 0> members;
members.Reserve(kMaxNumStructMembers);
for (size_t i = 0; i < kMaxNumStructMembers; ++i) {
members.Push(Member("m" + std::to_string(i), ty.i32()));
@@ -2424,73 +2423,73 @@
}
Structure("S", std::move(members),
- utils::Vector{Disable(ast::DisabledValidation::kIgnoreStructMemberLimit)});
+ Vector{Disable(ast::DisabledValidation::kIgnoreStructMemberLimit)});
EXPECT_TRUE(r()->Resolve()) << r()->error();
}
size_t kMaxNestDepthOfCompositeType = 255;
TEST_F(ResolverTest, MaxNestDepthOfCompositeType_Structs_Valid) {
- auto* s = Structure("S", utils::Vector{Member("m", ty.i32())});
+ auto* s = Structure("S", Vector{Member("m", ty.i32())});
size_t depth = 1; // Depth of struct
size_t iterations = kMaxNestDepthOfCompositeType - depth;
for (size_t i = 0; i < iterations; ++i) {
- s = Structure("S" + std::to_string(i), utils::Vector{Member("m", ty.Of(s))});
+ s = Structure("S" + std::to_string(i), Vector{Member("m", ty.Of(s))});
}
EXPECT_TRUE(r()->Resolve()) << r()->error();
}
TEST_F(ResolverTest, MaxNestDepthOfCompositeType_Structs_Invalid) {
- auto* s = Structure("S", utils::Vector{Member("m", ty.i32())});
+ auto* s = Structure("S", Vector{Member("m", ty.i32())});
size_t depth = 1; // Depth of struct
size_t iterations = kMaxNestDepthOfCompositeType - depth + 1;
for (size_t i = 0; i < iterations; ++i) {
auto source = i == iterations - 1 ? Source{{12, 34}} : Source{{0, i}};
- s = Structure(source, "S" + std::to_string(i), utils::Vector{Member("m", ty.Of(s))});
+ s = Structure(source, "S" + std::to_string(i), Vector{Member("m", ty.Of(s))});
}
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), "12:34 error: struct 'S254' has nesting depth of 256, maximum is 255");
}
TEST_F(ResolverTest, MaxNestDepthOfCompositeType_StructsWithVector_Valid) {
- auto* s = Structure("S", utils::Vector{Member("m", ty.vec3<i32>())});
+ auto* s = Structure("S", Vector{Member("m", ty.vec3<i32>())});
size_t depth = 2; // Despth of struct + vector
size_t iterations = kMaxNestDepthOfCompositeType - depth;
for (size_t i = 0; i < iterations; ++i) {
- s = Structure("S" + std::to_string(i), utils::Vector{Member("m", ty.Of(s))});
+ s = Structure("S" + std::to_string(i), Vector{Member("m", ty.Of(s))});
}
EXPECT_TRUE(r()->Resolve()) << r()->error();
}
TEST_F(ResolverTest, MaxNestDepthOfCompositeType_StructsWithVector_Invalid) {
- auto* s = Structure("S", utils::Vector{Member("m", ty.vec3<i32>())});
+ auto* s = Structure("S", Vector{Member("m", ty.vec3<i32>())});
size_t depth = 2; // Despth of struct + vector
size_t iterations = kMaxNestDepthOfCompositeType - depth + 1;
for (size_t i = 0; i < iterations; ++i) {
auto source = i == iterations - 1 ? Source{{12, 34}} : Source{{0, i}};
- s = Structure(source, "S" + std::to_string(i), utils::Vector{Member("m", ty.Of(s))});
+ s = Structure(source, "S" + std::to_string(i), Vector{Member("m", ty.Of(s))});
}
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), "12:34 error: struct 'S253' has nesting depth of 256, maximum is 255");
}
TEST_F(ResolverTest, MaxNestDepthOfCompositeType_StructsWithMatrix_Valid) {
- auto* s = Structure("S", utils::Vector{Member("m", ty.mat3x3<f32>())});
+ auto* s = Structure("S", Vector{Member("m", ty.mat3x3<f32>())});
size_t depth = 3; // Depth of struct + matrix
size_t iterations = kMaxNestDepthOfCompositeType - depth;
for (size_t i = 0; i < iterations; ++i) {
- s = Structure("S" + std::to_string(i), utils::Vector{Member("m", ty.Of(s))});
+ s = Structure("S" + std::to_string(i), Vector{Member("m", ty.Of(s))});
}
EXPECT_TRUE(r()->Resolve()) << r()->error();
}
TEST_F(ResolverTest, MaxNestDepthOfCompositeType_StructsWithMatrix_Invalid) {
- auto* s = Structure("S", utils::Vector{Member("m", ty.mat3x3<f32>())});
+ auto* s = Structure("S", Vector{Member("m", ty.mat3x3<f32>())});
size_t depth = 3; // Depth of struct + matrix
size_t iterations = kMaxNestDepthOfCompositeType - depth + 1;
for (size_t i = 0; i < iterations; ++i) {
auto source = i == iterations - 1 ? Source{{12, 34}} : Source{{0, i}};
- s = Structure(source, "S" + std::to_string(i), utils::Vector{Member("m", ty.Of(s))});
+ s = Structure(source, "S" + std::to_string(i), Vector{Member("m", ty.Of(s))});
}
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), "12:34 error: struct 'S252' has nesting depth of 256, maximum is 255");
@@ -2570,30 +2569,30 @@
TEST_F(ResolverTest, MaxNestDepthOfCompositeType_StructsOfArray_Valid) {
auto a = ty.array(ty.mat3x3<f32>(), 10_u);
- auto* s = Structure("S", utils::Vector{Member("m", a)});
+ auto* s = Structure("S", Vector{Member("m", a)});
size_t depth = 4; // Depth of struct + array + matrix
size_t iterations = kMaxNestDepthOfCompositeType - depth;
for (size_t i = 0; i < iterations; ++i) {
- s = Structure("S" + std::to_string(i), utils::Vector{Member("m", ty.Of(s))});
+ s = Structure("S" + std::to_string(i), Vector{Member("m", ty.Of(s))});
}
EXPECT_TRUE(r()->Resolve()) << r()->error();
}
TEST_F(ResolverTest, MaxNestDepthOfCompositeType_StructsOfArray_Invalid) {
auto a = ty.array(ty.mat3x3<f32>(), 10_u);
- auto* s = Structure("S", utils::Vector{Member("m", a)});
+ auto* s = Structure("S", Vector{Member("m", a)});
size_t depth = 4; // Depth of struct + array + matrix
size_t iterations = kMaxNestDepthOfCompositeType - depth + 1;
for (size_t i = 0; i < iterations; ++i) {
auto source = i == iterations - 1 ? Source{{12, 34}} : Source{{0, i}};
- s = Structure(source, "S" + std::to_string(i), utils::Vector{Member("m", ty.Of(s))});
+ s = Structure(source, "S" + std::to_string(i), Vector{Member("m", ty.Of(s))});
}
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), "12:34 error: struct 'S251' has nesting depth of 256, maximum is 255");
}
TEST_F(ResolverTest, MaxNestDepthOfCompositeType_ArraysOfStruct_Valid) {
- auto* s = Structure("S", utils::Vector{Member("m", ty.mat3x3<f32>())});
+ auto* s = Structure("S", Vector{Member("m", ty.mat3x3<f32>())});
auto a = ty.array(ty.Of(s), 10_u);
size_t depth = 4; // Depth of array + struct + matrix
size_t iterations = kMaxNestDepthOfCompositeType - depth;
@@ -2605,7 +2604,7 @@
}
TEST_F(ResolverTest, MaxNestDepthOfCompositeType_ArraysOfStruct_Invalid) {
- auto* s = Structure("S", utils::Vector{Member("m", ty.mat3x3<f32>())});
+ auto* s = Structure("S", Vector{Member("m", ty.mat3x3<f32>())});
auto a = ty.array(ty.Of(s), 10_u);
size_t depth = 4; // Depth of array + struct + matrix
size_t iterations = kMaxNestDepthOfCompositeType - depth + 1;
diff --git a/src/tint/lang/wgsl/resolver/resolver_test_helper.h b/src/tint/lang/wgsl/resolver/resolver_test_helper.h
index 57de071..2f30d66 100644
--- a/src/tint/lang/wgsl/resolver/resolver_test_helper.h
+++ b/src/tint/lang/wgsl/resolver/resolver_test_helper.h
@@ -95,8 +95,7 @@
/// @param var the variable to check
/// @param expected_users the expected users of the variable
/// @return true if all users are as expected
- bool CheckVarUsers(const ast::Variable* var,
- utils::VectorRef<const ast::Expression*> expected_users) {
+ bool CheckVarUsers(const ast::Variable* var, VectorRef<const ast::Expression*> expected_users) {
auto var_users = Sem().Get(var)->Users();
if (var_users.Length() != expected_users.Length()) {
return false;
@@ -152,8 +151,7 @@
}
using ast_type_func_ptr = ast::Type (*)(ProgramBuilder& b);
-using ast_expr_func_ptr = const ast::Expression* (*)(ProgramBuilder& b,
- utils::VectorRef<Scalar> args);
+using ast_expr_func_ptr = const ast::Expression* (*)(ProgramBuilder& b, VectorRef<Scalar> args);
using ast_expr_from_double_func_ptr = const ast::Expression* (*)(ProgramBuilder& b, double v);
using sem_type_func_ptr = const type::Type* (*)(ProgramBuilder& b);
using type_name_func_ptr = std::string (*)();
@@ -197,14 +195,14 @@
/// @param b the ProgramBuilder
/// @param args args of size 1 with the boolean value to init with
/// @return a new AST expression of the bool type
- static inline const ast::Expression* Expr(ProgramBuilder& b, utils::VectorRef<Scalar> args) {
+ static inline const ast::Expression* Expr(ProgramBuilder& b, VectorRef<Scalar> args) {
return b.Expr(std::get<bool>(args[0]));
}
/// @param b the ProgramBuilder
/// @param v arg of type double that will be cast to bool.
/// @return a new AST expression of the bool type
static inline const ast::Expression* ExprFromDouble(ProgramBuilder& b, double v) {
- return Expr(b, utils::Vector<Scalar, 1>{static_cast<ElementType>(v)});
+ return Expr(b, Vector<Scalar, 1>{static_cast<ElementType>(v)});
}
/// @returns the WGSL name for the type
static inline std::string Name() { return "bool"; }
@@ -228,14 +226,14 @@
/// @param b the ProgramBuilder
/// @param args args of size 1 with the i32 value to init with
/// @return a new AST i32 literal value expression
- static inline const ast::Expression* Expr(ProgramBuilder& b, utils::VectorRef<Scalar> args) {
+ static inline const ast::Expression* Expr(ProgramBuilder& b, VectorRef<Scalar> args) {
return b.Expr(std::get<i32>(args[0]));
}
/// @param b the ProgramBuilder
/// @param v arg of type double that will be cast to i32.
/// @return a new AST i32 literal value expression
static inline const ast::Expression* ExprFromDouble(ProgramBuilder& b, double v) {
- return Expr(b, utils::Vector<Scalar, 1>{static_cast<ElementType>(v)});
+ return Expr(b, Vector<Scalar, 1>{static_cast<ElementType>(v)});
}
/// @returns the WGSL name for the type
static inline std::string Name() { return "i32"; }
@@ -259,14 +257,14 @@
/// @param b the ProgramBuilder
/// @param args args of size 1 with the u32 value to init with
/// @return a new AST u32 literal value expression
- static inline const ast::Expression* Expr(ProgramBuilder& b, utils::VectorRef<Scalar> args) {
+ static inline const ast::Expression* Expr(ProgramBuilder& b, VectorRef<Scalar> args) {
return b.Expr(std::get<u32>(args[0]));
}
/// @param b the ProgramBuilder
/// @param v arg of type double that will be cast to u32.
/// @return a new AST u32 literal value expression
static inline const ast::Expression* ExprFromDouble(ProgramBuilder& b, double v) {
- return Expr(b, utils::Vector<Scalar, 1>{static_cast<ElementType>(v)});
+ return Expr(b, Vector<Scalar, 1>{static_cast<ElementType>(v)});
}
/// @returns the WGSL name for the type
static inline std::string Name() { return "u32"; }
@@ -290,14 +288,14 @@
/// @param b the ProgramBuilder
/// @param args args of size 1 with the f32 value to init with
/// @return a new AST f32 literal value expression
- static inline const ast::Expression* Expr(ProgramBuilder& b, utils::VectorRef<Scalar> args) {
+ static inline const ast::Expression* Expr(ProgramBuilder& b, VectorRef<Scalar> args) {
return b.Expr(std::get<f32>(args[0]));
}
/// @param b the ProgramBuilder
/// @param v arg of type double that will be cast to f32.
/// @return a new AST f32 literal value expression
static inline const ast::Expression* ExprFromDouble(ProgramBuilder& b, double v) {
- return Expr(b, utils::Vector<Scalar, 1>{static_cast<f32>(v)});
+ return Expr(b, Vector<Scalar, 1>{static_cast<f32>(v)});
}
/// @returns the WGSL name for the type
static inline std::string Name() { return "f32"; }
@@ -321,14 +319,14 @@
/// @param b the ProgramBuilder
/// @param args args of size 1 with the f16 value to init with
/// @return a new AST f16 literal value expression
- static inline const ast::Expression* Expr(ProgramBuilder& b, utils::VectorRef<Scalar> args) {
+ static inline const ast::Expression* Expr(ProgramBuilder& b, VectorRef<Scalar> args) {
return b.Expr(std::get<f16>(args[0]));
}
/// @param b the ProgramBuilder
/// @param v arg of type double that will be cast to f16.
/// @return a new AST f16 literal value expression
static inline const ast::Expression* ExprFromDouble(ProgramBuilder& b, double v) {
- return Expr(b, utils::Vector<Scalar, 1>{static_cast<ElementType>(v)});
+ return Expr(b, Vector<Scalar, 1>{static_cast<ElementType>(v)});
}
/// @returns the WGSL name for the type
static inline std::string Name() { return "f16"; }
@@ -353,14 +351,14 @@
/// @param b the ProgramBuilder
/// @param args args of size 1 with the abstract-float value to init with
/// @return a new AST abstract-float literal value expression
- static inline const ast::Expression* Expr(ProgramBuilder& b, utils::VectorRef<Scalar> args) {
+ static inline const ast::Expression* Expr(ProgramBuilder& b, VectorRef<Scalar> args) {
return b.Expr(std::get<AFloat>(args[0]));
}
/// @param b the ProgramBuilder
/// @param v arg of type double that will be cast to AFloat.
/// @return a new AST abstract-float literal value expression
static inline const ast::Expression* ExprFromDouble(ProgramBuilder& b, double v) {
- return Expr(b, utils::Vector<Scalar, 1>{static_cast<ElementType>(v)});
+ return Expr(b, Vector<Scalar, 1>{static_cast<ElementType>(v)});
}
/// @returns the WGSL name for the type
static inline std::string Name() { return "abstract-float"; }
@@ -383,14 +381,14 @@
/// @param b the ProgramBuilder
/// @param args args of size 1 with the abstract-int value to init with
/// @return a new AST abstract-int literal value expression
- static inline const ast::Expression* Expr(ProgramBuilder& b, utils::VectorRef<Scalar> args) {
+ static inline const ast::Expression* Expr(ProgramBuilder& b, VectorRef<Scalar> args) {
return b.Expr(std::get<AInt>(args[0]));
}
/// @param b the ProgramBuilder
/// @param v arg of type double that will be cast to AInt.
/// @return a new AST abstract-int literal value expression
static inline const ast::Expression* ExprFromDouble(ProgramBuilder& b, double v) {
- return Expr(b, utils::Vector<Scalar, 1>{static_cast<ElementType>(v)});
+ return Expr(b, Vector<Scalar, 1>{static_cast<ElementType>(v)});
}
/// @returns the WGSL name for the type
static inline std::string Name() { return "abstract-int"; }
@@ -422,17 +420,17 @@
/// @param b the ProgramBuilder
/// @param args args of size 1 or N with values of type T to initialize with
/// @return a new AST vector value expression
- static inline const ast::Expression* Expr(ProgramBuilder& b, utils::VectorRef<Scalar> args) {
+ static inline const ast::Expression* Expr(ProgramBuilder& b, VectorRef<Scalar> args) {
return b.Call(AST(b), ExprArgs(b, std::move(args)));
}
/// @param b the ProgramBuilder
/// @param args args of size 1 or N with values of type T to initialize with
/// @return the list of expressions that are used to construct the vector
- static inline auto ExprArgs(ProgramBuilder& b, utils::VectorRef<Scalar> args) {
+ static inline auto ExprArgs(ProgramBuilder& b, VectorRef<Scalar> args) {
const bool one_value = args.Length() == 1;
- utils::Vector<const ast::Expression*, N> r;
+ Vector<const ast::Expression*, N> r;
for (size_t i = 0; i < N; ++i) {
- r.Push(DataType<T>::Expr(b, utils::Vector<Scalar, 1>{one_value ? args[0] : args[i]}));
+ r.Push(DataType<T>::Expr(b, Vector<Scalar, 1>{one_value ? args[0] : args[i]}));
}
return r;
}
@@ -440,7 +438,7 @@
/// @param v arg of type double that will be cast to ElementType
/// @return a new AST vector value expression
static inline const ast::Expression* ExprFromDouble(ProgramBuilder& b, double v) {
- return Expr(b, utils::Vector<Scalar, 1>{static_cast<ElementType>(v)});
+ return Expr(b, Vector<Scalar, 1>{static_cast<ElementType>(v)});
}
/// @returns the WGSL name for the type
static inline std::string Name() {
@@ -475,22 +473,22 @@
/// @param b the ProgramBuilder
/// @param args args of size 1 or N*M with values of type T to initialize with
/// @return a new AST matrix value expression
- static inline const ast::Expression* Expr(ProgramBuilder& b, utils::VectorRef<Scalar> args) {
+ static inline const ast::Expression* Expr(ProgramBuilder& b, VectorRef<Scalar> args) {
return b.Call(AST(b), ExprArgs(b, std::move(args)));
}
/// @param b the ProgramBuilder
/// @param args args of size 1 or N*M with values of type T to initialize with
/// @return a new AST matrix value expression
- static inline auto ExprArgs(ProgramBuilder& b, utils::VectorRef<Scalar> args) {
+ static inline auto ExprArgs(ProgramBuilder& b, VectorRef<Scalar> args) {
const bool one_value = args.Length() == 1;
size_t next = 0;
- utils::Vector<const ast::Expression*, N> r;
+ Vector<const ast::Expression*, N> r;
for (uint32_t i = 0; i < N; ++i) {
if (one_value) {
r.Push(DataType<builtin::fluent_types::vec<M, T>>::Expr(
- b, utils::Vector<Scalar, 1>{args[0]}));
+ b, Vector<Scalar, 1>{args[0]}));
} else {
- utils::Vector<Scalar, M> v;
+ Vector<Scalar, M> v;
for (size_t j = 0; j < M; ++j) {
v.Push(args[next++]);
}
@@ -503,7 +501,7 @@
/// @param v arg of type double that will be cast to ElementType
/// @return a new AST matrix value expression
static inline const ast::Expression* ExprFromDouble(ProgramBuilder& b, double v) {
- return Expr(b, utils::Vector<Scalar, 1>{static_cast<ElementType>(v)});
+ return Expr(b, Vector<Scalar, 1>{static_cast<ElementType>(v)});
}
/// @returns the WGSL name for the type
static inline std::string Name() {
@@ -540,9 +538,9 @@
/// @param args the value nested elements will be initialized with
/// @return a new AST expression of the alias type
template <bool IS_COMPOSITE = is_composite>
- static inline utils::traits::EnableIf<!IS_COMPOSITE, const ast::Expression*> Expr(
+ static inline tint::traits::EnableIf<!IS_COMPOSITE, const ast::Expression*> Expr(
ProgramBuilder& b,
- utils::VectorRef<Scalar> args) {
+ VectorRef<Scalar> args) {
// Cast
return b.Call(AST(b), DataType<T>::Expr(b, std::move(args)));
}
@@ -551,9 +549,9 @@
/// @param args the value nested elements will be initialized with
/// @return a new AST expression of the alias type
template <bool IS_COMPOSITE = is_composite>
- static inline utils::traits::EnableIf<IS_COMPOSITE, const ast::Expression*> Expr(
+ static inline tint::traits::EnableIf<IS_COMPOSITE, const ast::Expression*> Expr(
ProgramBuilder& b,
- utils::VectorRef<Scalar> args) {
+ VectorRef<Scalar> args) {
// Construct
return b.Call(AST(b), DataType<T>::ExprArgs(b, std::move(args)));
}
@@ -562,7 +560,7 @@
/// @param v arg of type double that will be cast to ElementType
/// @return a new AST expression of the alias type
static inline const ast::Expression* ExprFromDouble(ProgramBuilder& b, double v) {
- return Expr(b, utils::Vector<Scalar, 1>{static_cast<ElementType>(v)});
+ return Expr(b, Vector<Scalar, 1>{static_cast<ElementType>(v)});
}
/// @returns the WGSL name for the type
@@ -594,8 +592,7 @@
/// @param b the ProgramBuilder
/// @return a new AST expression of the pointer type
- static inline const ast::Expression* Expr(ProgramBuilder& b,
- utils::VectorRef<Scalar> /*unused*/) {
+ static inline const ast::Expression* Expr(ProgramBuilder& b, VectorRef<Scalar> /*unused*/) {
auto sym = b.Symbols().New("global_for_ptr");
b.GlobalVar(sym, DataType<T>::AST(b), builtin::AddressSpace::kPrivate);
return b.AddressOf(sym);
@@ -605,7 +602,7 @@
/// @param v arg of type double that will be cast to ElementType
/// @return a new AST expression of the pointer type
static inline const ast::Expression* ExprFromDouble(ProgramBuilder& b, double v) {
- return Expr(b, utils::Vector<Scalar, 1>{static_cast<ElementType>(v)});
+ return Expr(b, Vector<Scalar, 1>{static_cast<ElementType>(v)});
}
/// @returns the WGSL name for the type
@@ -651,17 +648,17 @@
/// @param args args of size 1 or N with values of type T to initialize with
/// with
/// @return a new AST array value expression
- static inline const ast::Expression* Expr(ProgramBuilder& b, utils::VectorRef<Scalar> args) {
+ static inline const ast::Expression* Expr(ProgramBuilder& b, VectorRef<Scalar> args) {
return b.Call(AST(b), ExprArgs(b, std::move(args)));
}
/// @param b the ProgramBuilder
/// @param args args of size 1 or N with values of type T to initialize with
/// @return the list of expressions that are used to construct the array
- static inline auto ExprArgs(ProgramBuilder& b, utils::VectorRef<Scalar> args) {
+ static inline auto ExprArgs(ProgramBuilder& b, VectorRef<Scalar> args) {
const bool one_value = args.Length() == 1;
- utils::Vector<const ast::Expression*, N> r;
+ Vector<const ast::Expression*, N> r;
for (uint32_t i = 0; i < N; i++) {
- r.Push(DataType<T>::Expr(b, utils::Vector<Scalar, 1>{one_value ? args[0] : args[i]}));
+ r.Push(DataType<T>::Expr(b, Vector<Scalar, 1>{one_value ? args[0] : args[i]}));
}
return r;
}
@@ -669,7 +666,7 @@
/// @param v arg of type double that will be cast to ElementType
/// @return a new AST array value expression
static inline const ast::Expression* ExprFromDouble(ProgramBuilder& b, double v) {
- return Expr(b, utils::Vector<Scalar, 1>{static_cast<ElementType>(v)});
+ return Expr(b, Vector<Scalar, 1>{static_cast<ElementType>(v)});
}
/// @returns the WGSL name for the type
static inline std::string Name() {
@@ -717,7 +714,7 @@
/// @param args the scalar args
/// @returns Value
template <typename T>
- static Value Create(utils::VectorRef<Scalar> args) {
+ static Value Create(VectorRef<Scalar> args) {
static_assert(IsDataTypeSpecializedFor<T>, "No DataType<T> specialization exists");
using EL_TY = typename builder::DataType<T>::ElementType;
return Value{
@@ -750,7 +747,7 @@
}
/// The arguments used to construct the value
- utils::Vector<Scalar, 4> args;
+ Vector<Scalar, 4> args;
/// CreatePtrs for value's type used to create an expression with `args`
builder::CreatePtrs create_ptrs;
/// True if the element type is abstract
@@ -773,8 +770,8 @@
/// Creates a Value of DataType<T> from a scalar `v`
template <typename T>
Value Val(T v) {
- static_assert(utils::traits::IsTypeIn<T, Scalar>, "v must be a Number of bool");
- return Value::Create<T>(utils::Vector<Scalar, 1>{v});
+ static_assert(tint::traits::IsTypeIn<T, Scalar>, "v must be a Number of bool");
+ return Value::Create<T>(Vector<Scalar, 1>{v});
}
/// Creates a Value of DataType<vec<N, T>> from N scalar `args`
@@ -785,7 +782,7 @@
static_assert(std::conjunction_v<std::is_same<FirstT, Ts>...>,
"Vector args must all be the same type");
constexpr size_t N = sizeof...(args);
- utils::Vector<Scalar, sizeof...(args)> v{args...};
+ Vector<Scalar, sizeof...(args)> v{args...};
return Value::Create<builtin::fluent_types::vec<N, FirstT>>(std::move(v));
}
@@ -796,14 +793,14 @@
static_assert(std::conjunction_v<std::is_same<FirstT, Ts>...>,
"Array args must all be the same type");
constexpr size_t N = sizeof...(args);
- utils::Vector<Scalar, sizeof...(args)> v{args...};
+ Vector<Scalar, sizeof...(args)> v{args...};
return Value::Create<builtin::fluent_types::array<FirstT, N>>(std::move(v));
}
/// Creates a Value of DataType<mat<C,R,T> from C*R scalar `args`
template <size_t C, size_t R, typename T>
Value Mat(const T (&m_in)[C][R]) {
- utils::Vector<Scalar, C * R> m;
+ Vector<Scalar, C * R> m;
for (uint32_t i = 0; i < C; ++i) {
for (size_t j = 0; j < R; ++j) {
m.Push(m_in[i][j]);
@@ -816,7 +813,7 @@
template <typename T, size_t R>
Value Mat(const T (&c0)[R], const T (&c1)[R]) {
constexpr size_t C = 2;
- utils::Vector<Scalar, C * R> m;
+ Vector<Scalar, C * R> m;
for (auto v : c0) {
m.Push(v);
}
@@ -830,7 +827,7 @@
template <typename T, size_t R>
Value Mat(const T (&c0)[R], const T (&c1)[R], const T (&c2)[R]) {
constexpr size_t C = 3;
- utils::Vector<Scalar, C * R> m;
+ Vector<Scalar, C * R> m;
for (auto v : c0) {
m.Push(v);
}
@@ -847,7 +844,7 @@
template <typename T, size_t R>
Value Mat(const T (&c0)[R], const T (&c1)[R], const T (&c2)[R], const T (&c3)[R]) {
constexpr size_t C = 4;
- utils::Vector<Scalar, C * R> m;
+ Vector<Scalar, C * R> m;
for (auto v : c0) {
m.Push(v);
}
diff --git a/src/tint/lang/wgsl/resolver/root_identifier_test.cc b/src/tint/lang/wgsl/resolver/root_identifier_test.cc
index c632ec7..6f4386f 100644
--- a/src/tint/lang/wgsl/resolver/root_identifier_test.cc
+++ b/src/tint/lang/wgsl/resolver/root_identifier_test.cc
@@ -130,7 +130,7 @@
TEST_F(ResolverRootIdentifierTest, Parameter) {
auto* a = Param("a", ty.f32());
auto* expr = Expr(a);
- Func("foo", utils::Vector{a}, ty.void_(), utils::Vector{WrapInStatement(expr)});
+ Func("foo", Vector{a}, ty.void_(), Vector{WrapInStatement(expr)});
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -147,8 +147,7 @@
auto* expr_param = Expr(param);
auto* let = Let("b", expr_param);
auto* expr_let = Expr("b");
- Func("foo", utils::Vector{param}, ty.void_(),
- utils::Vector{WrapInStatement(let), WrapInStatement(expr_let)});
+ Func("foo", Vector{param}, ty.void_(), Vector{WrapInStatement(let), WrapInStatement(expr_let)});
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -216,7 +215,7 @@
// {
// a.f
// }
- auto* S = Structure("S", utils::Vector{Member("f", ty.f32())});
+ auto* S = Structure("S", Vector{Member("f", ty.f32())});
auto* a = GlobalVar("a", ty.Of(S), builtin::AddressSpace::kPrivate);
auto* expr = MemberAccessor(a, "f");
WrapInFunction(expr);
diff --git a/src/tint/lang/wgsl/resolver/sem_helper.cc b/src/tint/lang/wgsl/resolver/sem_helper.cc
index 40457c3..92531ef 100644
--- a/src/tint/lang/wgsl/resolver/sem_helper.cc
+++ b/src/tint/lang/wgsl/resolver/sem_helper.cc
@@ -70,22 +70,22 @@
return "function '" + name + "'";
},
[&](const sem::BuiltinEnumExpression<builtin::Access>* access) {
- return "access '" + utils::ToString(access->Value()) + "'";
+ return "access '" + tint::ToString(access->Value()) + "'";
},
[&](const sem::BuiltinEnumExpression<builtin::AddressSpace>* addr) {
- return "address space '" + utils::ToString(addr->Value()) + "'";
+ return "address space '" + tint::ToString(addr->Value()) + "'";
},
[&](const sem::BuiltinEnumExpression<builtin::BuiltinValue>* builtin) {
- return "builtin value '" + utils::ToString(builtin->Value()) + "'";
+ return "builtin value '" + tint::ToString(builtin->Value()) + "'";
},
[&](const sem::BuiltinEnumExpression<builtin::InterpolationSampling>* fmt) {
- return "interpolation sampling '" + utils::ToString(fmt->Value()) + "'";
+ return "interpolation sampling '" + tint::ToString(fmt->Value()) + "'";
},
[&](const sem::BuiltinEnumExpression<builtin::InterpolationType>* fmt) {
- return "interpolation type '" + utils::ToString(fmt->Value()) + "'";
+ return "interpolation type '" + tint::ToString(fmt->Value()) + "'";
},
[&](const sem::BuiltinEnumExpression<builtin::TexelFormat>* fmt) {
- return "texel format '" + utils::ToString(fmt->Value()) + "'";
+ return "texel format '" + tint::ToString(fmt->Value()) + "'";
},
[&](Default) -> std::string {
TINT_ICE(Resolver, builder_->Diagnostics())
diff --git a/src/tint/lang/wgsl/resolver/side_effects_test.cc b/src/tint/lang/wgsl/resolver/side_effects_test.cc
index d2b669a..84a04d4 100644
--- a/src/tint/lang/wgsl/resolver/side_effects_test.cc
+++ b/src/tint/lang/wgsl/resolver/side_effects_test.cc
@@ -36,8 +36,8 @@
auto global = Sym();
GlobalVar(global, ty.Of<T>(), builtin::AddressSpace::kPrivate);
auto local = Sym();
- Func(name, utils::Empty, ty.Of<T>(),
- utils::Vector{
+ Func(name, tint::Empty, ty.Of<T>(),
+ Vector{
Decl(Var(local, ty.Of<T>())),
Assign(global, local),
Return(global),
@@ -49,8 +49,8 @@
auto global = Sym();
GlobalVar(global, make_type(), builtin::AddressSpace::kPrivate);
auto local = Sym();
- Func(name, utils::Empty, make_type(),
- utils::Vector{
+ Func(name, tint::Empty, make_type(),
+ Vector{
Decl(Var(local, make_type())),
Assign(global, local),
Return(global),
@@ -94,8 +94,8 @@
TEST_F(SideEffectsTest, Call_Builtin_NoSE) {
GlobalVar("a", ty.f32(), builtin::AddressSpace::kPrivate);
auto* expr = Call("dpdx", "a");
- Func("f", utils::Empty, ty.void_(), utils::Vector{Ignore(expr)},
- utils::Vector{create<ast::StageAttribute>(ast::PipelineStage::kFragment)});
+ Func("f", tint::Empty, ty.void_(), Vector{Ignore(expr)},
+ Vector{create<ast::StageAttribute>(ast::PipelineStage::kFragment)});
EXPECT_TRUE(r()->Resolve()) << r()->error();
auto* sem = Sem().Get(expr);
@@ -107,8 +107,8 @@
TEST_F(SideEffectsTest, Call_Builtin_NoSE_WithSEArg) {
MakeSideEffectFunc<f32>("se");
auto* expr = Call("dpdx", Call("se"));
- Func("f", utils::Empty, ty.void_(), utils::Vector{Ignore(expr)},
- utils::Vector{create<ast::StageAttribute>(ast::PipelineStage::kFragment)});
+ Func("f", tint::Empty, ty.void_(), Vector{Ignore(expr)},
+ Vector{create<ast::StageAttribute>(ast::PipelineStage::kFragment)});
EXPECT_TRUE(r()->Resolve()) << r()->error();
auto* sem = Sem().Get(expr);
@@ -132,13 +132,13 @@
namespace builtin_tests {
struct Case {
const char* name;
- utils::Vector<const char*, 3> args;
+ Vector<const char*, 3> args;
bool has_side_effects;
bool returns_value;
ast::PipelineStage pipeline_stage;
};
static Case C(const char* name,
- utils::VectorRef<const char*> args,
+ VectorRef<const char*> args,
bool has_side_effects,
bool returns_value,
ast::PipelineStage stage = ast::PipelineStage::kFragment) {
@@ -205,20 +205,20 @@
Binding(AInt(next_binding++)));
}
- utils::Vector<const ast::Statement*, 4> stmts;
+ Vector<const ast::Statement*, 4> stmts;
stmts.Push(Decl(Let("pstorage_arr", AddressOf("storage_arr"))));
if (c.pipeline_stage == ast::PipelineStage::kCompute) {
stmts.Push(Decl(Let("pworkgroup_arr", AddressOf("workgroup_arr"))));
}
stmts.Push(Decl(Let("pa", AddressOf("a"))));
- utils::Vector<const ast::Expression*, 5> args;
+ Vector<const ast::Expression*, 5> args;
for (auto& a : c.args) {
args.Push(Expr(a));
}
auto* expr = Call(c.name, args);
- utils::Vector<const ast::Attribute*, 2> attrs;
+ Vector<const ast::Attribute*, 2> attrs;
attrs.Push(create<ast::StageAttribute>(c.pipeline_stage));
if (c.pipeline_stage == ast::PipelineStage::kCompute) {
attrs.Push(WorkgroupSize(Expr(1_u)));
@@ -230,7 +230,7 @@
stmts.Push(CallStmt(expr));
}
- Func("func", utils::Empty, ty.void_(), stmts, attrs);
+ Func("func", tint::Empty, ty.void_(), stmts, attrs);
EXPECT_TRUE(r()->Resolve()) << r()->error();
auto* sem = Sem().Get(expr);
@@ -243,135 +243,135 @@
SideEffectsBuiltinTest,
testing::ValuesIn(std::vector<Case>{
// No side-effect builts
- C("abs", utils::Vector{"f"}, false, true), //
- C("acos", utils::Vector{"f"}, false, true), //
- C("acosh", utils::Vector{"f"}, false, true), //
- C("all", utils::Vector{"vb"}, false, true), //
- C("any", utils::Vector{"vb"}, false, true), //
- C("arrayLength", utils::Vector{"pstorage_arr"}, false, true), //
- C("asin", utils::Vector{"f"}, false, true), //
- C("asinh", utils::Vector{"f"}, false, true), //
- C("atan", utils::Vector{"f"}, false, true), //
- C("atan2", utils::Vector{"f", "f"}, false, true), //
- C("atanh", utils::Vector{"f"}, false, true), //
- C("atomicLoad", utils::Vector{"pa"}, false, true), //
- C("ceil", utils::Vector{"f"}, false, true), //
- C("clamp", utils::Vector{"f", "f", "f"}, false, true), //
- C("cos", utils::Vector{"f"}, false, true), //
- C("cosh", utils::Vector{"f"}, false, true), //
- C("countLeadingZeros", utils::Vector{"i"}, false, true), //
- C("countOneBits", utils::Vector{"i"}, false, true), //
- C("countTrailingZeros", utils::Vector{"i"}, false, true), //
- C("cross", utils::Vector{"vf", "vf"}, false, true), //
- C("degrees", utils::Vector{"f"}, false, true), //
- C("determinant", utils::Vector{"m"}, false, true), //
- C("distance", utils::Vector{"f", "f"}, false, true), //
- C("dot", utils::Vector{"vf", "vf"}, false, true), //
- C("dot4I8Packed", utils::Vector{"u", "u"}, false, true), //
- C("dot4U8Packed", utils::Vector{"u", "u"}, false, true), //
- C("exp", utils::Vector{"f"}, false, true), //
- C("exp2", utils::Vector{"f"}, false, true), //
- C("extractBits", utils::Vector{"i", "u", "u"}, false, true), //
- C("faceForward", utils::Vector{"vf", "vf", "vf"}, false, true), //
- C("firstLeadingBit", utils::Vector{"u"}, false, true), //
- C("firstTrailingBit", utils::Vector{"u"}, false, true), //
- C("floor", utils::Vector{"f"}, false, true), //
- C("fma", utils::Vector{"f", "f", "f"}, false, true), //
- C("fract", utils::Vector{"vf"}, false, true), //
- C("frexp", utils::Vector{"f"}, false, true), //
- C("insertBits", utils::Vector{"i", "i", "u", "u"}, false, true), //
- C("inverseSqrt", utils::Vector{"f"}, false, true), //
- C("ldexp", utils::Vector{"f", "i"}, false, true), //
- C("length", utils::Vector{"vf"}, false, true), //
- C("log", utils::Vector{"f"}, false, true), //
- C("log2", utils::Vector{"f"}, false, true), //
- C("max", utils::Vector{"f", "f"}, false, true), //
- C("min", utils::Vector{"f", "f"}, false, true), //
- C("mix", utils::Vector{"f", "f", "f"}, false, true), //
- C("modf", utils::Vector{"f"}, false, true), //
- C("normalize", utils::Vector{"vf"}, false, true), //
- C("pack2x16float", utils::Vector{"vf2"}, false, true), //
- C("pack2x16snorm", utils::Vector{"vf2"}, false, true), //
- C("pack2x16unorm", utils::Vector{"vf2"}, false, true), //
- C("pack4x8snorm", utils::Vector{"vf4"}, false, true), //
- C("pack4x8unorm", utils::Vector{"vf4"}, false, true), //
- C("pow", utils::Vector{"f", "f"}, false, true), //
- C("radians", utils::Vector{"f"}, false, true), //
- C("reflect", utils::Vector{"vf", "vf"}, false, true), //
- C("refract", utils::Vector{"vf", "vf", "f"}, false, true), //
- C("reverseBits", utils::Vector{"u"}, false, true), //
- C("round", utils::Vector{"f"}, false, true), //
- C("select", utils::Vector{"f", "f", "b"}, false, true), //
- C("sign", utils::Vector{"f"}, false, true), //
- C("sin", utils::Vector{"f"}, false, true), //
- C("sinh", utils::Vector{"f"}, false, true), //
- C("smoothstep", utils::Vector{"f", "f", "f"}, false, true), //
- C("sqrt", utils::Vector{"f"}, false, true), //
- C("step", utils::Vector{"f", "f"}, false, true), //
- C("tan", utils::Vector{"f"}, false, true), //
- C("tanh", utils::Vector{"f"}, false, true), //
- C("textureDimensions", utils::Vector{"t2d"}, false, true), //
- C("textureGather", utils::Vector{"tdepth2d", "s2d", "vf2"}, false, true), //
- C("textureGatherCompare", utils::Vector{"tdepth2d", "scomp", "vf2", "f"}, false, true), //
- C("textureLoad", utils::Vector{"t2d", "vi2", "i"}, false, true), //
- C("textureNumLayers", utils::Vector{"t2d_arr"}, false, true), //
- C("textureNumLevels", utils::Vector{"t2d"}, false, true), //
- C("textureNumSamples", utils::Vector{"t2d_multi"}, false, true), //
+ C("abs", Vector{"f"}, false, true), //
+ C("acos", Vector{"f"}, false, true), //
+ C("acosh", Vector{"f"}, false, true), //
+ C("all", Vector{"vb"}, false, true), //
+ C("any", Vector{"vb"}, false, true), //
+ C("arrayLength", Vector{"pstorage_arr"}, false, true), //
+ C("asin", Vector{"f"}, false, true), //
+ C("asinh", Vector{"f"}, false, true), //
+ C("atan", Vector{"f"}, false, true), //
+ C("atan2", Vector{"f", "f"}, false, true), //
+ C("atanh", Vector{"f"}, false, true), //
+ C("atomicLoad", Vector{"pa"}, false, true), //
+ C("ceil", Vector{"f"}, false, true), //
+ C("clamp", Vector{"f", "f", "f"}, false, true), //
+ C("cos", Vector{"f"}, false, true), //
+ C("cosh", Vector{"f"}, false, true), //
+ C("countLeadingZeros", Vector{"i"}, false, true), //
+ C("countOneBits", Vector{"i"}, false, true), //
+ C("countTrailingZeros", Vector{"i"}, false, true), //
+ C("cross", Vector{"vf", "vf"}, false, true), //
+ C("degrees", Vector{"f"}, false, true), //
+ C("determinant", Vector{"m"}, false, true), //
+ C("distance", Vector{"f", "f"}, false, true), //
+ C("dot", Vector{"vf", "vf"}, false, true), //
+ C("dot4I8Packed", Vector{"u", "u"}, false, true), //
+ C("dot4U8Packed", Vector{"u", "u"}, false, true), //
+ C("exp", Vector{"f"}, false, true), //
+ C("exp2", Vector{"f"}, false, true), //
+ C("extractBits", Vector{"i", "u", "u"}, false, true), //
+ C("faceForward", Vector{"vf", "vf", "vf"}, false, true), //
+ C("firstLeadingBit", Vector{"u"}, false, true), //
+ C("firstTrailingBit", Vector{"u"}, false, true), //
+ C("floor", Vector{"f"}, false, true), //
+ C("fma", Vector{"f", "f", "f"}, false, true), //
+ C("fract", Vector{"vf"}, false, true), //
+ C("frexp", Vector{"f"}, false, true), //
+ C("insertBits", Vector{"i", "i", "u", "u"}, false, true), //
+ C("inverseSqrt", Vector{"f"}, false, true), //
+ C("ldexp", Vector{"f", "i"}, false, true), //
+ C("length", Vector{"vf"}, false, true), //
+ C("log", Vector{"f"}, false, true), //
+ C("log2", Vector{"f"}, false, true), //
+ C("max", Vector{"f", "f"}, false, true), //
+ C("min", Vector{"f", "f"}, false, true), //
+ C("mix", Vector{"f", "f", "f"}, false, true), //
+ C("modf", Vector{"f"}, false, true), //
+ C("normalize", Vector{"vf"}, false, true), //
+ C("pack2x16float", Vector{"vf2"}, false, true), //
+ C("pack2x16snorm", Vector{"vf2"}, false, true), //
+ C("pack2x16unorm", Vector{"vf2"}, false, true), //
+ C("pack4x8snorm", Vector{"vf4"}, false, true), //
+ C("pack4x8unorm", Vector{"vf4"}, false, true), //
+ C("pow", Vector{"f", "f"}, false, true), //
+ C("radians", Vector{"f"}, false, true), //
+ C("reflect", Vector{"vf", "vf"}, false, true), //
+ C("refract", Vector{"vf", "vf", "f"}, false, true), //
+ C("reverseBits", Vector{"u"}, false, true), //
+ C("round", Vector{"f"}, false, true), //
+ C("select", Vector{"f", "f", "b"}, false, true), //
+ C("sign", Vector{"f"}, false, true), //
+ C("sin", Vector{"f"}, false, true), //
+ C("sinh", Vector{"f"}, false, true), //
+ C("smoothstep", Vector{"f", "f", "f"}, false, true), //
+ C("sqrt", Vector{"f"}, false, true), //
+ C("step", Vector{"f", "f"}, false, true), //
+ C("tan", Vector{"f"}, false, true), //
+ C("tanh", Vector{"f"}, false, true), //
+ C("textureDimensions", Vector{"t2d"}, false, true), //
+ C("textureGather", Vector{"tdepth2d", "s2d", "vf2"}, false, true), //
+ C("textureGatherCompare", Vector{"tdepth2d", "scomp", "vf2", "f"}, false, true), //
+ C("textureLoad", Vector{"t2d", "vi2", "i"}, false, true), //
+ C("textureNumLayers", Vector{"t2d_arr"}, false, true), //
+ C("textureNumLevels", Vector{"t2d"}, false, true), //
+ C("textureNumSamples", Vector{"t2d_multi"}, false, true), //
C("textureSampleCompareLevel",
- utils::Vector{"tdepth2d", "scomp", "vf2", "f"},
+ Vector{"tdepth2d", "scomp", "vf2", "f"},
false,
- true), //
- C("textureSampleGrad", utils::Vector{"t2d", "s2d", "vf2", "vf2", "vf2"}, false, true), //
- C("textureSampleLevel", utils::Vector{"t2d", "s2d", "vf2", "f"}, false, true), //
- C("transpose", utils::Vector{"m"}, false, true), //
- C("trunc", utils::Vector{"f"}, false, true), //
- C("unpack2x16float", utils::Vector{"u"}, false, true), //
- C("unpack2x16snorm", utils::Vector{"u"}, false, true), //
- C("unpack2x16unorm", utils::Vector{"u"}, false, true), //
- C("unpack4x8snorm", utils::Vector{"u"}, false, true), //
- C("unpack4x8unorm", utils::Vector{"u"}, false, true), //
- C("storageBarrier", utils::Empty, false, false, ast::PipelineStage::kCompute), //
- C("workgroupBarrier", utils::Empty, false, false, ast::PipelineStage::kCompute), //
- C("textureSample", utils::Vector{"t2d", "s2d", "vf2"}, false, true), //
- C("textureSampleBias", utils::Vector{"t2d", "s2d", "vf2", "f"}, false, true), //
- C("textureSampleCompare", utils::Vector{"tdepth2d", "scomp", "vf2", "f"}, false, true), //
- C("dpdx", utils::Vector{"f"}, false, true), //
- C("dpdxCoarse", utils::Vector{"f"}, false, true), //
- C("dpdxFine", utils::Vector{"f"}, false, true), //
- C("dpdy", utils::Vector{"f"}, false, true), //
- C("dpdyCoarse", utils::Vector{"f"}, false, true), //
- C("dpdyFine", utils::Vector{"f"}, false, true), //
- C("fwidth", utils::Vector{"f"}, false, true), //
- C("fwidthCoarse", utils::Vector{"f"}, false, true), //
- C("fwidthFine", utils::Vector{"f"}, false, true), //
+ true), //
+ C("textureSampleGrad", Vector{"t2d", "s2d", "vf2", "vf2", "vf2"}, false, true), //
+ C("textureSampleLevel", Vector{"t2d", "s2d", "vf2", "f"}, false, true), //
+ C("transpose", Vector{"m"}, false, true), //
+ C("trunc", Vector{"f"}, false, true), //
+ C("unpack2x16float", Vector{"u"}, false, true), //
+ C("unpack2x16snorm", Vector{"u"}, false, true), //
+ C("unpack2x16unorm", Vector{"u"}, false, true), //
+ C("unpack4x8snorm", Vector{"u"}, false, true), //
+ C("unpack4x8unorm", Vector{"u"}, false, true), //
+ C("storageBarrier", tint::Empty, false, false, ast::PipelineStage::kCompute), //
+ C("workgroupBarrier", tint::Empty, false, false, ast::PipelineStage::kCompute), //
+ C("textureSample", Vector{"t2d", "s2d", "vf2"}, false, true), //
+ C("textureSampleBias", Vector{"t2d", "s2d", "vf2", "f"}, false, true), //
+ C("textureSampleCompare", Vector{"tdepth2d", "scomp", "vf2", "f"}, false, true), //
+ C("dpdx", Vector{"f"}, false, true), //
+ C("dpdxCoarse", Vector{"f"}, false, true), //
+ C("dpdxFine", Vector{"f"}, false, true), //
+ C("dpdy", Vector{"f"}, false, true), //
+ C("dpdyCoarse", Vector{"f"}, false, true), //
+ C("dpdyFine", Vector{"f"}, false, true), //
+ C("fwidth", Vector{"f"}, false, true), //
+ C("fwidthCoarse", Vector{"f"}, false, true), //
+ C("fwidthFine", Vector{"f"}, false, true), //
// Side-effect builtins
- C("atomicAdd", utils::Vector{"pa", "i"}, true, true), //
- C("atomicAnd", utils::Vector{"pa", "i"}, true, true), //
- C("atomicCompareExchangeWeak", utils::Vector{"pa", "i", "i"}, true, true), //
- C("atomicExchange", utils::Vector{"pa", "i"}, true, true), //
- C("atomicMax", utils::Vector{"pa", "i"}, true, true), //
- C("atomicMin", utils::Vector{"pa", "i"}, true, true), //
- C("atomicOr", utils::Vector{"pa", "i"}, true, true), //
- C("atomicStore", utils::Vector{"pa", "i"}, true, false), //
- C("atomicSub", utils::Vector{"pa", "i"}, true, true), //
- C("atomicXor", utils::Vector{"pa", "i"}, true, true), //
- C("textureStore", utils::Vector{"tstorage2d", "vi2", "vf4"}, true, false), //
+ C("atomicAdd", Vector{"pa", "i"}, true, true), //
+ C("atomicAnd", Vector{"pa", "i"}, true, true), //
+ C("atomicCompareExchangeWeak", Vector{"pa", "i", "i"}, true, true), //
+ C("atomicExchange", Vector{"pa", "i"}, true, true), //
+ C("atomicMax", Vector{"pa", "i"}, true, true), //
+ C("atomicMin", Vector{"pa", "i"}, true, true), //
+ C("atomicOr", Vector{"pa", "i"}, true, true), //
+ C("atomicStore", Vector{"pa", "i"}, true, false), //
+ C("atomicSub", Vector{"pa", "i"}, true, true), //
+ C("atomicXor", Vector{"pa", "i"}, true, true), //
+ C("textureStore", Vector{"tstorage2d", "vi2", "vf4"}, true, false), //
C("workgroupUniformLoad",
- utils::Vector{"pworkgroup_arr"},
+ Vector{"pworkgroup_arr"},
true,
true,
ast::PipelineStage::kCompute), //
// Unimplemented builtins
- // C("quantizeToF16", utils::Vector{"f"}, false), //
- // C("saturate", utils::Vector{"f"}, false), //
+ // C("quantizeToF16", Vector{"f"}, false), //
+ // C("saturate", Vector{"f"}, false), //
}));
} // namespace builtin_tests
TEST_F(SideEffectsTest, Call_Function) {
- Func("f", utils::Empty, ty.i32(), utils::Vector{Return(1_i)});
+ Func("f", tint::Empty, ty.i32(), Vector{Return(1_i)});
auto* expr = Call("f");
WrapInFunction(expr);
@@ -431,7 +431,7 @@
}
TEST_F(SideEffectsTest, MemberAccessor_Struct_NoSE) {
- auto* s = Structure("S", utils::Vector{Member("m", ty.i32())});
+ auto* s = Structure("S", Vector{Member("m", ty.i32())});
auto* var = Decl(Var("a", ty.Of(s)));
auto* expr = MemberAccessor("a", "m");
WrapInFunction(var, expr);
@@ -443,7 +443,7 @@
}
TEST_F(SideEffectsTest, MemberAccessor_Struct_SE) {
- auto* s = Structure("S", utils::Vector{Member("m", ty.i32())});
+ auto* s = Structure("S", Vector{Member("m", ty.i32())});
MakeSideEffectFunc("se", [&] { return ty.Of(s); });
auto* expr = MemberAccessor(Call("se"), "m");
WrapInFunction(expr);
diff --git a/src/tint/lang/wgsl/resolver/struct_address_space_use_test.cc b/src/tint/lang/wgsl/resolver/struct_address_space_use_test.cc
index 8a54300..e6395d8 100644
--- a/src/tint/lang/wgsl/resolver/struct_address_space_use_test.cc
+++ b/src/tint/lang/wgsl/resolver/struct_address_space_use_test.cc
@@ -28,7 +28,7 @@
using ResolverAddressSpaceUseTest = ResolverTest;
TEST_F(ResolverAddressSpaceUseTest, UnreachableStruct) {
- auto* s = Structure("S", utils::Vector{Member("a", ty.f32())});
+ auto* s = Structure("S", Vector{Member("a", ty.f32())});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -38,9 +38,9 @@
}
TEST_F(ResolverAddressSpaceUseTest, StructReachableFromParameter) {
- auto* s = Structure("S", utils::Vector{Member("a", ty.f32())});
+ auto* s = Structure("S", Vector{Member("a", ty.f32())});
- Func("f", utils::Vector{Param("param", ty.Of(s))}, ty.void_(), utils::Empty, utils::Empty);
+ Func("f", Vector{Param("param", ty.Of(s))}, ty.void_(), tint::Empty, tint::Empty);
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -50,9 +50,9 @@
}
TEST_F(ResolverAddressSpaceUseTest, StructReachableFromReturnType) {
- auto* s = Structure("S", utils::Vector{Member("a", ty.f32())});
+ auto* s = Structure("S", Vector{Member("a", ty.f32())});
- Func("f", utils::Empty, ty.Of(s), utils::Vector{Return(Call(ty.Of(s)))}, utils::Empty);
+ Func("f", tint::Empty, ty.Of(s), Vector{Return(Call(ty.Of(s)))}, tint::Empty);
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -62,7 +62,7 @@
}
TEST_F(ResolverAddressSpaceUseTest, StructReachableFromGlobal) {
- auto* s = Structure("S", utils::Vector{Member("a", ty.f32())});
+ auto* s = Structure("S", Vector{Member("a", ty.f32())});
GlobalVar("g", ty.Of(s), builtin::AddressSpace::kPrivate);
@@ -74,7 +74,7 @@
}
TEST_F(ResolverAddressSpaceUseTest, StructReachableViaGlobalAlias) {
- auto* s = Structure("S", utils::Vector{Member("a", ty.f32())});
+ auto* s = Structure("S", Vector{Member("a", ty.f32())});
auto* a = Alias("A", ty.Of(s));
GlobalVar("g", ty.Of(a), builtin::AddressSpace::kPrivate);
@@ -86,8 +86,8 @@
}
TEST_F(ResolverAddressSpaceUseTest, StructReachableViaGlobalStruct) {
- auto* s = Structure("S", utils::Vector{Member("a", ty.f32())});
- auto* o = Structure("O", utils::Vector{Member("a", ty.Of(s))});
+ auto* s = Structure("S", Vector{Member("a", ty.f32())});
+ auto* o = Structure("O", Vector{Member("a", ty.Of(s))});
GlobalVar("g", ty.Of(o), builtin::AddressSpace::kPrivate);
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -98,7 +98,7 @@
}
TEST_F(ResolverAddressSpaceUseTest, StructReachableViaGlobalArray) {
- auto* s = Structure("S", utils::Vector{Member("a", ty.f32())});
+ auto* s = Structure("S", Vector{Member("a", ty.f32())});
auto a = ty.array(ty.Of(s), 3_u);
GlobalVar("g", a, builtin::AddressSpace::kPrivate);
@@ -110,7 +110,7 @@
}
TEST_F(ResolverAddressSpaceUseTest, StructReachableFromLocal) {
- auto* s = Structure("S", utils::Vector{Member("a", ty.f32())});
+ auto* s = Structure("S", Vector{Member("a", ty.f32())});
WrapInFunction(Var("g", ty.Of(s)));
@@ -122,7 +122,7 @@
}
TEST_F(ResolverAddressSpaceUseTest, StructReachableViaLocalAlias) {
- auto* s = Structure("S", utils::Vector{Member("a", ty.f32())});
+ auto* s = Structure("S", Vector{Member("a", ty.f32())});
auto* a = Alias("A", ty.Of(s));
WrapInFunction(Var("g", ty.Of(a)));
@@ -134,8 +134,8 @@
}
TEST_F(ResolverAddressSpaceUseTest, StructReachableViaLocalStruct) {
- auto* s = Structure("S", utils::Vector{Member("a", ty.f32())});
- auto* o = Structure("O", utils::Vector{Member("a", ty.Of(s))});
+ auto* s = Structure("S", Vector{Member("a", ty.f32())});
+ auto* o = Structure("O", Vector{Member("a", ty.Of(s))});
WrapInFunction(Var("g", ty.Of(o)));
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -146,7 +146,7 @@
}
TEST_F(ResolverAddressSpaceUseTest, StructReachableViaLocalArray) {
- auto* s = Structure("S", utils::Vector{Member("a", ty.f32())});
+ auto* s = Structure("S", Vector{Member("a", ty.f32())});
auto a = ty.array(ty.Of(s), 3_u);
WrapInFunction(Var("g", a));
@@ -158,7 +158,7 @@
}
TEST_F(ResolverAddressSpaceUseTest, StructMultipleAddressSpaceUses) {
- auto* s = Structure("S", utils::Vector{Member("a", ty.f32())});
+ auto* s = Structure("S", Vector{Member("a", ty.f32())});
GlobalVar("x", ty.Of(s), builtin::AddressSpace::kUniform, Binding(0_a), Group(0_a));
GlobalVar("y", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kRead, Binding(1_a),
Group(0_a));
diff --git a/src/tint/lang/wgsl/resolver/struct_layout_test.cc b/src/tint/lang/wgsl/resolver/struct_layout_test.cc
index 50d52ed..5ee9362 100644
--- a/src/tint/lang/wgsl/resolver/struct_layout_test.cc
+++ b/src/tint/lang/wgsl/resolver/struct_layout_test.cc
@@ -26,7 +26,7 @@
using ResolverStructLayoutTest = ResolverTest;
TEST_F(ResolverStructLayoutTest, Scalars) {
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("a", ty.f32()),
Member("b", ty.u32()),
Member("c", ty.i32()),
@@ -57,7 +57,7 @@
TEST_F(ResolverStructLayoutTest, ScalarsWithF16) {
Enable(builtin::Extension::kF16);
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("a", ty.f32()),
Member("b", ty.f16()),
Member("c", ty.u32()),
@@ -109,7 +109,7 @@
auto* alias_a = Alias("a", ty.f32());
auto* alias_b = Alias("b", ty.f32());
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("a", ty.Of(alias_a)),
Member("b", ty.Of(alias_b)),
});
@@ -136,7 +136,7 @@
TEST_F(ResolverStructLayoutTest, ImplicitStrideArrayStaticSize) {
Enable(builtin::Extension::kF16);
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("a", ty.array<i32, 3>()),
Member("b", ty.array<f32, 5>()),
Member("c", ty.array<f16, 7>()),
@@ -176,11 +176,11 @@
TEST_F(ResolverStructLayoutTest, ExplicitStrideArrayStaticSize) {
Enable(builtin::Extension::kF16);
- auto* s = Structure("S", utils::Vector{
- Member("a", ty.array<i32, 3>(utils::Vector{Stride(8)})),
- Member("b", ty.array<f32, 5>(utils::Vector{Stride(16)})),
- Member("c", ty.array<f16, 7>(utils::Vector{Stride(4)})),
- Member("d", ty.array<f32, 1>(utils::Vector{Stride(32)})),
+ auto* s = Structure("S", Vector{
+ Member("a", ty.array<i32, 3>(Vector{Stride(8)})),
+ Member("b", ty.array<f32, 5>(Vector{Stride(16)})),
+ Member("c", ty.array<f16, 7>(Vector{Stride(4)})),
+ Member("d", ty.array<f32, 1>(Vector{Stride(32)})),
});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -214,7 +214,7 @@
}
TEST_F(ResolverStructLayoutTest, ImplicitStrideArrayRuntimeSized) {
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("c", ty.array<f32>()),
});
@@ -235,8 +235,8 @@
}
TEST_F(ResolverStructLayoutTest, ExplicitStrideArrayRuntimeSized) {
- auto* s = Structure("S", utils::Vector{
- Member("c", ty.array<f32>(utils::Vector{Stride(32)})),
+ auto* s = Structure("S", Vector{
+ Member("c", ty.array<f32>(Vector{Stride(32)})),
});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -256,9 +256,9 @@
}
TEST_F(ResolverStructLayoutTest, ImplicitStrideArrayOfExplicitStrideArray) {
- auto inner = ty.array<i32, 2>(utils::Vector{Stride(16)}); // size: 32
- auto outer = ty.array(inner, 12_u); // size: 12 * 32
- auto* s = Structure("S", utils::Vector{
+ auto inner = ty.array<i32, 2>(Vector{Stride(16)}); // size: 32
+ auto outer = ty.array(inner, 12_u); // size: 12 * 32
+ auto* s = Structure("S", Vector{
Member("c", outer),
});
@@ -279,13 +279,13 @@
}
TEST_F(ResolverStructLayoutTest, ImplicitStrideArrayOfStructure) {
- auto* inner = Structure("Inner", utils::Vector{
+ auto* inner = Structure("Inner", Vector{
Member("a", ty.vec2<i32>()),
Member("b", ty.vec3<i32>()),
Member("c", ty.vec4<i32>()),
}); // size: 48
auto outer = ty.array(ty.Of(inner), 12_u); // size: 12 * 48
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("c", outer),
});
@@ -306,7 +306,7 @@
}
TEST_F(ResolverStructLayoutTest, Vector) {
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("a", ty.vec2<i32>()),
Member("b", ty.vec3<i32>()),
Member("c", ty.vec4<i32>()),
@@ -337,7 +337,7 @@
TEST_F(ResolverStructLayoutTest, Matrix) {
Enable(builtin::Extension::kF16);
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("a_1", ty.mat2x2<f32>()),
Member("a_2", ty.mat2x2<f16>()),
Member("b_1", ty.mat2x3<f32>()),
@@ -427,10 +427,10 @@
}
TEST_F(ResolverStructLayoutTest, NestedStruct) {
- auto* inner = Structure("Inner", utils::Vector{
+ auto* inner = Structure("Inner", Vector{
Member("a", ty.mat3x3<f32>()),
});
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("a", ty.i32()),
Member("b", ty.Of(inner)),
Member("c", ty.i32()),
@@ -459,16 +459,16 @@
}
TEST_F(ResolverStructLayoutTest, SizeAttributes) {
- auto* inner = Structure("Inner", utils::Vector{
- Member("a", ty.f32(), utils::Vector{MemberSize(8_a)}),
- Member("b", ty.f32(), utils::Vector{MemberSize(16_a)}),
- Member("c", ty.f32(), utils::Vector{MemberSize(8_a)}),
+ auto* inner = Structure("Inner", Vector{
+ Member("a", ty.f32(), Vector{MemberSize(8_a)}),
+ Member("b", ty.f32(), Vector{MemberSize(16_a)}),
+ Member("c", ty.f32(), Vector{MemberSize(8_a)}),
});
- auto* s = Structure("S", utils::Vector{
- Member("a", ty.f32(), utils::Vector{MemberSize(4_a)}),
- Member("b", ty.u32(), utils::Vector{MemberSize(8_a)}),
+ auto* s = Structure("S", Vector{
+ Member("a", ty.f32(), Vector{MemberSize(4_a)}),
+ Member("b", ty.u32(), Vector{MemberSize(8_a)}),
Member("c", ty.Of(inner)),
- Member("d", ty.i32(), utils::Vector{MemberSize(32_a)}),
+ Member("d", ty.i32(), Vector{MemberSize(32_a)}),
});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -497,16 +497,16 @@
}
TEST_F(ResolverStructLayoutTest, AlignAttributes) {
- auto* inner = Structure("Inner", utils::Vector{
- Member("a", ty.f32(), utils::Vector{MemberAlign(8_i)}),
- Member("b", ty.f32(), utils::Vector{MemberAlign(16_i)}),
- Member("c", ty.f32(), utils::Vector{MemberAlign(4_i)}),
+ auto* inner = Structure("Inner", Vector{
+ Member("a", ty.f32(), Vector{MemberAlign(8_i)}),
+ Member("b", ty.f32(), Vector{MemberAlign(16_i)}),
+ Member("c", ty.f32(), Vector{MemberAlign(4_i)}),
});
- auto* s = Structure("S", utils::Vector{
- Member("a", ty.f32(), utils::Vector{MemberAlign(4_i)}),
- Member("b", ty.u32(), utils::Vector{MemberAlign(8_i)}),
+ auto* s = Structure("S", Vector{
+ Member("a", ty.f32(), Vector{MemberAlign(4_i)}),
+ Member("b", ty.u32(), Vector{MemberAlign(8_i)}),
Member("c", ty.Of(inner)),
- Member("d", ty.i32(), utils::Vector{MemberAlign(32_i)}),
+ Member("d", ty.i32(), Vector{MemberAlign(32_i)}),
});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -535,8 +535,8 @@
}
TEST_F(ResolverStructLayoutTest, StructWithLotsOfPadding) {
- auto* s = Structure("S", utils::Vector{
- Member("a", ty.i32(), utils::Vector{MemberAlign(1024_i)}),
+ auto* s = Structure("S", Vector{
+ Member("a", ty.i32(), Vector{MemberAlign(1024_i)}),
});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -556,17 +556,17 @@
}
TEST_F(ResolverStructLayoutTest, OffsetAttributes) {
- auto* inner = Structure("Inner", utils::Vector{
- Member("a", ty.f32(), utils::Vector{MemberOffset(8_i)}),
- Member("b", ty.f32(), utils::Vector{MemberOffset(16_i)}),
- Member("c", ty.f32(), utils::Vector{MemberOffset(32_i)}),
+ auto* inner = Structure("Inner", Vector{
+ Member("a", ty.f32(), Vector{MemberOffset(8_i)}),
+ Member("b", ty.f32(), Vector{MemberOffset(16_i)}),
+ Member("c", ty.f32(), Vector{MemberOffset(32_i)}),
});
- auto* s = Structure("S", utils::Vector{
- Member("a", ty.f32(), utils::Vector{MemberOffset(4_i)}),
- Member("b", ty.u32(), utils::Vector{MemberOffset(8_i)}),
- Member("c", ty.Of(inner), utils::Vector{MemberOffset(32_i)}),
+ auto* s = Structure("S", Vector{
+ Member("a", ty.f32(), Vector{MemberOffset(4_i)}),
+ Member("b", ty.u32(), Vector{MemberOffset(8_i)}),
+ Member("c", ty.Of(inner), Vector{MemberOffset(32_i)}),
Member("d", ty.i32()),
- Member("e", ty.i32(), utils::Vector{MemberOffset(128_i)}),
+ Member("e", ty.i32(), Vector{MemberOffset(128_i)}),
});
ASSERT_TRUE(r()->Resolve()) << r()->error();
diff --git a/src/tint/lang/wgsl/resolver/struct_pipeline_stage_use_test.cc b/src/tint/lang/wgsl/resolver/struct_pipeline_stage_use_test.cc
index c0edfc0..bccdb9a 100644
--- a/src/tint/lang/wgsl/resolver/struct_pipeline_stage_use_test.cc
+++ b/src/tint/lang/wgsl/resolver/struct_pipeline_stage_use_test.cc
@@ -30,7 +30,7 @@
using ResolverPipelineStageUseTest = ResolverTest;
TEST_F(ResolverPipelineStageUseTest, UnusedStruct) {
- auto* s = Structure("S", utils::Vector{Member("a", ty.f32(), utils::Vector{Location(0_a)})});
+ auto* s = Structure("S", Vector{Member("a", ty.f32(), Vector{Location(0_a)})});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -40,9 +40,9 @@
}
TEST_F(ResolverPipelineStageUseTest, StructUsedAsNonEntryPointParam) {
- auto* s = Structure("S", utils::Vector{Member("a", ty.f32(), utils::Vector{Location(0_a)})});
+ auto* s = Structure("S", Vector{Member("a", ty.f32(), Vector{Location(0_a)})});
- Func("foo", utils::Vector{Param("param", ty.Of(s))}, ty.void_(), utils::Empty, utils::Empty);
+ Func("foo", Vector{Param("param", ty.Of(s))}, ty.void_(), tint::Empty, tint::Empty);
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -52,10 +52,9 @@
}
TEST_F(ResolverPipelineStageUseTest, StructUsedAsNonEntryPointReturnType) {
- auto* s = Structure("S", utils::Vector{Member("a", ty.f32(), utils::Vector{Location(0_a)})});
+ auto* s = Structure("S", Vector{Member("a", ty.f32(), Vector{Location(0_a)})});
- Func("foo", utils::Empty, ty.Of(s), utils::Vector{Return(Call(ty.Of(s), Expr(0_f)))},
- utils::Empty);
+ Func("foo", tint::Empty, ty.Of(s), Vector{Return(Call(ty.Of(s), Expr(0_f)))}, tint::Empty);
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -65,12 +64,11 @@
}
TEST_F(ResolverPipelineStageUseTest, StructUsedAsVertexShaderParam) {
- auto* s = Structure("S", utils::Vector{Member("a", ty.f32(), utils::Vector{Location(0_a)})});
+ auto* s = Structure("S", Vector{Member("a", ty.f32(), Vector{Location(0_a)})});
- Func("main", utils::Vector{Param("param", ty.Of(s))}, ty.vec4<f32>(),
- utils::Vector{Return(Call<vec4<f32>>())},
- utils::Vector{Stage(ast::PipelineStage::kVertex)},
- utils::Vector{Builtin(builtin::BuiltinValue::kPosition)});
+ Func("main", Vector{Param("param", ty.Of(s))}, ty.vec4<f32>(),
+ Vector{Return(Call<vec4<f32>>())}, Vector{Stage(ast::PipelineStage::kVertex)},
+ Vector{Builtin(builtin::BuiltinValue::kPosition)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -81,12 +79,11 @@
}
TEST_F(ResolverPipelineStageUseTest, StructUsedAsVertexShaderReturnType) {
- auto* s = Structure(
- "S", utils::Vector{Member("a", ty.vec4<f32>(),
- utils::Vector{Builtin(builtin::BuiltinValue::kPosition)})});
+ auto* s = Structure("S", Vector{Member("a", ty.vec4<f32>(),
+ Vector{Builtin(builtin::BuiltinValue::kPosition)})});
- Func("main", utils::Empty, ty.Of(s), utils::Vector{Return(Call(ty.Of(s)))},
- utils::Vector{Stage(ast::PipelineStage::kVertex)});
+ Func("main", tint::Empty, ty.Of(s), Vector{Return(Call(ty.Of(s)))},
+ Vector{Stage(ast::PipelineStage::kVertex)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -97,10 +94,10 @@
}
TEST_F(ResolverPipelineStageUseTest, StructUsedAsFragmentShaderParam) {
- auto* s = Structure("S", utils::Vector{Member("a", ty.f32(), utils::Vector{Location(0_a)})});
+ auto* s = Structure("S", Vector{Member("a", ty.f32(), Vector{Location(0_a)})});
- Func("main", utils::Vector{Param("param", ty.Of(s))}, ty.void_(), utils::Empty,
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("main", Vector{Param("param", ty.Of(s))}, ty.void_(), tint::Empty,
+ Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -111,10 +108,10 @@
}
TEST_F(ResolverPipelineStageUseTest, StructUsedAsFragmentShaderReturnType) {
- auto* s = Structure("S", utils::Vector{Member("a", ty.f32(), utils::Vector{Location(0_a)})});
+ auto* s = Structure("S", Vector{Member("a", ty.f32(), Vector{Location(0_a)})});
- Func("main", utils::Empty, ty.Of(s), utils::Vector{Return(Call(ty.Of(s), Expr(0_f)))},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("main", tint::Empty, ty.Of(s), Vector{Return(Call(ty.Of(s), Expr(0_f)))},
+ Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -126,12 +123,11 @@
TEST_F(ResolverPipelineStageUseTest, StructUsedAsComputeShaderParam) {
auto* s = Structure(
- "S",
- utils::Vector{Member(
- "a", ty.u32(), utils::Vector{Builtin(builtin::BuiltinValue::kLocalInvocationIndex)})});
+ "S", Vector{Member("a", ty.u32(),
+ Vector{Builtin(builtin::BuiltinValue::kLocalInvocationIndex)})});
- Func("main", utils::Vector{Param("param", ty.Of(s))}, ty.void_(), utils::Empty,
- utils::Vector{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)});
+ Func("main", Vector{Param("param", ty.Of(s))}, ty.void_(), tint::Empty,
+ Vector{Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -142,15 +138,14 @@
}
TEST_F(ResolverPipelineStageUseTest, StructUsedMultipleStages) {
- auto* s = Structure(
- "S", utils::Vector{Member("a", ty.vec4<f32>(),
- utils::Vector{Builtin(builtin::BuiltinValue::kPosition)})});
+ auto* s = Structure("S", Vector{Member("a", ty.vec4<f32>(),
+ Vector{Builtin(builtin::BuiltinValue::kPosition)})});
- Func("vert_main", utils::Empty, ty.Of(s), utils::Vector{Return(Call(ty.Of(s)))},
- utils::Vector{Stage(ast::PipelineStage::kVertex)});
+ Func("vert_main", tint::Empty, ty.Of(s), Vector{Return(Call(ty.Of(s)))},
+ Vector{Stage(ast::PipelineStage::kVertex)});
- Func("frag_main", utils::Vector{Param("param", ty.Of(s))}, ty.void_(), utils::Empty,
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("frag_main", Vector{Param("param", ty.Of(s))}, ty.void_(), tint::Empty,
+ Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -162,11 +157,11 @@
}
TEST_F(ResolverPipelineStageUseTest, StructUsedAsShaderParamViaAlias) {
- auto* s = Structure("S", utils::Vector{Member("a", ty.f32(), utils::Vector{Location(0_a)})});
+ auto* s = Structure("S", Vector{Member("a", ty.f32(), Vector{Location(0_a)})});
auto* s_alias = Alias("S_alias", ty.Of(s));
- Func("main", utils::Vector{Param("param", ty.Of(s_alias))}, ty.void_(), utils::Empty,
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("main", Vector{Param("param", ty.Of(s_alias))}, ty.void_(), tint::Empty,
+ Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -177,10 +172,10 @@
}
TEST_F(ResolverPipelineStageUseTest, StructUsedAsShaderParamLocationSet) {
- auto* s = Structure("S", utils::Vector{Member("a", ty.f32(), utils::Vector{Location(3_a)})});
+ auto* s = Structure("S", Vector{Member("a", ty.f32(), Vector{Location(3_a)})});
- Func("main", utils::Vector{Param("param", ty.Of(s))}, ty.void_(), utils::Empty,
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("main", Vector{Param("param", ty.Of(s))}, ty.void_(), tint::Empty,
+ Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -191,12 +186,11 @@
}
TEST_F(ResolverPipelineStageUseTest, StructUsedAsShaderReturnTypeViaAlias) {
- auto* s = Structure("S", utils::Vector{Member("a", ty.f32(), utils::Vector{Location(0_a)})});
+ auto* s = Structure("S", Vector{Member("a", ty.f32(), Vector{Location(0_a)})});
auto* s_alias = Alias("S_alias", ty.Of(s));
- Func("main", utils::Empty, ty.Of(s_alias),
- utils::Vector{Return(Call(ty.Of(s_alias), Expr(0_f)))},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("main", tint::Empty, ty.Of(s_alias), Vector{Return(Call(ty.Of(s_alias), Expr(0_f)))},
+ Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -207,10 +201,10 @@
}
TEST_F(ResolverPipelineStageUseTest, StructUsedAsShaderReturnTypeLocationSet) {
- auto* s = Structure("S", utils::Vector{Member("a", ty.f32(), utils::Vector{Location(3_a)})});
+ auto* s = Structure("S", Vector{Member("a", ty.f32(), Vector{Location(3_a)})});
- Func("main", utils::Empty, ty.Of(s), utils::Vector{Return(Call(ty.Of(s), Expr(0_f)))},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("main", tint::Empty, ty.Of(s), Vector{Return(Call(ty.Of(s), Expr(0_f)))},
+ Vector{Stage(ast::PipelineStage::kFragment)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
diff --git a/src/tint/lang/wgsl/resolver/type_validation_test.cc b/src/tint/lang/wgsl/resolver/type_validation_test.cc
index 0909a86..5b09dc2 100644
--- a/src/tint/lang/wgsl/resolver/type_validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/type_validation_test.cc
@@ -100,8 +100,8 @@
// }
// var a: f32 = 2.1;
- Func("my_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("my_func", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("a", ty.f32(), Expr(2_f))),
});
@@ -152,14 +152,14 @@
auto* var1 = Var("a", ty.f32(), Expr(1_f));
- Func("func0", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("func0", tint::Empty, ty.void_(),
+ Vector{
Decl(Source{{12, 34}}, var0),
Return(),
});
- Func("func1", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("func1", tint::Empty, ty.void_(),
+ Vector{
Decl(Source{{13, 34}}, var1),
Return(),
});
@@ -335,7 +335,7 @@
TEST_F(ResolverTypeValidationTest, ArraySize_StorageBufferLargeArray) {
// var<storage> a : array<f32, 65536>;
GlobalVar("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, 65536_a)),
- builtin::AddressSpace::kStorage, utils::Vector{Binding(0_u), Group(0_u)});
+ builtin::AddressSpace::kStorage, Vector{Binding(0_u), Group(0_u)});
EXPECT_TRUE(r()->Resolve()) << r()->error();
}
@@ -344,10 +344,10 @@
// a : array<f32, 65536>,
// }
// var<storage> a : S;
- Structure("S", utils::Vector{Member(Source{{12, 34}}, "a",
- ty.array(Source{{12, 20}}, ty.f32(), 65536_a))});
+ Structure("S",
+ Vector{Member(Source{{12, 34}}, "a", ty.array(Source{{12, 20}}, ty.f32(), 65536_a))});
GlobalVar("a", ty(Source{{12, 30}}, "S"), builtin::AddressSpace::kStorage,
- utils::Vector{Binding(0_u), Group(0_u)});
+ Vector{Binding(0_u), Group(0_u)});
EXPECT_TRUE(r()->Resolve()) << r()->error();
}
@@ -356,8 +356,7 @@
// @offset(800000) a : f32
// }
// var<private> a : array<S, 65535>;
- Structure("S", utils::Vector{Member(Source{{12, 34}}, "a", ty.f32(),
- utils::Vector{MemberOffset(800000_a)})});
+ Structure("S", Vector{Member(Source{{12, 34}}, "a", ty.f32(), Vector{MemberOffset(800000_a)})});
GlobalVar("a", ty.array(ty(Source{{12, 30}}, "S"), Expr(Source{{12, 34}}, 65535_a)),
builtin::AddressSpace::kPrivate);
EXPECT_FALSE(r()->Resolve());
@@ -367,8 +366,7 @@
TEST_F(ResolverTypeValidationTest, ArraySize_TooBig_ExplicitStride) {
// var<private> a : @stride(8000000) array<f32, 65535>;
- GlobalVar("a",
- ty.array(ty.f32(), Expr(Source{{12, 34}}, 65535_a), utils::Vector{Stride(8000000)}),
+ GlobalVar("a", ty.array(ty.f32(), Expr(Source{{12, 34}}, 65535_a), Vector{Stride(8000000)}),
builtin::AddressSpace::kPrivate);
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
@@ -404,7 +402,7 @@
// a : array<f32, size>
// };
Override("size", Expr(10_i));
- Structure("S", utils::Vector{Member("a", ty.array(Source{{12, 34}}, ty.f32(), "size"))});
+ Structure("S", Vector{Member("a", ty.array(Source{{12, 34}}, ty.f32(), "size"))});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
"12:34 error: array with an 'override' element count can only be used as the store "
@@ -417,8 +415,8 @@
// var a : array<f32, size>;
// }
Override("size", Expr(10_i));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("a", ty.array(Source{{12, 34}}, ty.f32(), "size"))),
});
EXPECT_FALSE(r()->Resolve());
@@ -433,8 +431,8 @@
// var a : array<f32, size>;
// }
Override("size", Expr(10_i));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("a", ty.array(Source{{12, 34}}, ty.f32(), "size"))),
});
EXPECT_FALSE(r()->Resolve());
@@ -451,8 +449,8 @@
// }
Override("size", Expr(10_i));
GlobalVar("w", ty.array(ty.f32(), "size"), builtin::AddressSpace::kWorkgroup);
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(Var("a", Expr(Source{{12, 34}}, "w"))),
});
EXPECT_FALSE(r()->Resolve());
@@ -469,8 +467,8 @@
// }
Override("size", Expr(10_i));
GlobalVar("w", ty.array(ty.f32(), "size"), builtin::AddressSpace::kWorkgroup);
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("a", Expr(Source{{12, 34}}, "w"))),
});
EXPECT_FALSE(r()->Resolve());
@@ -501,8 +499,8 @@
// fn f(a : array<f32, size>) {
// }
Override("size", Expr(10_i));
- Func("f", utils::Vector{Param("a", ty.array(Source{{12, 34}}, ty.f32(), "size"))}, ty.void_(),
- utils::Empty);
+ Func("f", Vector{Param("a", ty.array(Source{{12, 34}}, ty.f32(), "size"))}, ty.void_(),
+ tint::Empty);
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), "12:34 error: type of function parameter must be constructible");
}
@@ -512,7 +510,7 @@
// fn f() -> array<f32, size> {
// }
Override("size", Expr(10_i));
- Func("f", utils::Empty, ty.array(Source{{12, 34}}, ty.f32(), "size"), utils::Empty);
+ Func("f", tint::Empty, ty.array(Source{{12, 34}}, ty.f32(), "size"), tint::Empty);
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), "12:34 error: function return type must be a constructible type");
}
@@ -576,11 +574,11 @@
auto* var = Var(Source{{56, 78}}, "a", ty.array(Source{{12, 34}}, ty.i32()));
- Func("func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("func", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kVertex),
});
@@ -595,7 +593,7 @@
// a: vec3;
// };
- Structure("S", utils::Vector{
+ Structure("S", Vector{
Member("a", ty.vec3<Infer>(Source{{12, 34}})),
});
@@ -607,7 +605,7 @@
// struct S {
// a: mat3x3;
// };
- Structure("S", utils::Vector{
+ Structure("S", Vector{
Member("a", ty.mat3x3<Infer>(Source{{12, 34}})),
});
@@ -624,10 +622,10 @@
// b: array<Bar, 65535>;
// }
- Structure(Source{{10, 34}}, "Bar", utils::Vector{Member("a", ty.array<f32, 10000>())});
+ Structure(Source{{10, 34}}, "Bar", Vector{Member("a", ty.array<f32, 10000>())});
Structure(Source{{12, 34}}, "Foo",
- utils::Vector{Member("a", ty.array(ty(Source{{12, 30}}, "Bar"), Expr(65535_a))),
- Member("b", ty.array(ty("Bar"), Expr(65535_a)))});
+ Vector{Member("a", ty.array(ty(Source{{12, 30}}, "Bar"), Expr(65535_a))),
+ Member("b", ty.array(ty("Bar"), Expr(65535_a)))});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
@@ -641,9 +639,9 @@
// c: f32;
// };
- Structure("Foo", utils::Vector{
- Member("z", ty.f32(), utils::Vector{MemberSize(2147483647_a)}),
- Member("y", ty.f32(), utils::Vector{MemberSize(2147483647_a)}),
+ Structure("Foo", Vector{
+ Member("z", ty.f32(), Vector{MemberSize(2147483647_a)}),
+ Member("y", ty.f32(), Vector{MemberSize(2147483647_a)}),
Member(Source{{12, 34}}, "a", ty.array<f32, 65535>()),
Member("c", ty.f32()),
});
@@ -659,7 +657,7 @@
// rt: array<f32>;
// };
- Structure("Foo", utils::Vector{
+ Structure("Foo", Vector{
Member("vf", ty.f32()),
Member("rt", ty.array<f32>()),
});
@@ -672,7 +670,7 @@
// rt : array<array<f32>, 4u>;
// };
- Structure("Foo", utils::Vector{
+ Structure("Foo", Vector{
Member("rt", ty.array(ty.array(Source{{12, 34}}, ty.f32()), 4_u)),
});
@@ -687,7 +685,7 @@
// };
// var<private> a : array<Foo, 4>;
- Structure("Foo", utils::Vector{Member("rt", ty.array<f32>())});
+ Structure("Foo", Vector{Member("rt", ty.array<f32>())});
GlobalVar("v", ty.array(ty(Source{{12, 34}}, "Foo"), 4_u), builtin::AddressSpace::kPrivate);
EXPECT_FALSE(r()->Resolve()) << r()->error();
@@ -703,10 +701,10 @@
// inner : Foo;
// };
- auto* foo = Structure("Foo", utils::Vector{
+ auto* foo = Structure("Foo", Vector{
Member("rt", ty.array<f32>()),
});
- Structure("Outer", utils::Vector{
+ Structure("Outer", Vector{
Member(Source{{12, 34}}, "inner", ty.Of(foo)),
});
@@ -722,7 +720,7 @@
// vf: f32;
// };
- Structure("Foo", utils::Vector{
+ Structure("Foo", Vector{
Member(Source{{12, 34}}, "rt", ty.array<f32>()),
Member("vf", ty.f32()),
});
@@ -760,16 +758,16 @@
auto* param = Param(Source{{56, 78}}, "a", ty.array(Source{{12, 34}}, ty.i32()));
- Func("func", utils::Vector{param}, ty.void_(),
- utils::Vector{
+ Func("func", Vector{param}, ty.void_(),
+ Vector{
Return(),
});
- Func("main", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("main", tint::Empty, ty.void_(),
+ Vector{
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kVertex),
});
@@ -785,8 +783,8 @@
auto* param = Param("a", ty.ptr(Source{{56, 78}}, builtin::AddressSpace::kWorkgroup,
ty.array(Source{{12, 34}}, ty.i32())));
- Func("func", utils::Vector{param}, ty.void_(),
- utils::Vector{
+ Func("func", Vector{param}, ty.void_(),
+ Vector{
Return(),
});
@@ -801,8 +799,8 @@
auto* param = Param(Source{{56, 78}}, "a", ty.array(Source{{12, 34}}, ty.i32()));
- Func("func", utils::Vector{param}, ty.void_(),
- utils::Vector{
+ Func("func", Vector{param}, ty.void_(),
+ Vector{
Return(),
});
@@ -820,7 +818,7 @@
//}
auto* alias = Alias("RTArr", ty.array<u32>());
- Structure("s", utils::Vector{
+ Structure("s", Vector{
Member(Source{{12, 34}}, "b", ty.Of(alias)),
Member("a", ty.u32()),
});
@@ -838,7 +836,7 @@
//}
auto* alias = Alias("RTArr", ty.array<u32>());
- Structure("s", utils::Vector{
+ Structure("s", Vector{
Member("a", ty.u32()),
Member("b", ty.Of(alias)),
});
@@ -857,8 +855,7 @@
TEST_F(ResolverTypeValidationTest, ArrayOfNonStorableTypeWithStride) {
auto ptr_ty = ty.ptr<uniform, u32>(Source{{12, 34}});
- GlobalVar("arr", ty.array(ptr_ty, 4_i, utils::Vector{Stride(16)}),
- builtin::AddressSpace::kPrivate);
+ GlobalVar("arr", ty.array(ptr_ty, 4_i, Vector{Stride(16)}), builtin::AddressSpace::kPrivate);
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(),
@@ -1049,8 +1046,8 @@
// var a : texture_storage_*<r32uint, write>;
auto& params = GetParam();
- auto st = ty(Source{{12, 34}}, params.name, utils::ToString(builtin::TexelFormat::kR32Uint),
- utils::ToString(builtin::Access::kWrite));
+ auto st = ty(Source{{12, 34}}, params.name, tint::ToString(builtin::TexelFormat::kR32Uint),
+ tint::ToString(builtin::Access::kWrite));
GlobalVar("a", st, Group(0_a), Binding(0_a));
@@ -1500,7 +1497,7 @@
// };
// var<private> v : S<true>;
- Structure(Source{{56, 78}}, "S", utils::Vector{Member("i", ty.i32())});
+ Structure(Source{{56, 78}}, "S", Vector{Member("i", ty.i32())});
GlobalVar("v", builtin::AddressSpace::kPrivate, ty(Source{{12, 34}}, "S", true));
EXPECT_FALSE(r()->Resolve());
diff --git a/src/tint/lang/wgsl/resolver/uniformity.cc b/src/tint/lang/wgsl/resolver/uniformity.cc
index 50d2058..392449f 100644
--- a/src/tint/lang/wgsl/resolver/uniformity.cc
+++ b/src/tint/lang/wgsl/resolver/uniformity.cc
@@ -132,7 +132,7 @@
uint32_t arg_index = 0xffffffffu;
/// The set of edges from this node to other nodes in the graph.
- utils::UniqueVector<Node*, 4> edges;
+ UniqueVector<Node*, 4> edges;
/// The node that this node was visited from, or nullptr if not visited.
Node* visited_from = nullptr;
@@ -159,10 +159,10 @@
bool pointer_may_become_non_uniform = false;
/// The parameters that are required to be uniform for the contents of this pointer parameter to
/// be uniform at function exit.
- utils::Vector<const sem::Parameter*, 8> ptr_output_source_param_values;
+ Vector<const sem::Parameter*, 8> ptr_output_source_param_values;
/// The pointer parameters whose contents are required to be uniform for the contents of this
/// pointer parameter to be uniform at function exit.
- utils::Vector<const sem::Parameter*, 8> ptr_output_source_param_contents;
+ Vector<const sem::Parameter*, 8> ptr_output_source_param_contents;
/// The node in the graph that corresponds to this parameter's (immutable) value.
Node* value;
/// The node in the graph that corresponds to this pointer parameter's initial contents.
@@ -224,10 +224,10 @@
/// The function's uniformity effects.
FunctionTag function_tag;
/// The uniformity requirements of the function's parameters.
- utils::Vector<ParameterInfo, 8> parameters;
+ Vector<ParameterInfo, 8> parameters;
/// The control flow graph.
- utils::BlockAllocator<Node> nodes;
+ BlockAllocator<Node> nodes;
/// Special `RequiredToBeUniform` nodes.
Node* required_to_be_uniform_error = nullptr;
@@ -247,20 +247,20 @@
/// in the analysis. This includes the contents of parameters to the function that are pointers.
/// This is used by the analysis for if statements and loops to know which variables need extra
/// nodes to capture their state when entering/exiting those constructs.
- utils::Hashset<const sem::Variable*, 8> local_var_decls;
+ Hashset<const sem::Variable*, 8> local_var_decls;
/// The set of partial pointer variables - pointers that point to a subobject (into an array or
/// struct).
- utils::Hashset<const sem::Variable*, 4> partial_ptrs;
+ Hashset<const sem::Variable*, 4> partial_ptrs;
/// LoopSwitchInfo tracks information about the value of variables for a control flow construct.
struct LoopSwitchInfo {
/// The type of this control flow construct.
std::string type;
/// The input values for local variables at the start of this construct.
- utils::Hashmap<const sem::Variable*, Node*, 4> var_in_nodes;
+ Hashmap<const sem::Variable*, Node*, 4> var_in_nodes;
/// The exit values for local variables at the end of this construct.
- utils::Hashmap<const sem::Variable*, Node*, 4> var_exit_nodes;
+ Hashmap<const sem::Variable*, Node*, 4> var_exit_nodes;
};
/// @returns the RequiredToBeUniform node that corresponds to `severity`
@@ -324,13 +324,13 @@
private:
/// A list of tags that have already been used within the current function.
- utils::Hashset<std::string, 8> tags_;
+ Hashset<std::string, 8> tags_;
/// Map from control flow statements to the corresponding LoopSwitchInfo structure.
- utils::Hashmap<const sem::Statement*, LoopSwitchInfo*, 8> loop_switch_infos;
+ Hashmap<const sem::Statement*, LoopSwitchInfo*, 8> loop_switch_infos;
/// Allocator of LoopSwitchInfos
- utils::BlockAllocator<LoopSwitchInfo> loop_switch_info_allocator;
+ BlockAllocator<LoopSwitchInfo> loop_switch_info_allocator;
};
/// UniformityGraph is used to analyze the uniformity requirements and effects of functions in a
@@ -379,7 +379,7 @@
diag::List& diagnostics_;
/// Map of analyzed function results.
- utils::Hashmap<const ast::Function*, FunctionInfo, 8> functions_;
+ Hashmap<const ast::Function*, FunctionInfo, 8> functions_;
/// The function currently being analyzed.
FunctionInfo* current_function_;
@@ -439,7 +439,7 @@
#endif
/// Helper to generate a tag for the uniformity requirements of the parameter at `index`.
- auto get_param_tag = [&](utils::UniqueVector<Node*, 4>& reachable, size_t index) {
+ auto get_param_tag = [&](UniqueVector<Node*, 4>& reachable, size_t index) {
auto* param = sem_.Get(func->params[index]);
auto& param_info = current_function_->parameters[index];
if (param->Type()->Is<type::Pointer>()) {
@@ -459,7 +459,7 @@
// Look at which nodes are reachable from "RequiredToBeUniform".
{
- utils::UniqueVector<Node*, 4> reachable;
+ UniqueVector<Node*, 4> reachable;
auto traverse = [&](builtin::DiagnosticSeverity severity) {
Traverse(current_function_->RequiredToBeUniform(severity), &reachable);
if (reachable.Contains(current_function_->may_be_non_uniform)) {
@@ -496,7 +496,7 @@
if (current_function_->value_return) {
current_function_->ResetVisited();
- utils::UniqueVector<Node*, 4> reachable;
+ UniqueVector<Node*, 4> reachable;
Traverse(current_function_->value_return, &reachable);
if (reachable.Contains(current_function_->may_be_non_uniform)) {
current_function_->function_tag = ReturnValueMayBeNonUniform;
@@ -519,7 +519,7 @@
// Reset "visited" state for all nodes.
current_function_->ResetVisited();
- utils::UniqueVector<Node*, 4> reachable;
+ UniqueVector<Node*, 4> reachable;
Traverse(param_info.ptr_output_contents, &reachable);
if (reachable.Contains(current_function_->may_be_non_uniform)) {
param_info.pointer_may_become_non_uniform = true;
@@ -566,7 +566,7 @@
},
[&](const ast::BlockStatement* b) {
- utils::Hashmap<const sem::Variable*, Node*, 4> scoped_assignments;
+ Hashmap<const sem::Variable*, Node*, 4> scoped_assignments;
{
// Push a new scope for variable assignments in the block.
current_function_->variables.Push();
@@ -901,15 +901,15 @@
v->affects_control_flow = true;
v->AddEdge(v_cond);
- utils::Hashmap<const sem::Variable*, Node*, 4> true_vars;
- utils::Hashmap<const sem::Variable*, Node*, 4> false_vars;
+ Hashmap<const sem::Variable*, Node*, 4> true_vars;
+ Hashmap<const sem::Variable*, Node*, 4> false_vars;
// Helper to process a statement with a new scope for variable assignments.
// Populates `assigned_vars` with new nodes for any variables that are assigned in
// this statement.
auto process_in_scope =
[&](Node* cf_in, const ast::Statement* s,
- utils::Hashmap<const sem::Variable*, Node*, 4>& assigned_vars) {
+ Hashmap<const sem::Variable*, Node*, 4>& assigned_vars) {
// Push a new scope for variable assignments.
current_function_->variables.Push();
@@ -1491,8 +1491,8 @@
// Process call arguments
Node* cf_last_arg = cf;
- utils::Vector<Node*, 8> args;
- utils::Vector<Node*, 8> ptrarg_contents;
+ Vector<Node*, 8> args;
+ Vector<Node*, 8> ptrarg_contents;
ptrarg_contents.Resize(call->args.Length());
for (size_t i = 0; i < call->args.Length(); i++) {
auto [cf_i, arg_i] = ProcessExpression(cf_last_arg, call->args[i]);
@@ -1692,8 +1692,8 @@
/// recording which node they were reached from.
/// @param source the starting node
/// @param reachable the set of reachable nodes to populate, if required
- void Traverse(Node* source, utils::UniqueVector<Node*, 4>* reachable = nullptr) {
- utils::Vector<Node*, 8> to_visit{source};
+ void Traverse(Node* source, UniqueVector<Node*, 4>* reachable = nullptr) {
+ Vector<Node*, 8> to_visit{source};
while (!to_visit.IsEmpty()) {
auto* node = to_visit.Back();
@@ -1819,7 +1819,7 @@
non_uniform_source->ast,
[&](const ast::IdentifierExpression* ident) {
auto* var = sem_.GetVal(ident)->UnwrapLoad()->As<sem::VariableUser>()->Variable();
- utils::StringStream ss;
+ StringStream ss;
if (auto* param = var->As<sem::Parameter>()) {
auto* func = param->Owner()->As<sem::Function>();
ss << param_type(param) << "'" << NameFor(ident) << "' of '" << NameFor(func)
@@ -1832,7 +1832,7 @@
},
[&](const ast::Variable* v) {
auto* var = sem_.Get(v);
- utils::StringStream ss;
+ StringStream ss;
ss << "reading from " << var_type(var) << "'" << NameFor(v)
<< "' may result in a non-uniform value";
diagnostics_.add_note(diag::System::Resolver, ss.str(), v->source);
@@ -1849,7 +1849,7 @@
case Node::kFunctionCallArgumentContents: {
auto* arg = c->args[non_uniform_source->arg_index];
auto* var = sem_.GetVal(arg)->RootIdentifier();
- utils::StringStream ss;
+ StringStream ss;
ss << "reading from " << var_type(var) << "'" << NameFor(var)
<< "' may result in a non-uniform value";
diagnostics_.add_note(diag::System::Resolver, ss.str(),
@@ -1936,7 +1936,7 @@
// Show the place where the non-uniform argument was passed.
// If this is a builtin, this will be the trigger location for the failure.
- utils::StringStream ss;
+ StringStream ss;
ss << "possibly non-uniform value passed" << (is_value ? "" : " via pointer")
<< " here";
report(call->args[cause->arg_index]->source, ss.str(), /* note */ user_func != nullptr);
@@ -1948,7 +1948,7 @@
{
// Show a builtin was reachable from this call (which may be the call itself).
// This will be the trigger location for the failure.
- utils::StringStream ss;
+ StringStream ss;
ss << "'" << NameFor(builtin_call->target)
<< "' must only be called from uniform control flow";
report(builtin_call->source, ss.str(), /* note */ false);
@@ -1956,7 +1956,7 @@
if (builtin_call != call) {
// The call was to a user function, so show that call too.
- utils::StringStream ss;
+ StringStream ss;
ss << "called ";
if (target->As<sem::Function>() != SemCall(builtin_call)->Stmt()->Function()) {
ss << "indirectly ";
diff --git a/src/tint/lang/wgsl/resolver/uniformity_test.cc b/src/tint/lang/wgsl/resolver/uniformity_test.cc
index 3478d2f..c7e1b71 100644
--- a/src/tint/lang/wgsl/resolver/uniformity_test.cc
+++ b/src/tint/lang/wgsl/resolver/uniformity_test.cc
@@ -5292,8 +5292,8 @@
// ...
// *p254 = rhs;
// }
- utils::Vector<const ast::Parameter*, 8> params;
- utils::Vector<const ast::Statement*, 8> foo_body;
+ Vector<const ast::Parameter*, 8> params;
+ Vector<const ast::Statement*, 8> foo_body;
const ast::Expression* rhs_init = b.Deref("p0");
for (int i = 1; i < 255; i++) {
rhs_init = b.Add(rhs_init, b.Deref("p" + std::to_string(i)));
@@ -5320,8 +5320,8 @@
// }
// }
b.GlobalVar("non_uniform_global", ty.i32(), builtin::AddressSpace::kPrivate);
- utils::Vector<const ast::Statement*, 8> main_body;
- utils::Vector<const ast::Expression*, 8> args;
+ Vector<const ast::Statement*, 8> main_body;
+ Vector<const ast::Expression*, 8> args;
for (int i = 0; i < 255; i++) {
auto name = "v" + std::to_string(i);
main_body.Push(b.Decl(b.Var(name, ty.i32())));
@@ -5330,7 +5330,7 @@
main_body.Push(b.Assign("v0", "non_uniform_global"));
main_body.Push(b.CallStmt(b.Call("foo", args)));
main_body.Push(b.If(b.Equal("v254", 0_i), b.Block(b.CallStmt(b.Call("workgroupBarrier")))));
- b.Func("main", utils::Empty, ty.void_(), main_body);
+ b.Func("main", tint::Empty, ty.void_(), main_body);
RunTest(std::move(b), false);
EXPECT_EQ(error_,
@@ -8254,7 +8254,7 @@
// }
// }
b.GlobalVar("v0", ty.i32(), builtin::AddressSpace::kPrivate, b.Expr(0_i));
- utils::Vector<const ast::Statement*, 8> foo_body;
+ Vector<const ast::Statement*, 8> foo_body;
std::string v_last = "v0";
for (int i = 1; i < 100000; i++) {
auto v = "v" + std::to_string(i);
@@ -8262,7 +8262,7 @@
v_last = v;
}
foo_body.Push(b.If(b.Equal(v_last, 0_i), b.Block(b.CallStmt(b.Call("workgroupBarrier")))));
- b.Func("foo", utils::Empty, ty.void_(), foo_body);
+ b.Func("foo", tint::Empty, ty.void_(), foo_body);
RunTest(std::move(b), false);
EXPECT_EQ(error_,
@@ -8279,7 +8279,7 @@
: public UniformityAnalysisTestBase,
public ::testing::TestWithParam<builtin::DiagnosticSeverity> {
protected:
- // TODO(jrprice): Remove this in favour of utils::ToString() when we change "note" to "info".
+ // TODO(jrprice): Remove this in favour of tint::ToString() when we change "note" to "info".
const char* ToStr(builtin::DiagnosticSeverity severity) {
switch (severity) {
case builtin::DiagnosticSeverity::kError:
@@ -8296,7 +8296,7 @@
TEST_P(UniformityAnalysisDiagnosticFilterTest, Directive) {
auto& param = GetParam();
- utils::StringStream ss;
+ StringStream ss;
ss << "diagnostic(" << param << ", derivative_uniformity);"
<< R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
@@ -8315,7 +8315,7 @@
if (param == builtin::DiagnosticSeverity::kOff) {
EXPECT_TRUE(error_.empty());
} else {
- utils::StringStream err;
+ StringStream err;
err << ToStr(param) << ": 'textureSample' must only be called";
EXPECT_THAT(error_, ::testing::HasSubstr(err.str()));
}
@@ -8323,7 +8323,7 @@
TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnFunction) {
auto& param = GetParam();
- utils::StringStream ss;
+ StringStream ss;
ss << R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
@group(0) @binding(1) var t : texture_2d<f32>;
@@ -8342,7 +8342,7 @@
if (param == builtin::DiagnosticSeverity::kOff) {
EXPECT_TRUE(error_.empty());
} else {
- utils::StringStream err;
+ StringStream err;
err << ToStr(param) << ": 'textureSample' must only be called";
EXPECT_THAT(error_, ::testing::HasSubstr(err.str()));
}
@@ -8350,7 +8350,7 @@
TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnBlock) {
auto& param = GetParam();
- utils::StringStream ss;
+ StringStream ss;
ss << R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
@group(0) @binding(1) var t : texture_2d<f32>;
@@ -8368,7 +8368,7 @@
if (param == builtin::DiagnosticSeverity::kOff) {
EXPECT_TRUE(error_.empty());
} else {
- utils::StringStream err;
+ StringStream err;
err << ToStr(param) << ": 'textureSample' must only be called";
EXPECT_THAT(error_, ::testing::HasSubstr(err.str()));
}
@@ -8376,7 +8376,7 @@
TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnForStatement_CallInInitializer) {
auto& param = GetParam();
- utils::StringStream ss;
+ StringStream ss;
ss << R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
fn foo() {
@@ -8391,7 +8391,7 @@
if (param == builtin::DiagnosticSeverity::kOff) {
EXPECT_TRUE(error_.empty());
} else {
- utils::StringStream err;
+ StringStream err;
err << ToStr(param) << ": 'dpdx' must only be called";
EXPECT_THAT(error_, ::testing::HasSubstr(err.str()));
}
@@ -8399,7 +8399,7 @@
TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnForStatement_CallInCondition) {
auto& param = GetParam();
- utils::StringStream ss;
+ StringStream ss;
ss << R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
fn foo() {
@@ -8414,7 +8414,7 @@
if (param == builtin::DiagnosticSeverity::kOff) {
EXPECT_TRUE(error_.empty());
} else {
- utils::StringStream err;
+ StringStream err;
err << ToStr(param) << ": 'dpdx' must only be called";
EXPECT_THAT(error_, ::testing::HasSubstr(err.str()));
}
@@ -8422,7 +8422,7 @@
TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnForStatement_CallInIncrement) {
auto& param = GetParam();
- utils::StringStream ss;
+ StringStream ss;
ss << R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
fn foo() {
@@ -8437,7 +8437,7 @@
if (param == builtin::DiagnosticSeverity::kOff) {
EXPECT_TRUE(error_.empty());
} else {
- utils::StringStream err;
+ StringStream err;
err << ToStr(param) << ": 'dpdx' must only be called";
EXPECT_THAT(error_, ::testing::HasSubstr(err.str()));
}
@@ -8445,7 +8445,7 @@
TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnForStatement_CallInBody) {
auto& param = GetParam();
- utils::StringStream ss;
+ StringStream ss;
ss << R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
@group(0) @binding(1) var t : texture_2d<f32>;
@@ -8463,7 +8463,7 @@
if (param == builtin::DiagnosticSeverity::kOff) {
EXPECT_TRUE(error_.empty());
} else {
- utils::StringStream err;
+ StringStream err;
err << ToStr(param) << ": 'textureSample' must only be called";
EXPECT_THAT(error_, ::testing::HasSubstr(err.str()));
}
@@ -8471,7 +8471,7 @@
TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnIfStatement_CallInCondition) {
auto& param = GetParam();
- utils::StringStream ss;
+ StringStream ss;
ss << R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
fn foo() {
@@ -8486,7 +8486,7 @@
if (param == builtin::DiagnosticSeverity::kOff) {
EXPECT_TRUE(error_.empty());
} else {
- utils::StringStream err;
+ StringStream err;
err << ToStr(param) << ": 'dpdx' must only be called";
EXPECT_THAT(error_, ::testing::HasSubstr(err.str()));
}
@@ -8494,7 +8494,7 @@
TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnIfStatement_CallInBody) {
auto& param = GetParam();
- utils::StringStream ss;
+ StringStream ss;
ss << R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
@group(0) @binding(1) var t : texture_2d<f32>;
@@ -8512,7 +8512,7 @@
if (param == builtin::DiagnosticSeverity::kOff) {
EXPECT_TRUE(error_.empty());
} else {
- utils::StringStream err;
+ StringStream err;
err << ToStr(param) << ": 'textureSample' must only be called";
EXPECT_THAT(error_, ::testing::HasSubstr(err.str()));
}
@@ -8520,7 +8520,7 @@
TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnIfStatement_CallInElse) {
auto& param = GetParam();
- utils::StringStream ss;
+ StringStream ss;
ss << R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
@group(0) @binding(1) var t : texture_2d<f32>;
@@ -8539,7 +8539,7 @@
if (param == builtin::DiagnosticSeverity::kOff) {
EXPECT_TRUE(error_.empty());
} else {
- utils::StringStream err;
+ StringStream err;
err << ToStr(param) << ": 'textureSample' must only be called";
EXPECT_THAT(error_, ::testing::HasSubstr(err.str()));
}
@@ -8547,7 +8547,7 @@
TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnLoopStatement_CallInBody) {
auto& param = GetParam();
- utils::StringStream ss;
+ StringStream ss;
ss << R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
fn foo() {
@@ -8566,7 +8566,7 @@
if (param == builtin::DiagnosticSeverity::kOff) {
EXPECT_TRUE(error_.empty());
} else {
- utils::StringStream err;
+ StringStream err;
err << ToStr(param) << ": 'dpdx' must only be called";
EXPECT_THAT(error_, ::testing::HasSubstr(err.str()));
}
@@ -8574,7 +8574,7 @@
TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnLoopStatement_CallInContinuing) {
auto& param = GetParam();
- utils::StringStream ss;
+ StringStream ss;
ss << R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
fn foo() {
@@ -8593,7 +8593,7 @@
if (param == builtin::DiagnosticSeverity::kOff) {
EXPECT_TRUE(error_.empty());
} else {
- utils::StringStream err;
+ StringStream err;
err << ToStr(param) << ": 'dpdx' must only be called";
EXPECT_THAT(error_, ::testing::HasSubstr(err.str()));
}
@@ -8601,7 +8601,7 @@
TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnLoopBody_CallInBody) {
auto& param = GetParam();
- utils::StringStream ss;
+ StringStream ss;
ss << R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
fn foo() {
@@ -8620,7 +8620,7 @@
if (param == builtin::DiagnosticSeverity::kOff) {
EXPECT_TRUE(error_.empty());
} else {
- utils::StringStream err;
+ StringStream err;
err << ToStr(param) << ": 'dpdx' must only be called";
EXPECT_THAT(error_, ::testing::HasSubstr(err.str()));
}
@@ -8628,7 +8628,7 @@
TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnLoopBody_CallInContinuing) {
auto& param = GetParam();
- utils::StringStream ss;
+ StringStream ss;
ss << R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
fn foo() {
@@ -8647,7 +8647,7 @@
if (param == builtin::DiagnosticSeverity::kOff) {
EXPECT_TRUE(error_.empty());
} else {
- utils::StringStream err;
+ StringStream err;
err << ToStr(param) << ": 'dpdx' must only be called";
EXPECT_THAT(error_, ::testing::HasSubstr(err.str()));
}
@@ -8655,7 +8655,7 @@
TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnLoopContinuing_CallInContinuing) {
auto& param = GetParam();
- utils::StringStream ss;
+ StringStream ss;
ss << R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
fn foo() {
@@ -8674,7 +8674,7 @@
if (param == builtin::DiagnosticSeverity::kOff) {
EXPECT_TRUE(error_.empty());
} else {
- utils::StringStream err;
+ StringStream err;
err << ToStr(param) << ": 'dpdx' must only be called";
EXPECT_THAT(error_, ::testing::HasSubstr(err.str()));
}
@@ -8682,7 +8682,7 @@
TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnSwitchStatement_CallInCondition) {
auto& param = GetParam();
- utils::StringStream ss;
+ StringStream ss;
ss << R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
fn foo() {
@@ -8698,7 +8698,7 @@
if (param == builtin::DiagnosticSeverity::kOff) {
EXPECT_TRUE(error_.empty());
} else {
- utils::StringStream err;
+ StringStream err;
err << ToStr(param) << ": 'dpdx' must only be called";
EXPECT_THAT(error_, ::testing::HasSubstr(err.str()));
}
@@ -8706,7 +8706,7 @@
TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnSwitchStatement_CallInBody) {
auto& param = GetParam();
- utils::StringStream ss;
+ StringStream ss;
ss << R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
@group(0) @binding(1) var t : texture_2d<f32>;
@@ -8726,7 +8726,7 @@
if (param == builtin::DiagnosticSeverity::kOff) {
EXPECT_TRUE(error_.empty());
} else {
- utils::StringStream err;
+ StringStream err;
err << ToStr(param) << ": 'textureSample' must only be called";
EXPECT_THAT(error_, ::testing::HasSubstr(err.str()));
}
@@ -8734,7 +8734,7 @@
TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnSwitchBody_CallInBody) {
auto& param = GetParam();
- utils::StringStream ss;
+ StringStream ss;
ss << R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
@group(0) @binding(1) var t : texture_2d<f32>;
@@ -8754,7 +8754,7 @@
if (param == builtin::DiagnosticSeverity::kOff) {
EXPECT_TRUE(error_.empty());
} else {
- utils::StringStream err;
+ StringStream err;
err << ToStr(param) << ": 'textureSample' must only be called";
EXPECT_THAT(error_, ::testing::HasSubstr(err.str()));
}
@@ -8762,7 +8762,7 @@
TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnWhileStatement_CallInCondition) {
auto& param = GetParam();
- utils::StringStream ss;
+ StringStream ss;
ss << R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
fn foo() {
@@ -8777,7 +8777,7 @@
if (param == builtin::DiagnosticSeverity::kOff) {
EXPECT_TRUE(error_.empty());
} else {
- utils::StringStream err;
+ StringStream err;
err << ToStr(param) << ": 'dpdx' must only be called";
EXPECT_THAT(error_, ::testing::HasSubstr(err.str()));
}
@@ -8785,7 +8785,7 @@
TEST_P(UniformityAnalysisDiagnosticFilterTest, AttributeOnWhileStatement_CallInBody) {
auto& param = GetParam();
- utils::StringStream ss;
+ StringStream ss;
ss << R"(
@group(0) @binding(0) var<storage, read_write> non_uniform : i32;
@group(0) @binding(1) var t : texture_2d<f32>;
@@ -8803,7 +8803,7 @@
if (param == builtin::DiagnosticSeverity::kOff) {
EXPECT_TRUE(error_.empty());
} else {
- utils::StringStream err;
+ StringStream err;
err << ToStr(param) << ": 'textureSample' must only be called";
EXPECT_THAT(error_, ::testing::HasSubstr(err.str()));
}
diff --git a/src/tint/lang/wgsl/resolver/unresolved_identifier_test.cc b/src/tint/lang/wgsl/resolver/unresolved_identifier_test.cc
index 4379ad5..d107760 100644
--- a/src/tint/lang/wgsl/resolver/unresolved_identifier_test.cc
+++ b/src/tint/lang/wgsl/resolver/unresolved_identifier_test.cc
@@ -30,7 +30,7 @@
Expr(Source{{12, 34}}, "privte"), // declared_address_space
nullptr, // declared_access
nullptr, // initializer
- utils::Empty // attributes
+ tint::Empty // attributes
));
EXPECT_FALSE(r()->Resolve());
@@ -40,10 +40,8 @@
}
TEST_F(ResolverUnresolvedIdentifierSuggestions, BuiltinValue) {
- Func("f",
- utils::Vector{
- Param("p", ty.i32(), utils::Vector{Builtin(Expr(Source{{12, 34}}, "positon"))})},
- ty.void_(), utils::Empty, utils::Vector{Stage(ast::PipelineStage::kVertex)});
+ Func("f", Vector{Param("p", ty.i32(), Vector{Builtin(Expr(Source{{12, 34}}, "positon"))})},
+ ty.void_(), tint::Empty, Vector{Stage(ast::PipelineStage::kVertex)});
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), R"(12:34 error: unresolved builtin value 'positon'
@@ -66,7 +64,7 @@
Expr("private"), // declared_address_space
Expr(Source{{12, 34}}, "reed"), // declared_access
nullptr, // initializer
- utils::Empty // attributes
+ tint::Empty // attributes
));
EXPECT_FALSE(r()->Resolve());
@@ -76,9 +74,9 @@
}
TEST_F(ResolverUnresolvedIdentifierSuggestions, InterpolationSampling) {
- Structure("s", utils::Vector{
+ Structure("s", Vector{
Member("m", ty.vec4<f32>(),
- utils::Vector{
+ Vector{
Interpolate(builtin::InterpolationType::kLinear,
Expr(Source{{12, 34}}, "centre")),
}),
@@ -91,9 +89,9 @@
}
TEST_F(ResolverUnresolvedIdentifierSuggestions, InterpolationType) {
- Structure("s", utils::Vector{
+ Structure("s", Vector{
Member("m", ty.vec4<f32>(),
- utils::Vector{
+ Vector{
Interpolate(Expr(Source{{12, 34}}, "liner")),
}),
});
diff --git a/src/tint/lang/wgsl/resolver/validation_test.cc b/src/tint/lang/wgsl/resolver/validation_test.cc
index 84c2764..c6c399e 100644
--- a/src/tint/lang/wgsl/resolver/validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/validation_test.cc
@@ -50,13 +50,13 @@
using ResolverValidationTest = ResolverTest;
-class FakeStmt final : public utils::Castable<FakeStmt, ast::Statement> {
+class FakeStmt final : public Castable<FakeStmt, ast::Statement> {
public:
FakeStmt(GenerationID pid, ast::NodeID nid, Source src) : Base(pid, nid, src) {}
FakeStmt* Clone(CloneContext*) const override { return nullptr; }
};
-class FakeExpr final : public utils::Castable<FakeExpr, ast::Expression> {
+class FakeExpr final : public Castable<FakeExpr, ast::Expression> {
public:
FakeExpr(GenerationID pid, ast::NodeID nid, Source src) : Base(pid, nid, src) {}
FakeExpr* Clone(CloneContext*) const override { return nullptr; }
@@ -67,15 +67,15 @@
GlobalVar("dst", ty.vec4<f32>(), builtin::AddressSpace::kPrivate);
auto* stmt = Assign(Expr("dst"), Expr(Source{{3, 4}}, "wg"));
- Func(Source{{9, 10}}, "f0", utils::Empty, ty.vec4<f32>(),
- utils::Vector{
+ Func(Source{{9, 10}}, "f0", tint::Empty, ty.vec4<f32>(),
+ Vector{
stmt,
Return(Expr("dst")),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kVertex),
},
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kPosition),
});
@@ -99,13 +99,13 @@
GlobalVar("dst", ty.vec4<f32>(), builtin::AddressSpace::kPrivate);
auto* stmt = Assign(Expr("dst"), Expr(Source{{3, 4}}, "wg"));
- Func(Source{{5, 6}}, "f2", utils::Empty, ty.void_(), utils::Vector{stmt});
- Func(Source{{7, 8}}, "f1", utils::Empty, ty.void_(),
- utils::Vector{
+ Func(Source{{5, 6}}, "f2", tint::Empty, ty.void_(), Vector{stmt});
+ Func(Source{{7, 8}}, "f1", tint::Empty, ty.void_(),
+ Vector{
CallStmt(Call("f2")),
});
- Func(Source{{9, 10}}, "f0", utils::Empty, ty.void_(), utils::Vector{CallStmt(Call("f1"))},
- utils::Vector{
+ Func(Source{{9, 10}}, "f0", tint::Empty, ty.void_(), Vector{CallStmt(Call("f1"))},
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -195,8 +195,8 @@
GlobalVar("global_var", ty.f32(), builtin::AddressSpace::kPrivate, Expr(2.1_f));
- Func("my_func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("my_func", tint::Empty, ty.void_(),
+ Vector{
Assign(Expr(Source{{12, 34}}, "global_var"), 3.14_f),
Return(),
});
@@ -269,8 +269,8 @@
TEST_F(ResolverValidationTest, AddressSpace_FunctionVariableWorkgroupClass) {
auto* var = Var("var", ty.i32(), builtin::AddressSpace::kWorkgroup);
- Func("func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("func", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
});
@@ -283,8 +283,8 @@
TEST_F(ResolverValidationTest, AddressSpace_FunctionVariableI32) {
auto* var = Var("s", ty.i32(), builtin::AddressSpace::kPrivate);
- Func("func", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("func", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
});
@@ -384,8 +384,8 @@
auto* star_p = Deref(p);
auto* accessor_expr = MemberAccessor(star_p, "z");
auto* x = Var("x", ty.f32(), accessor_expr);
- Func("func", utils::Vector{p}, ty.f32(),
- utils::Vector{
+ Func("func", Vector{p}, ty.f32(),
+ Vector{
Decl(x),
Return(x),
});
@@ -401,8 +401,8 @@
auto* accessor_expr = MemberAccessor(p, Ident(Source{{12, 34}}, "z"));
auto* star_p = Deref(accessor_expr);
auto* x = Var("x", ty.f32(), star_p);
- Func("func", utils::Vector{p}, ty.f32(),
- utils::Vector{
+ Func("func", Vector{p}, ty.f32(),
+ Vector{
Decl(x),
Return(x),
});
@@ -731,10 +731,10 @@
// }
// }
- Func("my_func", utils::Empty, ty.void_(),
- utils::Vector{Loop( // loop
- Block(), // loop block
- Block( // loop continuing block
+ Func("my_func", tint::Empty, ty.void_(),
+ Vector{Loop( // loop
+ Block(), // loop block
+ Block( // loop continuing block
Discard(Source{{12, 34}}), BreakIf(true)))});
EXPECT_TRUE(r()->Resolve()) << r()->error();
@@ -885,9 +885,9 @@
// break;
// }
- Func("my_func", utils::Empty, ty.void_(),
- utils::Vector{For(nullptr, nullptr, Discard(Source{{12, 34}}), //
- Block(Break()))});
+ Func("my_func", tint::Empty, ty.void_(),
+ Vector{For(nullptr, nullptr, Discard(Source{{12, 34}}), //
+ Block(Break()))});
EXPECT_TRUE(r()->Resolve()) << r()->error();
}
@@ -1132,7 +1132,7 @@
}
TEST_F(ResolverValidationTest, StructMemberDuplicateName) {
- Structure("S", utils::Vector{
+ Structure("S", Vector{
Member(Source{{12, 34}}, "a", ty.i32()),
Member(Source{{56, 78}}, "a", ty.i32()),
});
@@ -1142,7 +1142,7 @@
"is here");
}
TEST_F(ResolverValidationTest, StructMemberDuplicateNameDifferentTypes) {
- Structure("S", utils::Vector{
+ Structure("S", Vector{
Member(Source{{12, 34}}, "a", ty.bool_()),
Member(Source{{12, 34}}, "a", ty.vec3<f32>()),
});
@@ -1152,11 +1152,11 @@
"is here");
}
TEST_F(ResolverValidationTest, StructMemberDuplicateNamePass) {
- Structure("S", utils::Vector{
+ Structure("S", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
});
- Structure("S1", utils::Vector{
+ Structure("S1", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
});
@@ -1164,8 +1164,8 @@
}
TEST_F(ResolverValidationTest, NegativeStructMemberAlignAttribute) {
- Structure("S", utils::Vector{
- Member("a", ty.f32(), utils::Vector{MemberAlign(Source{{12, 34}}, -2_i)}),
+ Structure("S", Vector{
+ Member("a", ty.f32(), Vector{MemberAlign(Source{{12, 34}}, -2_i)}),
});
EXPECT_FALSE(r()->Resolve());
@@ -1174,8 +1174,8 @@
}
TEST_F(ResolverValidationTest, NonPOTStructMemberAlignAttribute) {
- Structure("S", utils::Vector{
- Member("a", ty.f32(), utils::Vector{MemberAlign(Source{{12, 34}}, 3_i)}),
+ Structure("S", Vector{
+ Member("a", ty.f32(), Vector{MemberAlign(Source{{12, 34}}, 3_i)}),
});
EXPECT_FALSE(r()->Resolve());
@@ -1184,8 +1184,8 @@
}
TEST_F(ResolverValidationTest, ZeroStructMemberAlignAttribute) {
- Structure("S", utils::Vector{
- Member("a", ty.f32(), utils::Vector{MemberAlign(Source{{12, 34}}, 0_i)}),
+ Structure("S", Vector{
+ Member("a", ty.f32(), Vector{MemberAlign(Source{{12, 34}}, 0_i)}),
});
EXPECT_FALSE(r()->Resolve());
@@ -1194,8 +1194,8 @@
}
TEST_F(ResolverValidationTest, ZeroStructMemberSizeAttribute) {
- Structure("S", utils::Vector{
- Member("a", ty.f32(), utils::Vector{MemberSize(Source{{12, 34}}, 1_a)}),
+ Structure("S", Vector{
+ Member("a", ty.f32(), Vector{MemberSize(Source{{12, 34}}, 1_a)}),
});
EXPECT_FALSE(r()->Resolve());
@@ -1203,9 +1203,9 @@
}
TEST_F(ResolverValidationTest, OffsetAndSizeAttribute) {
- Structure("S", utils::Vector{
+ Structure("S", Vector{
Member(Source{{12, 34}}, "a", ty.f32(),
- utils::Vector{MemberOffset(0_a), MemberSize(4_a)}),
+ Vector{MemberOffset(0_a), MemberSize(4_a)}),
});
EXPECT_FALSE(r()->Resolve());
@@ -1213,9 +1213,9 @@
}
TEST_F(ResolverValidationTest, OffsetAndAlignAttribute) {
- Structure("S", utils::Vector{
+ Structure("S", Vector{
Member(Source{{12, 34}}, "a", ty.f32(),
- utils::Vector{MemberOffset(0_a), MemberAlign(4_i)}),
+ Vector{MemberOffset(0_a), MemberAlign(4_i)}),
});
EXPECT_FALSE(r()->Resolve());
@@ -1223,9 +1223,9 @@
}
TEST_F(ResolverValidationTest, OffsetAndAlignAndSizeAttribute) {
- Structure("S", utils::Vector{
+ Structure("S", Vector{
Member(Source{{12, 34}}, "a", ty.f32(),
- utils::Vector{MemberOffset(0_a), MemberAlign(4_i), MemberSize(4_a)}),
+ Vector{MemberOffset(0_a), MemberAlign(4_i), MemberSize(4_a)}),
});
EXPECT_FALSE(r()->Resolve());
diff --git a/src/tint/lang/wgsl/resolver/validator.cc b/src/tint/lang/wgsl/resolver/validator.cc
index 886c952..1716e50 100644
--- a/src/tint/lang/wgsl/resolver/validator.cc
+++ b/src/tint/lang/wgsl/resolver/validator.cc
@@ -147,12 +147,11 @@
} // namespace
-Validator::Validator(
- ProgramBuilder* builder,
- SemHelper& sem,
- const builtin::Extensions& enabled_extensions,
- const utils::Hashmap<const type::Type*, const Source*, 8>& atomic_composite_info,
- utils::Hashset<TypeAndAddressSpace, 8>& valid_type_storage_layouts)
+Validator::Validator(ProgramBuilder* builder,
+ SemHelper& sem,
+ const builtin::Extensions& enabled_extensions,
+ const Hashmap<const type::Type*, const Source*, 8>& atomic_composite_info,
+ Hashset<TypeAndAddressSpace, 8>& valid_type_storage_layouts)
: symbols_(builder->Symbols()),
diagnostics_(builder->Diagnostics()),
sem_(sem),
@@ -306,7 +305,7 @@
}
}
- return CheckTypeAccessAddressSpace(s->StoreType(), s->Access(), s->AddressSpace(), utils::Empty,
+ return CheckTypeAccessAddressSpace(s->StoreType(), s->Access(), s->AddressSpace(), tint::Empty,
a->source);
}
@@ -381,7 +380,7 @@
// Value type has to match storage type
if (storage_ty != value_type) {
- utils::StringStream s;
+ StringStream s;
s << "cannot initialize " << v->Kind() << " of type '" << sem_.TypeNameOf(storage_ty)
<< "' with value of type '" << sem_.TypeNameOf(initializer_ty) << "'";
AddError(s.str(), v->source);
@@ -409,7 +408,7 @@
uint32_t actual_align = ty->Align();
uint32_t required_align = actual_align;
if (is_uniform_struct_or_array(ty)) {
- required_align = utils::RoundUp(16u, actual_align);
+ required_align = tint::RoundUp(16u, actual_align);
}
return required_align;
};
@@ -427,7 +426,7 @@
auto note_usage = [&] {
AddNote("'" + store_ty->FriendlyName() + "' used in address space '" +
- utils::ToString(address_space) + "' here",
+ tint::ToString(address_space) + "' here",
source);
};
@@ -457,7 +456,7 @@
builtin::Extension::kChromiumInternalRelaxedUniformLayout)) {
AddError("the offset of a struct member of type '" +
m->Type()->UnwrapRef()->FriendlyName() + "' in address space '" +
- utils::ToString(address_space) + "' must be a multiple of " +
+ tint::ToString(address_space) + "' must be a multiple of " +
std::to_string(required_align) + " bytes, but '" + member_name_of(m) +
"' is currently at offset " + std::to_string(m->Offset()) +
". Consider setting @align(" + std::to_string(required_align) +
@@ -581,7 +580,7 @@
bool Validator::GlobalVariable(
const sem::GlobalVariable* global,
- const utils::Hashmap<OverrideId, const sem::Variable*, 8>& override_ids) const {
+ const Hashmap<OverrideId, const sem::Variable*, 8>& override_ids) const {
auto* decl = global->Declaration();
if (global->AddressSpace() != builtin::AddressSpace::kWorkgroup &&
IsArrayWithOverrideCount(global->Type())) {
@@ -695,7 +694,7 @@
// https://gpuweb.github.io/gpuweb/wgsl/#var-and-let
// Optionally has an initializer expression, if the variable is in the private or
// function address spaces.
- AddError("var of address space '" + utils::ToString(v->AddressSpace()) +
+ AddError("var of address space '" + tint::ToString(v->AddressSpace()) +
"' cannot have an initializer. var initializers are only supported "
"for the address spaces 'private' and 'function'",
var->source);
@@ -729,9 +728,8 @@
return true;
}
-bool Validator::Override(
- const sem::GlobalVariable* v,
- const utils::Hashmap<OverrideId, const sem::Variable*, 8>& override_ids) const {
+bool Validator::Override(const sem::GlobalVariable* v,
+ const Hashmap<OverrideId, const sem::Variable*, 8>& override_ids) const {
auto* decl = v->Declaration();
auto* storage_ty = v->Type()->UnwrapRef();
@@ -795,7 +793,7 @@
break;
}
if (!ok) {
- utils::StringStream ss;
+ StringStream ss;
ss << "function parameter of pointer type cannot be in '" << sc
<< "' address space";
AddError(ss.str(), decl->source);
@@ -823,7 +821,7 @@
ast::PipelineStage stage,
const bool is_input) const {
auto* type = storage_ty->UnwrapRef();
- utils::StringStream stage_name;
+ StringStream stage_name;
stage_name << stage;
bool is_stage_mismatch = false;
bool is_output = !is_input;
@@ -836,7 +834,7 @@
is_stage_mismatch = true;
}
if (!(type->is_float_vector() && type->As<type::Vector>()->Width() == 4)) {
- utils::StringStream err;
+ StringStream err;
err << "store type of @builtin(" << builtin << ") must be 'vec4<f32>'";
AddError(err.str(), attr->source);
return false;
@@ -851,7 +849,7 @@
is_stage_mismatch = true;
}
if (!(type->is_unsigned_integer_vector() && type->As<type::Vector>()->Width() == 3)) {
- utils::StringStream err;
+ StringStream err;
err << "store type of @builtin(" << builtin << ") must be 'vec3<u32>'";
AddError(err.str(), attr->source);
return false;
@@ -863,7 +861,7 @@
is_stage_mismatch = true;
}
if (!type->Is<type::F32>()) {
- utils::StringStream err;
+ StringStream err;
err << "store type of @builtin(" << builtin << ") must be 'f32'";
AddError(err.str(), attr->source);
return false;
@@ -875,7 +873,7 @@
is_stage_mismatch = true;
}
if (!type->Is<type::Bool>()) {
- utils::StringStream err;
+ StringStream err;
err << "store type of @builtin(" << builtin << ") must be 'bool'";
AddError(err.str(), attr->source);
return false;
@@ -887,7 +885,7 @@
is_stage_mismatch = true;
}
if (!type->Is<type::U32>()) {
- utils::StringStream err;
+ StringStream err;
err << "store type of @builtin(" << builtin << ") must be 'u32'";
AddError(err.str(), attr->source);
return false;
@@ -900,7 +898,7 @@
is_stage_mismatch = true;
}
if (!type->Is<type::U32>()) {
- utils::StringStream err;
+ StringStream err;
err << "store type of @builtin(" << builtin << ") must be 'u32'";
AddError(err.str(), attr->source);
return false;
@@ -911,7 +909,7 @@
is_stage_mismatch = true;
}
if (!type->Is<type::U32>()) {
- utils::StringStream err;
+ StringStream err;
err << "store type of @builtin(" << builtin << ") must be 'u32'";
AddError(err.str(), attr->source);
return false;
@@ -923,7 +921,7 @@
is_stage_mismatch = true;
}
if (!type->Is<type::U32>()) {
- utils::StringStream err;
+ StringStream err;
err << "store type of @builtin(" << builtin << ") must be 'u32'";
AddError(err.str(), attr->source);
return false;
@@ -934,7 +932,7 @@
}
if (is_stage_mismatch) {
- utils::StringStream err;
+ StringStream err;
err << "@builtin(" << builtin << ") cannot be used in "
<< (is_input ? "input of " : "output of ") << stage_name.str() << " pipeline stage";
AddError(err.str(), attr->source);
@@ -1051,15 +1049,15 @@
// order to catch conflicts.
// TODO(jrprice): This state could be stored in sem::Function instead, and then passed to
// sem::Function since it would be useful there too.
- utils::Hashset<builtin::BuiltinValue, 4> builtins;
- utils::Hashset<std::pair<uint32_t, uint32_t>, 8> locationsAndIndexes;
+ Hashset<builtin::BuiltinValue, 4> builtins;
+ Hashset<std::pair<uint32_t, uint32_t>, 8> locationsAndIndexes;
enum class ParamOrRetType {
kParameter,
kReturnType,
};
// Inner lambda that is applied to a type and all of its members.
- auto validate_entry_point_attributes_inner = [&](utils::VectorRef<const ast::Attribute*> attrs,
+ auto validate_entry_point_attributes_inner = [&](VectorRef<const ast::Attribute*> attrs,
const type::Type* ty, Source source,
ParamOrRetType param_or_ret,
bool is_struct_member,
@@ -1087,7 +1085,7 @@
pipeline_io_attribute = attr;
if (builtins.Contains(builtin)) {
- utils::StringStream err;
+ StringStream err;
err << "@builtin(" << builtin << ") appears multiple times as pipeline "
<< (param_or_ret == ParamOrRetType::kParameter ? "input" : "output");
AddError(err.str(), decl->source);
@@ -1206,7 +1204,7 @@
std::pair<uint32_t, uint32_t> locationAndIndex(location.value(), idx);
if (!locationsAndIndexes.Add(locationAndIndex)) {
- utils::StringStream err;
+ StringStream err;
if (!index_attribute) {
err << "@location(" << location.value() << ") appears multiple times";
} else {
@@ -1246,7 +1244,7 @@
};
// Outer lambda for validating the entry point attributes for a type.
- auto validate_entry_point_attributes = [&](utils::VectorRef<const ast::Attribute*> attrs,
+ auto validate_entry_point_attributes = [&](VectorRef<const ast::Attribute*> attrs,
const type::Type* ty, Source source,
ParamOrRetType param_or_ret,
std::optional<uint32_t> location,
@@ -1325,7 +1323,7 @@
}
// Validate there are no resource variable binding collisions
- utils::Hashmap<BindingPoint, const ast::Variable*, 8> binding_points;
+ Hashmap<BindingPoint, const ast::Variable*, 8> binding_points;
for (auto* global : func->TransitivelyReferencedGlobals()) {
auto* var_decl = global->Declaration()->As<ast::Var>();
if (!var_decl) {
@@ -1396,7 +1394,7 @@
return true;
}
-bool Validator::Statements(utils::VectorRef<const ast::Statement*> stmts) const {
+bool Validator::Statements(VectorRef<const ast::Statement*> stmts) const {
for (auto* stmt : stmts) {
if (!sem_.Get(stmt)->IsReachable()) {
if (!AddDiagnostic(builtin::ChromiumDiagnosticRule::kUnreachableCode,
@@ -1485,7 +1483,7 @@
sem_.NoteDeclarationSource(fn->Declaration());
},
[&](const sem::Builtin* b) {
- AddError("ignoring return value of builtin '" + utils::ToString(b->Type()) + "'",
+ AddError("ignoring return value of builtin '" + tint::ToString(b->Type()) + "'",
call->Declaration()->source);
},
[&](const sem::ValueConversion*) {
@@ -1599,7 +1597,7 @@
// If the called function does not return a value, a function call statement should be
// used instead.
auto* builtin = call->Target()->As<sem::Builtin>();
- auto name = utils::ToString(builtin->Type());
+ auto name = tint::ToString(builtin->Type());
AddError("builtin '" + name + "' does not return a value", call->Declaration()->source);
return false;
}
@@ -1694,7 +1692,7 @@
if (!enabled_extensions_.Contains(extension)) {
AddError("cannot call built-in function '" + std::string(builtin->str()) +
- "' without extension " + utils::ToString(extension),
+ "' without extension " + tint::ToString(extension),
call->Declaration()->source);
return false;
}
@@ -1898,7 +1896,7 @@
return true;
}
-bool Validator::PipelineStages(utils::VectorRef<sem::Function*> entry_points) const {
+bool Validator::PipelineStages(VectorRef<sem::Function*> entry_points) const {
auto backtrace = [&](const sem::Function* func, const sem::Function* entry_point) {
if (func != entry_point) {
TraverseCallChain(diagnostics_, entry_point, func, [&](const sem::Function* f) {
@@ -1917,7 +1915,7 @@
if (stage != ast::PipelineStage::kCompute) {
for (auto* var : func->DirectlyReferencedGlobals()) {
if (var->AddressSpace() == builtin::AddressSpace::kWorkgroup) {
- utils::StringStream stage_name;
+ StringStream stage_name;
stage_name << stage;
for (auto* user : var->Users()) {
if (func == user->Stmt()->Function()) {
@@ -1941,7 +1939,7 @@
for (auto* builtin : func->DirectlyCalledBuiltins()) {
if (!builtin->SupportedStages().Contains(stage)) {
auto* call = func->FindDirectCallTo(builtin);
- utils::StringStream err;
+ StringStream err;
err << "built-in cannot be used by " << stage << " pipeline stage";
AddError(err.str(),
call ? call->Declaration()->source : func->Declaration()->source);
@@ -1955,7 +1953,7 @@
auto check_no_discards = [&](const sem::Function* func, const sem::Function* entry_point) {
if (auto* discard = func->DiscardStatement()) {
auto stage = entry_point->Declaration()->PipelineStage();
- utils::StringStream err;
+ StringStream err;
err << "discard statement cannot be used in " << stage << " pipeline stage";
AddError(err.str(), discard->Declaration()->source);
backtrace(func, entry_point);
@@ -1993,7 +1991,7 @@
return true;
}
-bool Validator::PushConstants(utils::VectorRef<sem::Function*> entry_points) const {
+bool Validator::PushConstants(VectorRef<sem::Function*> entry_points) const {
for (auto* entry_point : entry_points) {
// State checked and modified by check_push_constant so that it remembers previously seen
// push_constant variables for an entry-point.
@@ -2111,7 +2109,7 @@
return false;
}
- utils::Hashset<std::pair<uint32_t, uint32_t>, 8> locationsAndIndexes;
+ Hashset<std::pair<uint32_t, uint32_t>, 8> locationsAndIndexes;
for (auto* member : str->Members()) {
if (auto* r = member->Type()->As<type::Array>()) {
if (r->Count()->Is<type::RuntimeArrayCount>()) {
@@ -2230,7 +2228,7 @@
uint32_t location = member->Attributes().location.value();
std::pair<uint32_t, uint32_t> locationAndIndex(location, index);
if (!locationsAndIndexes.Add(locationAndIndex)) {
- utils::StringStream err;
+ StringStream err;
if (!index_attribute) {
err << "@location(" << location << ") appears multiple times";
AddError(err.str(), location_attribute->source);
@@ -2337,7 +2335,7 @@
}
const sem::CaseSelector* default_selector = nullptr;
- utils::Hashmap<int64_t, Source, 4> selectors;
+ Hashmap<int64_t, Source, 4> selectors;
for (auto* case_stmt : s->body) {
auto* case_sem = sem_.Get<sem::CaseStatement>(case_stmt);
@@ -2521,9 +2519,9 @@
return true;
}
-bool Validator::NoDuplicateAttributes(utils::VectorRef<const ast::Attribute*> attributes) const {
- utils::Hashmap<const utils::TypeInfo*, Source, 8> seen;
- utils::Vector<const ast::DiagnosticControl*, 8> diagnostic_controls;
+bool Validator::NoDuplicateAttributes(VectorRef<const ast::Attribute*> attributes) const {
+ Hashmap<const tint::TypeInfo*, Source, 8> seen;
+ tint::Vector<const ast::DiagnosticControl*, 8> diagnostic_controls;
for (auto* d : attributes) {
if (auto* diag = d->As<ast::DiagnosticAttribute>()) {
// Allow duplicate diagnostic attributes, and check for conflicts later.
@@ -2540,11 +2538,11 @@
return DiagnosticControls(diagnostic_controls, "attribute");
}
-bool Validator::DiagnosticControls(utils::VectorRef<const ast::DiagnosticControl*> controls,
+bool Validator::DiagnosticControls(VectorRef<const ast::DiagnosticControl*> controls,
const char* use) const {
// Make sure that no two diagnostic controls conflict.
// They conflict if the rule name is the same and the severity is different.
- utils::Hashmap<std::pair<Symbol, Symbol>, const ast::DiagnosticControl*, 8> diagnostics;
+ Hashmap<std::pair<Symbol, Symbol>, const ast::DiagnosticControl*, 8> diagnostics;
for (auto* dc : controls) {
auto category = dc->rule_name->category ? dc->rule_name->category->symbol : Symbol();
auto name = dc->rule_name->name->symbol;
@@ -2552,12 +2550,12 @@
auto diag_added = diagnostics.Add(std::make_pair(category, name), dc);
if (!diag_added && (*diag_added.value)->severity != dc->severity) {
{
- utils::StringStream ss;
+ StringStream ss;
ss << "conflicting diagnostic " << use;
AddError(ss.str(), dc->rule_name->source);
}
{
- utils::StringStream ss;
+ StringStream ss;
ss << "severity of '" << dc->rule_name->String() << "' set to '" << dc->severity
<< "' here";
AddNote(ss.str(), (*diag_added.value)->rule_name->source);
@@ -2568,7 +2566,7 @@
return true;
}
-bool Validator::IsValidationDisabled(utils::VectorRef<const ast::Attribute*> attributes,
+bool Validator::IsValidationDisabled(VectorRef<const ast::Attribute*> attributes,
ast::DisabledValidation validation) const {
for (auto* attribute : attributes) {
if (auto* dv = attribute->As<ast::DisableValidationAttribute>()) {
@@ -2580,7 +2578,7 @@
return false;
}
-bool Validator::IsValidationEnabled(utils::VectorRef<const ast::Attribute*> attributes,
+bool Validator::IsValidationEnabled(VectorRef<const ast::Attribute*> attributes,
ast::DisabledValidation validation) const {
return !IsValidationDisabled(attributes, validation);
}
@@ -2606,12 +2604,11 @@
return vec_type.FriendlyName();
}
-bool Validator::CheckTypeAccessAddressSpace(
- const type::Type* store_ty,
- builtin::Access access,
- builtin::AddressSpace address_space,
- utils::VectorRef<const tint::ast::Attribute*> attributes,
- const Source& source) const {
+bool Validator::CheckTypeAccessAddressSpace(const type::Type* store_ty,
+ builtin::Access access,
+ builtin::AddressSpace address_space,
+ VectorRef<const tint::ast::Attribute*> attributes,
+ const Source& source) const {
if (!AddressSpaceLayout(store_ty, address_space, source)) {
return false;
}
diff --git a/src/tint/lang/wgsl/resolver/validator.h b/src/tint/lang/wgsl/resolver/validator.h
index ba4bf44..187c88f 100644
--- a/src/tint/lang/wgsl/resolver/validator.h
+++ b/src/tint/lang/wgsl/resolver/validator.h
@@ -102,8 +102,8 @@
Validator(ProgramBuilder* builder,
SemHelper& helper,
const builtin::Extensions& enabled_extensions,
- const utils::Hashmap<const type::Type*, const Source*, 8>& atomic_composite_info,
- utils::Hashset<TypeAndAddressSpace, 8>& valid_type_storage_layouts);
+ const Hashmap<const type::Type*, const Source*, 8>& atomic_composite_info,
+ Hashset<TypeAndAddressSpace, 8>& valid_type_storage_layouts);
~Validator();
/// Adds the given error message to the diagnostics
@@ -152,12 +152,12 @@
/// Validates pipeline stages
/// @param entry_points the entry points to the module
/// @returns true on success, false otherwise.
- bool PipelineStages(utils::VectorRef<sem::Function*> entry_points) const;
+ bool PipelineStages(VectorRef<sem::Function*> entry_points) const;
/// Validates push_constant variables
/// @param entry_points the entry points to the module
/// @returns true on success, false otherwise.
- bool PushConstants(utils::VectorRef<sem::Function*> entry_points) const;
+ bool PushConstants(VectorRef<sem::Function*> entry_points) const;
/// Validates aliases
/// @param alias the alias to validate
@@ -274,9 +274,8 @@
/// @param var the global variable to validate
/// @param override_id the set of override ids in the module
/// @returns true on success, false otherwise
- bool GlobalVariable(
- const sem::GlobalVariable* var,
- const utils::Hashmap<OverrideId, const sem::Variable*, 8>& override_id) const;
+ bool GlobalVariable(const sem::GlobalVariable* var,
+ const Hashmap<OverrideId, const sem::Variable*, 8>& override_id) const;
/// Validates a break-if statement
/// @param stmt the statement to validate
@@ -368,7 +367,7 @@
/// Validates a list of statements
/// @param stmts the statements to validate
/// @returns true on success, false otherwise
- bool Statements(utils::VectorRef<const ast::Statement*> stmts) const;
+ bool Statements(VectorRef<const ast::Statement*> stmts) const;
/// Validates a storage texture
/// @param t the texture to validate
@@ -421,7 +420,7 @@
/// @param override_id the set of override ids in the module
/// @returns true on success, false otherwise.
bool Override(const sem::GlobalVariable* v,
- const utils::Hashmap<OverrideId, const sem::Variable*, 8>& override_id) const;
+ const Hashmap<OverrideId, const sem::Variable*, 8>& override_id) const;
/// Validates a 'const' variable declaration
/// @param v the variable to validate
@@ -472,13 +471,13 @@
/// Validates there are no duplicate attributes
/// @param attributes the list of attributes to validate
/// @returns true on success, false otherwise.
- bool NoDuplicateAttributes(utils::VectorRef<const ast::Attribute*> attributes) const;
+ bool NoDuplicateAttributes(VectorRef<const ast::Attribute*> attributes) const;
/// Validates a set of diagnostic controls.
/// @param controls the diagnostic controls to validate
/// @param use the place where the controls are being used ("directive" or "attribute")
/// @returns true on success, false otherwise.
- bool DiagnosticControls(utils::VectorRef<const ast::DiagnosticControl*> controls,
+ bool DiagnosticControls(VectorRef<const ast::DiagnosticControl*> controls,
const char* use) const;
/// Validates a address space layout
@@ -493,7 +492,7 @@
/// `validation`
/// @param attributes the attribute list to check
/// @param validation the validation mode to check
- bool IsValidationDisabled(utils::VectorRef<const ast::Attribute*> attributes,
+ bool IsValidationDisabled(VectorRef<const ast::Attribute*> attributes,
ast::DisabledValidation validation) const;
/// @returns true if the attribute list does not contains a
@@ -501,7 +500,7 @@
/// `validation`
/// @param attributes the attribute list to check
/// @param validation the validation mode to check
- bool IsValidationEnabled(utils::VectorRef<const ast::Attribute*> attributes,
+ bool IsValidationEnabled(VectorRef<const ast::Attribute*> attributes,
ast::DisabledValidation validation) const;
private:
@@ -542,15 +541,15 @@
bool CheckTypeAccessAddressSpace(const type::Type* store_ty,
builtin::Access access,
builtin::AddressSpace address_space,
- utils::VectorRef<const tint::ast::Attribute*> attributes,
+ VectorRef<const tint::ast::Attribute*> attributes,
const Source& source) const;
SymbolTable& symbols_;
diag::List& diagnostics_;
SemHelper& sem_;
DiagnosticFilterStack diagnostic_filters_;
const builtin::Extensions& enabled_extensions_;
- const utils::Hashmap<const type::Type*, const Source*, 8>& atomic_composite_info_;
- utils::Hashset<TypeAndAddressSpace, 8>& valid_type_storage_layouts_;
+ const Hashmap<const type::Type*, const Source*, 8>& atomic_composite_info_;
+ Hashset<TypeAndAddressSpace, 8>& valid_type_storage_layouts_;
};
} // namespace tint::resolver
@@ -564,7 +563,7 @@
/// @param tas the TypeAndAddressSpace
/// @return the hash value
inline std::size_t operator()(const tint::resolver::TypeAndAddressSpace& tas) const {
- return tint::utils::Hash(tas.type, tas.address_space);
+ return Hash(tas.type, tas.address_space);
}
};
diff --git a/src/tint/lang/wgsl/resolver/value_constructor_validation_test.cc b/src/tint/lang/wgsl/resolver/value_constructor_validation_test.cc
index b0ec809..3399e77 100644
--- a/src/tint/lang/wgsl/resolver/value_constructor_validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/value_constructor_validation_test.cc
@@ -184,8 +184,8 @@
Enable(builtin::Extension::kF16);
- Func("foo", utils::Empty, params.create_rhs_ast_type(*this),
- utils::Vector{Return(Call(params.create_rhs_ast_type(*this)))}, {});
+ Func("foo", tint::Empty, params.create_rhs_ast_type(*this),
+ Vector{Return(Call(params.create_rhs_ast_type(*this)))}, {});
auto* a = Var("a", Call("foo"));
// Self-assign 'a' to force the expression to be resolved so we can test its
@@ -348,7 +348,7 @@
auto rhs_type = params.rhs_type(*this);
auto* rhs_value_expr = params.rhs_value_expr(*this, 0);
- utils::StringStream ss;
+ StringStream ss;
ss << FriendlyName(lhs_type1) << " = " << FriendlyName(lhs_type2) << "("
<< FriendlyName(rhs_type) << "(<rhs value expr>))";
SCOPED_TRACE(ss.str());
@@ -441,7 +441,7 @@
auto rhs_type = rhs_params.ast(*this);
auto* rhs_value_expr = rhs_params.expr_from_double(*this, 0);
- utils::StringStream ss;
+ StringStream ss;
ss << FriendlyName(lhs_type1) << " = " << FriendlyName(lhs_type2) << "("
<< FriendlyName(rhs_type) << "(<rhs value expr>))";
SCOPED_TRACE(ss.str());
@@ -2427,8 +2427,8 @@
Enable(builtin::Extension::kF16);
const std::string element_type_name = param.get_element_type_name();
- utils::StringStream args_tys;
- utils::Vector<const ast::Expression*, 8> args;
+ StringStream args_tys;
+ Vector<const ast::Expression*, 8> args;
for (uint32_t i = 0; i < param.columns - 1; i++) {
ast::Type vec_type = param.create_column_ast_type(*this);
args.Push(Call(vec_type));
@@ -2456,8 +2456,8 @@
Enable(builtin::Extension::kF16);
const std::string element_type_name = param.get_element_type_name();
- utils::StringStream args_tys;
- utils::Vector<const ast::Expression*, 8> args;
+ StringStream args_tys;
+ Vector<const ast::Expression*, 8> args;
for (uint32_t i = 0; i < param.columns * param.rows - 1; i++) {
args.Push(Call(param.create_element_ast_type(*this)));
if (i > 0) {
@@ -2484,8 +2484,8 @@
Enable(builtin::Extension::kF16);
const std::string element_type_name = param.get_element_type_name();
- utils::StringStream args_tys;
- utils::Vector<const ast::Expression*, 8> args;
+ StringStream args_tys;
+ Vector<const ast::Expression*, 8> args;
for (uint32_t i = 0; i < param.columns + 1; i++) {
ast::Type vec_type = param.create_column_ast_type(*this);
args.Push(Call(vec_type));
@@ -2513,8 +2513,8 @@
Enable(builtin::Extension::kF16);
const std::string element_type_name = param.get_element_type_name();
- utils::StringStream args_tys;
- utils::Vector<const ast::Expression*, 8> args;
+ StringStream args_tys;
+ Vector<const ast::Expression*, 8> args;
for (uint32_t i = 0; i < param.columns * param.rows + 1; i++) {
args.Push(Call(param.create_element_ast_type(*this)));
if (i > 0) {
@@ -2540,8 +2540,8 @@
Enable(builtin::Extension::kF16);
- utils::StringStream args_tys;
- utils::Vector<const ast::Expression*, 8> args;
+ StringStream args_tys;
+ Vector<const ast::Expression*, 8> args;
for (uint32_t i = 0; i < param.columns; i++) {
auto vec_type = ty.vec<u32>(param.rows);
args.Push(Call(vec_type));
@@ -2568,8 +2568,8 @@
Enable(builtin::Extension::kF16);
- utils::StringStream args_tys;
- utils::Vector<const ast::Expression*, 8> args;
+ StringStream args_tys;
+ Vector<const ast::Expression*, 8> args;
for (uint32_t i = 0; i < param.columns; i++) {
args.Push(Expr(1_u));
if (i > 0) {
@@ -2601,8 +2601,8 @@
Enable(builtin::Extension::kF16);
const std::string element_type_name = param.get_element_type_name();
- utils::StringStream args_tys;
- utils::Vector<const ast::Expression*, 8> args;
+ StringStream args_tys;
+ Vector<const ast::Expression*, 8> args;
for (uint32_t i = 0; i < param.columns; i++) {
ast::Type valid_vec_type = param.create_column_ast_type(*this);
args.Push(Call(valid_vec_type));
@@ -2639,8 +2639,8 @@
Enable(builtin::Extension::kF16);
const std::string element_type_name = param.get_element_type_name();
- utils::StringStream args_tys;
- utils::Vector<const ast::Expression*, 8> args;
+ StringStream args_tys;
+ Vector<const ast::Expression*, 8> args;
for (uint32_t i = 0; i < param.columns; i++) {
ast::Type valid_vec_type = param.create_column_ast_type(*this);
args.Push(Call(valid_vec_type));
@@ -2685,7 +2685,7 @@
Enable(builtin::Extension::kF16);
- utils::Vector<const ast::Expression*, 4> args;
+ Vector<const ast::Expression*, 4> args;
for (uint32_t i = 0; i < param.columns; i++) {
ast::Type vec_type = param.create_column_ast_type(*this);
args.Push(Call(vec_type));
@@ -2706,7 +2706,7 @@
Enable(builtin::Extension::kF16);
- utils::Vector<const ast::Expression*, 16> args;
+ Vector<const ast::Expression*, 16> args;
for (uint32_t i = 0; i < param.columns * param.rows; i++) {
args.Push(Call(param.create_element_ast_type(*this)));
}
@@ -2728,8 +2728,8 @@
auto* elem_type_alias = Alias("ElemType", param.create_element_ast_type(*this));
- utils::StringStream args_tys;
- utils::Vector<const ast::Expression*, 4> args;
+ StringStream args_tys;
+ Vector<const ast::Expression*, 4> args;
for (uint32_t i = 0; i < param.columns; i++) {
auto vec_type = ty.vec(ty.u32(), param.rows);
args.Push(Call(vec_type));
@@ -2758,7 +2758,7 @@
auto* elem_type_alias = Alias("ElemType", param.create_element_ast_type(*this));
- utils::Vector<const ast::Expression*, 8> args;
+ Vector<const ast::Expression*, 8> args;
for (uint32_t i = 0; i < param.columns; i++) {
ast::Type vec_type = param.create_column_ast_type(*this);
args.Push(Call(vec_type));
@@ -2791,7 +2791,7 @@
ast::Type vec_type = param.create_column_ast_type(*this);
auto* vec_alias = Alias("ColVectorAlias", vec_type);
- utils::Vector<const ast::Expression*, 4> args;
+ Vector<const ast::Expression*, 4> args;
for (uint32_t i = 0; i < param.columns; i++) {
args.Push(Call(ty.Of(vec_alias)));
}
@@ -2810,8 +2810,8 @@
ast::Type matrix_type = param.create_mat_ast_type(*this);
auto* u32_type_alias = Alias("UnsignedInt", ty.u32());
- utils::StringStream args_tys;
- utils::Vector<const ast::Expression*, 4> args;
+ StringStream args_tys;
+ Vector<const ast::Expression*, 4> args;
for (uint32_t i = 0; i < param.columns; i++) {
auto vec_type = ty.vec(ty.Of(u32_type_alias), param.rows);
args.Push(Call(vec_type));
@@ -2836,7 +2836,7 @@
auto* elem_type_alias = Alias("ElemType", param.create_element_ast_type(*this));
- utils::Vector<const ast::Expression*, 4> args;
+ Vector<const ast::Expression*, 4> args;
for (uint32_t i = 0; i < param.columns; i++) {
auto vec_type = ty.vec(ty.Of(elem_type_alias), param.rows);
args.Push(Call(vec_type));
@@ -2854,7 +2854,7 @@
Enable(builtin::Extension::kF16);
- utils::Vector<const ast::Expression*, 8> args;
+ Vector<const ast::Expression*, 8> args;
for (uint32_t i = 0; i < param.columns; i++) {
args.Push(Call(param.create_column_ast_type(*this)));
}
@@ -2871,7 +2871,7 @@
Enable(builtin::Extension::kF16);
- utils::Vector<const ast::Expression*, 8> args;
+ Vector<const ast::Expression*, 8> args;
for (uint32_t i = 0; i < param.rows * param.columns; i++) {
args.Push(param.create_element_ast_value(*this, static_cast<double>(i)));
}
@@ -2887,11 +2887,11 @@
Enable(builtin::Extension::kF16);
- utils::StringStream err;
+ StringStream err;
err << "12:34 error: no matching constructor for mat" << param.columns << "x" << param.rows
<< "(";
- utils::Vector<const ast::Expression*, 8> args;
+ Vector<const ast::Expression*, 8> args;
for (uint32_t i = 0; i < param.columns; i++) {
if (i > 0) {
err << ", ";
@@ -2918,11 +2918,11 @@
Enable(builtin::Extension::kF16);
- utils::StringStream err;
+ StringStream err;
err << "12:34 error: no matching constructor for mat" << param.columns << "x" << param.rows
<< "(";
- utils::Vector<const ast::Expression*, 16> args;
+ Vector<const ast::Expression*, 16> args;
for (uint32_t i = 0; i < param.rows * param.columns; i++) {
if (i > 0) {
err << ", ";
@@ -3002,8 +3002,8 @@
Enable(builtin::Extension::kF16);
- utils::Vector<const ast::StructMember*, 16> members;
- utils::Vector<const ast::Expression*, 16> values;
+ Vector<const ast::StructMember*, 16> members;
+ Vector<const ast::Expression*, 16> values;
for (uint32_t i = 0; i < N; i++) {
ast::Type struct_type = str_params.ast(*this);
members.Push(Member("member_" + std::to_string(i), struct_type));
@@ -3027,8 +3027,8 @@
Enable(builtin::Extension::kF16);
- utils::Vector<const ast::StructMember*, 16> members;
- utils::Vector<const ast::Expression*, 8> values;
+ Vector<const ast::StructMember*, 16> members;
+ Vector<const ast::Expression*, 8> values;
for (uint32_t i = 0; i < N + 1; i++) {
if (i < N) {
ast::Type struct_type = str_params.ast(*this);
@@ -3064,8 +3064,8 @@
return;
}
- utils::Vector<const ast::StructMember*, 16> members;
- utils::Vector<const ast::Expression*, 8> values;
+ Vector<const ast::StructMember*, 16> members;
+ Vector<const ast::Expression*, 8> values;
// make the last value of the constructor to have a different type
uint32_t constructor_value_with_different_type = N - 1;
for (uint32_t i = 0; i < N; i++) {
@@ -3080,7 +3080,7 @@
auto* tc = Call(ty.Of(s), values);
WrapInFunction(tc);
- utils::StringStream err;
+ StringStream err;
err << "error: type in structure constructor does not match struct member ";
err << "type: expected '" << str_params.name() << "', found '" << ctor_params.name() << "'";
EXPECT_FALSE(r()->Resolve());
@@ -3095,12 +3095,12 @@
TEST_F(ResolverValueConstructorValidationTest, Struct_Nested) {
auto* inner_m = Member("m", ty.i32());
- auto* inner_s = Structure("inner_s", utils::Vector{inner_m});
+ auto* inner_s = Structure("inner_s", Vector{inner_m});
auto* m0 = Member("m0", ty.i32());
auto* m1 = Member("m1", ty.Of(inner_s));
auto* m2 = Member("m2", ty.i32());
- auto* s = Structure("s", utils::Vector{m0, m1, m2});
+ auto* s = Structure("s", Vector{m0, m1, m2});
auto* tc = Call(Source{{12, 34}}, ty.Of(s), 1_i, 1_i, 1_i);
WrapInFunction(tc);
@@ -3112,14 +3112,14 @@
TEST_F(ResolverValueConstructorValidationTest, Struct) {
auto* m = Member("m", ty.i32());
- auto* s = Structure("MyInputs", utils::Vector{m});
+ auto* s = Structure("MyInputs", Vector{m});
auto* tc = Call(Source{{12, 34}}, ty.Of(s));
WrapInFunction(tc);
ASSERT_TRUE(r()->Resolve()) << r()->error();
}
TEST_F(ResolverValueConstructorValidationTest, Struct_Empty) {
- auto* str = Structure("S", utils::Vector{
+ auto* str = Structure("S", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
Member("c", ty.vec3<i32>()),
@@ -3145,7 +3145,7 @@
}
TEST_F(ResolverValueConstructorValidationTest, NonConstructibleType_AtomicStructMember) {
- auto* str = Structure("S", utils::Vector{Member("a", ty.atomic(ty.i32()))});
+ auto* str = Structure("S", Vector{Member("a", ty.atomic(ty.i32()))});
WrapInFunction(Assign(Phony(), Call(Source{{12, 34}}, ty.Of(str))));
EXPECT_FALSE(r()->Resolve());
@@ -3168,7 +3168,7 @@
}
TEST_F(ResolverValueConstructorValidationTest, StructConstructorAsStatement) {
- Structure("S", utils::Vector{Member("m", ty.i32())});
+ Structure("S", Vector{Member("m", ty.i32())});
WrapInFunction(CallStmt(Call(Source{{12, 34}}, "S", 1_a)));
EXPECT_FALSE(r()->Resolve());
diff --git a/src/tint/lang/wgsl/resolver/variable_test.cc b/src/tint/lang/wgsl/resolver/variable_test.cc
index a567a9a..bfac51b 100644
--- a/src/tint/lang/wgsl/resolver/variable_test.cc
+++ b/src/tint/lang/wgsl/resolver/variable_test.cc
@@ -44,7 +44,7 @@
Enable(builtin::Extension::kF16);
- auto* S = Structure("S", utils::Vector{Member("i", ty.i32())});
+ auto* S = Structure("S", Vector{Member("i", ty.i32())});
auto* A = Alias("A", ty.Of(S));
auto* i = Var("i", ty.i32());
@@ -55,8 +55,8 @@
auto* s = Var("s", ty.Of(S));
auto* a = Var("a", ty.Of(A));
- Func("F", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("F", tint::Empty, ty.void_(),
+ Vector{
Decl(i),
Decl(u),
Decl(f),
@@ -109,7 +109,7 @@
Enable(builtin::Extension::kF16);
- auto* S = Structure("S", utils::Vector{Member("i", ty.i32())});
+ auto* S = Structure("S", Vector{Member("i", ty.i32())});
auto* A = Alias("A", ty.Of(S));
auto* i_c = Expr(1_i);
@@ -128,8 +128,8 @@
auto* s = Var("s", ty.Of(S), s_c);
auto* a = Var("a", ty.Of(A), a_c);
- Func("F", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("F", tint::Empty, ty.void_(),
+ Vector{
Decl(i),
Decl(u),
Decl(f),
@@ -183,7 +183,7 @@
auto* t = Alias("a", ty.i32());
auto* v = Var("a", Expr(false));
- Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(v)});
+ Func("F", tint::Empty, ty.void_(), Vector{Decl(v)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -202,9 +202,9 @@
// var a = true;
// }
- auto* t = Structure("a", utils::Vector{Member("m", ty.i32())});
+ auto* t = Structure("a", Vector{Member("m", ty.i32())});
auto* v = Var("a", Expr(false));
- Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(v)});
+ Func("F", tint::Empty, ty.void_(), Vector{Decl(v)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -220,7 +220,7 @@
// }
auto* v = Var("a", Expr(false));
- auto* f = Func("a", utils::Empty, ty.void_(), utils::Vector{Decl(v)});
+ auto* f = Func("a", tint::Empty, ty.void_(), Vector{Decl(v)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -241,7 +241,7 @@
auto* g = GlobalVar("a", ty.i32(), builtin::AddressSpace::kPrivate);
auto* v = Var("a", Expr("a"));
- Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(v)});
+ Func("F", tint::Empty, ty.void_(), Vector{Decl(v)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -265,7 +265,7 @@
auto* g = GlobalConst("a", ty.i32(), Expr(1_i));
auto* v = Var("a", Expr("a"));
- Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(v)});
+ Func("F", tint::Empty, ty.void_(), Vector{Decl(v)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -289,7 +289,7 @@
auto* x = Var("a", ty.i32(), Expr(1_i));
auto* y = Var("a", Expr("a"));
- Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(x), Block(Decl(y))});
+ Func("F", tint::Empty, ty.void_(), Vector{Decl(x), Block(Decl(y))});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -316,7 +316,7 @@
auto* c = Const("a", ty.i32(), Expr(1_i));
auto* v = Var("a", Expr("a"));
- Func("X", utils::Empty, ty.void_(), utils::Vector{Decl(c), Block(Decl(v))});
+ Func("X", tint::Empty, ty.void_(), Vector{Decl(c), Block(Decl(v))});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -342,7 +342,7 @@
auto* l = Let("a", ty.i32(), Expr(1_i));
auto* v = Var("a", Expr("a"));
- Func("X", utils::Empty, ty.void_(), utils::Vector{Decl(l), Block(Decl(v))});
+ Func("X", tint::Empty, ty.void_(), Vector{Decl(l), Block(Decl(v))});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -367,7 +367,7 @@
auto* p = Param("a", ty.i32());
auto* v = Var("a", Expr("a"));
- Func("X", utils::Vector{p}, ty.void_(), utils::Vector{Block(Decl(v))});
+ Func("X", Vector{p}, ty.void_(), Vector{Block(Decl(v))});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -402,7 +402,7 @@
Enable(builtin::Extension::kF16);
- auto* S = Structure("S", utils::Vector{Member("i", ty.i32())});
+ auto* S = Structure("S", Vector{Member("i", ty.i32())});
auto* A = Alias("A", ty.Of(S));
auto* v = Var("v", ty.i32());
@@ -424,8 +424,8 @@
auto* a = Let("a", ty.Of(A), a_c);
auto* p = Let("p", ty.ptr<function, i32>(), p_c);
- Func("F", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("F", tint::Empty, ty.void_(),
+ Vector{
Decl(v),
Decl(i),
Decl(u),
@@ -471,8 +471,8 @@
// fn f() {
// let p = &s.inner.arr[3];
// }
- auto* inner = Structure("Inner", utils::Vector{Member("arr", ty.array<i32, 4>())});
- auto* buf = Structure("S", utils::Vector{Member("inner", ty.Of(inner))});
+ auto* inner = Structure("Inner", Vector{Member("arr", ty.array<i32, 4>())});
+ auto* buf = Structure("S", Vector{Member("inner", ty.Of(inner))});
auto* storage = GlobalVar("s", ty.Of(buf), builtin::AddressSpace::kStorage,
builtin::Access::kReadWrite, Binding(0_a), Group(0_a));
@@ -499,7 +499,7 @@
auto* t = Alias("a", ty.i32());
auto* l = Let("a", Expr(false));
- Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(l)});
+ Func("F", tint::Empty, ty.void_(), Vector{Decl(l)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -518,9 +518,9 @@
// let a = false;
// }
- auto* t = Structure("a", utils::Vector{Member("m", ty.i32())});
+ auto* t = Structure("a", Vector{Member("m", ty.i32())});
auto* l = Let("a", Expr(false));
- Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(l)});
+ Func("F", tint::Empty, ty.void_(), Vector{Decl(l)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -536,7 +536,7 @@
// }
auto* l = Let("a", Expr(false));
- auto* fb = Func("a", utils::Empty, ty.void_(), utils::Vector{Decl(l)});
+ auto* fb = Func("a", tint::Empty, ty.void_(), Vector{Decl(l)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -557,7 +557,7 @@
auto* g = GlobalVar("a", ty.i32(), builtin::AddressSpace::kPrivate);
auto* l = Let("a", Expr("a"));
- Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(l)});
+ Func("F", tint::Empty, ty.void_(), Vector{Decl(l)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -581,7 +581,7 @@
auto* g = GlobalConst("a", ty.i32(), Expr(1_i));
auto* l = Let("a", Expr("a"));
- Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(l)});
+ Func("F", tint::Empty, ty.void_(), Vector{Decl(l)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -605,7 +605,7 @@
auto* v = Var("a", ty.i32(), Expr(1_i));
auto* l = Let("a", Expr("a"));
- Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(v), Block(Decl(l))});
+ Func("F", tint::Empty, ty.void_(), Vector{Decl(v), Block(Decl(l))});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -632,7 +632,7 @@
auto* x = Const("a", ty.i32(), Expr(1_i));
auto* y = Let("a", Expr("a"));
- Func("X", utils::Empty, ty.void_(), utils::Vector{Decl(x), Block(Decl(y))});
+ Func("X", tint::Empty, ty.void_(), Vector{Decl(x), Block(Decl(y))});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -658,7 +658,7 @@
auto* x = Let("a", ty.i32(), Expr(1_i));
auto* y = Let("a", Expr("a"));
- Func("X", utils::Empty, ty.void_(), utils::Vector{Decl(x), Block(Decl(y))});
+ Func("X", tint::Empty, ty.void_(), Vector{Decl(x), Block(Decl(y))});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -683,7 +683,7 @@
auto* p = Param("a", ty.i32());
auto* l = Let("a", Expr("a"));
- Func("X", utils::Vector{p}, ty.void_(), utils::Vector{Block(Decl(l))});
+ Func("X", Vector{p}, ty.void_(), Vector{Block(Decl(l))});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -711,7 +711,7 @@
auto* t = Alias("a", ty.i32());
auto* c = Const("a", Expr(false));
- Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(c)});
+ Func("F", tint::Empty, ty.void_(), Vector{Decl(c)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -730,9 +730,9 @@
// const a = false;
// }
- auto* t = Structure("a", utils::Vector{Member("m", ty.i32())});
+ auto* t = Structure("a", Vector{Member("m", ty.i32())});
auto* c = Const("a", Expr(false));
- Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(c)});
+ Func("F", tint::Empty, ty.void_(), Vector{Decl(c)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -748,7 +748,7 @@
// }
auto* c = Const("a", Expr(false));
- auto* fb = Func("a", utils::Empty, ty.void_(), utils::Vector{Decl(c)});
+ auto* fb = Func("a", tint::Empty, ty.void_(), Vector{Decl(c)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -769,7 +769,7 @@
auto* g = GlobalVar("a", ty.i32(), builtin::AddressSpace::kPrivate);
auto* c = Const("a", Expr(1_i));
- Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(c)});
+ Func("F", tint::Empty, ty.void_(), Vector{Decl(c)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -788,7 +788,7 @@
auto* g = GlobalConst("a", ty.i32(), Expr(1_i));
auto* c = Const("a", Expr("a"));
- Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(c)});
+ Func("F", tint::Empty, ty.void_(), Vector{Decl(c)});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -812,7 +812,7 @@
auto* v = Var("a", ty.i32(), Expr(1_i));
auto* c = Const("a", Expr(1_i));
- Func("F", utils::Empty, ty.void_(), utils::Vector{Decl(v), Block(Decl(c))});
+ Func("F", tint::Empty, ty.void_(), Vector{Decl(v), Block(Decl(c))});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -834,7 +834,7 @@
auto* x = Const("a", ty.i32(), Expr(1_i));
auto* y = Const("a", Expr("a"));
- Func("X", utils::Empty, ty.void_(), utils::Vector{Decl(x), Block(Decl(y))});
+ Func("X", tint::Empty, ty.void_(), Vector{Decl(x), Block(Decl(y))});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -860,7 +860,7 @@
auto* l = Let("a", ty.i32(), Expr(1_i));
auto* c = Const("a", Expr(1_i));
- Func("X", utils::Empty, ty.void_(), utils::Vector{Decl(l), Block(Decl(c))});
+ Func("X", tint::Empty, ty.void_(), Vector{Decl(l), Block(Decl(c))});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -881,7 +881,7 @@
auto* p = Param("a", ty.i32());
auto* c = Const("a", Expr(1_i));
- Func("X", utils::Vector{p}, ty.void_(), utils::Vector{Block(Decl(c))});
+ Func("X", Vector{p}, ty.void_(), Vector{Block(Decl(c))});
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -894,7 +894,7 @@
}
TEST_F(ResolverVariableTest, LocalConst_ExplicitType_Decls) {
- Structure("S", utils::Vector{Member("m", ty.u32())});
+ Structure("S", Vector{Member("m", ty.u32())});
auto* c_i32 = Const("a", ty.i32(), Expr(0_i));
auto* c_u32 = Const("b", ty.u32(), Expr(0_u));
@@ -938,7 +938,7 @@
}
TEST_F(ResolverVariableTest, LocalConst_ImplicitType_Decls) {
- Structure("S", utils::Vector{Member("m", ty.u32())});
+ Structure("S", Vector{Member("m", ty.u32())});
auto* c_i32 = Const("a", Expr(0_i));
auto* c_u32 = Const("b", Expr(0_u));
@@ -1037,7 +1037,7 @@
TEST_F(ResolverVariableTest, GlobalVar_AddressSpace) {
// https://gpuweb.github.io/gpuweb/wgsl/#storage-class
- auto* buf = Structure("S", utils::Vector{Member("m", ty.i32())});
+ auto* buf = Structure("S", Vector{Member("m", ty.i32())});
auto* private_ = GlobalVar("p", ty.i32(), builtin::AddressSpace::kPrivate);
auto* workgroup = GlobalVar("w", ty.i32(), builtin::AddressSpace::kWorkgroup);
auto* uniform =
@@ -1065,7 +1065,7 @@
TEST_F(ResolverVariableTest, GlobalVar_ExplicitAddressSpace) {
// https://gpuweb.github.io/gpuweb/wgsl/#storage-class
- auto* buf = Structure("S", utils::Vector{Member("m", ty.i32())});
+ auto* buf = Structure("S", Vector{Member("m", ty.i32())});
auto* storage = GlobalVar("sb", ty.Of(buf), builtin::AddressSpace::kStorage,
builtin::Access::kReadWrite, Binding(1_a), Group(0_a));
@@ -1204,7 +1204,7 @@
// }
auto* p = Param("a", ty.bool_());
- auto* f = Func("a", utils::Vector{p}, ty.void_(), utils::Empty);
+ auto* f = Func("a", Vector{p}, ty.void_(), tint::Empty);
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -1225,7 +1225,7 @@
auto* g = GlobalVar("a", ty.i32(), builtin::AddressSpace::kPrivate);
auto* p = Param("a", ty.bool_());
- Func("F", utils::Vector{p}, ty.void_(), utils::Empty);
+ Func("F", Vector{p}, ty.void_(), tint::Empty);
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -1246,7 +1246,7 @@
auto* g = GlobalConst("a", ty.i32(), Expr(1_i));
auto* p = Param("a", ty.bool_());
- Func("F", utils::Vector{p}, ty.void_(), utils::Empty);
+ Func("F", Vector{p}, ty.void_(), tint::Empty);
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -1267,7 +1267,7 @@
auto* a = Alias("a", ty.i32());
auto* p = Param("a", ty("a"));
- Func("F", utils::Vector{p}, ty.void_(), utils::Empty);
+ Func("F", Vector{p}, ty.void_(), tint::Empty);
ASSERT_TRUE(r()->Resolve()) << r()->error();
@@ -1292,8 +1292,8 @@
// }
GlobalVar(Source{{56, 78}}, "a", ty.i32(), builtin::AddressSpace::kPrivate);
- Func("F", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("F", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", Expr(Ident(Source{{12, 34}}, "a", "i32")))),
});
@@ -1310,8 +1310,8 @@
// }
GlobalConst(Source{{56, 78}}, "a", Expr(1_i));
- Func("F", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("F", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", Expr(Ident(Source{{12, 34}}, "a", "i32")))),
});
@@ -1328,8 +1328,8 @@
// }
Override(Source{{56, 78}}, "a", Expr(1_i));
- Func("F", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("F", tint::Empty, ty.void_(),
+ Vector{
Decl(Let("l", Expr(Ident(Source{{12, 34}}, "a", "i32")))),
});
@@ -1343,8 +1343,8 @@
// let l = a<i32>;
// }
- Func("F", utils::Vector{Param(Source{{56, 78}}, "a", ty.i32())}, ty.void_(),
- utils::Vector{
+ Func("F", Vector{Param(Source{{56, 78}}, "a", ty.i32())}, ty.void_(),
+ Vector{
Decl(Let("l", Expr(Ident(Source{{12, 34}}, "a", "i32")))),
});
@@ -1359,8 +1359,8 @@
// let l = a<i32>;
// }
- Func("F", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("F", tint::Empty, ty.void_(),
+ Vector{
Decl(Var(Source{{56, 78}}, "a", ty.i32())),
Decl(Let("l", Expr(Ident(Source{{12, 34}}, "a", "i32")))),
});
@@ -1376,8 +1376,8 @@
// let l = a<i32>;
// }
- Func("F", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("F", tint::Empty, ty.void_(),
+ Vector{
Decl(Let(Source{{56, 78}}, "a", Expr(1_i))),
Decl(Let("l", Expr(Ident(Source{{12, 34}}, "a", "i32")))),
});
diff --git a/src/tint/lang/wgsl/resolver/variable_validation_test.cc b/src/tint/lang/wgsl/resolver/variable_validation_test.cc
index 0dbe8a6..0d19278 100644
--- a/src/tint/lang/wgsl/resolver/variable_validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/variable_validation_test.cc
@@ -309,10 +309,10 @@
// fn f() {
// let p : pointer<storage, i32, read_write> = &s.inner.arr[2i];
// }
- auto* inner = Structure("Inner", utils::Vector{
+ auto* inner = Structure("Inner", Vector{
Member("arr", ty.array<i32, 4>()),
});
- auto* buf = Structure("S", utils::Vector{
+ auto* buf = Structure("S", Vector{
Member("inner", ty.Of(inner)),
});
auto* var =
@@ -339,7 +339,7 @@
}
TEST_F(ResolverVariableValidationTest, NonConstructibleType_RuntimeArray) {
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member(Source{{12, 34}}, "m", ty.array<i32>()),
});
auto* v = Var(Source{{56, 78}}, "v", ty.Of(s));
@@ -353,7 +353,7 @@
}
TEST_F(ResolverVariableValidationTest, NonConstructibleType_Struct_WithAtomic) {
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("m", ty.atomic(ty.i32())),
});
auto* v = Var("v", ty.Of(s));
diff --git a/src/tint/lang/wgsl/sem/accessor_expression.h b/src/tint/lang/wgsl/sem/accessor_expression.h
index 02f0288..70b5276 100644
--- a/src/tint/lang/wgsl/sem/accessor_expression.h
+++ b/src/tint/lang/wgsl/sem/accessor_expression.h
@@ -24,7 +24,7 @@
/// AccessorExpression is the base class for all semantic information for an ast::AccessorExpression
/// node.
-class AccessorExpression : public utils::Castable<AccessorExpression, ValueExpression> {
+class AccessorExpression : public Castable<AccessorExpression, ValueExpression> {
public:
/// Destructor
~AccessorExpression() override;
diff --git a/src/tint/lang/wgsl/sem/array_count.cc b/src/tint/lang/wgsl/sem/array_count.cc
index 5e52e72..2e867a4 100644
--- a/src/tint/lang/wgsl/sem/array_count.cc
+++ b/src/tint/lang/wgsl/sem/array_count.cc
@@ -22,7 +22,7 @@
namespace tint::sem {
NamedOverrideArrayCount::NamedOverrideArrayCount(const GlobalVariable* var)
- : Base(static_cast<size_t>(utils::TypeInfo::Of<NamedOverrideArrayCount>().full_hashcode)),
+ : Base(static_cast<size_t>(tint::TypeInfo::Of<NamedOverrideArrayCount>().full_hashcode)),
variable(var) {}
NamedOverrideArrayCount::~NamedOverrideArrayCount() = default;
@@ -43,7 +43,7 @@
}
UnnamedOverrideArrayCount::UnnamedOverrideArrayCount(const ValueExpression* e)
- : Base(static_cast<size_t>(utils::TypeInfo::Of<UnnamedOverrideArrayCount>().full_hashcode)),
+ : Base(static_cast<size_t>(tint::TypeInfo::Of<UnnamedOverrideArrayCount>().full_hashcode)),
expr(e) {}
UnnamedOverrideArrayCount::~UnnamedOverrideArrayCount() = default;
diff --git a/src/tint/lang/wgsl/sem/array_count.h b/src/tint/lang/wgsl/sem/array_count.h
index 49c6dd4..82f8f51 100644
--- a/src/tint/lang/wgsl/sem/array_count.h
+++ b/src/tint/lang/wgsl/sem/array_count.h
@@ -29,8 +29,7 @@
/// override N : i32;
/// type arr = array<i32, N>
/// ```
-class NamedOverrideArrayCount final
- : public utils::Castable<NamedOverrideArrayCount, type::ArrayCount> {
+class NamedOverrideArrayCount final : public Castable<NamedOverrideArrayCount, type::ArrayCount> {
public:
/// Constructor
/// @param var the `override` variable
@@ -59,7 +58,7 @@
/// type arr = array<i32, N*2>
/// ```
class UnnamedOverrideArrayCount final
- : public utils::Castable<UnnamedOverrideArrayCount, type::ArrayCount> {
+ : public Castable<UnnamedOverrideArrayCount, type::ArrayCount> {
public:
/// Constructor
/// @param e the override expression
diff --git a/src/tint/lang/wgsl/sem/behavior.cc b/src/tint/lang/wgsl/sem/behavior.cc
index 8a66fb2..f47070c 100644
--- a/src/tint/lang/wgsl/sem/behavior.cc
+++ b/src/tint/lang/wgsl/sem/behavior.cc
@@ -16,7 +16,7 @@
namespace tint::sem {
-utils::StringStream& operator<<(utils::StringStream& out, Behavior behavior) {
+StringStream& operator<<(StringStream& out, Behavior behavior) {
switch (behavior) {
case Behavior::kReturn:
return out << "Return";
diff --git a/src/tint/lang/wgsl/sem/behavior.h b/src/tint/lang/wgsl/sem/behavior.h
index d47f57a..dc0df58 100644
--- a/src/tint/lang/wgsl/sem/behavior.h
+++ b/src/tint/lang/wgsl/sem/behavior.h
@@ -29,13 +29,13 @@
};
/// Behaviors is a set of Behavior
-using Behaviors = utils::EnumSet<Behavior>;
+using Behaviors = tint::EnumSet<Behavior>;
/// Writes the Behavior to the stream.
/// @param out the stream to write to
/// @param behavior the Behavior to write
/// @returns out so calls can be chained
-utils::StringStream& operator<<(utils::StringStream& out, Behavior behavior);
+StringStream& operator<<(StringStream& out, Behavior behavior);
} // namespace tint::sem
diff --git a/src/tint/lang/wgsl/sem/block_statement.h b/src/tint/lang/wgsl/sem/block_statement.h
index ae9b40a..795d836 100644
--- a/src/tint/lang/wgsl/sem/block_statement.h
+++ b/src/tint/lang/wgsl/sem/block_statement.h
@@ -31,7 +31,7 @@
/// Holds semantic information about a block, such as parent block and variables
/// declared in the block.
-class BlockStatement : public utils::Castable<BlockStatement, CompoundStatement> {
+class BlockStatement : public Castable<BlockStatement, CompoundStatement> {
public:
/// Constructor
/// @param declaration the AST node for this block statement
@@ -50,8 +50,7 @@
};
/// The root block statement for a function
-class FunctionBlockStatement final
- : public utils::Castable<FunctionBlockStatement, BlockStatement> {
+class FunctionBlockStatement final : public Castable<FunctionBlockStatement, BlockStatement> {
public:
/// Constructor
/// @param function the owning function
@@ -62,7 +61,7 @@
};
/// Holds semantic information about a loop body block or for-loop body block
-class LoopBlockStatement final : public utils::Castable<LoopBlockStatement, BlockStatement> {
+class LoopBlockStatement final : public Castable<LoopBlockStatement, BlockStatement> {
public:
/// Constructor
/// @param declaration the AST node for this block statement
diff --git a/src/tint/lang/wgsl/sem/break_if_statement.h b/src/tint/lang/wgsl/sem/break_if_statement.h
index 20ed60c..a688984 100644
--- a/src/tint/lang/wgsl/sem/break_if_statement.h
+++ b/src/tint/lang/wgsl/sem/break_if_statement.h
@@ -28,7 +28,7 @@
namespace tint::sem {
/// Holds semantic information about a break-if statement
-class BreakIfStatement final : public utils::Castable<BreakIfStatement, CompoundStatement> {
+class BreakIfStatement final : public Castable<BreakIfStatement, CompoundStatement> {
public:
/// Constructor
/// @param declaration the AST node for this break-if statement
diff --git a/src/tint/lang/wgsl/sem/builtin.cc b/src/tint/lang/wgsl/sem/builtin.cc
index 2840dc8..ee1fe17 100644
--- a/src/tint/lang/wgsl/sem/builtin.cc
+++ b/src/tint/lang/wgsl/sem/builtin.cc
@@ -32,7 +32,7 @@
Builtin::Builtin(builtin::Function type,
const type::Type* return_type,
- utils::VectorRef<Parameter*> parameters,
+ VectorRef<Parameter*> parameters,
EvaluationStage eval_stage,
PipelineStageSet supported_stages,
bool is_deprecated,
diff --git a/src/tint/lang/wgsl/sem/builtin.h b/src/tint/lang/wgsl/sem/builtin.h
index 046f189..dfea716 100644
--- a/src/tint/lang/wgsl/sem/builtin.h
+++ b/src/tint/lang/wgsl/sem/builtin.h
@@ -27,7 +27,7 @@
namespace tint::sem {
/// Builtin holds the semantic information for a builtin function.
-class Builtin final : public utils::Castable<Builtin, CallTarget> {
+class Builtin final : public Castable<Builtin, CallTarget> {
public:
/// Constructor
/// @param type the builtin type
@@ -39,7 +39,7 @@
/// @param must_use true if the builtin was annotated with `@must_use`
Builtin(builtin::Function type,
const type::Type* return_type,
- utils::VectorRef<Parameter*> parameters,
+ VectorRef<Parameter*> parameters,
EvaluationStage eval_stage,
PipelineStageSet supported_stages,
bool is_deprecated,
@@ -123,8 +123,8 @@
/// @param i the Builtin to create a hash for
/// @return the hash value
inline std::size_t operator()(const tint::sem::Builtin& i) const {
- return tint::utils::Hash(i.Type(), i.SupportedStages(), i.ReturnType(), i.Parameters(),
- i.IsDeprecated());
+ return Hash(i.Type(), i.SupportedStages(), i.ReturnType(), i.Parameters(),
+ i.IsDeprecated());
}
};
diff --git a/src/tint/lang/wgsl/sem/builtin_enum_expression.h b/src/tint/lang/wgsl/sem/builtin_enum_expression.h
index 4c934ed..fb56aea 100644
--- a/src/tint/lang/wgsl/sem/builtin_enum_expression.h
+++ b/src/tint/lang/wgsl/sem/builtin_enum_expression.h
@@ -26,7 +26,7 @@
/// Base class for BuiltinEnumExpression.
/// Useful for Is() queries.
-class BuiltinEnumExpressionBase : public utils::Castable<BuiltinEnumExpressionBase, Expression> {
+class BuiltinEnumExpressionBase : public Castable<BuiltinEnumExpressionBase, Expression> {
public:
/// Constructor
/// @param declaration the AST node
@@ -41,7 +41,7 @@
/// builtin enumerator value.
template <typename ENUM>
class BuiltinEnumExpression
- : public utils::Castable<BuiltinEnumExpression<ENUM>, BuiltinEnumExpressionBase> {
+ : public Castable<BuiltinEnumExpression<ENUM>, BuiltinEnumExpressionBase> {
public:
/// Constructor
/// @param declaration the AST node
diff --git a/src/tint/lang/wgsl/sem/call.cc b/src/tint/lang/wgsl/sem/call.cc
index 38e71b4..dede66b 100644
--- a/src/tint/lang/wgsl/sem/call.cc
+++ b/src/tint/lang/wgsl/sem/call.cc
@@ -24,7 +24,7 @@
Call::Call(const ast::CallExpression* declaration,
const CallTarget* target,
EvaluationStage stage,
- utils::VectorRef<const sem::ValueExpression*> arguments,
+ VectorRef<const sem::ValueExpression*> arguments,
const Statement* statement,
const constant::Value* constant,
bool has_side_effects)
diff --git a/src/tint/lang/wgsl/sem/call.h b/src/tint/lang/wgsl/sem/call.h
index 271c0ac..6cb15b3 100644
--- a/src/tint/lang/wgsl/sem/call.h
+++ b/src/tint/lang/wgsl/sem/call.h
@@ -26,7 +26,7 @@
/// Call is the base class for semantic nodes that hold semantic information for
/// ast::CallExpression nodes.
-class Call final : public utils::Castable<Call, ValueExpression> {
+class Call final : public Castable<Call, ValueExpression> {
public:
/// Constructor
/// @param declaration the AST node
@@ -39,7 +39,7 @@
Call(const ast::CallExpression* declaration,
const CallTarget* target,
EvaluationStage stage,
- utils::VectorRef<const sem::ValueExpression*> arguments,
+ VectorRef<const sem::ValueExpression*> arguments,
const Statement* statement,
const constant::Value* constant,
bool has_side_effects);
@@ -60,7 +60,7 @@
private:
CallTarget const* const target_;
- utils::Vector<const sem::ValueExpression*, 8> arguments_;
+ tint::Vector<const sem::ValueExpression*, 8> arguments_;
};
} // namespace tint::sem
diff --git a/src/tint/lang/wgsl/sem/call_target.cc b/src/tint/lang/wgsl/sem/call_target.cc
index 94664ca..b5ce684 100644
--- a/src/tint/lang/wgsl/sem/call_target.cc
+++ b/src/tint/lang/wgsl/sem/call_target.cc
@@ -26,7 +26,7 @@
CallTarget::CallTarget(EvaluationStage stage, bool must_use) : stage_(stage), must_use_(must_use) {}
CallTarget::CallTarget(const type::Type* return_type,
- utils::VectorRef<Parameter*> parameters,
+ VectorRef<Parameter*> parameters,
EvaluationStage stage,
bool must_use)
: stage_(stage), must_use_(must_use) {
@@ -43,7 +43,7 @@
CallTargetSignature::CallTargetSignature() = default;
CallTargetSignature::CallTargetSignature(const type::Type* ret_ty,
- utils::VectorRef<const sem::Parameter*> params)
+ VectorRef<const sem::Parameter*> params)
: return_type(ret_ty), parameters(std::move(params)) {}
CallTargetSignature::CallTargetSignature(const CallTargetSignature&) = default;
CallTargetSignature::~CallTargetSignature() = default;
@@ -77,11 +77,11 @@
std::size_t hash<tint::sem::CallTargetSignature>::operator()(
const tint::sem::CallTargetSignature& sig) const {
- size_t hash = tint::utils::Hash(sig.parameters.Length());
+ size_t hash = tint::Hash(sig.parameters.Length());
for (auto* p : sig.parameters) {
- hash = tint::utils::HashCombine(hash, p->Type(), p->Usage());
+ hash = HashCombine(hash, p->Type(), p->Usage());
}
- return tint::utils::Hash(hash, sig.return_type);
+ return Hash(hash, sig.return_type);
}
} // namespace std
diff --git a/src/tint/lang/wgsl/sem/call_target.h b/src/tint/lang/wgsl/sem/call_target.h
index 1008a23..f897b88 100644
--- a/src/tint/lang/wgsl/sem/call_target.h
+++ b/src/tint/lang/wgsl/sem/call_target.h
@@ -33,7 +33,7 @@
/// Constructor
/// @param ret_ty the call target return type
/// @param params the call target parameters
- CallTargetSignature(const type::Type* ret_ty, utils::VectorRef<const Parameter*> params);
+ CallTargetSignature(const type::Type* ret_ty, VectorRef<const Parameter*> params);
/// Copy constructor
CallTargetSignature(const CallTargetSignature&);
@@ -44,7 +44,7 @@
/// The type of the call target return value
const type::Type* return_type = nullptr;
/// The parameters of the call target
- utils::Vector<const sem::Parameter*, 8> parameters;
+ tint::Vector<const sem::Parameter*, 8> parameters;
/// Equality operator
/// @param other the signature to compare this to
@@ -67,7 +67,7 @@
/// CallTarget is the base for callable functions, builtins, value constructors and value
/// conversions.
-class CallTarget : public utils::Castable<CallTarget, Node> {
+class CallTarget : public Castable<CallTarget, Node> {
public:
/// Constructor
/// @param stage the earliest evaluation stage for a call to this target
@@ -82,7 +82,7 @@
/// @param must_use the result of the call target must be used, i.e. it cannot be used as a call
/// statement.
CallTarget(const type::Type* return_type,
- utils::VectorRef<Parameter*> parameters,
+ VectorRef<Parameter*> parameters,
EvaluationStage stage,
bool must_use);
diff --git a/src/tint/lang/wgsl/sem/diagnostic_severity_test.cc b/src/tint/lang/wgsl/sem/diagnostic_severity_test.cc
index bb5b775..57c0bab 100644
--- a/src/tint/lang/wgsl/sem/diagnostic_severity_test.cc
+++ b/src/tint/lang/wgsl/sem/diagnostic_severity_test.cc
@@ -91,7 +91,7 @@
auto while_severity = builtin::DiagnosticSeverity::kError;
auto while_body_severity = builtin::DiagnosticSeverity::kWarning;
auto attr = [&](auto severity) {
- return utils::Vector{DiagnosticAttribute(severity, "chromium", "unreachable_code")};
+ return tint::Vector{DiagnosticAttribute(severity, "chromium", "unreachable_code")};
};
auto* return_foo_if = Return();
@@ -104,30 +104,30 @@
auto* return_foo_loop = Return();
auto* return_foo_while = Return();
auto* breakif_foo_continuing = BreakIf(Expr(true));
- auto* else_stmt = Block(utils::Vector{return_foo_else}, attr(else_body_severity));
+ auto* else_stmt = Block(tint::Vector{return_foo_else}, attr(else_body_severity));
auto* elseif = If(Expr(false), Block(return_foo_elseif), Else(else_stmt));
- auto* if_foo = If(Expr(true), Block(utils::Vector{return_foo_if}, attr(if_body_severity)),
+ auto* if_foo = If(Expr(true), Block(tint::Vector{return_foo_if}, attr(if_body_severity)),
Else(elseif), attr(if_severity));
auto* case_stmt =
- Case(CaseSelector(0_a), Block(utils::Vector{return_foo_case}, attr(case_severity)));
+ Case(CaseSelector(0_a), Block(tint::Vector{return_foo_case}, attr(case_severity)));
auto* default_stmt = DefaultCase(Block(return_foo_default));
- auto* swtch = Switch(42_a, utils::Vector{case_stmt, default_stmt}, attr(switch_severity),
+ auto* swtch = Switch(42_a, tint::Vector{case_stmt, default_stmt}, attr(switch_severity),
attr(switch_body_severity));
auto* fl =
For(Decl(Var("i", ty.i32())), false, Increment("i"),
- Block(utils::Vector{return_foo_for}, attr(for_body_severity)), attr(for_severity));
- auto* l = Loop(Block(utils::Vector{return_foo_loop}, attr(loop_body_severity)),
- Block(utils::Vector{breakif_foo_continuing}, attr(continuing_severity)),
+ Block(tint::Vector{return_foo_for}, attr(for_body_severity)), attr(for_severity));
+ auto* l = Loop(Block(tint::Vector{return_foo_loop}, attr(loop_body_severity)),
+ Block(tint::Vector{breakif_foo_continuing}, attr(continuing_severity)),
attr(loop_severity));
- auto* wl = While(false, Block(utils::Vector{return_foo_while}, attr(while_body_severity)),
+ auto* wl = While(false, Block(tint::Vector{return_foo_while}, attr(while_body_severity)),
attr(while_severity));
auto* block_1 =
- Block(utils::Vector{if_foo, return_foo_block, swtch, fl, l, wl}, attr(block_severity));
+ Block(tint::Vector{if_foo, return_foo_block, swtch, fl, l, wl}, attr(block_severity));
auto* func_attr = DiagnosticAttribute(func_severity, "chromium", "unreachable_code");
- auto* foo = Func("foo", {}, ty.void_(), utils::Vector{block_1}, utils::Vector{func_attr});
+ auto* foo = Func("foo", {}, ty.void_(), tint::Vector{block_1}, tint::Vector{func_attr});
auto* return_bar = Return();
- auto* bar = Func("bar", {}, ty.void_(), utils::Vector{return_bar});
+ auto* bar = Func("bar", {}, ty.void_(), tint::Vector{return_bar});
auto p = Build();
EXPECT_TRUE(p.IsValid()) << p.Diagnostics().str();
diff --git a/src/tint/lang/wgsl/sem/expression.h b/src/tint/lang/wgsl/sem/expression.h
index fabe326..034ccaa 100644
--- a/src/tint/lang/wgsl/sem/expression.h
+++ b/src/tint/lang/wgsl/sem/expression.h
@@ -26,7 +26,7 @@
namespace tint::sem {
/// Expression holds the semantic information for expression nodes.
-class Expression : public utils::Castable<Expression, Node> {
+class Expression : public Castable<Expression, Node> {
public:
/// Constructor
/// @param declaration the AST node
diff --git a/src/tint/lang/wgsl/sem/for_loop_statement.h b/src/tint/lang/wgsl/sem/for_loop_statement.h
index b3d038b..6a2caa6 100644
--- a/src/tint/lang/wgsl/sem/for_loop_statement.h
+++ b/src/tint/lang/wgsl/sem/for_loop_statement.h
@@ -28,7 +28,7 @@
namespace tint::sem {
/// Holds semantic information about a for-loop statement
-class ForLoopStatement final : public utils::Castable<ForLoopStatement, CompoundStatement> {
+class ForLoopStatement final : public Castable<ForLoopStatement, CompoundStatement> {
public:
/// Constructor
/// @param declaration the AST node for this for-loop statement
diff --git a/src/tint/lang/wgsl/sem/function.cc b/src/tint/lang/wgsl/sem/function.cc
index 850e4cd..a83ee86 100644
--- a/src/tint/lang/wgsl/sem/function.cc
+++ b/src/tint/lang/wgsl/sem/function.cc
@@ -114,7 +114,7 @@
}
Function::VariableBindings Function::TransitivelyReferencedVariablesOfType(
- const tint::utils::TypeInfo* type) const {
+ const tint::TypeInfo* type) const {
VariableBindings ret;
for (auto* global : TransitivelyReferencedGlobals()) {
auto* unwrapped_type = global->Type()->UnwrapRef();
diff --git a/src/tint/lang/wgsl/sem/function.h b/src/tint/lang/wgsl/sem/function.h
index 3674b77..cddfdcd 100644
--- a/src/tint/lang/wgsl/sem/function.h
+++ b/src/tint/lang/wgsl/sem/function.h
@@ -47,7 +47,7 @@
using WorkgroupSize = std::array<std::optional<uint32_t>, 3>;
/// Function holds the semantic information for function nodes.
-class Function final : public utils::Castable<Function, CallTarget> {
+class Function final : public Castable<Function, CallTarget> {
public:
/// A vector of [Variable*, BindingPoint] pairs
using VariableBindings = std::vector<std::pair<const Variable*, BindingPoint>>;
@@ -80,7 +80,7 @@
}
/// @returns all directly referenced global variables
- const utils::UniqueVector<const GlobalVariable*, 4>& DirectlyReferencedGlobals() const {
+ const UniqueVector<const GlobalVariable*, 4>& DirectlyReferencedGlobals() const {
return directly_referenced_globals_;
}
@@ -93,7 +93,7 @@
}
/// @returns all transitively referenced global variables
- const utils::UniqueVector<const GlobalVariable*, 8>& TransitivelyReferencedGlobals() const {
+ const UniqueVector<const GlobalVariable*, 8>& TransitivelyReferencedGlobals() const {
return transitively_referenced_globals_;
}
@@ -105,7 +105,7 @@
}
/// @returns the list of functions that this function transitively calls.
- const utils::UniqueVector<const Function*, 8>& TransitivelyCalledFunctions() const {
+ const UniqueVector<const Function*, 8>& TransitivelyCalledFunctions() const {
return transitively_called_functions_;
}
@@ -116,7 +116,7 @@
}
/// @returns the list of builtins that this function directly calls.
- const utils::UniqueVector<const Builtin*, 4>& DirectlyCalledBuiltins() const {
+ const UniqueVector<const Builtin*, 4>& DirectlyCalledBuiltins() const {
return directly_called_builtins_;
}
@@ -138,7 +138,7 @@
/// @returns the list of texture/sampler pairs that this function uses
/// (directly or indirectly).
- utils::VectorRef<VariablePair> TextureSamplerPairs() const { return texture_sampler_pairs_; }
+ VectorRef<VariablePair> TextureSamplerPairs() const { return texture_sampler_pairs_; }
/// @returns the list of direct calls to functions / builtins made by this
/// function
@@ -223,14 +223,14 @@
/// must be decorated with both binding and group attributes.
/// @param type the type of the variables to find
/// @returns the referenced variables
- VariableBindings TransitivelyReferencedVariablesOfType(const tint::utils::TypeInfo* type) const;
+ VariableBindings TransitivelyReferencedVariablesOfType(const tint::TypeInfo* type) const;
/// Retrieves any referenced variables of the given type. Note, the variables
/// must be decorated with both binding and group attributes.
/// @returns the referenced variables
template <typename T>
VariableBindings TransitivelyReferencedVariablesOfType() const {
- return TransitivelyReferencedVariablesOfType(&utils::TypeInfo::Of<T>());
+ return TransitivelyReferencedVariablesOfType(&tint::TypeInfo::Of<T>());
}
/// Checks if the given entry point is an ancestor
@@ -284,11 +284,11 @@
const ast::Function* const declaration_;
sem::WorkgroupSize workgroup_size_;
- utils::UniqueVector<const GlobalVariable*, 4> directly_referenced_globals_;
- utils::UniqueVector<const GlobalVariable*, 8> transitively_referenced_globals_;
- utils::UniqueVector<const Function*, 8> transitively_called_functions_;
- utils::UniqueVector<const Builtin*, 4> directly_called_builtins_;
- utils::UniqueVector<VariablePair, 8> texture_sampler_pairs_;
+ UniqueVector<const GlobalVariable*, 4> directly_referenced_globals_;
+ UniqueVector<const GlobalVariable*, 8> transitively_referenced_globals_;
+ UniqueVector<const Function*, 8> transitively_called_functions_;
+ UniqueVector<const Builtin*, 4> directly_called_builtins_;
+ UniqueVector<VariablePair, 8> texture_sampler_pairs_;
std::vector<const Call*> direct_calls_;
std::vector<const Call*> callsites_;
std::vector<const Function*> ancestor_entry_points_;
diff --git a/src/tint/lang/wgsl/sem/function_expression.h b/src/tint/lang/wgsl/sem/function_expression.h
index 2be70ff..60b5470 100644
--- a/src/tint/lang/wgsl/sem/function_expression.h
+++ b/src/tint/lang/wgsl/sem/function_expression.h
@@ -26,7 +26,7 @@
/// FunctionExpression holds the semantic information for expression nodes that resolve to
/// functions.
-class FunctionExpression : public utils::Castable<FunctionExpression, Expression> {
+class FunctionExpression : public Castable<FunctionExpression, Expression> {
public:
/// Constructor
/// @param declaration the AST node
diff --git a/src/tint/lang/wgsl/sem/if_statement.h b/src/tint/lang/wgsl/sem/if_statement.h
index 7fed592..ac6e9cb 100644
--- a/src/tint/lang/wgsl/sem/if_statement.h
+++ b/src/tint/lang/wgsl/sem/if_statement.h
@@ -28,7 +28,7 @@
namespace tint::sem {
/// Holds semantic information about an if statement
-class IfStatement final : public utils::Castable<IfStatement, CompoundStatement> {
+class IfStatement final : public Castable<IfStatement, CompoundStatement> {
public:
/// Constructor
/// @param declaration the AST node for this if statement
diff --git a/src/tint/lang/wgsl/sem/index_accessor_expression.h b/src/tint/lang/wgsl/sem/index_accessor_expression.h
index 3a30e0c..db1c60a 100644
--- a/src/tint/lang/wgsl/sem/index_accessor_expression.h
+++ b/src/tint/lang/wgsl/sem/index_accessor_expression.h
@@ -23,8 +23,7 @@
namespace tint::sem {
/// IndexAccessorExpression holds the semantic information for a ast::IndexAccessorExpression node.
-class IndexAccessorExpression final
- : public utils::Castable<IndexAccessorExpression, AccessorExpression> {
+class IndexAccessorExpression final : public Castable<IndexAccessorExpression, AccessorExpression> {
public:
/// Constructor
/// @param declaration the AST node
diff --git a/src/tint/lang/wgsl/sem/info.h b/src/tint/lang/wgsl/sem/info.h
index 5ceb724..91cbcce 100644
--- a/src/tint/lang/wgsl/sem/info.h
+++ b/src/tint/lang/wgsl/sem/info.h
@@ -52,7 +52,7 @@
std::conditional_t<std::is_same<SEM, InferFromAST>::value, SemanticNodeTypeFor<AST>, SEM>;
/// Alias to a unique vector of transitively referenced global variables
- using TransitivelyReferenced = utils::UniqueVector<const GlobalVariable*, 4>;
+ using TransitivelyReferenced = UniqueVector<const GlobalVariable*, 4>;
/// Constructor
Info();
@@ -77,11 +77,11 @@
/// @param ast_node the AST node
/// @returns a pointer to the semantic node if found, otherwise nullptr
template <typename SEM = InferFromAST,
- typename AST = utils::CastableBase,
+ typename AST = CastableBase,
typename RESULT = GetResultType<SEM, AST>>
const RESULT* Get(const AST* ast_node) const {
static_assert(std::is_same_v<SEM, InferFromAST> ||
- !utils::traits::IsTypeOrDerived<SemanticNodeTypeFor<AST>, SEM>,
+ !tint::traits::IsTypeOrDerived<SemanticNodeTypeFor<AST>, SEM>,
"explicit template argument is unnecessary");
if (ast_node && ast_node->node_id.value < nodes_.size()) {
return As<RESULT>(nodes_[ast_node->node_id.value]);
@@ -141,8 +141,7 @@
/// Records that this variable (transitively) references the given override variable.
/// @param from the item the variable is referenced from
/// @param var the module-scope override variable
- void AddTransitivelyReferencedOverride(const utils::CastableBase* from,
- const GlobalVariable* var) {
+ void AddTransitivelyReferencedOverride(const CastableBase* from, const GlobalVariable* var) {
if (referenced_overrides_.count(from) == 0) {
referenced_overrides_.insert({from, TransitivelyReferenced{}});
}
@@ -151,8 +150,7 @@
/// @param from the key to look up
/// @returns all transitively referenced override variables or nullptr if none set
- const TransitivelyReferenced* TransitivelyReferencedOverrides(
- const utils::CastableBase* from) const {
+ const TransitivelyReferenced* TransitivelyReferencedOverrides(const CastableBase* from) const {
if (referenced_overrides_.count(from) == 0) {
return nullptr;
}
@@ -168,9 +166,9 @@
private:
// AST node index to semantic node
- std::vector<const utils::CastableBase*> nodes_;
+ std::vector<const CastableBase*> nodes_;
// Lists transitively referenced overrides for the given item
- std::unordered_map<const utils::CastableBase*, TransitivelyReferenced> referenced_overrides_;
+ std::unordered_map<const CastableBase*, TransitivelyReferenced> referenced_overrides_;
// The semantic module
sem::Module* module_ = nullptr;
};
diff --git a/src/tint/lang/wgsl/sem/load.h b/src/tint/lang/wgsl/sem/load.h
index d617e73..705f4b1 100644
--- a/src/tint/lang/wgsl/sem/load.h
+++ b/src/tint/lang/wgsl/sem/load.h
@@ -23,7 +23,7 @@
/// Load is a semantic expression which represents the load of a reference to a non-reference value.
/// Loads from reference types are implicit in WGSL, so the Load semantic node shares the same AST
/// node as the inner semantic node.
-class Load final : public utils::Castable<Load, ValueExpression> {
+class Load final : public Castable<Load, ValueExpression> {
public:
/// Constructor
/// @param reference the reference expression being loaded
diff --git a/src/tint/lang/wgsl/sem/loop_statement.h b/src/tint/lang/wgsl/sem/loop_statement.h
index e2d2af4..d5c84ae 100644
--- a/src/tint/lang/wgsl/sem/loop_statement.h
+++ b/src/tint/lang/wgsl/sem/loop_statement.h
@@ -25,7 +25,7 @@
namespace tint::sem {
/// Holds semantic information about a loop statement
-class LoopStatement final : public utils::Castable<LoopStatement, CompoundStatement> {
+class LoopStatement final : public Castable<LoopStatement, CompoundStatement> {
public:
/// Constructor
/// @param declaration the AST node for this loop statement
@@ -41,7 +41,7 @@
/// Holds semantic information about a loop continuing block
class LoopContinuingBlockStatement final
- : public utils::Castable<LoopContinuingBlockStatement, BlockStatement> {
+ : public Castable<LoopContinuingBlockStatement, BlockStatement> {
public:
/// Constructor
/// @param declaration the AST node for this block statement
diff --git a/src/tint/lang/wgsl/sem/materialize.h b/src/tint/lang/wgsl/sem/materialize.h
index 2c998bc..fbc6314 100644
--- a/src/tint/lang/wgsl/sem/materialize.h
+++ b/src/tint/lang/wgsl/sem/materialize.h
@@ -25,7 +25,7 @@
/// the same AST node as the inner semantic node.
/// Abstract numerics types may only be used by compile-time expressions, so a Materialize semantic
/// node must have a valid Constant value.
-class Materialize final : public utils::Castable<Materialize, ValueExpression> {
+class Materialize final : public Castable<Materialize, ValueExpression> {
public:
/// Constructor
/// @param expr the inner expression, being materialized
diff --git a/src/tint/lang/wgsl/sem/member_accessor_expression.cc b/src/tint/lang/wgsl/sem/member_accessor_expression.cc
index 529f446..aa9064d 100644
--- a/src/tint/lang/wgsl/sem/member_accessor_expression.cc
+++ b/src/tint/lang/wgsl/sem/member_accessor_expression.cc
@@ -60,7 +60,7 @@
const Statement* statement,
const constant::Value* constant,
const ValueExpression* object,
- utils::VectorRef<uint32_t> indices,
+ VectorRef<uint32_t> indices,
bool has_side_effects,
const Variable* root_ident /* = nullptr */)
: Base(declaration,
diff --git a/src/tint/lang/wgsl/sem/member_accessor_expression.h b/src/tint/lang/wgsl/sem/member_accessor_expression.h
index 3dfcf88..25a213a 100644
--- a/src/tint/lang/wgsl/sem/member_accessor_expression.h
+++ b/src/tint/lang/wgsl/sem/member_accessor_expression.h
@@ -30,8 +30,7 @@
/// MemberAccessorExpression is the base class for all semantic information for a
/// ast::MemberAccessorExpression node.
-class MemberAccessorExpression
- : public utils::Castable<MemberAccessorExpression, AccessorExpression> {
+class MemberAccessorExpression : public Castable<MemberAccessorExpression, AccessorExpression> {
public:
/// Destructor
~MemberAccessorExpression() override;
@@ -59,8 +58,7 @@
/// StructMemberAccess holds the semantic information for a
/// ast::MemberAccessorExpression node that represents an access to a structure
/// member.
-class StructMemberAccess final
- : public utils::Castable<StructMemberAccess, MemberAccessorExpression> {
+class StructMemberAccess final : public Castable<StructMemberAccess, MemberAccessorExpression> {
public:
/// Constructor
/// @param declaration the AST node
@@ -92,7 +90,7 @@
/// Swizzle holds the semantic information for a ast::MemberAccessorExpression
/// node that represents a vector swizzle.
-class Swizzle final : public utils::Castable<Swizzle, MemberAccessorExpression> {
+class Swizzle final : public Castable<Swizzle, MemberAccessorExpression> {
public:
/// Constructor
/// @param declaration the AST node
@@ -108,7 +106,7 @@
const Statement* statement,
const constant::Value* constant,
const ValueExpression* object,
- utils::VectorRef<uint32_t> indices,
+ VectorRef<uint32_t> indices,
bool has_side_effects,
const Variable* root_ident = nullptr);
@@ -119,7 +117,7 @@
const auto& Indices() const { return indices_; }
private:
- utils::Vector<uint32_t, 4> const indices_;
+ tint::Vector<uint32_t, 4> const indices_;
};
} // namespace tint::sem
diff --git a/src/tint/lang/wgsl/sem/module.cc b/src/tint/lang/wgsl/sem/module.cc
index a9fa178..bd63aec 100644
--- a/src/tint/lang/wgsl/sem/module.cc
+++ b/src/tint/lang/wgsl/sem/module.cc
@@ -21,7 +21,7 @@
namespace tint::sem {
-Module::Module(utils::VectorRef<const ast::Node*> dep_ordered_decls, builtin::Extensions extensions)
+Module::Module(VectorRef<const ast::Node*> dep_ordered_decls, builtin::Extensions extensions)
: dep_ordered_decls_(std::move(dep_ordered_decls)), extensions_(std::move(extensions)) {}
Module::~Module() = default;
diff --git a/src/tint/lang/wgsl/sem/module.h b/src/tint/lang/wgsl/sem/module.h
index 7aca716..7ab2fdb 100644
--- a/src/tint/lang/wgsl/sem/module.h
+++ b/src/tint/lang/wgsl/sem/module.h
@@ -29,20 +29,18 @@
/// Module holds the top-level semantic types, functions and global variables
/// used by a Program.
-class Module final : public utils::Castable<Module, Node> {
+class Module final : public Castable<Module, Node> {
public:
/// Constructor
/// @param dep_ordered_decls the dependency-ordered module-scope declarations
/// @param extensions the list of enabled extensions in the module
- Module(utils::VectorRef<const ast::Node*> dep_ordered_decls, builtin::Extensions extensions);
+ Module(VectorRef<const ast::Node*> dep_ordered_decls, builtin::Extensions extensions);
/// Destructor
~Module() override;
/// @returns the dependency-ordered global declarations for the module
- utils::VectorRef<const ast::Node*> DependencyOrderedDeclarations() const {
- return dep_ordered_decls_;
- }
+ VectorRef<const ast::Node*> DependencyOrderedDeclarations() const { return dep_ordered_decls_; }
/// @returns the list of enabled extensions in the module
const builtin::Extensions& Extensions() const { return extensions_; }
@@ -60,7 +58,7 @@
}
private:
- const utils::Vector<const ast::Node*, 64> dep_ordered_decls_;
+ const tint::Vector<const ast::Node*, 64> dep_ordered_decls_;
builtin::Extensions extensions_;
builtin::DiagnosticRuleSeverities diagnostic_severities_;
};
diff --git a/src/tint/lang/wgsl/sem/node.h b/src/tint/lang/wgsl/sem/node.h
index dd86305..586d5c3 100644
--- a/src/tint/lang/wgsl/sem/node.h
+++ b/src/tint/lang/wgsl/sem/node.h
@@ -20,7 +20,7 @@
namespace tint::sem {
/// Node is the base class for all semantic nodes
-class Node : public utils::Castable<Node> {
+class Node : public Castable<Node> {
public:
/// Constructor
Node();
diff --git a/src/tint/lang/wgsl/sem/pipeline_stage_set.h b/src/tint/lang/wgsl/sem/pipeline_stage_set.h
index 4d98665..c21796f 100644
--- a/src/tint/lang/wgsl/sem/pipeline_stage_set.h
+++ b/src/tint/lang/wgsl/sem/pipeline_stage_set.h
@@ -20,7 +20,7 @@
namespace tint::sem {
-using PipelineStageSet = utils::EnumSet<ast::PipelineStage>;
+using PipelineStageSet = tint::EnumSet<ast::PipelineStage>;
} // namespace tint::sem
diff --git a/src/tint/lang/wgsl/sem/sampler_texture_pair.h b/src/tint/lang/wgsl/sem/sampler_texture_pair.h
index 46d4410..516a050 100644
--- a/src/tint/lang/wgsl/sem/sampler_texture_pair.h
+++ b/src/tint/lang/wgsl/sem/sampler_texture_pair.h
@@ -48,7 +48,7 @@
/// @param o the stream to write to
/// @param stp the SamplerTexturePair
/// @return the stream so calls can be chained
-inline utils::StringStream& operator<<(utils::StringStream& o, const SamplerTexturePair& stp) {
+inline StringStream& operator<<(StringStream& o, const SamplerTexturePair& stp) {
return o << "[sampler: " << stp.sampler_binding_point
<< ", texture: " << stp.sampler_binding_point << "]";
}
@@ -66,7 +66,7 @@
/// @param stp the texture pair to create a hash for
/// @return the hash value
inline std::size_t operator()(const tint::sem::SamplerTexturePair& stp) const {
- return tint::utils::Hash(stp.sampler_binding_point, stp.texture_binding_point);
+ return Hash(stp.sampler_binding_point, stp.texture_binding_point);
}
};
diff --git a/src/tint/lang/wgsl/sem/statement.h b/src/tint/lang/wgsl/sem/statement.h
index 21909b5..65b52c2 100644
--- a/src/tint/lang/wgsl/sem/statement.h
+++ b/src/tint/lang/wgsl/sem/statement.h
@@ -57,7 +57,7 @@
} // namespace detail
/// Statement holds the semantic information for a statement.
-class Statement : public utils::Castable<Statement, Node> {
+class Statement : public Castable<Statement, Node> {
public:
/// Constructor
/// @param declaration the AST node for this statement
@@ -133,7 +133,7 @@
/// CompoundStatement is the base class of statements that can hold other
/// statements.
-class CompoundStatement : public utils::Castable<CompoundStatement, Statement> {
+class CompoundStatement : public Castable<CompoundStatement, Statement> {
public:
/// Constructor
/// @param declaration the AST node for this statement
@@ -155,7 +155,7 @@
};
/// @returns a map of variable name to variable declarations associated with this block
- const utils::Hashmap<Symbol, OrderedLocalVariable, 4>& Decls() const { return decls_; }
+ const Hashmap<Symbol, OrderedLocalVariable, 4>& Decls() const { return decls_; }
/// Associates a declaration with this block.
/// @note this method must be called in variable declaration order
@@ -163,7 +163,7 @@
void AddDecl(const LocalVariable* var);
private:
- utils::Hashmap<Symbol, OrderedLocalVariable, 4> decls_;
+ Hashmap<Symbol, OrderedLocalVariable, 4> decls_;
};
template <typename Pred>
diff --git a/src/tint/lang/wgsl/sem/struct.cc b/src/tint/lang/wgsl/sem/struct.cc
index e71a6ad..e779ac0 100644
--- a/src/tint/lang/wgsl/sem/struct.cc
+++ b/src/tint/lang/wgsl/sem/struct.cc
@@ -23,7 +23,7 @@
Struct::Struct(const ast::Struct* declaration,
Symbol name,
- utils::VectorRef<const StructMember*> members,
+ VectorRef<const StructMember*> members,
uint32_t align,
uint32_t size,
uint32_t size_no_padding)
diff --git a/src/tint/lang/wgsl/sem/struct.h b/src/tint/lang/wgsl/sem/struct.h
index e731673..20dcdce 100644
--- a/src/tint/lang/wgsl/sem/struct.h
+++ b/src/tint/lang/wgsl/sem/struct.h
@@ -39,7 +39,7 @@
/// Struct holds the semantic information for structures.
/// Unlike type::Struct, sem::Struct has an AST declaration node.
-class Struct final : public utils::Castable<Struct, type::Struct> {
+class Struct final : public Castable<Struct, type::Struct> {
public:
/// Constructor
/// @param declaration the AST structure declaration
@@ -50,7 +50,7 @@
/// @param size_no_padding size of the members without the end of structure alignment padding
Struct(const ast::Struct* declaration,
Symbol name,
- utils::VectorRef<const StructMember*> members,
+ VectorRef<const StructMember*> members,
uint32_t align,
uint32_t size,
uint32_t size_no_padding);
@@ -62,7 +62,7 @@
const ast::Struct* Declaration() const { return declaration_; }
/// @returns the members of the structure
- utils::VectorRef<const StructMember*> Members() const {
+ VectorRef<const StructMember*> Members() const {
return Base::Members().ReinterpretCast<const StructMember*>();
}
@@ -72,7 +72,7 @@
/// StructMember holds the semantic information for structure members.
/// Unlike type::StructMember, sem::StructMember has an AST declaration node.
-class StructMember final : public utils::Castable<StructMember, type::StructMember> {
+class StructMember final : public Castable<StructMember, type::StructMember> {
public:
/// Constructor
/// @param declaration the AST declaration node
diff --git a/src/tint/lang/wgsl/sem/struct_test.cc b/src/tint/lang/wgsl/sem/struct_test.cc
index 3ab79e0..0706b01 100644
--- a/src/tint/lang/wgsl/sem/struct_test.cc
+++ b/src/tint/lang/wgsl/sem/struct_test.cc
@@ -24,9 +24,9 @@
TEST_F(SemStructTest, Creation) {
auto name = Sym("S");
- auto* impl = create<ast::Struct>(Ident(name), utils::Empty, utils::Empty);
+ auto* impl = create<ast::Struct>(Ident(name), tint::Empty, tint::Empty);
auto* ptr = impl;
- auto* s = create<sem::Struct>(impl, impl->name->symbol, utils::Empty, 4u /* align */,
+ auto* s = create<sem::Struct>(impl, impl->name->symbol, tint::Empty, 4u /* align */,
8u /* size */, 16u /* size_no_padding */);
EXPECT_EQ(s->Declaration(), ptr);
EXPECT_EQ(s->Align(), 4u);
@@ -35,11 +35,11 @@
}
TEST_F(SemStructTest, Equals) {
- auto* a_impl = create<ast::Struct>(Ident("a"), utils::Empty, utils::Empty);
- auto* a = create<sem::Struct>(a_impl, a_impl->name->symbol, utils::Empty, 4u /* align */,
+ auto* a_impl = create<ast::Struct>(Ident("a"), tint::Empty, tint::Empty);
+ auto* a = create<sem::Struct>(a_impl, a_impl->name->symbol, tint::Empty, 4u /* align */,
4u /* size */, 4u /* size_no_padding */);
- auto* b_impl = create<ast::Struct>(Ident("b"), utils::Empty, utils::Empty);
- auto* b = create<sem::Struct>(b_impl, b_impl->name->symbol, utils::Empty, 4u /* align */,
+ auto* b_impl = create<ast::Struct>(Ident("b"), tint::Empty, tint::Empty);
+ auto* b = create<sem::Struct>(b_impl, b_impl->name->symbol, tint::Empty, 4u /* align */,
4u /* size */, 4u /* size_no_padding */);
EXPECT_TRUE(a->Equals(*a));
@@ -49,8 +49,8 @@
TEST_F(SemStructTest, FriendlyName) {
auto name = Sym("my_struct");
- auto* impl = create<ast::Struct>(Ident(name), utils::Empty, utils::Empty);
- auto* s = create<sem::Struct>(impl, impl->name->symbol, utils::Empty, 4u /* align */,
+ auto* impl = create<ast::Struct>(Ident(name), tint::Empty, tint::Empty);
+ auto* s = create<sem::Struct>(impl, impl->name->symbol, tint::Empty, 4u /* align */,
4u /* size */, 4u /* size_no_padding */);
EXPECT_EQ(s->FriendlyName(), "my_struct");
}
diff --git a/src/tint/lang/wgsl/sem/switch_statement.h b/src/tint/lang/wgsl/sem/switch_statement.h
index 43c6bc6..2718e70 100644
--- a/src/tint/lang/wgsl/sem/switch_statement.h
+++ b/src/tint/lang/wgsl/sem/switch_statement.h
@@ -37,7 +37,7 @@
namespace tint::sem {
/// Holds semantic information about an switch statement
-class SwitchStatement final : public utils::Castable<SwitchStatement, CompoundStatement> {
+class SwitchStatement final : public Castable<SwitchStatement, CompoundStatement> {
public:
/// Constructor
/// @param declaration the AST node for this switch statement
@@ -64,7 +64,7 @@
};
/// Holds semantic information about a switch case statement
-class CaseStatement final : public utils::Castable<CaseStatement, CompoundStatement> {
+class CaseStatement final : public Castable<CaseStatement, CompoundStatement> {
public:
/// Constructor
/// @param declaration the AST node for this case statement
@@ -98,7 +98,7 @@
};
/// Holds semantic information about a switch case selector
-class CaseSelector final : public utils::Castable<CaseSelector, Node> {
+class CaseSelector final : public Castable<CaseSelector, Node> {
public:
/// Constructor
/// @param decl the selector declaration
diff --git a/src/tint/lang/wgsl/sem/type_expression.h b/src/tint/lang/wgsl/sem/type_expression.h
index 45baee7..6850f8a 100644
--- a/src/tint/lang/wgsl/sem/type_expression.h
+++ b/src/tint/lang/wgsl/sem/type_expression.h
@@ -25,7 +25,7 @@
namespace tint::sem {
/// TypeExpression holds the semantic information for expression nodes that resolve to types.
-class TypeExpression : public utils::Castable<TypeExpression, Expression> {
+class TypeExpression : public Castable<TypeExpression, Expression> {
public:
/// Constructor
/// @param declaration the AST node
diff --git a/src/tint/lang/wgsl/sem/type_mappings.h b/src/tint/lang/wgsl/sem/type_mappings.h
index 25434a1..1fd9b8e 100644
--- a/src/tint/lang/wgsl/sem/type_mappings.h
+++ b/src/tint/lang/wgsl/sem/type_mappings.h
@@ -20,9 +20,9 @@
#include "src/tint/lang/wgsl/sem/builtin_enum_expression.h"
// Forward declarations
-namespace tint::utils {
+namespace tint {
class CastableBase;
-} // namespace tint::utils
+} // namespace tint
namespace tint::ast {
class AccessorExpression;
class BinaryExpression;
@@ -78,7 +78,7 @@
struct TypeMappings {
//! @cond Doxygen_Suppress
BuiltinEnumExpression<builtin::BuiltinValue>* operator()(ast::BuiltinAttribute*);
- utils::CastableBase* operator()(ast::Node*);
+ CastableBase* operator()(ast::Node*);
Expression* operator()(ast::Expression*);
ForLoopStatement* operator()(ast::ForLoopStatement*);
Function* operator()(ast::Function*);
diff --git a/src/tint/lang/wgsl/sem/value_constructor.cc b/src/tint/lang/wgsl/sem/value_constructor.cc
index 97e811e..9f78fa2 100644
--- a/src/tint/lang/wgsl/sem/value_constructor.cc
+++ b/src/tint/lang/wgsl/sem/value_constructor.cc
@@ -21,7 +21,7 @@
namespace tint::sem {
ValueConstructor::ValueConstructor(const type::Type* type,
- utils::VectorRef<Parameter*> parameters,
+ VectorRef<Parameter*> parameters,
EvaluationStage stage)
: Base(type, std::move(parameters), stage, /* must_use */ true) {}
diff --git a/src/tint/lang/wgsl/sem/value_constructor.h b/src/tint/lang/wgsl/sem/value_constructor.h
index a8a488a..77248ef 100644
--- a/src/tint/lang/wgsl/sem/value_constructor.h
+++ b/src/tint/lang/wgsl/sem/value_constructor.h
@@ -21,14 +21,14 @@
namespace tint::sem {
/// ValueConstructor is the CallTarget for a value constructor.
-class ValueConstructor final : public utils::Castable<ValueConstructor, CallTarget> {
+class ValueConstructor final : public Castable<ValueConstructor, CallTarget> {
public:
/// Constructor
/// @param type the type that's being constructed
/// @param parameters the constructor parameters
/// @param stage the earliest evaluation stage for the expression
ValueConstructor(const type::Type* type,
- utils::VectorRef<Parameter*> parameters,
+ VectorRef<Parameter*> parameters,
EvaluationStage stage);
/// Destructor
diff --git a/src/tint/lang/wgsl/sem/value_conversion.cc b/src/tint/lang/wgsl/sem/value_conversion.cc
index 3049f74..95f5004 100644
--- a/src/tint/lang/wgsl/sem/value_conversion.cc
+++ b/src/tint/lang/wgsl/sem/value_conversion.cc
@@ -21,7 +21,7 @@
ValueConversion::ValueConversion(const type::Type* type,
sem::Parameter* parameter,
EvaluationStage stage)
- : Base(type, utils::Vector<sem::Parameter*, 1>{parameter}, stage, /* must_use */ true) {}
+ : Base(type, tint::Vector<sem::Parameter*, 1>{parameter}, stage, /* must_use */ true) {}
ValueConversion::~ValueConversion() = default;
diff --git a/src/tint/lang/wgsl/sem/value_conversion.h b/src/tint/lang/wgsl/sem/value_conversion.h
index 2eb0fd1..ff94656 100644
--- a/src/tint/lang/wgsl/sem/value_conversion.h
+++ b/src/tint/lang/wgsl/sem/value_conversion.h
@@ -20,7 +20,7 @@
namespace tint::sem {
/// ValueConversion is the CallTarget for a value conversion (cast).
-class ValueConversion final : public utils::Castable<ValueConversion, CallTarget> {
+class ValueConversion final : public Castable<ValueConversion, CallTarget> {
public:
/// Constructor
/// @param type the target type of the cast
diff --git a/src/tint/lang/wgsl/sem/value_expression.h b/src/tint/lang/wgsl/sem/value_expression.h
index 9f7355c..18d0cd9 100644
--- a/src/tint/lang/wgsl/sem/value_expression.h
+++ b/src/tint/lang/wgsl/sem/value_expression.h
@@ -29,7 +29,7 @@
namespace tint::sem {
/// ValueExpression holds the semantic information for expression nodes.
-class ValueExpression : public utils::Castable<ValueExpression, Expression> {
+class ValueExpression : public Castable<ValueExpression, Expression> {
public:
/// Constructor
/// @param declaration the AST node
diff --git a/src/tint/lang/wgsl/sem/variable.h b/src/tint/lang/wgsl/sem/variable.h
index 981939f..db6ed83 100644
--- a/src/tint/lang/wgsl/sem/variable.h
+++ b/src/tint/lang/wgsl/sem/variable.h
@@ -45,7 +45,7 @@
/// Variable is the base class for local variables, global variables and
/// parameters.
-class Variable : public utils::Castable<Variable, Node> {
+class Variable : public Castable<Variable, Node> {
public:
/// Constructor
/// @param declaration the AST declaration node
@@ -91,7 +91,7 @@
void SetInitializer(const ValueExpression* initializer) { initializer_ = initializer; }
/// @returns the expressions that use the variable
- utils::VectorRef<const VariableUser*> Users() const { return users_; }
+ VectorRef<const VariableUser*> Users() const { return users_; }
/// @param user the user to add
void AddUser(const VariableUser* user) { users_.Push(user); }
@@ -104,11 +104,11 @@
const builtin::Access access_;
const constant::Value* constant_value_;
const ValueExpression* initializer_ = nullptr;
- utils::Vector<const VariableUser*, 8> users_;
+ tint::Vector<const VariableUser*, 8> users_;
};
/// LocalVariable is a function-scope variable
-class LocalVariable final : public utils::Castable<LocalVariable, Variable> {
+class LocalVariable final : public Castable<LocalVariable, Variable> {
public:
/// Constructor
/// @param declaration the AST declaration node
@@ -133,19 +133,19 @@
const sem::Statement* Statement() const { return statement_; }
/// @returns the Type, Function or Variable that this local variable shadows
- const utils::CastableBase* Shadows() const { return shadows_; }
+ const CastableBase* Shadows() const { return shadows_; }
/// Sets the Type, Function or Variable that this local variable shadows
/// @param shadows the Type, Function or Variable that this variable shadows
- void SetShadows(const utils::CastableBase* shadows) { shadows_ = shadows; }
+ void SetShadows(const CastableBase* shadows) { shadows_ = shadows; }
private:
const sem::Statement* const statement_;
- const utils::CastableBase* shadows_ = nullptr;
+ const CastableBase* shadows_ = nullptr;
};
/// GlobalVariable is a module-scope variable
-class GlobalVariable final : public utils::Castable<GlobalVariable, Variable> {
+class GlobalVariable final : public Castable<GlobalVariable, Variable> {
public:
/// Constructor
/// @param declaration the AST declaration node
@@ -197,7 +197,7 @@
};
/// Parameter is a function parameter
-class Parameter final : public utils::Castable<Parameter, Variable> {
+class Parameter final : public Castable<Parameter, Variable> {
public:
/// Constructor for function parameters
/// @param declaration the AST declaration node
@@ -238,11 +238,11 @@
void SetOwner(CallTarget const* owner) { owner_ = owner; }
/// @returns the Type, Function or Variable that this local variable shadows
- const utils::CastableBase* Shadows() const { return shadows_; }
+ const CastableBase* Shadows() const { return shadows_; }
/// Sets the Type, Function or Variable that this local variable shadows
/// @param shadows the Type, Function or Variable that this variable shadows
- void SetShadows(const utils::CastableBase* shadows) { shadows_ = shadows; }
+ void SetShadows(const CastableBase* shadows) { shadows_ = shadows; }
/// @returns the resource binding point for the parameter
std::optional<tint::BindingPoint> BindingPoint() const { return binding_point_; }
@@ -254,14 +254,14 @@
const uint32_t index_;
const ParameterUsage usage_;
CallTarget const* owner_ = nullptr;
- const utils::CastableBase* shadows_ = nullptr;
+ const CastableBase* shadows_ = nullptr;
const std::optional<tint::BindingPoint> binding_point_;
const std::optional<uint32_t> location_;
};
/// VariableUser holds the semantic information for an identifier expression
/// node that resolves to a variable.
-class VariableUser final : public utils::Castable<VariableUser, ValueExpression> {
+class VariableUser final : public Castable<VariableUser, ValueExpression> {
public:
/// Constructor
/// @param declaration the AST identifier node
@@ -297,7 +297,7 @@
/// @param i the variable pair to create a hash for
/// @return the hash value
inline std::size_t operator()(const tint::sem::VariablePair& i) const {
- return tint::utils::Hash(i.first, i.second);
+ return Hash(i.first, i.second);
}
};
diff --git a/src/tint/lang/wgsl/sem/while_statement.h b/src/tint/lang/wgsl/sem/while_statement.h
index edd1e2d..fed8bf1 100644
--- a/src/tint/lang/wgsl/sem/while_statement.h
+++ b/src/tint/lang/wgsl/sem/while_statement.h
@@ -28,7 +28,7 @@
namespace tint::sem {
/// Holds semantic information about a while statement
-class WhileStatement final : public utils::Castable<WhileStatement, CompoundStatement> {
+class WhileStatement final : public Castable<WhileStatement, CompoundStatement> {
public:
/// Constructor
/// @param declaration the AST node for this while statement
diff --git a/src/tint/lang/wgsl/writer/ast_printer/alias_type_test.cc b/src/tint/lang/wgsl/writer/ast_printer/alias_type_test.cc
index f24d939..79d202f 100644
--- a/src/tint/lang/wgsl/writer/ast_printer/alias_type_test.cc
+++ b/src/tint/lang/wgsl/writer/ast_printer/alias_type_test.cc
@@ -33,7 +33,7 @@
}
TEST_F(WgslASTPrinterTest, EmitTypeDecl_Struct) {
- auto* s = Structure("A", utils::Vector{
+ auto* s = Structure("A", Vector{
Member("a", ty.f32()),
Member("b", ty.i32()),
});
@@ -55,7 +55,7 @@
}
TEST_F(WgslASTPrinterTest, EmitAlias_ToStruct) {
- auto* s = Structure("A", utils::Vector{
+ auto* s = Structure("A", Vector{
Member("a", ty.f32()),
Member("b", ty.i32()),
});
diff --git a/src/tint/lang/wgsl/writer/ast_printer/array_accessor_test.cc b/src/tint/lang/wgsl/writer/ast_printer/array_accessor_test.cc
index 3de6a1f..ff1dfb9 100644
--- a/src/tint/lang/wgsl/writer/ast_printer/array_accessor_test.cc
+++ b/src/tint/lang/wgsl/writer/ast_printer/array_accessor_test.cc
@@ -31,7 +31,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "ary[5i]");
@@ -46,7 +46,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "(*(p))[5i]");
diff --git a/src/tint/lang/wgsl/writer/ast_printer/ast_printer.cc b/src/tint/lang/wgsl/writer/ast_printer/ast_printer.cc
index 38e4127..07a2edf 100644
--- a/src/tint/lang/wgsl/writer/ast_printer/ast_printer.cc
+++ b/src/tint/lang/wgsl/writer/ast_printer/ast_printer.cc
@@ -116,7 +116,7 @@
}
}
-void ASTPrinter::EmitDiagnosticControl(utils::StringStream& out,
+void ASTPrinter::EmitDiagnosticControl(StringStream& out,
const ast::DiagnosticControl& diagnostic) {
out << "diagnostic(" << diagnostic.severity << ", " << diagnostic.rule_name->String() << ")";
}
@@ -149,7 +149,7 @@
});
}
-void ASTPrinter::EmitExpression(utils::StringStream& out, const ast::Expression* expr) {
+void ASTPrinter::EmitExpression(StringStream& out, const ast::Expression* expr) {
Switch(
expr, //
[&](const ast::IndexAccessorExpression* a) { EmitIndexAccessor(out, a); },
@@ -164,8 +164,7 @@
[&](Default) { diagnostics_.add_error(diag::System::Writer, "unknown expression type"); });
}
-void ASTPrinter::EmitIndexAccessor(utils::StringStream& out,
- const ast::IndexAccessorExpression* expr) {
+void ASTPrinter::EmitIndexAccessor(StringStream& out, const ast::IndexAccessorExpression* expr) {
bool paren_lhs =
!expr->object
->IsAnyOf<ast::AccessorExpression, ast::CallExpression, ast::IdentifierExpression>();
@@ -182,8 +181,7 @@
out << "]";
}
-void ASTPrinter::EmitMemberAccessor(utils::StringStream& out,
- const ast::MemberAccessorExpression* expr) {
+void ASTPrinter::EmitMemberAccessor(StringStream& out, const ast::MemberAccessorExpression* expr) {
bool paren_lhs =
!expr->object
->IsAnyOf<ast::AccessorExpression, ast::CallExpression, ast::IdentifierExpression>();
@@ -198,7 +196,7 @@
out << "." << expr->member->symbol.Name();
}
-void ASTPrinter::EmitBitcast(utils::StringStream& out, const ast::BitcastExpression* expr) {
+void ASTPrinter::EmitBitcast(StringStream& out, const ast::BitcastExpression* expr) {
out << "bitcast<";
EmitExpression(out, expr->type);
@@ -207,7 +205,7 @@
out << ")";
}
-void ASTPrinter::EmitCall(utils::StringStream& out, const ast::CallExpression* expr) {
+void ASTPrinter::EmitCall(StringStream& out, const ast::CallExpression* expr) {
EmitExpression(out, expr->target);
out << "(";
@@ -224,7 +222,7 @@
out << ")";
}
-void ASTPrinter::EmitLiteral(utils::StringStream& out, const ast::LiteralExpression* lit) {
+void ASTPrinter::EmitLiteral(StringStream& out, const ast::LiteralExpression* lit) {
Switch(
lit, //
[&](const ast::BoolLiteralExpression* l) { out << (l->value ? "true" : "false"); },
@@ -244,11 +242,11 @@
[&](Default) { diagnostics_.add_error(diag::System::Writer, "unknown literal type"); });
}
-void ASTPrinter::EmitIdentifier(utils::StringStream& out, const ast::IdentifierExpression* expr) {
+void ASTPrinter::EmitIdentifier(StringStream& out, const ast::IdentifierExpression* expr) {
EmitIdentifier(out, expr->identifier);
}
-void ASTPrinter::EmitIdentifier(utils::StringStream& out, const ast::Identifier* ident) {
+void ASTPrinter::EmitIdentifier(StringStream& out, const ast::Identifier* ident) {
if (auto* tmpl_ident = ident->As<ast::TemplatedIdentifier>()) {
if (!tmpl_ident->attributes.IsEmpty()) {
EmitAttributes(out, tmpl_ident->attributes);
@@ -317,7 +315,7 @@
}
}
-void ASTPrinter::EmitImageFormat(utils::StringStream& out, const builtin::TexelFormat fmt) {
+void ASTPrinter::EmitImageFormat(StringStream& out, const builtin::TexelFormat fmt) {
switch (fmt) {
case builtin::TexelFormat::kUndefined:
diagnostics_.add_error(diag::System::Writer, "unknown image format");
@@ -334,14 +332,14 @@
}
Line() << "struct " << str->name->symbol.Name() << " {";
- utils::Hashset<std::string_view, 8> member_names;
+ Hashset<std::string_view, 8> member_names;
for (auto* mem : str->members) {
member_names.Add(mem->name->symbol.NameView());
}
size_t padding_idx = 0;
auto new_padding_name = [&] {
while (true) {
- auto name = "padding_" + utils::ToString(padding_idx++);
+ auto name = "padding_" + tint::ToString(padding_idx++);
if (member_names.Add(name)) {
return name;
}
@@ -362,7 +360,7 @@
// TODO(crbug.com/tint/798) move the @offset attribute handling to the transform::Wgsl
// sanitizer.
if (auto* mem_sem = program_->Sem().Get(mem)) {
- offset = utils::RoundUp(mem_sem->Align(), offset);
+ offset = tint::RoundUp(mem_sem->Align(), offset);
if (uint32_t padding = mem_sem->Offset() - offset) {
add_padding(padding);
offset += padding;
@@ -373,13 +371,13 @@
// Offset attributes no longer exist in the WGSL spec, but are emitted
// by the SPIR-V reader and are consumed by the Resolver(). These should not
// be emitted, but instead struct padding fields should be emitted.
- utils::Vector<const ast::Attribute*, 4> attributes_sanitized;
+ Vector<const ast::Attribute*, 4> attributes_sanitized;
attributes_sanitized.Reserve(mem->attributes.Length());
for (auto* attr : mem->attributes) {
if (attr->Is<ast::StructMemberOffsetAttribute>()) {
auto l = Line();
l << "/* ";
- EmitAttributes(l, utils::Vector{attr});
+ EmitAttributes(l, Vector{attr});
l << " */";
} else {
attributes_sanitized.Push(attr);
@@ -400,7 +398,7 @@
Line() << "}";
}
-void ASTPrinter::EmitVariable(utils::StringStream& out, const ast::Variable* v) {
+void ASTPrinter::EmitVariable(StringStream& out, const ast::Variable* v) {
if (!v->attributes.IsEmpty()) {
EmitAttributes(out, v->attributes);
out << " ";
@@ -440,8 +438,7 @@
out << ";";
}
-void ASTPrinter::EmitAttributes(utils::StringStream& out,
- utils::VectorRef<const ast::Attribute*> attrs) {
+void ASTPrinter::EmitAttributes(StringStream& out, VectorRef<const ast::Attribute*> attrs) {
bool first = true;
for (auto* attr : attrs) {
if (!first) {
@@ -535,7 +532,7 @@
}
}
-void ASTPrinter::EmitBinary(utils::StringStream& out, const ast::BinaryExpression* expr) {
+void ASTPrinter::EmitBinary(StringStream& out, const ast::BinaryExpression* expr) {
out << "(";
EmitExpression(out, expr->lhs);
@@ -547,7 +544,7 @@
out << ")";
}
-void ASTPrinter::EmitBinaryOp(utils::StringStream& out, const ast::BinaryOp op) {
+void ASTPrinter::EmitBinaryOp(StringStream& out, const ast::BinaryOp op) {
switch (op) {
case ast::BinaryOp::kAnd:
out << "&";
@@ -609,7 +606,7 @@
}
}
-void ASTPrinter::EmitUnaryOp(utils::StringStream& out, const ast::UnaryOpExpression* expr) {
+void ASTPrinter::EmitUnaryOp(StringStream& out, const ast::UnaryOpExpression* expr) {
switch (expr->op) {
case ast::UnaryOp::kAddressOf:
out << "&";
@@ -641,7 +638,7 @@
Line() << "}";
}
-void ASTPrinter::EmitBlockHeader(utils::StringStream& out, const ast::BlockStatement* stmt) {
+void ASTPrinter::EmitBlockHeader(StringStream& out, const ast::BlockStatement* stmt) {
if (!stmt->attributes.IsEmpty()) {
EmitAttributes(out, stmt->attributes);
out << " ";
@@ -679,13 +676,13 @@
});
}
-void ASTPrinter::EmitStatements(utils::VectorRef<const ast::Statement*> stmts) {
+void ASTPrinter::EmitStatements(VectorRef<const ast::Statement*> stmts) {
for (auto* s : stmts) {
EmitStatement(s);
}
}
-void ASTPrinter::EmitStatementsWithIndent(utils::VectorRef<const ast::Statement*> stmts) {
+void ASTPrinter::EmitStatementsWithIndent(VectorRef<const ast::Statement*> stmts) {
ScopedIndent si(this);
EmitStatements(stmts);
}
@@ -873,14 +870,14 @@
case 0: // No initializer
break;
case 1: // Single line initializer statement
- out << utils::TrimSuffix(init_buf.lines[0].content, ";");
+ out << tint::TrimSuffix(init_buf.lines[0].content, ";");
break;
default: // Block initializer statement
for (size_t i = 1; i < init_buf.lines.size(); i++) {
// Indent all by the first line
init_buf.lines[i].indent += current_buffer_->current_indent;
}
- out << utils::TrimSuffix(init_buf.String(), "\n");
+ out << tint::TrimSuffix(init_buf.String(), "\n");
break;
}
@@ -896,14 +893,14 @@
case 0: // No continuing
break;
case 1: // Single line continuing statement
- out << utils::TrimSuffix(cont_buf.lines[0].content, ";");
+ out << tint::TrimSuffix(cont_buf.lines[0].content, ";");
break;
default: // Block continuing statement
for (size_t i = 1; i < cont_buf.lines.size(); i++) {
// Indent all by the first line
cont_buf.lines[i].indent += current_buffer_->current_indent;
}
- out << utils::TrimSuffix(cont_buf.String(), "\n");
+ out << tint::TrimSuffix(cont_buf.String(), "\n");
break;
}
}
diff --git a/src/tint/lang/wgsl/writer/ast_printer/ast_printer.h b/src/tint/lang/wgsl/writer/ast_printer/ast_printer.h
index 99f07ee..10fc7ab 100644
--- a/src/tint/lang/wgsl/writer/ast_printer/ast_printer.h
+++ b/src/tint/lang/wgsl/writer/ast_printer/ast_printer.h
@@ -70,7 +70,7 @@
namespace tint::wgsl::writer {
/// Implementation class for WGSL generator
-class ASTPrinter : public utils::TextGenerator {
+class ASTPrinter : public tint::TextGenerator {
public:
/// Constructor
/// @param program the program
@@ -83,7 +83,7 @@
/// Handles generating a diagnostic control
/// @param out the output stream
/// @param diagnostic the diagnostic control node
- void EmitDiagnosticControl(utils::StringStream& out, const ast::DiagnosticControl& diagnostic);
+ void EmitDiagnosticControl(StringStream& out, const ast::DiagnosticControl& diagnostic);
/// Handles generating an enable directive
/// @param enable the enable node
void EmitEnable(const ast::Enable* enable);
@@ -93,29 +93,29 @@
/// Handles an index accessor expression
/// @param out the output stream
/// @param expr the expression to emit
- void EmitIndexAccessor(utils::StringStream& out, const ast::IndexAccessorExpression* expr);
+ void EmitIndexAccessor(StringStream& out, const ast::IndexAccessorExpression* expr);
/// Handles an assignment statement
/// @param stmt the statement to emit
void EmitAssign(const ast::AssignmentStatement* stmt);
/// Handles generating a binary expression
/// @param out the output stream
/// @param expr the binary expression
- void EmitBinary(utils::StringStream& out, const ast::BinaryExpression* expr);
+ void EmitBinary(StringStream& out, const ast::BinaryExpression* expr);
/// Handles generating a binary operator
/// @param out the output stream
/// @param op the binary operator
- void EmitBinaryOp(utils::StringStream& out, const ast::BinaryOp op);
+ void EmitBinaryOp(StringStream& out, const ast::BinaryOp op);
/// Handles generating a bitcast expression
/// @param out the output stream
/// @param expr the bitcast expression
- void EmitBitcast(utils::StringStream& out, const ast::BitcastExpression* expr);
+ void EmitBitcast(StringStream& out, const ast::BitcastExpression* expr);
/// Handles a block statement
/// @param stmt the statement to emit
void EmitBlock(const ast::BlockStatement* stmt);
/// Handles emitting the start of a block statement (including attributes)
/// @param out the output stream to write the header to
/// @param stmt the block statement to emit the header for
- void EmitBlockHeader(utils::StringStream& out, const ast::BlockStatement* stmt);
+ void EmitBlockHeader(StringStream& out, const ast::BlockStatement* stmt);
/// Handles a break statement
/// @param stmt the statement to emit
void EmitBreak(const ast::BreakStatement* stmt);
@@ -125,7 +125,7 @@
/// Handles generating a call expression
/// @param out the output stream
/// @param expr the call expression
- void EmitCall(utils::StringStream& out, const ast::CallExpression* expr);
+ void EmitCall(StringStream& out, const ast::CallExpression* expr);
/// Handles a case statement
/// @param stmt the statement
void EmitCase(const ast::CaseStatement* stmt);
@@ -135,25 +135,25 @@
/// Handles generating a literal expression
/// @param out the output stream
/// @param expr the literal expression expression
- void EmitLiteral(utils::StringStream& out, const ast::LiteralExpression* expr);
+ void EmitLiteral(StringStream& out, const ast::LiteralExpression* expr);
/// Handles a continue statement
/// @param stmt the statement to emit
void EmitContinue(const ast::ContinueStatement* stmt);
/// Handles generate an Expression
/// @param out the output stream
/// @param expr the expression
- void EmitExpression(utils::StringStream& out, const ast::Expression* expr);
+ void EmitExpression(StringStream& out, const ast::Expression* expr);
/// Handles generating a function
/// @param func the function to generate
void EmitFunction(const ast::Function* func);
/// Handles generating an identifier expression
/// @param out the output stream
/// @param expr the identifier expression
- void EmitIdentifier(utils::StringStream& out, const ast::IdentifierExpression* expr);
+ void EmitIdentifier(StringStream& out, const ast::IdentifierExpression* expr);
/// Handles generating an identifier
/// @param out the output of the expression stream
/// @param ident the identifier
- void EmitIdentifier(utils::StringStream& out, const ast::Identifier* ident);
+ void EmitIdentifier(StringStream& out, const ast::Identifier* ident);
/// Handles an if statement
/// @param stmt the statement to emit
void EmitIf(const ast::IfStatement* stmt);
@@ -175,7 +175,7 @@
/// Handles a member accessor expression
/// @param out the output stream
/// @param expr the member accessor expression
- void EmitMemberAccessor(utils::StringStream& out, const ast::MemberAccessorExpression* expr);
+ void EmitMemberAccessor(StringStream& out, const ast::MemberAccessorExpression* expr);
/// Handles return statements
/// @param stmt the statement to emit
void EmitReturn(const ast::ReturnStatement* stmt);
@@ -187,10 +187,10 @@
void EmitStatement(const ast::Statement* stmt);
/// Handles a statement list
/// @param stmts the statements to emit
- void EmitStatements(utils::VectorRef<const ast::Statement*> stmts);
+ void EmitStatements(VectorRef<const ast::Statement*> stmts);
/// Handles a statement list with an increased indentation
/// @param stmts the statements to emit
- void EmitStatementsWithIndent(utils::VectorRef<const ast::Statement*> stmts);
+ void EmitStatementsWithIndent(VectorRef<const ast::Statement*> stmts);
/// Handles generating a switch statement
/// @param stmt the statement to emit
void EmitSwitch(const ast::SwitchStatement* stmt);
@@ -200,19 +200,19 @@
/// Handles emitting an image format
/// @param out the output stream
/// @param fmt the format to generate
- void EmitImageFormat(utils::StringStream& out, const builtin::TexelFormat fmt);
+ void EmitImageFormat(StringStream& out, const builtin::TexelFormat fmt);
/// Handles a unary op expression
/// @param out the output stream
/// @param expr the expression to emit
- void EmitUnaryOp(utils::StringStream& out, const ast::UnaryOpExpression* expr);
+ void EmitUnaryOp(StringStream& out, const ast::UnaryOpExpression* expr);
/// Handles generating a variable
/// @param out the output stream
/// @param var the variable to generate
- void EmitVariable(utils::StringStream& out, const ast::Variable* var);
+ void EmitVariable(StringStream& out, const ast::Variable* var);
/// Handles generating a attribute list
/// @param out the output stream
/// @param attrs the attribute list
- void EmitAttributes(utils::StringStream& out, utils::VectorRef<const ast::Attribute*> attrs);
+ void EmitAttributes(StringStream& out, VectorRef<const ast::Attribute*> attrs);
private:
Program const* const program_;
diff --git a/src/tint/lang/wgsl/writer/ast_printer/binary_test.cc b/src/tint/lang/wgsl/writer/ast_printer/binary_test.cc
index 29ebddb..1d6595c 100644
--- a/src/tint/lang/wgsl/writer/ast_printer/binary_test.cc
+++ b/src/tint/lang/wgsl/writer/ast_printer/binary_test.cc
@@ -25,7 +25,7 @@
ast::BinaryOp op;
};
inline std::ostream& operator<<(std::ostream& out, BinaryData data) {
- utils::StringStream str;
+ StringStream str;
str << data.op;
out << str.str();
return out;
@@ -52,7 +52,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), params.result);
diff --git a/src/tint/lang/wgsl/writer/ast_printer/bitcast_test.cc b/src/tint/lang/wgsl/writer/ast_printer/bitcast_test.cc
index cd08116..efc6962 100644
--- a/src/tint/lang/wgsl/writer/ast_printer/bitcast_test.cc
+++ b/src/tint/lang/wgsl/writer/ast_printer/bitcast_test.cc
@@ -30,7 +30,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, bitcast);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "bitcast<f32>(1i)");
diff --git a/src/tint/lang/wgsl/writer/ast_printer/call_test.cc b/src/tint/lang/wgsl/writer/ast_printer/call_test.cc
index d8279ae..2b4df2e 100644
--- a/src/tint/lang/wgsl/writer/ast_printer/call_test.cc
+++ b/src/tint/lang/wgsl/writer/ast_printer/call_test.cc
@@ -26,8 +26,8 @@
using WgslASTPrinterTest = TestHelper;
TEST_F(WgslASTPrinterTest, EmitExpression_Call_WithoutParams) {
- Func("my_func", utils::Empty, ty.f32(),
- utils::Vector{
+ Func("my_func", tint::Empty, ty.f32(),
+ Vector{
Return(1.23_f),
});
@@ -36,7 +36,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, call);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "my_func()");
@@ -44,12 +44,12 @@
TEST_F(WgslASTPrinterTest, EmitExpression_Call_WithParams) {
Func("my_func",
- utils::Vector{
+ Vector{
Param(Sym(), ty.f32()),
Param(Sym(), ty.f32()),
},
ty.f32(),
- utils::Vector{
+ Vector{
Return(1.23_f),
});
GlobalVar("param1", ty.f32(), builtin::AddressSpace::kPrivate);
@@ -60,7 +60,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, call);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "my_func(param1, param2)");
@@ -68,11 +68,11 @@
TEST_F(WgslASTPrinterTest, EmitStatement_Call) {
Func("my_func",
- utils::Vector{
+ Vector{
Param(Sym(), ty.f32()),
Param(Sym(), ty.f32()),
},
- ty.void_(), utils::Empty, utils::Empty);
+ ty.void_(), tint::Empty, tint::Empty);
GlobalVar("param1", ty.f32(), builtin::AddressSpace::kPrivate);
GlobalVar("param2", ty.f32(), builtin::AddressSpace::kPrivate);
diff --git a/src/tint/lang/wgsl/writer/ast_printer/case_test.cc b/src/tint/lang/wgsl/writer/ast_printer/case_test.cc
index e470e86..ba79b81 100644
--- a/src/tint/lang/wgsl/writer/ast_printer/case_test.cc
+++ b/src/tint/lang/wgsl/writer/ast_printer/case_test.cc
@@ -43,7 +43,7 @@
TEST_F(WgslASTPrinterTest, Emit_Case_MultipleSelectors) {
auto* s = Switch(1_i,
Case(
- utils::Vector{
+ Vector{
CaseSelector(5_i),
CaseSelector(6_i),
},
diff --git a/src/tint/lang/wgsl/writer/ast_printer/cast_test.cc b/src/tint/lang/wgsl/writer/ast_printer/cast_test.cc
index d66a3b0..0b0e8a6 100644
--- a/src/tint/lang/wgsl/writer/ast_printer/cast_test.cc
+++ b/src/tint/lang/wgsl/writer/ast_printer/cast_test.cc
@@ -31,7 +31,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, cast);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "f32(1i)");
@@ -45,7 +45,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, cast);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "f16(1i)");
@@ -57,7 +57,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, cast);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "vec3<f32>(vec3<i32>(1i, 2i, 3i))");
@@ -71,7 +71,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, cast);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "vec3<f16>(vec3<i32>(1i, 2i, 3i))");
diff --git a/src/tint/lang/wgsl/writer/ast_printer/const_assert_test.cc b/src/tint/lang/wgsl/writer/ast_printer/const_assert_test.cc
index ca85489..f929348 100644
--- a/src/tint/lang/wgsl/writer/ast_printer/const_assert_test.cc
+++ b/src/tint/lang/wgsl/writer/ast_printer/const_assert_test.cc
@@ -34,7 +34,7 @@
}
TEST_F(WgslASTPrinterTest, Emit_FunctionConstAssert) {
- Func("f", utils::Empty, ty.void_(), utils::Vector{ConstAssert(true)});
+ Func("f", tint::Empty, ty.void_(), Vector{ConstAssert(true)});
ASTPrinter& gen = Build();
gen.Generate();
diff --git a/src/tint/lang/wgsl/writer/ast_printer/diagnostic_test.cc b/src/tint/lang/wgsl/writer/ast_printer/diagnostic_test.cc
index 19c907c..e76a90c 100644
--- a/src/tint/lang/wgsl/writer/ast_printer/diagnostic_test.cc
+++ b/src/tint/lang/wgsl/writer/ast_printer/diagnostic_test.cc
@@ -35,7 +35,7 @@
TEST_F(WgslASTPrinterTest, Emit_DiagnosticAttribute) {
auto* attr =
DiagnosticAttribute(builtin::DiagnosticSeverity::kError, "chromium", "unreachable_code");
- Func("foo", {}, ty.void_(), {}, utils::Vector{attr});
+ Func("foo", {}, ty.void_(), {}, Vector{attr});
ASTPrinter& gen = Build();
gen.Generate();
diff --git a/src/tint/lang/wgsl/writer/ast_printer/discard_test.cc b/src/tint/lang/wgsl/writer/ast_printer/discard_test.cc
index 24d556fb9..a04e75a 100644
--- a/src/tint/lang/wgsl/writer/ast_printer/discard_test.cc
+++ b/src/tint/lang/wgsl/writer/ast_printer/discard_test.cc
@@ -24,8 +24,7 @@
TEST_F(WgslASTPrinterTest, Emit_Discard) {
auto* stmt = Discard();
- Func("F", utils::Empty, ty.void_(), utils::Vector{stmt},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{stmt}, Vector{Stage(ast::PipelineStage::kFragment)});
ASTPrinter& gen = Build();
diff --git a/src/tint/lang/wgsl/writer/ast_printer/function_test.cc b/src/tint/lang/wgsl/writer/ast_printer/function_test.cc
index 8fb71cd..5ae3823 100644
--- a/src/tint/lang/wgsl/writer/ast_printer/function_test.cc
+++ b/src/tint/lang/wgsl/writer/ast_printer/function_test.cc
@@ -28,8 +28,8 @@
using WgslASTPrinterTest = TestHelper;
TEST_F(WgslASTPrinterTest, Emit_Function) {
- auto* func = Func("my_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("my_func", tint::Empty, ty.void_(),
+ Vector{
Return(),
});
@@ -46,12 +46,12 @@
TEST_F(WgslASTPrinterTest, Emit_Function_WithParams) {
auto* func = Func("my_func",
- utils::Vector{
+ Vector{
Param("a", ty.f32()),
Param("b", ty.i32()),
},
ty.void_(),
- utils::Vector{
+ Vector{
Return(),
});
@@ -67,11 +67,11 @@
}
TEST_F(WgslASTPrinterTest, Emit_Function_WithAttribute_WorkgroupSize) {
- auto* func = Func("my_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("my_func", tint::Empty, ty.void_(),
+ Vector{
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(2_i, 4_i, 6_i),
});
@@ -89,11 +89,11 @@
}
TEST_F(WgslASTPrinterTest, Emit_Function_WithAttribute_MustUse) {
- auto* func = Func("my_func", utils::Empty, ty.i32(),
- utils::Vector{
+ auto* func = Func("my_func", tint::Empty, ty.i32(),
+ Vector{
Return(1_i),
},
- utils::Vector{
+ Vector{
MustUse(),
});
@@ -111,11 +111,11 @@
TEST_F(WgslASTPrinterTest, Emit_Function_WithAttribute_WorkgroupSize_WithIdent) {
GlobalConst("height", ty.i32(), Expr(2_i));
- auto* func = Func("my_func", utils::Empty, ty.void_(),
- utils::Vector{
+ auto* func = Func("my_func", tint::Empty, ty.void_(),
+ Vector{
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(2_i, "height"),
});
@@ -135,15 +135,15 @@
TEST_F(WgslASTPrinterTest, Emit_Function_EntryPoint_Parameters) {
auto vec4 = ty.vec4<f32>();
auto* coord = Param("coord", vec4,
- utils::Vector{
+ Vector{
Builtin(builtin::BuiltinValue::kPosition),
});
auto* loc1 = Param("loc1", ty.f32(),
- utils::Vector{
+ Vector{
Location(1_a),
});
- auto* func = Func("frag_main", utils::Vector{coord, loc1}, ty.void_(), utils::Empty,
- utils::Vector{
+ auto* func = Func("frag_main", Vector{coord, loc1}, ty.void_(), tint::Empty,
+ Vector{
Stage(ast::PipelineStage::kFragment),
});
@@ -159,14 +159,14 @@
}
TEST_F(WgslASTPrinterTest, Emit_Function_EntryPoint_ReturnValue) {
- auto* func = Func("frag_main", utils::Empty, ty.f32(),
- utils::Vector{
+ auto* func = Func("frag_main", tint::Empty, ty.f32(),
+ Vector{
Return(1_f),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kFragment),
},
- utils::Vector{
+ Vector{
Location(1_a),
});
@@ -199,7 +199,7 @@
// return;
// }
- auto* s = Structure("Data", utils::Vector{
+ auto* s = Structure("Data", Vector{
Member("d", ty.f32()),
});
@@ -209,12 +209,12 @@
{
auto* var = Var("v", ty.f32(), MemberAccessor("data", "d"));
- Func("a", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("a", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
@@ -223,12 +223,12 @@
{
auto* var = Var("v", ty.f32(), MemberAccessor("data", "d"));
- Func("b", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("b", tint::Empty, ty.void_(),
+ Vector{
Decl(var),
Return(),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
diff --git a/src/tint/lang/wgsl/writer/ast_printer/global_decl_test.cc b/src/tint/lang/wgsl/writer/ast_printer/global_decl_test.cc
index 380cb22..c1d6fbf 100644
--- a/src/tint/lang/wgsl/writer/ast_printer/global_decl_test.cc
+++ b/src/tint/lang/wgsl/writer/ast_printer/global_decl_test.cc
@@ -50,29 +50,29 @@
TEST_F(WgslASTPrinterTest, Emit_GlobalsInterleaved) {
GlobalVar("a0", ty.f32(), builtin::AddressSpace::kPrivate);
- auto* s0 = Structure("S0", utils::Vector{
+ auto* s0 = Structure("S0", Vector{
Member("a", ty.i32()),
});
Func("func", {}, ty.f32(),
- utils::Vector{
+ Vector{
Return("a0"),
},
- utils::Empty);
+ tint::Empty);
GlobalVar("a1", ty.f32(), builtin::AddressSpace::kPrivate);
- auto* s1 = Structure("S1", utils::Vector{
+ auto* s1 = Structure("S1", Vector{
Member("a", ty.i32()),
});
Func("main", {}, ty.void_(),
- utils::Vector{
+ Vector{
Decl(Var("s0", ty.Of(s0))),
Decl(Var("s1", ty.Of(s1))),
Assign("a1", Call("func")),
},
- utils::Vector{
+ Vector{
Stage(ast::PipelineStage::kCompute),
WorkgroupSize(1_i),
});
diff --git a/src/tint/lang/wgsl/writer/ast_printer/identifier_test.cc b/src/tint/lang/wgsl/writer/ast_printer/identifier_test.cc
index db35228..f9a5910 100644
--- a/src/tint/lang/wgsl/writer/ast_printer/identifier_test.cc
+++ b/src/tint/lang/wgsl/writer/ast_printer/identifier_test.cc
@@ -29,7 +29,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, i);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "glsl");
diff --git a/src/tint/lang/wgsl/writer/ast_printer/literal_test.cc b/src/tint/lang/wgsl/writer/ast_printer/literal_test.cc
index a292d85..77c1fce 100644
--- a/src/tint/lang/wgsl/writer/ast_printer/literal_test.cc
+++ b/src/tint/lang/wgsl/writer/ast_printer/literal_test.cc
@@ -117,7 +117,7 @@
SetResolveOnBuild(false);
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitLiteral(out, v);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), GetParam().expected);
@@ -166,7 +166,7 @@
SetResolveOnBuild(false);
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitLiteral(out, v);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), GetParam().expected);
diff --git a/src/tint/lang/wgsl/writer/ast_printer/loop_test.cc b/src/tint/lang/wgsl/writer/ast_printer/loop_test.cc
index 3f8a42d..aafa543 100644
--- a/src/tint/lang/wgsl/writer/ast_printer/loop_test.cc
+++ b/src/tint/lang/wgsl/writer/ast_printer/loop_test.cc
@@ -28,8 +28,7 @@
auto* continuing = Block();
auto* l = Loop(body, continuing);
- Func("F", utils::Empty, ty.void_(), utils::Vector{l},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{l}, Vector{Stage(ast::PipelineStage::kFragment)});
ASTPrinter& gen = Build();
@@ -50,8 +49,7 @@
auto* continuing = Block(CallStmt(Call("a_statement")));
auto* l = Loop(body, continuing);
- Func("F", utils::Empty, ty.void_(), utils::Vector{l},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{l}, Vector{Stage(ast::PipelineStage::kFragment)});
ASTPrinter& gen = Build();
@@ -76,8 +74,7 @@
auto* continuing = Block(CallStmt(Call("a_statement")), BreakIf(true));
auto* l = Loop(body, continuing);
- Func("F", utils::Empty, ty.void_(), utils::Vector{l},
- utils::Vector{Stage(ast::PipelineStage::kFragment)});
+ Func("F", tint::Empty, ty.void_(), Vector{l}, Vector{Stage(ast::PipelineStage::kFragment)});
ASTPrinter& gen = Build();
diff --git a/src/tint/lang/wgsl/writer/ast_printer/member_accessor_test.cc b/src/tint/lang/wgsl/writer/ast_printer/member_accessor_test.cc
index d7046e1..a65285e 100644
--- a/src/tint/lang/wgsl/writer/ast_printer/member_accessor_test.cc
+++ b/src/tint/lang/wgsl/writer/ast_printer/member_accessor_test.cc
@@ -23,7 +23,7 @@
using WgslASTPrinterTest = TestHelper;
TEST_F(WgslASTPrinterTest, EmitExpression_MemberAccessor) {
- auto* s = Structure("Data", utils::Vector{Member("mem", ty.f32())});
+ auto* s = Structure("Data", Vector{Member("mem", ty.f32())});
GlobalVar("str", ty.Of(s), builtin::AddressSpace::kPrivate);
auto* expr = MemberAccessor("str", "mem");
@@ -31,14 +31,14 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "str.mem");
}
TEST_F(WgslASTPrinterTest, EmitExpression_MemberAccessor_OfDref) {
- auto* s = Structure("Data", utils::Vector{Member("mem", ty.f32())});
+ auto* s = Structure("Data", Vector{Member("mem", ty.f32())});
GlobalVar("str", ty.Of(s), builtin::AddressSpace::kPrivate);
auto* p = Let("p", AddressOf("str"));
@@ -47,7 +47,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, expr);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "(*(p)).mem");
diff --git a/src/tint/lang/wgsl/writer/ast_printer/return_test.cc b/src/tint/lang/wgsl/writer/ast_printer/return_test.cc
index 781ae6b..936a614 100644
--- a/src/tint/lang/wgsl/writer/ast_printer/return_test.cc
+++ b/src/tint/lang/wgsl/writer/ast_printer/return_test.cc
@@ -38,7 +38,7 @@
TEST_F(WgslASTPrinterTest, Emit_ReturnWithValue) {
auto* r = Return(123_i);
- Func("f", utils::Empty, ty.i32(), utils::Vector{r});
+ Func("f", tint::Empty, ty.i32(), Vector{r});
ASTPrinter& gen = Build();
diff --git a/src/tint/lang/wgsl/writer/ast_printer/switch_test.cc b/src/tint/lang/wgsl/writer/ast_printer/switch_test.cc
index 6461aa3..9c03b21 100644
--- a/src/tint/lang/wgsl/writer/ast_printer/switch_test.cc
+++ b/src/tint/lang/wgsl/writer/ast_printer/switch_test.cc
@@ -30,9 +30,9 @@
auto* def = Case(DefaultCaseSelector(), def_body);
auto* case_body = Block(create<ast::BreakStatement>());
- auto* case_stmt = Case(utils::Vector{CaseSelector(5_i)}, case_body);
+ auto* case_stmt = Case(Vector{CaseSelector(5_i)}, case_body);
- utils::Vector body{
+ Vector body{
case_stmt,
def,
};
@@ -62,10 +62,10 @@
GlobalVar("cond", ty.i32(), builtin::AddressSpace::kPrivate);
auto* def_body = Block(create<ast::BreakStatement>());
- auto* def = Case(utils::Vector{CaseSelector(5_i), DefaultCaseSelector()}, def_body);
+ auto* def = Case(Vector{CaseSelector(5_i), DefaultCaseSelector()}, def_body);
auto* cond = Expr("cond");
- auto* s = Switch(cond, utils::Vector{def});
+ auto* s = Switch(cond, Vector{def});
WrapInFunction(s);
ASTPrinter& gen = Build();
diff --git a/src/tint/lang/wgsl/writer/ast_printer/type_test.cc b/src/tint/lang/wgsl/writer/ast_printer/type_test.cc
index 622327b..38a4a30 100644
--- a/src/tint/lang/wgsl/writer/ast_printer/type_test.cc
+++ b/src/tint/lang/wgsl/writer/ast_printer/type_test.cc
@@ -36,7 +36,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, type);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "alias");
@@ -47,19 +47,18 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, type);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "array<bool, 4u>");
}
TEST_F(WgslASTPrinterTest, EmitType_Array_Attribute) {
- auto type =
- Alias("make_type_reachable", ty.array(ty.bool_(), 4_u, utils::Vector{Stride(16)}))->type;
+ auto type = Alias("make_type_reachable", ty.array(ty.bool_(), 4_u, Vector{Stride(16)}))->type;
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, type);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "@stride(16) array<bool, 4u>");
@@ -70,7 +69,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, type);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "array<bool>");
@@ -81,7 +80,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, type);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "bool");
@@ -92,7 +91,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, type);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "f32");
@@ -105,7 +104,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, type);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "f16");
@@ -116,7 +115,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, type);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "i32");
@@ -127,7 +126,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, type);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "mat2x3<f32>");
@@ -140,7 +139,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, type);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "mat2x3<f16>");
@@ -151,7 +150,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, type);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "ptr<workgroup, f32>");
@@ -162,14 +161,14 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, type);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "ptr<storage, f32, read_write>");
}
TEST_F(WgslASTPrinterTest, EmitType_Struct) {
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("a", ty.i32()),
Member("b", ty.f32()),
});
@@ -177,16 +176,16 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, type);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "S");
}
TEST_F(WgslASTPrinterTest, EmitType_StructOffsetDecl) {
- auto* s = Structure("S", utils::Vector{
- Member("a", ty.i32(), utils::Vector{MemberOffset(8_a)}),
- Member("b", ty.f32(), utils::Vector{MemberOffset(16_a)}),
+ auto* s = Structure("S", Vector{
+ Member("a", ty.i32(), Vector{MemberOffset(8_a)}),
+ Member("b", ty.f32(), Vector{MemberOffset(16_a)}),
});
ASTPrinter& gen = Build();
@@ -207,11 +206,10 @@
}
TEST_F(WgslASTPrinterTest, EmitType_StructOffsetDecl_WithSymbolCollisions) {
- auto* s =
- Structure("S", utils::Vector{
- Member("tint_0_padding", ty.i32(), utils::Vector{MemberOffset(8_a)}),
- Member("tint_2_padding", ty.f32(), utils::Vector{MemberOffset(16_a)}),
- });
+ auto* s = Structure("S", Vector{
+ Member("tint_0_padding", ty.i32(), Vector{MemberOffset(8_a)}),
+ Member("tint_2_padding", ty.f32(), Vector{MemberOffset(16_a)}),
+ });
ASTPrinter& gen = Build();
@@ -231,9 +229,9 @@
}
TEST_F(WgslASTPrinterTest, EmitType_StructAlignDecl) {
- auto* s = Structure("S", utils::Vector{
- Member("a", ty.i32(), utils::Vector{MemberAlign(8_a)}),
- Member("b", ty.f32(), utils::Vector{MemberAlign(16_a)}),
+ auto* s = Structure("S", Vector{
+ Member("a", ty.i32(), Vector{MemberAlign(8_a)}),
+ Member("b", ty.f32(), Vector{MemberAlign(16_a)}),
});
ASTPrinter& gen = Build();
@@ -250,9 +248,9 @@
}
TEST_F(WgslASTPrinterTest, EmitType_StructSizeDecl) {
- auto* s = Structure("S", utils::Vector{
- Member("a", ty.i32(), utils::Vector{MemberSize(16_a)}),
- Member("b", ty.f32(), utils::Vector{MemberSize(32_a)}),
+ auto* s = Structure("S", Vector{
+ Member("a", ty.i32(), Vector{MemberSize(16_a)}),
+ Member("b", ty.f32(), Vector{MemberSize(32_a)}),
});
ASTPrinter& gen = Build();
@@ -269,9 +267,9 @@
}
TEST_F(WgslASTPrinterTest, EmitType_Struct_WithAttribute) {
- auto* s = Structure("S", utils::Vector{
+ auto* s = Structure("S", Vector{
Member("a", ty.i32()),
- Member("b", ty.f32(), utils::Vector{MemberAlign(8_a)}),
+ Member("b", ty.f32(), Vector{MemberAlign(8_a)}),
});
ASTPrinter& gen = Build();
@@ -288,9 +286,9 @@
TEST_F(WgslASTPrinterTest, EmitType_Struct_WithEntryPointAttributes) {
auto* s = Structure(
- "S", utils::Vector{
- Member("a", ty.u32(), utils::Vector{Builtin(builtin::BuiltinValue::kVertexIndex)}),
- Member("b", ty.f32(), utils::Vector{Location(2_a)}),
+ "S", Vector{
+ Member("a", ty.u32(), Vector{Builtin(builtin::BuiltinValue::kVertexIndex)}),
+ Member("b", ty.f32(), Vector{Location(2_a)}),
});
ASTPrinter& gen = Build();
@@ -311,7 +309,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, type);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "u32");
@@ -322,7 +320,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, type);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "vec3<f32>");
@@ -335,7 +333,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, type);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "vec3<f16>");
@@ -358,7 +356,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, type);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), param.name);
@@ -380,7 +378,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, type);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), std::string(param.name) + "<f32>");
@@ -394,7 +392,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, type);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), std::string(param.name) + "<i32>");
@@ -408,7 +406,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, type);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), std::string(param.name) + "<u32>");
@@ -432,7 +430,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, type);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), std::string(param.name) + "<f32>");
@@ -446,7 +444,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, type);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), std::string(param.name) + "<i32>");
@@ -460,7 +458,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, type);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), std::string(param.name) + "<u32>");
@@ -489,7 +487,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, type);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), param.name);
@@ -521,7 +519,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitImageFormat(out, param.fmt);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), param.name);
@@ -553,7 +551,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, type);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "sampler");
@@ -565,7 +563,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, type);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "sampler_comparison");
diff --git a/src/tint/lang/wgsl/writer/ast_printer/unary_op_test.cc b/src/tint/lang/wgsl/writer/ast_printer/unary_op_test.cc
index 50f8bc9..bc5402f 100644
--- a/src/tint/lang/wgsl/writer/ast_printer/unary_op_test.cc
+++ b/src/tint/lang/wgsl/writer/ast_printer/unary_op_test.cc
@@ -29,7 +29,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, op);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "&(expr)");
@@ -42,7 +42,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, op);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "~(expr)");
@@ -56,7 +56,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, op);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "*(expr)");
@@ -69,7 +69,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, op);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "!(expr)");
@@ -82,7 +82,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitExpression(out, op);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), "-(expr)");
diff --git a/src/tint/lang/wgsl/writer/ast_printer/variable_decl_statement_test.cc b/src/tint/lang/wgsl/writer/ast_printer/variable_decl_statement_test.cc
index 30775b6..33d50c3 100644
--- a/src/tint/lang/wgsl/writer/ast_printer/variable_decl_statement_test.cc
+++ b/src/tint/lang/wgsl/writer/ast_printer/variable_decl_statement_test.cc
@@ -57,8 +57,8 @@
TEST_F(WgslASTPrinterTest, Emit_VariableDeclStatement_Const_AInt) {
auto* C = Const("C", Expr(1_a));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -75,8 +75,8 @@
TEST_F(WgslASTPrinterTest, Emit_VariableDeclStatement_Const_AFloat) {
auto* C = Const("C", Expr(1._a));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -93,8 +93,8 @@
TEST_F(WgslASTPrinterTest, Emit_VariableDeclStatement_Const_i32) {
auto* C = Const("C", Expr(1_i));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -111,8 +111,8 @@
TEST_F(WgslASTPrinterTest, Emit_VariableDeclStatement_Const_u32) {
auto* C = Const("C", Expr(1_u));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -129,8 +129,8 @@
TEST_F(WgslASTPrinterTest, Emit_VariableDeclStatement_Const_f32) {
auto* C = Const("C", Expr(1_f));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -149,8 +149,8 @@
Enable(builtin::Extension::kF16);
auto* C = Const("C", Expr(1_h));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -169,8 +169,8 @@
TEST_F(WgslASTPrinterTest, Emit_VariableDeclStatement_Const_vec3_AInt) {
auto* C = Const("C", Call<vec3<Infer>>(1_a, 2_a, 3_a));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -187,8 +187,8 @@
TEST_F(WgslASTPrinterTest, Emit_VariableDeclStatement_Const_vec3_AFloat) {
auto* C = Const("C", Call<vec3<Infer>>(1._a, 2._a, 3._a));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -205,8 +205,8 @@
TEST_F(WgslASTPrinterTest, Emit_VariableDeclStatement_Const_vec3_f32) {
auto* C = Const("C", Call<vec3<f32>>(1_f, 2_f, 3_f));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -225,8 +225,8 @@
Enable(builtin::Extension::kF16);
auto* C = Const("C", Call<vec3<f16>>(1_h, 2_h, 3_h));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -245,8 +245,8 @@
TEST_F(WgslASTPrinterTest, Emit_VariableDeclStatement_Const_mat2x3_AFloat) {
auto* C = Const("C", Call<mat2x3<Infer>>(1._a, 2._a, 3._a, 4._a, 5._a, 6._a));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -263,8 +263,8 @@
TEST_F(WgslASTPrinterTest, Emit_VariableDeclStatement_Const_mat2x3_f32) {
auto* C = Const("C", Call<mat2x3<f32>>(1_f, 2_f, 3_f, 4_f, 5_f, 6_f));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -283,8 +283,8 @@
Enable(builtin::Extension::kF16);
auto* C = Const("C", Call<mat2x3<f16>>(1_h, 2_h, 3_h, 4_h, 5_h, 6_h));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -303,8 +303,8 @@
TEST_F(WgslASTPrinterTest, Emit_VariableDeclStatement_Const_arr_f32) {
auto* C = Const("C", Call<array<f32, 3>>(1_f, 2_f, 3_f));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
@@ -324,8 +324,8 @@
Call<vec2<bool>>(true, false), //
Call<vec2<bool>>(false, true), //
Call<vec2<bool>>(true, true)));
- Func("f", utils::Empty, ty.void_(),
- utils::Vector{
+ Func("f", tint::Empty, ty.void_(),
+ Vector{
Decl(C),
Decl(Let("l", Expr(C))),
});
diff --git a/src/tint/lang/wgsl/writer/ast_printer/variable_test.cc b/src/tint/lang/wgsl/writer/ast_printer/variable_test.cc
index e558255..d969942 100644
--- a/src/tint/lang/wgsl/writer/ast_printer/variable_test.cc
+++ b/src/tint/lang/wgsl/writer/ast_printer/variable_test.cc
@@ -29,7 +29,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitVariable(out, v);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), R"(var<private> a : f32;)");
@@ -40,33 +40,33 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitVariable(out, v);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), R"(var<private> a : f32;)");
}
TEST_F(WgslASTPrinterTest, EmitVariable_Access_Read) {
- auto* s = Structure("S", utils::Vector{Member("a", ty.i32())});
+ auto* s = Structure("S", Vector{Member("a", ty.i32())});
auto* v = GlobalVar("a", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kRead,
Binding(0_a), Group(0_a));
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitVariable(out, v);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), R"(@binding(0) @group(0) var<storage, read> a : S;)");
}
TEST_F(WgslASTPrinterTest, EmitVariable_Access_ReadWrite) {
- auto* s = Structure("S", utils::Vector{Member("a", ty.i32())});
+ auto* s = Structure("S", Vector{Member("a", ty.i32())});
auto* v = GlobalVar("a", ty.Of(s), builtin::AddressSpace::kStorage, builtin::Access::kReadWrite,
Binding(0_a), Group(0_a));
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitVariable(out, v);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), R"(@binding(0) @group(0) var<storage, read_write> a : S;)");
@@ -77,7 +77,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitVariable(out, v);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), R"(@group(1) @binding(2) var a : sampler;)");
@@ -88,7 +88,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitVariable(out, v);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), R"(var<private> a : f32 = 1.0f;)");
@@ -100,7 +100,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitVariable(out, v);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), R"(let a : f32 = 1.0f;)");
@@ -112,7 +112,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitVariable(out, v);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), R"(let a = 1.0f;)");
@@ -124,7 +124,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitVariable(out, v);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), R"(const a : f32 = 1.0f;)");
@@ -136,7 +136,7 @@
ASTPrinter& gen = Build();
- utils::StringStream out;
+ StringStream out;
gen.EmitVariable(out, v);
EXPECT_THAT(gen.Diagnostics(), testing::IsEmpty());
EXPECT_EQ(out.str(), R"(const a = 1.0f;)");
diff --git a/src/tint/lang/wgsl/writer/ir_to_program/ir_to_program.cc b/src/tint/lang/wgsl/writer/ir_to_program/ir_to_program.cc
index 671b1b4..ffe0443 100644
--- a/src/tint/lang/wgsl/writer/ir_to_program/ir_to_program.cc
+++ b/src/tint/lang/wgsl/writer/ir_to_program/ir_to_program.cc
@@ -144,10 +144,10 @@
using ValueBinding = std::variant<VariableValue, InlinedValue, ConsumedValue>;
/// IR values to their representation
- utils::Hashmap<ir::Value*, ValueBinding, 32> bindings_;
+ Hashmap<ir::Value*, ValueBinding, 32> bindings_;
/// Names for values
- utils::Hashmap<ir::Value*, Symbol, 32> names_;
+ Hashmap<ir::Value*, Symbol, 32> names_;
/// The nesting depth of the currently generated AST
/// 0 is module scope
@@ -155,21 +155,21 @@
/// 2+ is within control flow
uint32_t nesting_depth_ = 0;
- using StatementList = utils::Vector<const ast::Statement*,
- decltype(ast::BlockStatement::statements)::static_length>;
+ using StatementList =
+ Vector<const ast::Statement*, decltype(ast::BlockStatement::statements)::static_length>;
StatementList* statements_ = nullptr;
/// The current switch case block
ir::Block* current_switch_case_ = nullptr;
/// Values that can be inlined.
- utils::Hashset<ir::Value*, 64> can_inline_;
+ Hashset<ir::Value*, 64> can_inline_;
/// Set of enable directives emitted.
- utils::Hashset<builtin::Extension, 4> enables_;
+ Hashset<builtin::Extension, 4> enables_;
/// Map of struct to output program name.
- utils::Hashmap<const type::Struct*, Symbol, 8> structs_;
+ Hashmap<const type::Struct*, Symbol, 8> structs_;
/// True if 'diagnostic(off, derivative_uniformity)' has been emitted
bool disabled_derivative_uniformity_ = false;
@@ -187,7 +187,7 @@
// TODO(crbug.com/tint/1915): Properly implement this when we've fleshed out Function
static constexpr size_t N = decltype(ast::Function::params)::static_length;
- auto params = utils::Transform<N>(fn->Params(), [&](ir::FunctionParam* param) {
+ auto params = tint::Transform<N>(fn->Params(), [&](ir::FunctionParam* param) {
auto ty = Type(param->Type());
auto name = NameFor(param);
Bind(param, name, PtrKind::kPtr);
@@ -197,8 +197,8 @@
auto name = NameFor(fn);
auto ret_ty = Type(fn->ReturnType());
auto* body = Block(fn->Block());
- utils::Vector<const ast::Attribute*, 1> attrs{};
- utils::Vector<const ast::Attribute*, 1> ret_attrs{};
+ Vector<const ast::Attribute*, 1> attrs{};
+ Vector<const ast::Attribute*, 1> ret_attrs{};
return b.Func(name, std::move(params), ret_ty, body, std::move(attrs),
std::move(ret_attrs));
}
@@ -223,7 +223,7 @@
void MarkInlinable(ir::Block* block) {
// An ordered list of possibly-inlinable values returned by sequenced instructions that have
// not yet been marked-for or ruled-out-for inlining.
- utils::UniqueVector<ir::Value*, 32> pending_resolution;
+ UniqueVector<ir::Value*, 32> pending_resolution;
// Walk the instructions of the block starting with the first.
for (auto* inst : *block) {
@@ -232,7 +232,7 @@
// Walk the instruction's operands starting with the right-most.
auto operands = inst->Operands();
- for (auto* operand : utils::Reverse(operands)) {
+ for (auto* operand : tint::Reverse(operands)) {
if (!pending_resolution.Contains(operand)) {
continue;
}
@@ -447,7 +447,7 @@
auto* cond = Expr(s->Condition());
- auto cases = utils::Transform(
+ auto cases = tint::Transform(
s->Cases(), //
[&](ir::Switch::Case c) -> const tint::ast::CaseStatement* {
SCOPED_NESTING();
@@ -458,12 +458,12 @@
body = Block(c.Block());
}
- auto selectors = utils::Transform(c.selectors, //
- [&](ir::Switch::CaseSelector cs) {
- return cs.IsDefault()
- ? b.DefaultCaseSelector()
- : b.CaseSelector(Expr(cs.val));
- });
+ auto selectors = tint::Transform(c.selectors, //
+ [&](ir::Switch::CaseSelector cs) {
+ return cs.IsDefault()
+ ? b.DefaultCaseSelector()
+ : b.CaseSelector(Expr(cs.val));
+ });
return b.Case(std::move(selectors), body);
});
@@ -510,7 +510,7 @@
Symbol name = NameFor(var->Result());
Bind(var->Result(), name, PtrKind::kRef);
- utils::Vector<const ast::Attribute*, 4> attrs;
+ Vector<const ast::Attribute*, 4> attrs;
if (auto bp = var->BindingPoint()) {
attrs.Push(b.Group(AInt(bp->group)));
attrs.Push(b.Binding(AInt(bp->binding)));
@@ -555,7 +555,7 @@
}
void Call(ir::Call* call) {
- auto args = utils::Transform<4>(call->Args(), [&](ir::Value* arg) {
+ auto args = tint::Transform<4>(call->Args(), [&](ir::Value* arg) {
// Pointer-like arguments are passed by pointer, never reference.
return Expr(arg, PtrKind::kPtr);
});
@@ -657,7 +657,7 @@
void Swizzle(ir::Swizzle* s) {
auto* vec = Expr(s->Object());
- utils::Vector<char, 4> components;
+ Vector<char, 4> components;
for (uint32_t i : s->Indices()) {
if (TINT_UNLIKELY(i >= 4)) {
TINT_ICE(IR, b.Diagnostics()) << "invalid swizzle index: " << i;
@@ -805,7 +805,7 @@
return b.Call(ty, Constant(c->Index(0)));
}
- utils::Vector<const ast::Expression*, 8> els;
+ Vector<const ast::Expression*, 8> els;
for (size_t i = 0, n = c->NumElements(); i < n; i++) {
els.Push(Constant(c->Index(i)));
}
@@ -876,7 +876,7 @@
},
[&](const type::Array* a) {
auto el = Type(a->ElemType());
- utils::Vector<const ast::Attribute*, 1> attrs;
+ Vector<const ast::Attribute*, 1> attrs;
if (!a->IsStrideImplicit()) {
attrs.Push(b.Stride(a->Stride()));
}
@@ -931,10 +931,10 @@
ast::Type Struct(const type::Struct* s) {
auto n = structs_.GetOrCreate(s, [&] {
- auto members = utils::Transform<8>(s->Members(), [&](const type::StructMember* m) {
+ auto members = tint::Transform<8>(s->Members(), [&](const type::StructMember* m) {
auto ty = Type(m->Type());
const auto& ir_attrs = m->Attributes();
- utils::Vector<const ast::Attribute*, 4> ast_attrs;
+ Vector<const ast::Attribute*, 4> ast_attrs;
if (m->Type()->Align() != m->Align()) {
ast_attrs.Push(b.MemberAlign(u32(m->Align())));
}
@@ -961,7 +961,7 @@
});
// TODO(crbug.com/tint/1902): Emit structure attributes
- utils::Vector<const ast::Attribute*, 2> attrs;
+ Vector<const ast::Attribute*, 2> attrs;
auto name = b.Symbols().Register(s->Name().NameView());
b.Structure(name, std::move(members), std::move(attrs));
diff --git a/src/tint/lang/wgsl/writer/ir_to_program/ir_to_program_test.cc b/src/tint/lang/wgsl/writer/ir_to_program/ir_to_program_test.cc
index f1b29fa..d177132 100644
--- a/src/tint/lang/wgsl/writer/ir_to_program/ir_to_program_test.cc
+++ b/src/tint/lang/wgsl/writer/ir_to_program/ir_to_program_test.cc
@@ -47,7 +47,7 @@
return result;
}
- result.wgsl = std::string(utils::TrimSpace(output.wgsl));
+ result.wgsl = std::string(tint::TrimSpace(output.wgsl));
if (!result.wgsl.empty()) {
result.wgsl = "\n" + result.wgsl + "\n";
}
diff --git a/src/tint/lang/wgsl/writer/ir_to_program/ir_to_program_test.h b/src/tint/lang/wgsl/writer/ir_to_program/ir_to_program_test.h
index d6f4e0a..2abae48 100644
--- a/src/tint/lang/wgsl/writer/ir_to_program/ir_to_program_test.h
+++ b/src/tint/lang/wgsl/writer/ir_to_program/ir_to_program_test.h
@@ -39,19 +39,19 @@
Result Run();
};
-#define EXPECT_WGSL(expected_wgsl) \
- do { \
- if (auto got = Run(); got.err.empty()) { \
- auto expected = std::string(utils::TrimSpace(expected_wgsl)); \
- if (!expected.empty()) { \
- expected = "\n" + expected + "\n"; \
- } \
- EXPECT_EQ(expected, got.wgsl) << "IR: " << got.ir; \
- } else { \
- FAIL() << got.err << std::endl \
- << "IR: " << got.ir << std::endl \
- << "AST: " << got.ast << std::endl; \
- } \
+#define EXPECT_WGSL(expected_wgsl) \
+ do { \
+ if (auto got = Run(); got.err.empty()) { \
+ auto expected = std::string(tint::TrimSpace(expected_wgsl)); \
+ if (!expected.empty()) { \
+ expected = "\n" + expected + "\n"; \
+ } \
+ EXPECT_EQ(expected, got.wgsl) << "IR: " << got.ir; \
+ } else { \
+ FAIL() << got.err << std::endl \
+ << "IR: " << got.ir << std::endl \
+ << "AST: " << got.ast << std::endl; \
+ } \
} while (false)
} // namespace tint::wgsl::writer
diff --git a/src/tint/lang/wgsl/writer/ir_to_program/rename_conflicts.cc b/src/tint/lang/wgsl/writer/ir_to_program/rename_conflicts.cc
index d5b57f1..f7f62f7 100644
--- a/src/tint/lang/wgsl/writer/ir_to_program/rename_conflicts.cc
+++ b/src/tint/lang/wgsl/writer/ir_to_program/rename_conflicts.cc
@@ -77,13 +77,13 @@
private:
/// Map of identifier to declaration.
/// The declarations may be one of an ir::Value or type::Struct.
- using Scope = utils::Hashmap<std::string_view, CastableBase*, 8>;
+ using Scope = Hashmap<std::string_view, CastableBase*, 8>;
/// The IR module.
ir::Module* ir = nullptr;
/// Stack of scopes
- utils::Vector<Scope, 8> scopes{};
+ Vector<Scope, 8> scopes{};
/// Registers all the WGSL module-scope declarations in the root-scope.
/// Duplicate declarations with the same name will renamed.
@@ -178,7 +178,7 @@
},
[&](ir::CoreBuiltinCall* call) {
// Ensure builtin of a builtin call is resolvable
- auto name = utils::ToString(call->Func());
+ auto name = tint::ToString(call->Func());
EnsureResolvesTo(name, nullptr);
});
@@ -200,18 +200,18 @@
return nullptr;
},
[&](const type::Vector* v) {
- EnsureResolvesTo("vec" + utils::ToString(v->Width()), nullptr);
+ EnsureResolvesTo("vec" + tint::ToString(v->Width()), nullptr);
return v->type();
},
[&](const type::Matrix* m) {
EnsureResolvesTo(
- "mat" + utils::ToString(m->columns()) + "x" + utils::ToString(m->rows()),
+ "mat" + tint::ToString(m->columns()) + "x" + tint::ToString(m->rows()),
nullptr);
return m->type();
},
[&](const type::Pointer* p) {
- EnsureResolvesTo(utils::ToString(p->Access()), nullptr);
- EnsureResolvesTo(utils::ToString(p->AddressSpace()), nullptr);
+ EnsureResolvesTo(tint::ToString(p->Access()), nullptr);
+ EnsureResolvesTo(tint::ToString(p->AddressSpace()), nullptr);
return p->StoreType();
},
[&](const type::Struct* s) {
@@ -228,7 +228,7 @@
/// Ensures that the identifier @p identifier resolves to the declaration @p thing
void EnsureResolvesTo(std::string_view identifier, const CastableBase* thing) {
- for (auto& scope : utils::Reverse(scopes)) {
+ for (auto& scope : tint::Reverse(scopes)) {
if (auto decl = scope.Get(identifier)) {
if (decl.value() == thing) {
return; // Resolved to the right thing.
@@ -270,7 +270,7 @@
/// @return true if @p s is a builtin (non-user declared) structure.
bool IsBuiltinStruct(const type::Struct* s) {
// TODO(bclayton): Need to do better than this.
- return utils::HasPrefix(s->Name().NameView(), "_");
+ return tint::HasPrefix(s->Name().NameView(), "_");
}
};
diff --git a/src/tint/lang/wgsl/writer/ir_to_program/rename_conflicts.h b/src/tint/lang/wgsl/writer/ir_to_program/rename_conflicts.h
index 2033dde..918b331 100644
--- a/src/tint/lang/wgsl/writer/ir_to_program/rename_conflicts.h
+++ b/src/tint/lang/wgsl/writer/ir_to_program/rename_conflicts.h
@@ -22,7 +22,7 @@
/// RenameConflicts is a transform that renames declarations which prevent identifiers from
/// resolving to the correct declaration, and those with identical identifiers declared in the same
/// scope.
-class RenameConflicts final : public utils::Castable<RenameConflicts, ir::transform::Transform> {
+class RenameConflicts final : public Castable<RenameConflicts, ir::transform::Transform> {
public:
/// Constructor
RenameConflicts();
diff --git a/src/tint/lang/wgsl/writer/syntax_tree_printer/syntax_tree_printer.cc b/src/tint/lang/wgsl/writer/syntax_tree_printer/syntax_tree_printer.cc
index 99123f3..5de0f1e 100644
--- a/src/tint/lang/wgsl/writer/syntax_tree_printer/syntax_tree_printer.cc
+++ b/src/tint/lang/wgsl/writer/syntax_tree_printer/syntax_tree_printer.cc
@@ -512,7 +512,7 @@
Line() << "]";
}
-void SyntaxTreePrinter::EmitAttributes(utils::VectorRef<const ast::Attribute*> attrs) {
+void SyntaxTreePrinter::EmitAttributes(VectorRef<const ast::Attribute*> attrs) {
for (auto* attr : attrs) {
Switch(
attr, //
@@ -810,13 +810,13 @@
});
}
-void SyntaxTreePrinter::EmitStatements(utils::VectorRef<const ast::Statement*> stmts) {
+void SyntaxTreePrinter::EmitStatements(VectorRef<const ast::Statement*> stmts) {
for (auto* s : stmts) {
EmitStatement(s);
}
}
-void SyntaxTreePrinter::EmitStatementsWithIndent(utils::VectorRef<const ast::Statement*> stmts) {
+void SyntaxTreePrinter::EmitStatementsWithIndent(VectorRef<const ast::Statement*> stmts) {
ScopedIndent si(this);
EmitStatements(stmts);
}
@@ -1020,14 +1020,14 @@
case 0: // No initializer
break;
case 1: // Single line initializer statement
- Line() << utils::TrimSuffix(init_buf.lines[0].content, ";");
+ Line() << tint::TrimSuffix(init_buf.lines[0].content, ";");
break;
default: // Block initializer statement
for (size_t i = 1; i < init_buf.lines.size(); i++) {
// Indent all by the first line
init_buf.lines[i].indent += current_buffer_->current_indent;
}
- Line() << utils::TrimSuffix(init_buf.String(), "\n");
+ Line() << tint::TrimSuffix(init_buf.String(), "\n");
break;
}
}
@@ -1048,14 +1048,14 @@
case 0: // No continuing
break;
case 1: // Single line continuing statement
- Line() << utils::TrimSuffix(cont_buf.lines[0].content, ";");
+ Line() << tint::TrimSuffix(cont_buf.lines[0].content, ";");
break;
default: // Block continuing statement
for (size_t i = 1; i < cont_buf.lines.size(); i++) {
// Indent all by the first line
cont_buf.lines[i].indent += current_buffer_->current_indent;
}
- Line() << utils::TrimSuffix(cont_buf.String(), "\n");
+ Line() << tint::TrimSuffix(cont_buf.String(), "\n");
break;
}
}
diff --git a/src/tint/lang/wgsl/writer/syntax_tree_printer/syntax_tree_printer.h b/src/tint/lang/wgsl/writer/syntax_tree_printer/syntax_tree_printer.h
index 2f8157f..9a60536 100644
--- a/src/tint/lang/wgsl/writer/syntax_tree_printer/syntax_tree_printer.h
+++ b/src/tint/lang/wgsl/writer/syntax_tree_printer/syntax_tree_printer.h
@@ -70,7 +70,7 @@
namespace tint::wgsl::writer {
/// Implementation class for AST generator
-class SyntaxTreePrinter : public utils::TextGenerator {
+class SyntaxTreePrinter : public tint::TextGenerator {
public:
/// Constructor
/// @param program the program
@@ -175,10 +175,10 @@
void EmitStatement(const ast::Statement* stmt);
/// Handles a statement list
/// @param stmts the statements to emit
- void EmitStatements(utils::VectorRef<const ast::Statement*> stmts);
+ void EmitStatements(VectorRef<const ast::Statement*> stmts);
/// Handles a statement list with an increased indentation
/// @param stmts the statements to emit
- void EmitStatementsWithIndent(utils::VectorRef<const ast::Statement*> stmts);
+ void EmitStatementsWithIndent(VectorRef<const ast::Statement*> stmts);
/// Handles generating a switch statement
/// @param stmt the statement to emit
void EmitSwitch(const ast::SwitchStatement* stmt);
@@ -196,7 +196,7 @@
void EmitVariable(const ast::Variable* var);
/// Handles generating a attribute list
/// @param attrs the attribute list
- void EmitAttributes(utils::VectorRef<const ast::Attribute*> attrs);
+ void EmitAttributes(VectorRef<const ast::Attribute*> attrs);
private:
Program const* const program_;
diff --git a/src/tint/tint.natvis b/src/tint/tint.natvis
index 6096d84..838d54b 100644
--- a/src/tint/tint.natvis
+++ b/src/tint/tint.natvis
@@ -21,7 +21,7 @@
<!-- utils -->
<!--=================================================================-->
- <Type Name="tint::utils::Slice<*>">
+ <Type Name="tint::Slice<*>">
<DisplayString>{{ length={len}, capacity={cap} }}</DisplayString>
<Expand>
<!--<Item Name="[length]">len</Item>
@@ -33,7 +33,7 @@
</Expand>
</Type>
- <Type Name="tint::utils::Vector<*,*>">
+ <Type Name="tint::Vector<*,*>">
<Intrinsic Name="Length" Expression="(size_t)(impl_.slice.len)" />
<Expand>
<Item Name="[heap]">impl_.slice.cap > (int)$T2</Item>
@@ -46,7 +46,7 @@
</Expand>
</Type>
- <Type Name="tint::utils::VectorRef<*>">
+ <Type Name="tint::VectorRef<*>">
<Expand>
<Item Name="[can move]">can_move_</Item>
<ExpandedItem>slice_</ExpandedItem>
diff --git a/src/tint/tint_gdb.py b/src/tint/tint_gdb.py
index 88c614d..fd50d60 100644
--- a/src/tint/tint_gdb.py
+++ b/src/tint/tint_gdb.py
@@ -60,7 +60,7 @@
class UtilsSlicePrinter(Printer):
- '''Printer for tint::utils::Slice<T>'''
+ '''Printer for tint::Slice<T>'''
def __init__(self, val):
super(UtilsSlicePrinter, self).__init__(val)
@@ -98,12 +98,11 @@
return 'array'
-pp_set.add_printer('UtilsSlicePrinter',
- '^tint::utils::Slice<.*>$', UtilsSlicePrinter)
+pp_set.add_printer('UtilsSlicePrinter', '^tint::Slice<.*>$', UtilsSlicePrinter)
class UtilsVectorPrinter(Printer):
- '''Printer for tint::utils::Vector<T, N>'''
+ '''Printer for tint::Vector<T, N>'''
def __init__(self, val):
super(UtilsVectorPrinter, self).__init__(val)
@@ -131,12 +130,11 @@
return 'array'
-pp_set.add_printer(
- 'UtilsVector', '^tint::utils::Vector<.*>$', UtilsVectorPrinter)
+pp_set.add_printer('UtilsVector', '^tint::Vector<.*>$', UtilsVectorPrinter)
class UtilsVectorRefPrinter(Printer):
- '''Printer for tint::utils::VectorRef<T>'''
+ '''Printer for tint::VectorRef<T>'''
def __init__(self, val):
super(UtilsVectorRefPrinter, self).__init__(val)
@@ -161,8 +159,8 @@
return 'array'
-pp_set.add_printer(
- 'UtilsVector', '^tint::utils::VectorRef<.*>$', UtilsVectorRefPrinter)
+pp_set.add_printer('UtilsVector', '^tint::VectorRef<.*>$',
+ UtilsVectorRefPrinter)
class UtilsHashmapBasePrinter(Printer):
@@ -215,8 +213,7 @@
return None
-pp_set.add_printer(
- 'UtilsHashset', '^tint::utils::Hashset<.*>$', UtilsHashsetPrinter)
+pp_set.add_printer('UtilsHashset', '^tint::Hashset<.*>$', UtilsHashsetPrinter)
class UtilsHashmapPrinter(UtilsHashmapBasePrinter):
@@ -231,8 +228,7 @@
return None
-pp_set.add_printer(
- 'UtilsHashmap', '^tint::utils::Hashmap<.*>$', UtilsHashmapPrinter)
+pp_set.add_printer('UtilsHashmap', '^tint::Hashmap<.*>$', UtilsHashmapPrinter)
gdb.printing.register_pretty_printer(gdb, pp_set, replace=_DEBUGGING)
diff --git a/src/tint/tint_lldb.py b/src/tint/tint_lldb.py
index 84e6ad3..d9b92b6 100644
--- a/src/tint/tint_lldb.py
+++ b/src/tint/tint_lldb.py
@@ -92,20 +92,16 @@
tint_category = debugger.CreateCategory('tint')
tint_category.SetEnabled(True)
- attach_synthetic_to_type(
- UtilsSlicePrinter, r'^tint::utils::Slice<.+>$', True)
+ attach_synthetic_to_type(UtilsSlicePrinter, r'^tint::Slice<.+>$', True)
- attach_synthetic_to_type(
- UtilsVectorPrinter, r'^tint::utils::Vector<.+>$', True)
+ attach_synthetic_to_type(UtilsVectorPrinter, r'^tint::Vector<.+>$', True)
- attach_synthetic_to_type(
- UtilsVectorRefPrinter, r'^tint::utils::VectorRef<.+>$', True)
+ attach_synthetic_to_type(UtilsVectorRefPrinter, r'^tint::VectorRef<.+>$',
+ True)
- attach_synthetic_to_type(
- UtilsHashsetPrinter, r'^tint::utils::Hashset<.+>$', True)
+ attach_synthetic_to_type(UtilsHashsetPrinter, r'^tint::Hashset<.+>$', True)
- attach_synthetic_to_type(
- UtilsHashmapPrinter, r'^tint::utils::Hashmap<.+>$', True)
+ attach_synthetic_to_type(UtilsHashmapPrinter, r'^tint::Hashmap<.+>$', True)
def attach_synthetic_to_type(synth_class, type_name, is_regex=False):
@@ -213,7 +209,7 @@
class UtilsSlicePrinter(Printer):
- '''Printer for tint::utils::Slice<T>'''
+ '''Printer for tint::Slice<T>'''
def initialize(self):
self.len = self.valobj.GetChildMemberWithName('len')
@@ -251,7 +247,7 @@
class UtilsVectorPrinter(Printer):
- '''Printer for tint::utils::Vector<T, N>'''
+ '''Printer for tint::Vector<T, N>'''
def initialize(self):
self.slice = self.member('impl_', 'slice')
@@ -277,7 +273,7 @@
class UtilsVectorRefPrinter(Printer):
- '''Printer for tint::utils::VectorRef<T>'''
+ '''Printer for tint::VectorRef<T>'''
def initialize(self):
self.slice = self.member('slice_')
diff --git a/src/tint/utils/cli/cli.cc b/src/tint/utils/cli/cli.cc
index 72ff0d6..a8180b5 100644
--- a/src/tint/utils/cli/cli.cc
+++ b/src/tint/utils/cli/cli.cc
@@ -22,12 +22,12 @@
#include "src/tint/utils/containers/transform.h"
#include "src/tint/utils/text/string.h"
-namespace tint::utils::cli {
+namespace tint::cli {
Option::~Option() = default;
void OptionSet::ShowHelp(std::ostream& s_out) {
- utils::Vector<const Option*, 32> sorted_options;
+ Vector<const Option*, 32> sorted_options;
for (auto* opt : options.Objects()) {
sorted_options.Push(opt);
}
@@ -37,7 +37,7 @@
std::string left;
std::string right;
};
- utils::Vector<CmdInfo, 64> cmd_infos;
+ Vector<CmdInfo, 64> cmd_infos;
for (auto* opt : sorted_options) {
{
@@ -71,7 +71,7 @@
// Measure
size_t left_width = 0;
for (auto& cmd_info : cmd_infos) {
- for (auto line : utils::Split(cmd_info.left, "\n")) {
+ for (auto line : tint::Split(cmd_info.left, "\n")) {
if (line.length() < kMaxRightOffset) {
left_width = std::max(left_width, line.length());
}
@@ -88,8 +88,8 @@
};
for (auto& cmd_info : cmd_infos) {
- auto left_lines = utils::Split(cmd_info.left, "\n");
- auto right_lines = utils::Split(cmd_info.right, "\n");
+ auto left_lines = tint::Split(cmd_info.left, "\n");
+ auto right_lines = tint::Split(cmd_info.right, "\n");
size_t num_lines = std::max(left_lines.Length(), right_lines.Length());
for (size_t i = 0; i < num_lines; i++) {
@@ -119,9 +119,9 @@
}
Result<OptionSet::Unconsumed> OptionSet::Parse(std::ostream& s_err,
- utils::VectorRef<std::string_view> arguments_raw) {
+ VectorRef<std::string_view> arguments_raw) {
// Build a map of name to option, and set defaults
- utils::Hashmap<std::string, Option*, 32> options_by_name;
+ Hashmap<std::string, Option*, 32> options_by_name;
for (auto* opt : options.Objects()) {
opt->SetDefault();
for (auto name : {opt->Name(), opt->Alias(), opt->ShortName()}) {
@@ -145,7 +145,7 @@
arguments.push_back(arg);
}
- utils::Hashset<Option*, 8> options_parsed;
+ Hashset<Option*, 8> options_parsed;
Unconsumed unconsumed;
while (!arguments.empty()) {
@@ -166,8 +166,8 @@
auto names = options_by_name.Keys();
auto alternatives =
Transform(names, [&](const std::string& s) { return std::string_view(s); });
- utils::StringStream ss;
- utils::SuggestAlternativeOptions opts;
+ StringStream ss;
+ tint::SuggestAlternativeOptions opts;
opts.prefix = "--";
opts.list_possible_values = false;
SuggestAlternatives(arg, alternatives.Slice(), ss, opts);
@@ -179,4 +179,4 @@
return unconsumed;
}
-} // namespace tint::utils::cli
+} // namespace tint::cli
diff --git a/src/tint/utils/cli/cli.h b/src/tint/utils/cli/cli.h
index 1f14fb2..05f9c1f 100644
--- a/src/tint/utils/cli/cli.h
+++ b/src/tint/utils/cli/cli.h
@@ -27,7 +27,7 @@
#include "src/tint/utils/text/parse_num.h"
#include "src/tint/utils/text/string.h"
-namespace tint::utils::cli {
+namespace tint::cli {
/// Alias is a fluent-constructor helper for Options
struct Alias {
@@ -155,7 +155,7 @@
class OptionSet {
public:
/// Unconsumed is a list of unconsumed command line arguments
- using Unconsumed = utils::Vector<std::string_view, 8>;
+ using Unconsumed = Vector<std::string_view, 8>;
/// Constructs and returns a new Option to be owned by the OptionSet
/// @tparam T the Option type
@@ -175,11 +175,11 @@
/// @param err the error stream
/// @param arguments the command line arguments, excluding the initial executable name
/// @return a Result holding a list of arguments that were not consumed as options
- Result<Unconsumed> Parse(std::ostream& err, utils::VectorRef<std::string_view> arguments);
+ Result<Unconsumed> Parse(std::ostream& err, VectorRef<std::string_view> arguments);
private:
/// The list of options to parse
- utils::BlockAllocator<Option, 1024> options;
+ BlockAllocator<Option, 1024> options;
};
/// ValueOption is an option that accepts a single value
@@ -329,7 +329,7 @@
/// A description of the option.
std::string description;
/// The enum options as a pair of enum value to name
- utils::Vector<EnumName<ENUM>, 8> enum_names;
+ Vector<EnumName<ENUM>, 8> enum_names;
/// The default value.
std::optional<ENUM> default_value;
/// The option value. Populated with Parse().
@@ -347,7 +347,7 @@
template <typename... SETTINGS>
EnumOption(std::string option_name,
std::string option_description,
- utils::VectorRef<EnumName<ENUM>> names,
+ VectorRef<EnumName<ENUM>> names,
SETTINGS&&... settings)
: name(std::move(option_name)),
description(std::move(option_description)),
@@ -405,6 +405,6 @@
}
};
-} // namespace tint::utils::cli
+} // namespace tint::cli
#endif // SRC_TINT_UTILS_CLI_CLI_H_
diff --git a/src/tint/utils/cli/cli_test.cc b/src/tint/utils/cli/cli_test.cc
index 6b8fe4e..cfa5f25 100644
--- a/src/tint/utils/cli/cli_test.cc
+++ b/src/tint/utils/cli/cli_test.cc
@@ -21,13 +21,13 @@
#include "src/tint/utils/containers/transform.h" // Used by ToStringList()
-namespace tint::utils::cli {
+namespace tint::cli {
namespace {
// Workaround for https://github.com/google/googletest/issues/3081
// Remove when using C++20
template <size_t N>
-utils::Vector<std::string, N> ToStringList(const utils::Vector<std::string_view, N>& views) {
+Vector<std::string, N> ToStringList(const Vector<std::string_view, N>& views) {
return Transform(views, [](std::string_view view) { return std::string(view); });
}
@@ -108,7 +108,7 @@
OptionSet opts;
opts.Add<EnumOption<E>>("my_enum_option", "sets the awesome value",
- utils::Vector{
+ Vector{
EnumName(E::X, "X"),
EnumName(E::Y, "Y"),
EnumName(E::Z, "Z"),
@@ -130,7 +130,7 @@
opts.Add<ValueOption<int>>("option-a", "an integer");
opts.Add<BoolOption>("option-b", "a boolean");
opts.Add<EnumOption<E>>("option-c", "sets the awesome value",
- utils::Vector{
+ Vector{
EnumName(E::X, "X"),
EnumName(E::Y, "Y"),
EnumName(E::Z, "Z"),
@@ -235,7 +235,7 @@
OptionSet opts;
auto& opt = opts.Add<EnumOption<E>>("my_option", "sets the awesome value",
- utils::Vector{
+ Vector{
EnumName(E::X, "X"),
EnumName(E::Y, "Y"),
EnumName(E::Z, "Z"),
@@ -289,11 +289,11 @@
auto& opt = opts.Add<BoolOption>("my_option", "a boolean value", Default{true});
std::stringstream err;
- auto res = opts.Parse(err, utils::Empty);
+ auto res = opts.Parse(err, tint::Empty);
ASSERT_TRUE(res) << err.str();
EXPECT_TRUE(err.str().empty());
EXPECT_EQ(opt.value, true);
}
} // namespace
-} // namespace tint::utils::cli
+} // namespace tint::cli
diff --git a/src/tint/utils/command/command.h b/src/tint/utils/command/command.h
index 3406ffc..078e7a1 100644
--- a/src/tint/utils/command/command.h
+++ b/src/tint/utils/command/command.h
@@ -18,7 +18,7 @@
#include <string>
#include <utility>
-namespace tint::utils {
+namespace tint {
/// Command is a helper used by tests for executing a process with a number of
/// arguments and an optional stdin string, and then collecting and returning
@@ -77,6 +77,6 @@
std::string input_;
};
-} // namespace tint::utils
+} // namespace tint
#endif // SRC_TINT_UTILS_COMMAND_COMMAND_H_
diff --git a/src/tint/utils/command/command_other.cc b/src/tint/utils/command/command_other.cc
index f500482..c52c3f9 100644
--- a/src/tint/utils/command/command_other.cc
+++ b/src/tint/utils/command/command_other.cc
@@ -14,7 +14,7 @@
#include "src/tint/utils/command/command.h"
-namespace tint::utils {
+namespace tint {
Command::Command(const std::string&) {}
@@ -32,4 +32,4 @@
return out;
}
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/command/command_posix.cc b/src/tint/utils/command/command_posix.cc
index a615cc6..9d43381 100644
--- a/src/tint/utils/command/command_posix.cc
+++ b/src/tint/utils/command/command_posix.cc
@@ -21,7 +21,7 @@
#include <sstream>
#include <vector>
-namespace tint::utils {
+namespace tint {
namespace {
@@ -261,4 +261,4 @@
}
}
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/command/command_test.cc b/src/tint/utils/command/command_test.cc
index a362243..3e2b9ee 100644
--- a/src/tint/utils/command/command_test.cc
+++ b/src/tint/utils/command/command_test.cc
@@ -16,7 +16,7 @@
#include "gtest/gtest.h"
-namespace tint::utils {
+namespace tint {
namespace {
#ifdef _WIN32
@@ -87,4 +87,4 @@
#endif
} // namespace
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/command/command_windows.cc b/src/tint/utils/command/command_windows.cc
index cbd749f..bce39e9 100644
--- a/src/tint/utils/command/command_windows.cc
+++ b/src/tint/utils/command/command_windows.cc
@@ -22,7 +22,7 @@
#include "src/tint/utils/macros/defer.h"
#include "src/tint/utils/text/string_stream.h"
-namespace tint::utils {
+namespace tint {
namespace {
@@ -197,7 +197,7 @@
si.hStdError = stderr_pipe.write;
si.hStdInput = stdin_pipe.read;
- utils::StringStream args;
+ StringStream args;
args << path_;
for (auto& arg : arguments) {
if (!arg.empty()) {
@@ -269,4 +269,4 @@
return output;
}
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/containers/bitset.h b/src/tint/utils/containers/bitset.h
index de8eb58..512e265 100644
--- a/src/tint/utils/containers/bitset.h
+++ b/src/tint/utils/containers/bitset.h
@@ -19,7 +19,7 @@
#include "src/tint/utils/containers/vector.h"
-namespace tint::utils {
+namespace tint {
/// Bitset is a dynamically sized, vector of bits, packed into integer words.
/// Bits can be individually read and written using the index operator.
@@ -116,6 +116,6 @@
size_t len_ = 0;
};
-} // namespace tint::utils
+} // namespace tint
#endif // SRC_TINT_UTILS_CONTAINERS_BITSET_H_
diff --git a/src/tint/utils/containers/bitset_test.cc b/src/tint/utils/containers/bitset_test.cc
index 70de877..53f3ba3 100644
--- a/src/tint/utils/containers/bitset_test.cc
+++ b/src/tint/utils/containers/bitset_test.cc
@@ -16,7 +16,7 @@
#include "gtest/gtest.h"
-namespace tint::utils {
+namespace tint {
namespace {
TEST(Bitset, Length) {
@@ -142,4 +142,4 @@
}
} // namespace
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/containers/enum_set.h b/src/tint/utils/containers/enum_set.h
index e8729629..2e3fd15 100644
--- a/src/tint/utils/containers/enum_set.h
+++ b/src/tint/utils/containers/enum_set.h
@@ -22,7 +22,7 @@
#include "src/tint/utils/text/string_stream.h"
-namespace tint::utils {
+namespace tint {
/// EnumSet is a set of enum values.
/// @note As the EnumSet is backed by a single uint64_t value, it can only hold
@@ -228,7 +228,7 @@
/// @param set the EnumSet to write
/// @returns out so calls can be chained
template <typename ENUM>
-inline utils::StringStream& operator<<(utils::StringStream& out, EnumSet<ENUM> set) {
+inline StringStream& operator<<(StringStream& out, EnumSet<ENUM> set) {
out << "{";
bool first = true;
for (auto e : set) {
@@ -241,17 +241,17 @@
return out << "}";
}
-} // namespace tint::utils
+} // namespace tint
namespace std {
-/// Custom std::hash specialization for tint::utils::EnumSet<T>
+/// Custom std::hash specialization for tint::EnumSet<T>
template <typename T>
-class hash<tint::utils::EnumSet<T>> {
+class hash<tint::EnumSet<T>> {
public:
/// @param e the EnumSet to create a hash for
/// @return the hash value
- inline std::size_t operator()(const tint::utils::EnumSet<T>& e) const {
+ inline std::size_t operator()(const tint::EnumSet<T>& e) const {
return std::hash<uint64_t>()(e.Value());
}
};
diff --git a/src/tint/utils/containers/enum_set_test.cc b/src/tint/utils/containers/enum_set_test.cc
index 32303c8..dbeb54c 100644
--- a/src/tint/utils/containers/enum_set_test.cc
+++ b/src/tint/utils/containers/enum_set_test.cc
@@ -19,14 +19,14 @@
#include "gmock/gmock.h"
#include "src/tint/utils/text/string_stream.h"
-namespace tint::utils {
+namespace tint {
namespace {
using ::testing::ElementsAre;
enum class E { A = 0, B = 3, C = 7 };
-utils::StringStream& operator<<(utils::StringStream& out, E e) {
+StringStream& operator<<(StringStream& out, E e) {
switch (e) {
case E::A:
return out << "A";
@@ -245,10 +245,10 @@
}
TEST(EnumSetTest, Ostream) {
- utils::StringStream ss;
+ StringStream ss;
ss << EnumSet<E>(E::A, E::C);
EXPECT_EQ(ss.str(), "{A, C}");
}
} // namespace
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/containers/hashmap.h b/src/tint/utils/containers/hashmap.h
index daa006e..bfbe7fc 100644
--- a/src/tint/utils/containers/hashmap.h
+++ b/src/tint/utils/containers/hashmap.h
@@ -24,7 +24,7 @@
#include "src/tint/utils/debug/debug.h"
#include "src/tint/utils/math/hash.h"
-namespace tint::utils {
+namespace tint {
/// An unordered map that uses a robin-hood hashing algorithm.
template <typename KEY,
@@ -285,6 +285,6 @@
}
};
-} // namespace tint::utils
+} // namespace tint
#endif // SRC_TINT_UTILS_CONTAINERS_HASHMAP_H_
diff --git a/src/tint/utils/containers/hashmap_base.h b/src/tint/utils/containers/hashmap_base.h
index 9d20197..a77299b 100644
--- a/src/tint/utils/containers/hashmap_base.h
+++ b/src/tint/utils/containers/hashmap_base.h
@@ -27,7 +27,7 @@
#define TINT_ASSERT_ITERATORS_NOT_INVALIDATED
-namespace tint::utils {
+namespace tint {
/// Action taken by a map mutation
enum class MapAction {
@@ -98,7 +98,7 @@
/// @param key_value the KeyValue to write
/// @returns out so calls can be chained
template <typename KEY, typename VALUE>
-utils::StringStream& operator<<(utils::StringStream& out, const KeyValue<KEY, VALUE>& key_value) {
+StringStream& operator<<(StringStream& out, const KeyValue<KEY, VALUE>& key_value) {
return out << "[" << key_value.key << ": " << key_value.value << "]";
}
@@ -631,6 +631,6 @@
size_t generation_ = 0;
};
-} // namespace tint::utils
+} // namespace tint
#endif // SRC_TINT_UTILS_CONTAINERS_HASHMAP_BASE_H_
diff --git a/src/tint/utils/containers/hashmap_test.cc b/src/tint/utils/containers/hashmap_test.cc
index 52f2970..fa7394c 100644
--- a/src/tint/utils/containers/hashmap_test.cc
+++ b/src/tint/utils/containers/hashmap_test.cc
@@ -22,7 +22,7 @@
#include "gmock/gmock.h"
-namespace tint::utils {
+namespace tint {
namespace {
constexpr std::array kPrimes{
@@ -534,4 +534,4 @@
}
} // namespace
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/containers/hashset.h b/src/tint/utils/containers/hashset.h
index 8ab452f..e3bc40b 100644
--- a/src/tint/utils/containers/hashset.h
+++ b/src/tint/utils/containers/hashset.h
@@ -26,7 +26,7 @@
#include "src/tint/utils/containers/vector.h"
#include "src/tint/utils/debug/debug.h"
-namespace tint::utils {
+namespace tint {
/// An unordered set that uses a robin-hood hashing algorithm.
template <typename KEY, size_t N, typename HASH = Hasher<KEY>, typename EQUAL = std::equal_to<KEY>>
@@ -58,8 +58,8 @@
/// @returns the set entries of the map as a vector
/// @note the order of the returned vector is non-deterministic between compilers.
template <size_t N2 = N>
- utils::Vector<KEY, N2> Vector() const {
- utils::Vector<KEY, N2> out;
+ tint::Vector<KEY, N2> Vector() const {
+ tint::Vector<KEY, N2> out;
out.Reserve(this->Count());
for (auto& value : *this) {
out.Push(value);
@@ -92,6 +92,6 @@
}
};
-} // namespace tint::utils
+} // namespace tint
#endif // SRC_TINT_UTILS_CONTAINERS_HASHSET_H_
diff --git a/src/tint/utils/containers/hashset_test.cc b/src/tint/utils/containers/hashset_test.cc
index c9e147e..e80908b 100644
--- a/src/tint/utils/containers/hashset_test.cc
+++ b/src/tint/utils/containers/hashset_test.cc
@@ -23,7 +23,7 @@
#include "gmock/gmock.h"
#include "src/tint/utils/containers/predicates.h"
-namespace tint::utils {
+namespace tint {
namespace {
constexpr std::array kPrimes{
@@ -178,4 +178,4 @@
}
} // namespace
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/containers/map.h b/src/tint/utils/containers/map.h
index 74a0ea8..59cb289 100644
--- a/src/tint/utils/containers/map.h
+++ b/src/tint/utils/containers/map.h
@@ -17,7 +17,7 @@
#include <unordered_map>
-namespace tint::utils {
+namespace tint {
/// Lookup is a utility function for fetching a value from an unordered map if
/// it exists, otherwise returning the `if_missing` argument.
@@ -51,6 +51,6 @@
return value;
}
-} // namespace tint::utils
+} // namespace tint
#endif // SRC_TINT_UTILS_CONTAINERS_MAP_H_
diff --git a/src/tint/utils/containers/map_test.cc b/src/tint/utils/containers/map_test.cc
index 843421a..5519c86 100644
--- a/src/tint/utils/containers/map_test.cc
+++ b/src/tint/utils/containers/map_test.cc
@@ -18,7 +18,7 @@
#include "gtest/gtest.h"
-namespace tint::utils {
+namespace tint {
namespace {
TEST(Lookup, Test) {
@@ -53,4 +53,4 @@
}
} // namespace
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/containers/predicates.h b/src/tint/utils/containers/predicates.h
index a919741..a7ac3dc 100644
--- a/src/tint/utils/containers/predicates.h
+++ b/src/tint/utils/containers/predicates.h
@@ -15,7 +15,7 @@
#ifndef SRC_TINT_UTILS_CONTAINERS_PREDICATES_H_
#define SRC_TINT_UTILS_CONTAINERS_PREDICATES_H_
-namespace tint::utils {
+namespace tint {
/// @param value the value to compare against
/// @return a function with the signature `bool(const T&)` which returns true if the argument is
@@ -73,6 +73,6 @@
return ptr == nullptr;
}
-} // namespace tint::utils
+} // namespace tint
#endif // SRC_TINT_UTILS_CONTAINERS_PREDICATES_H_
diff --git a/src/tint/utils/containers/predicates_test.cc b/src/tint/utils/containers/predicates_test.cc
index cf685b2..2fdd728 100644
--- a/src/tint/utils/containers/predicates_test.cc
+++ b/src/tint/utils/containers/predicates_test.cc
@@ -16,7 +16,7 @@
#include "gtest/gtest.h"
-namespace tint::utils {
+namespace tint {
namespace {
TEST(PredicatesTest, Eq) {
@@ -80,4 +80,4 @@
}
} // namespace
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/containers/reverse.h b/src/tint/utils/containers/reverse.h
index bb85a9e..e4c4def 100644
--- a/src/tint/utils/containers/reverse.h
+++ b/src/tint/utils/containers/reverse.h
@@ -17,10 +17,10 @@
#include <iterator>
-namespace tint::utils {
+namespace tint {
namespace detail {
-/// Used by utils::Reverse to hold the underlying iterable.
+/// Used by tint::Reverse to hold the underlying iterable.
/// begin(ReverseIterable<T>) and end(ReverseIterable<T>) are automatically
/// called for range-for loops, via argument-dependent lookup.
/// See https://en.cppreference.com/w/cpp/language/range-for
@@ -49,7 +49,7 @@
/// * for (auto it = vec.rbegin(); i != vec.rend(); ++it) {
/// * auto v = *it;
/// */
-/// for (auto v : utils::Reverse(vec)) {
+/// for (auto v : tint::Reverse(vec)) {
/// }
/// ```
template <typename T>
@@ -57,6 +57,6 @@
return {iterable};
}
-} // namespace tint::utils
+} // namespace tint
#endif // SRC_TINT_UTILS_CONTAINERS_REVERSE_H_
diff --git a/src/tint/utils/containers/reverse_test.cc b/src/tint/utils/containers/reverse_test.cc
index 4ca0369..69a3b8e 100644
--- a/src/tint/utils/containers/reverse_test.cc
+++ b/src/tint/utils/containers/reverse_test.cc
@@ -18,7 +18,7 @@
#include "gmock/gmock.h"
-namespace tint::utils {
+namespace tint {
namespace {
TEST(ReverseTest, Vector) {
@@ -31,4 +31,4 @@
}
} // namespace
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/containers/scope_stack.h b/src/tint/utils/containers/scope_stack.h
index d98f2cd..76b9ff7 100644
--- a/src/tint/utils/containers/scope_stack.h
+++ b/src/tint/utils/containers/scope_stack.h
@@ -67,7 +67,7 @@
/// Return the top scope of the stack.
/// @returns the top scope of the stack
- const utils::Hashmap<K, V, 4>& Top() const { return stack_.Back(); }
+ const Hashmap<K, V, 4>& Top() const { return stack_.Back(); }
/// Clear the scope stack.
void Clear() {
@@ -76,7 +76,7 @@
}
private:
- utils::Vector<utils::Hashmap<K, V, 4>, 8> stack_ = {{}};
+ Vector<Hashmap<K, V, 4>, 8> stack_ = {{}};
};
} // namespace tint
diff --git a/src/tint/utils/containers/slice.h b/src/tint/utils/containers/slice.h
index 972d4bb..7097409 100644
--- a/src/tint/utils/containers/slice.h
+++ b/src/tint/utils/containers/slice.h
@@ -23,7 +23,7 @@
#include "src/tint/utils/rtti/castable.h"
#include "src/tint/utils/traits/traits.h"
-namespace tint::utils {
+namespace tint {
/// A type used to indicate an empty array.
struct EmptyType {};
@@ -44,7 +44,7 @@
template <typename TO, typename FROM>
static constexpr bool ConstRemoved = std::is_const_v<FROM> && !std::is_const_v<TO>;
-/// Private implementation of tint::utils::CanReinterpretSlice.
+/// Private implementation of tint::CanReinterpretSlice.
/// Specialized for the case of TO equal to FROM, which is the common case, and avoids inspection of
/// the base classes, which can be troublesome if the slice is of an incomplete type.
template <ReinterpretMode MODE, typename TO, typename FROM>
@@ -54,7 +54,7 @@
using FROM_EL = std::remove_pointer_t<std::decay_t<FROM>>;
public:
- /// @see utils::CanReinterpretSlice
+ /// @see tint::CanReinterpretSlice
static constexpr bool value =
// const can only be applied, not removed
!ConstRemoved<TO, FROM> &&
@@ -74,8 +74,8 @@
// or
// derives from TO
(std::is_same_v<std::remove_const_t<FROM_EL>, std::remove_const_t<TO_EL>> ||
- (IsCastable<FROM_EL, TO_EL> && (MODE == ReinterpretMode::kUnsafe ||
- utils::traits::IsTypeOrDerived<FROM_EL, TO_EL>)))));
+ (IsCastable<FROM_EL, TO_EL> &&
+ (MODE == ReinterpretMode::kUnsafe || tint::traits::IsTypeOrDerived<FROM_EL, TO_EL>)))));
};
/// Specialization of 'CanReinterpretSlice' for when TO and FROM are equal types.
@@ -96,7 +96,7 @@
/// the same type as, or is an ancestor of the pointee type of `FROM`.
template <ReinterpretMode MODE, typename TO, typename FROM>
static constexpr bool CanReinterpretSlice =
- utils::detail::CanReinterpretSlice<MODE, TO, FROM>::value;
+ tint::detail::CanReinterpretSlice<MODE, TO, FROM>::value;
/// A slice represents a contigious array of elements of type T.
template <typename T>
@@ -253,6 +253,6 @@
template <typename T, size_t N>
Slice(T (&elements)[N]) -> Slice<T>;
-} // namespace tint::utils
+} // namespace tint
#endif // SRC_TINT_UTILS_CONTAINERS_SLICE_H_
diff --git a/src/tint/utils/containers/slice_test.cc b/src/tint/utils/containers/slice_test.cc
index 139dcc5..9836d2b 100644
--- a/src/tint/utils/containers/slice_test.cc
+++ b/src/tint/utils/containers/slice_test.cc
@@ -16,7 +16,7 @@
#include "gmock/gmock.h"
-namespace tint::utils {
+namespace tint {
namespace {
class C0 : public Castable<C0> {};
@@ -182,4 +182,4 @@
}
} // namespace
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/containers/transform.h b/src/tint/utils/containers/transform.h
index 4e3e686..463376c 100644
--- a/src/tint/utils/containers/transform.h
+++ b/src/tint/utils/containers/transform.h
@@ -23,7 +23,7 @@
#include "src/tint/utils/containers/vector.h"
#include "src/tint/utils/traits/traits.h"
-namespace tint::utils {
+namespace tint {
/// Transform performs an element-wise transformation of a vector.
/// @param in the input vector.
@@ -170,6 +170,6 @@
return result;
}
-} // namespace tint::utils
+} // namespace tint
#endif // SRC_TINT_UTILS_CONTAINERS_TRANSFORM_H_
diff --git a/src/tint/utils/containers/transform_test.cc b/src/tint/utils/containers/transform_test.cc
index aec9d78..ac3b9a3 100644
--- a/src/tint/utils/containers/transform_test.cc
+++ b/src/tint/utils/containers/transform_test.cc
@@ -23,7 +23,7 @@
static_assert(std::is_same<decltype(vector)::value_type, expected>::value, \
"unexpected result vector element type")
-namespace tint::utils {
+namespace tint {
namespace {
TEST(TransformTest, StdVectorEmpty) {
@@ -346,4 +346,4 @@
}
} // namespace
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/containers/unique_allocator.h b/src/tint/utils/containers/unique_allocator.h
index d5e7e24..ffdcb7d 100644
--- a/src/tint/utils/containers/unique_allocator.h
+++ b/src/tint/utils/containers/unique_allocator.h
@@ -21,7 +21,7 @@
#include "src/tint/utils/memory/block_allocator.h"
-namespace tint::utils {
+namespace tint {
/// UniqueAllocator is used to allocate unique instances of the template type
/// `T`.
@@ -114,6 +114,6 @@
std::unordered_set<Entry, Comparator, Comparator> items;
};
-} // namespace tint::utils
+} // namespace tint
#endif // SRC_TINT_UTILS_CONTAINERS_UNIQUE_ALLOCATOR_H_
diff --git a/src/tint/utils/containers/unique_allocator_test.cc b/src/tint/utils/containers/unique_allocator_test.cc
index a71ce98..8f9e91b 100644
--- a/src/tint/utils/containers/unique_allocator_test.cc
+++ b/src/tint/utils/containers/unique_allocator_test.cc
@@ -18,7 +18,7 @@
#include "gtest/gtest.h"
-namespace tint::utils {
+namespace tint {
namespace {
TEST(UniqueAllocator, Int) {
@@ -49,4 +49,4 @@
}
} // namespace
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/containers/unique_vector.h b/src/tint/utils/containers/unique_vector.h
index 980a06f..5bdc75b 100644
--- a/src/tint/utils/containers/unique_vector.h
+++ b/src/tint/utils/containers/unique_vector.h
@@ -24,7 +24,7 @@
#include "src/tint/utils/containers/hashset.h"
#include "src/tint/utils/containers/vector.h"
-namespace tint::utils {
+namespace tint {
/// UniqueVector is an ordered container that only contains unique items.
/// Attempting to add a duplicate is a no-op.
@@ -144,6 +144,6 @@
Hashset<T, N, HASH, EQUAL> set;
};
-} // namespace tint::utils
+} // namespace tint
#endif // SRC_TINT_UTILS_CONTAINERS_UNIQUE_VECTOR_H_
diff --git a/src/tint/utils/containers/unique_vector_test.cc b/src/tint/utils/containers/unique_vector_test.cc
index 5f50b3a..796d143 100644
--- a/src/tint/utils/containers/unique_vector_test.cc
+++ b/src/tint/utils/containers/unique_vector_test.cc
@@ -20,7 +20,7 @@
#include "gtest/gtest.h"
-namespace tint::utils {
+namespace tint {
namespace {
TEST(UniqueVectorTest, Empty) {
@@ -175,7 +175,7 @@
unique_vec.Add(1);
unique_vec.Add(2);
- utils::VectorRef<int> ref = unique_vec;
+ VectorRef<int> ref = unique_vec;
EXPECT_EQ(ref.Length(), 3u);
EXPECT_EQ(unique_vec.IsEmpty(), false);
int i = 0;
@@ -233,4 +233,4 @@
}
} // namespace
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/containers/vector.h b/src/tint/utils/containers/vector.h
index b844e54..32d42e3 100644
--- a/src/tint/utils/containers/vector.h
+++ b/src/tint/utils/containers/vector.h
@@ -29,7 +29,7 @@
#include "src/tint/utils/memory/bitcast.h"
#include "src/tint/utils/text/string_stream.h"
-namespace tint::utils {
+namespace tint {
/// Forward declarations
template <typename>
@@ -37,9 +37,9 @@
template <typename>
class VectorRef;
-} // namespace tint::utils
+} // namespace tint
-namespace tint::utils {
+namespace tint {
/// Vector is a small-object-optimized, dynamically-sized vector of contigious elements of type T.
///
@@ -472,10 +472,10 @@
}
/// @returns the internal slice of the vector
- utils::Slice<T> Slice() { return impl_.slice; }
+ tint::Slice<T> Slice() { return impl_.slice; }
/// @returns the internal slice of the vector
- utils::Slice<const T> Slice() const { return impl_.slice; }
+ tint::Slice<const T> Slice() const { return impl_.slice; }
private:
/// Friend class (differing specializations of this class)
@@ -511,7 +511,7 @@
/// Copies all the elements from `other` to this vector, replacing the content of this vector.
/// @param other the
- void Copy(const utils::Slice<T>& other) {
+ void Copy(const tint::Slice<T>& other) {
if (impl_.slice.cap < other.len) {
ClearAndFree();
impl_.Allocate(other.len);
@@ -548,7 +548,7 @@
/// The internal structure for the vector with a small array.
struct ImplWithSmallArray {
TStorage small_arr[N];
- utils::Slice<T> slice = {small_arr[0].Get(), 0, N};
+ tint::Slice<T> slice = {small_arr[0].Get(), 0, N};
/// Allocates a new vector of `T` either from #small_arr, or from the heap, then assigns the
/// pointer it to #slice.data, and updates #slice.cap.
@@ -576,7 +576,7 @@
/// The internal structure for the vector without a small array.
struct ImplWithoutSmallArray {
- utils::Slice<T> slice = Empty;
+ tint::Slice<T> slice = Empty;
/// Allocates a new vector of `T` and assigns it to #slice.data, and updates #slice.cap.
void Allocate(size_t new_cap) {
@@ -631,7 +631,7 @@
/// Helper for determining the Vector element type (`T`) from the vector's constuctor arguments
template <typename... Ts>
using VectorCommonType =
- typename utils::detail::VectorCommonType<IsCastable<std::remove_pointer_t<Ts>...>, Ts...>::type;
+ typename tint::detail::VectorCommonType<IsCastable<std::remove_pointer_t<Ts>...>, Ts...>::type;
/// Deduction guide for Vector
template <typename... Ts>
@@ -661,8 +661,8 @@
template <typename T>
class VectorRef {
/// @returns an empty slice.
- static utils::Slice<T>& EmptySlice() {
- static utils::Slice<T> empty;
+ static tint::Slice<T>& EmptySlice() {
+ static tint::Slice<T> empty;
return empty;
}
@@ -678,7 +678,7 @@
/// Constructor from a Slice
/// @param slice the slice
- VectorRef(utils::Slice<T>& slice) // NOLINT(runtime/explicit)
+ VectorRef(tint::Slice<T>& slice) // NOLINT(runtime/explicit)
: slice_(slice) {}
/// Constructor from a Vector
@@ -691,7 +691,7 @@
/// @param vector the vector to create a reference of
template <size_t N>
VectorRef(const Vector<T, N>& vector) // NOLINT(runtime/explicit)
- : slice_(const_cast<utils::Slice<T>&>(vector.impl_.slice)) {}
+ : slice_(const_cast<tint::Slice<T>&>(vector.impl_.slice)) {}
/// Constructor from a moved Vector
/// @param vector the vector being moved
@@ -760,7 +760,7 @@
}
/// @returns the internal slice of the vector
- utils::Slice<T> Slice() { return slice_; }
+ tint::Slice<T> Slice() { return slice_; }
/// @returns true if the vector is empty.
bool IsEmpty() const { return slice_.len == 0; }
@@ -797,7 +797,7 @@
friend class VectorRef;
/// The slice of the vector being referenced.
- utils::Slice<T>& slice_;
+ tint::Slice<T>& slice_;
/// Whether the slice data is passed by r-value reference, and can be moved.
bool can_move_ = false;
};
@@ -866,32 +866,32 @@
namespace detail {
-/// IsVectorLike<T>::value is true if T is a utils::Vector or utils::VectorRef.
+/// IsVectorLike<T>::value is true if T is a Vector or VectorRef.
template <typename T>
struct IsVectorLike {
/// Non-specialized form of IsVectorLike defaults to false
static constexpr bool value = false;
};
-/// IsVectorLike specialization for utils::Vector
+/// IsVectorLike specialization for Vector
template <typename T, size_t N>
-struct IsVectorLike<utils::Vector<T, N>> {
- /// True for the IsVectorLike specialization of utils::Vector
+struct IsVectorLike<Vector<T, N>> {
+ /// True for the IsVectorLike specialization of Vector
static constexpr bool value = true;
};
-/// IsVectorLike specialization for utils::VectorRef
+/// IsVectorLike specialization for VectorRef
template <typename T>
-struct IsVectorLike<utils::VectorRef<T>> {
- /// True for the IsVectorLike specialization of utils::VectorRef
+struct IsVectorLike<VectorRef<T>> {
+ /// True for the IsVectorLike specialization of VectorRef
static constexpr bool value = true;
};
} // namespace detail
/// True if T is a Vector<T, N> or VectorRef<T>
template <typename T>
-static constexpr bool IsVectorLike = utils::detail::IsVectorLike<T>::value;
+static constexpr bool IsVectorLike = tint::detail::IsVectorLike<T>::value;
-} // namespace tint::utils
+} // namespace tint
#endif // SRC_TINT_UTILS_CONTAINERS_VECTOR_H_
diff --git a/src/tint/utils/containers/vector_test.cc b/src/tint/utils/containers/vector_test.cc
index 0883eab..ab8a3e2 100644
--- a/src/tint/utils/containers/vector_test.cc
+++ b/src/tint/utils/containers/vector_test.cc
@@ -23,7 +23,7 @@
#include "src/tint/utils/memory/bitcast.h"
#include "src/tint/utils/text/string_stream.h"
-namespace tint::utils {
+namespace tint {
namespace {
class C0 : public Castable<C0> {};
@@ -1991,7 +1991,7 @@
}
TEST(TintVectorTest, ostream) {
- utils::StringStream ss;
+ StringStream ss;
ss << Vector{1, 2, 3};
EXPECT_EQ(ss.str(), "[1, 2, 3]");
}
@@ -2262,7 +2262,7 @@
}
TEST(TintVectorRefTest, ostream) {
- utils::StringStream ss;
+ StringStream ss;
Vector vec{1, 2, 3};
const VectorRef<int> vec_ref(vec);
ss << vec_ref;
@@ -2270,9 +2270,9 @@
}
} // namespace
-} // namespace tint::utils
+} // namespace tint
-TINT_INSTANTIATE_TYPEINFO(tint::utils::C0);
-TINT_INSTANTIATE_TYPEINFO(tint::utils::C1);
-TINT_INSTANTIATE_TYPEINFO(tint::utils::C2a);
-TINT_INSTANTIATE_TYPEINFO(tint::utils::C2b);
+TINT_INSTANTIATE_TYPEINFO(tint::C0);
+TINT_INSTANTIATE_TYPEINFO(tint::C1);
+TINT_INSTANTIATE_TYPEINFO(tint::C2a);
+TINT_INSTANTIATE_TYPEINFO(tint::C2b);
diff --git a/src/tint/utils/debug/debug.h b/src/tint/utils/debug/debug.h
index 4cf4257..c039861 100644
--- a/src/tint/utils/debug/debug.h
+++ b/src/tint/utils/debug/debug.h
@@ -72,7 +72,7 @@
const size_t line_;
diag::System system_;
diag::List& diagnostics_;
- utils::StringStream msg_;
+ StringStream msg_;
};
} // namespace tint
diff --git a/src/tint/utils/diagnostic/formatter.cc b/src/tint/utils/diagnostic/formatter.cc
index 416551f..8c995d6 100644
--- a/src/tint/utils/diagnostic/formatter.cc
+++ b/src/tint/utils/diagnostic/formatter.cc
@@ -43,7 +43,7 @@
}
std::string to_str(const Source::Location& location) {
- utils::StringStream ss;
+ StringStream ss;
if (location.line > 0) {
ss << location.line;
if (location.column > 0) {
@@ -77,7 +77,7 @@
auto str = stream.str();
if (str.length() > 0) {
printer->write(str, style);
- utils::StringStream reset;
+ StringStream reset;
stream.swap(reset);
}
}
@@ -102,7 +102,7 @@
private:
Printer* printer;
diag::Style style;
- utils::StringStream stream;
+ StringStream stream;
};
Formatter::Formatter() {}
diff --git a/src/tint/utils/diagnostic/printer.h b/src/tint/utils/diagnostic/printer.h
index 07b2c2c..39e3698 100644
--- a/src/tint/utils/diagnostic/printer.h
+++ b/src/tint/utils/diagnostic/printer.h
@@ -74,7 +74,7 @@
void write(const std::string& str, const Style&) override;
private:
- utils::StringStream stream;
+ StringStream stream;
};
} // namespace tint::diag
diff --git a/src/tint/utils/diagnostic/source.cc b/src/tint/utils/diagnostic/source.cc
index d2b079c..8565ca3 100644
--- a/src/tint/utils/diagnostic/source.cc
+++ b/src/tint/utils/diagnostic/source.cc
@@ -27,19 +27,19 @@
// See https://www.w3.org/TR/WGSL/#blankspace
auto* utf8 = reinterpret_cast<const uint8_t*>(&str[i]);
- auto [cp, n] = utils::utf8::Decode(utf8, str.size() - i);
+ auto [cp, n] = tint::utf8::Decode(utf8, str.size() - i);
if (n == 0) {
return false;
}
- static const auto kLF = utils::CodePoint(0x000A); // line feed
- static const auto kVTab = utils::CodePoint(0x000B); // vertical tab
- static const auto kFF = utils::CodePoint(0x000C); // form feed
- static const auto kNL = utils::CodePoint(0x0085); // next line
- static const auto kCR = utils::CodePoint(0x000D); // carriage return
- static const auto kLS = utils::CodePoint(0x2028); // line separator
- static const auto kPS = utils::CodePoint(0x2029); // parargraph separator
+ static const auto kLF = tint::CodePoint(0x000A); // line feed
+ static const auto kVTab = tint::CodePoint(0x000B); // vertical tab
+ static const auto kFF = tint::CodePoint(0x000C); // form feed
+ static const auto kNL = tint::CodePoint(0x0085); // next line
+ static const auto kCR = tint::CodePoint(0x000D); // carriage return
+ static const auto kLS = tint::CodePoint(0x2028); // line separator
+ static const auto kPS = tint::CodePoint(0x2029); // parargraph separator
if (cp == kLF || cp == kVTab || cp == kFF || cp == kNL || cp == kPS || cp == kLS) {
*is_line_break = true;
@@ -54,7 +54,7 @@
if (auto next_i = i + n; next_i < str.size()) {
auto* next_utf8 = reinterpret_cast<const uint8_t*>(&str[next_i]);
- auto [next_cp, next_n] = utils::utf8::Decode(next_utf8, str.size() - next_i);
+ auto [next_cp, next_n] = tint::utf8::Decode(next_utf8, str.size() - next_i);
if (next_n == 0) {
return false;
@@ -121,7 +121,7 @@
Source::File::~File() = default;
-utils::StringStream& operator<<(utils::StringStream& out, const Source& source) {
+StringStream& operator<<(StringStream& out, const Source& source) {
auto rng = source.range;
if (source.file) {
diff --git a/src/tint/utils/diagnostic/source.h b/src/tint/utils/diagnostic/source.h
index 7f5f765..a377e61 100644
--- a/src/tint/utils/diagnostic/source.h
+++ b/src/tint/utils/diagnostic/source.h
@@ -196,7 +196,7 @@
/// @param out the stream to write to
/// @param loc the location to write
/// @returns out so calls can be chained
-inline utils::StringStream& operator<<(utils::StringStream& out, const Source::Location& loc) {
+inline StringStream& operator<<(StringStream& out, const Source::Location& loc) {
out << loc.line << ":" << loc.column;
return out;
}
@@ -205,7 +205,7 @@
/// @param out the stream to write to
/// @param range the range to write
/// @returns out so calls can be chained
-inline utils::StringStream& operator<<(utils::StringStream& out, const Source::Range& range) {
+inline StringStream& operator<<(StringStream& out, const Source::Range& range) {
out << "[" << range.begin << ", " << range.end << "]";
return out;
}
@@ -214,14 +214,13 @@
/// @param out the stream to write to
/// @param source the source to write
/// @returns out so calls can be chained
-utils::StringStream& operator<<(utils::StringStream& out, const Source& source);
+StringStream& operator<<(StringStream& out, const Source& source);
/// Writes the Source::FileContent to the stream.
/// @param out the stream to write to
/// @param content the file content to write
/// @returns out so calls can be chained
-inline utils::StringStream& operator<<(utils::StringStream& out,
- const Source::FileContent& content) {
+inline StringStream& operator<<(StringStream& out, const Source::FileContent& content) {
out << content.data;
return out;
}
diff --git a/src/tint/utils/file/tmpfile.h b/src/tint/utils/file/tmpfile.h
index ed83918..38cdf71 100644
--- a/src/tint/utils/file/tmpfile.h
+++ b/src/tint/utils/file/tmpfile.h
@@ -19,7 +19,7 @@
#include "src/tint/utils/text/string_stream.h"
-namespace tint::utils {
+namespace tint {
/// TmpFile constructs a temporary file that can be written to, and is
/// automatically deleted on destruction.
@@ -56,7 +56,7 @@
/// @return a reference to this TmpFile
template <typename T>
inline TmpFile& operator<<(T&& data) {
- utils::StringStream ss;
+ StringStream ss;
ss << data;
std::string str = ss.str();
Append(str.data(), str.size());
@@ -70,6 +70,6 @@
std::string path_;
};
-} // namespace tint::utils
+} // namespace tint
#endif // SRC_TINT_UTILS_FILE_TMPFILE_H_
diff --git a/src/tint/utils/file/tmpfile_other.cc b/src/tint/utils/file/tmpfile_other.cc
index 1a7da4c..1f3ef9d 100644
--- a/src/tint/utils/file/tmpfile_other.cc
+++ b/src/tint/utils/file/tmpfile_other.cc
@@ -14,7 +14,7 @@
#include "src/tint/utils/file/tmpfile.h"
-namespace tint::utils {
+namespace tint {
TmpFile::TmpFile(std::string) {}
@@ -24,4 +24,4 @@
return false;
}
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/file/tmpfile_posix.cc b/src/tint/utils/file/tmpfile_posix.cc
index f26747d..9d6505b 100644
--- a/src/tint/utils/file/tmpfile_posix.cc
+++ b/src/tint/utils/file/tmpfile_posix.cc
@@ -19,7 +19,7 @@
#include "src/tint/utils/debug/debug.h"
-namespace tint::utils {
+namespace tint {
namespace {
@@ -63,4 +63,4 @@
return false;
}
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/file/tmpfile_test.cc b/src/tint/utils/file/tmpfile_test.cc
index e2fff23..b8fea6d 100644
--- a/src/tint/utils/file/tmpfile_test.cc
+++ b/src/tint/utils/file/tmpfile_test.cc
@@ -18,7 +18,7 @@
#include "gtest/gtest.h"
-namespace tint::utils {
+namespace tint {
namespace {
TEST(TmpFileTest, WriteReadAppendDelete) {
@@ -85,4 +85,4 @@
}
} // namespace
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/file/tmpfile_windows.cc b/src/tint/utils/file/tmpfile_windows.cc
index 0a4598e..8c990e3 100644
--- a/src/tint/utils/file/tmpfile_windows.cc
+++ b/src/tint/utils/file/tmpfile_windows.cc
@@ -17,7 +17,7 @@
#include <stdio.h>
#include <cstdio>
-namespace tint::utils {
+namespace tint {
namespace {
@@ -58,4 +58,4 @@
return true;
}
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/generation_id.h b/src/tint/utils/generation_id.h
index 6e8c5e8..fd8455a 100644
--- a/src/tint/utils/generation_id.h
+++ b/src/tint/utils/generation_id.h
@@ -75,7 +75,7 @@
/// @param out the stream to write to
/// @param id the generation identifier to write
/// @returns out so calls can be chained
-inline utils::StringStream& operator<<(utils::StringStream& out, GenerationID id) {
+inline StringStream& operator<<(StringStream& out, GenerationID id) {
out << "Generation<" << id.Value() << ">";
return out;
}
diff --git a/src/tint/utils/macros/defer.h b/src/tint/utils/macros/defer.h
index 7320f87..a6f51a9 100644
--- a/src/tint/utils/macros/defer.h
+++ b/src/tint/utils/macros/defer.h
@@ -19,7 +19,7 @@
#include "src/tint/utils/macros/concat.h"
-namespace tint::utils {
+namespace tint {
/// Defer executes a function or function like object when it is destructed.
template <typename F>
@@ -50,11 +50,10 @@
return Defer<F>(std::forward<F>(f));
}
-} // namespace tint::utils
+} // namespace tint
/// TINT_DEFER(S) executes the statement(s) `S` when exiting the current lexical
/// scope.
-#define TINT_DEFER(S) \
- auto TINT_CONCAT(tint_defer_, __COUNTER__) = ::tint::utils::MakeDefer([&] { S; })
+#define TINT_DEFER(S) auto TINT_CONCAT(tint_defer_, __COUNTER__) = ::tint::MakeDefer([&] { S; })
#endif // SRC_TINT_UTILS_MACROS_DEFER_H_
diff --git a/src/tint/utils/macros/defer_test.cc b/src/tint/utils/macros/defer_test.cc
index f131cc8..70bb8fa 100644
--- a/src/tint/utils/macros/defer_test.cc
+++ b/src/tint/utils/macros/defer_test.cc
@@ -16,7 +16,7 @@
#include "gtest/gtest.h"
-namespace tint::utils {
+namespace tint {
namespace {
TEST(DeferTest, Basic) {
@@ -39,4 +39,4 @@
}
} // namespace
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/macros/scoped_assignment.h b/src/tint/utils/macros/scoped_assignment.h
index d5279f8..9d4e98b 100644
--- a/src/tint/utils/macros/scoped_assignment.h
+++ b/src/tint/utils/macros/scoped_assignment.h
@@ -20,7 +20,7 @@
#include "src/tint/utils/macros/concat.h"
-namespace tint::utils {
+namespace tint {
/// Helper class that temporarily assigns a value to a variable for the lifetime
/// of the ScopedAssignment object. Once the ScopedAssignment is destructed, the
@@ -49,14 +49,14 @@
T old_value_;
};
-} // namespace tint::utils
+} // namespace tint
/// TINT_SCOPED_ASSIGNMENT(var, val) assigns `val` to `var`, and automatically
/// restores the original value of `var` when exiting the current lexical scope.
-#define TINT_SCOPED_ASSIGNMENT(var, val) \
- ::tint::utils::ScopedAssignment<std::remove_reference_t<decltype(var)>> TINT_CONCAT( \
- tint_scoped_assignment_, __COUNTER__) { \
- var, val \
+#define TINT_SCOPED_ASSIGNMENT(var, val) \
+ ::tint::ScopedAssignment<std::remove_reference_t<decltype(var)>> TINT_CONCAT( \
+ tint_scoped_assignment_, __COUNTER__) { \
+ var, val \
}
#endif // SRC_TINT_UTILS_MACROS_SCOPED_ASSIGNMENT_H_
diff --git a/src/tint/utils/macros/scoped_assignment_test.cc b/src/tint/utils/macros/scoped_assignment_test.cc
index fa3b4ad..2641298 100644
--- a/src/tint/utils/macros/scoped_assignment_test.cc
+++ b/src/tint/utils/macros/scoped_assignment_test.cc
@@ -16,7 +16,7 @@
#include "gtest/gtest.h"
-namespace tint::utils {
+namespace tint {
namespace {
TEST(ScopedAssignmentTest, Scopes) {
@@ -42,4 +42,4 @@
}
} // namespace
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/math/crc32.h b/src/tint/utils/math/crc32.h
index 022eefd..3113edb 100644
--- a/src/tint/utils/math/crc32.h
+++ b/src/tint/utils/math/crc32.h
@@ -18,7 +18,7 @@
#include <stdint.h>
#include <cstddef>
-namespace tint::utils {
+namespace tint {
constexpr uint32_t kCRC32LUT[] = {
0, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
@@ -76,6 +76,6 @@
return crc ^ 0xffffffff;
}
-} // namespace tint::utils
+} // namespace tint
#endif // SRC_TINT_UTILS_MATH_CRC32_H_
diff --git a/src/tint/utils/math/crc32_test.cc b/src/tint/utils/math/crc32_test.cc
index f029108..403ace7 100644
--- a/src/tint/utils/math/crc32_test.cc
+++ b/src/tint/utils/math/crc32_test.cc
@@ -16,7 +16,7 @@
#include "gtest/gtest.h"
-namespace tint::utils {
+namespace tint {
namespace {
TEST(CRC32Test, Compiletime) {
@@ -32,4 +32,4 @@
}
} // namespace
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/math/hash.h b/src/tint/utils/math/hash.h
index 74f053b..bdaaabe 100644
--- a/src/tint/utils/math/hash.h
+++ b/src/tint/utils/math/hash.h
@@ -27,7 +27,7 @@
#include "src/tint/utils/containers/vector.h"
#include "src/tint/utils/math/crc32.h"
-namespace tint::utils {
+namespace tint {
namespace detail {
/// Helper for obtaining a seed bias value for HashCombine with a bit-width
@@ -111,12 +111,12 @@
}
};
-/// Hasher specialization for utils::Vector
+/// Hasher specialization for Vector
template <typename T, size_t N>
-struct Hasher<utils::Vector<T, N>> {
+struct Hasher<Vector<T, N>> {
/// @param vector the Vector to hash
/// @returns a hash of the Vector
- size_t operator()(const utils::Vector<T, N>& vector) const {
+ size_t operator()(const Vector<T, N>& vector) const {
auto hash = Hash(vector.Length());
for (auto& el : vector) {
hash = HashCombine(hash, el);
@@ -125,12 +125,12 @@
}
};
-/// Hasher specialization for utils::VectorRef
+/// Hasher specialization for VectorRef
template <typename T>
-struct Hasher<utils::VectorRef<T>> {
+struct Hasher<VectorRef<T>> {
/// @param vector the VectorRef reference to hash
/// @returns a hash of the Vector
- size_t operator()(const utils::VectorRef<T>& vector) const {
+ size_t operator()(const VectorRef<T>& vector) const {
auto hash = Hash(vector.Length());
for (auto& el : vector) {
hash = HashCombine(hash, el);
@@ -209,7 +209,7 @@
/// The returned hash is dependent on the order of the arguments.
template <typename... ARGS>
size_t HashCombine(size_t hash, const ARGS&... values) {
- constexpr size_t offset = utils::detail::HashCombineOffset<sizeof(size_t)>::value();
+ constexpr size_t offset = tint::detail::HashCombineOffset<sizeof(size_t)>::value();
((hash ^= Hash(values) + (offset ^ (hash >> 2))), ...);
return hash;
}
@@ -281,19 +281,17 @@
bool operator==(const UnorderedKeyWrapper& other) const { return value == other.value; }
};
-} // namespace tint::utils
+} // namespace tint
namespace std {
-/// Custom std::hash specialization for tint::utils::UnorderedKeyWrapper
+/// Custom std::hash specialization for tint::UnorderedKeyWrapper
template <typename T>
-class hash<tint::utils::UnorderedKeyWrapper<T>> {
+class hash<tint::UnorderedKeyWrapper<T>> {
public:
/// @param w the UnorderedKeyWrapper
/// @return the hash value
- inline std::size_t operator()(const tint::utils::UnorderedKeyWrapper<T>& w) const {
- return w.hash;
- }
+ inline std::size_t operator()(const tint::UnorderedKeyWrapper<T>& w) const { return w.hash; }
};
} // namespace std
diff --git a/src/tint/utils/math/hash_test.cc b/src/tint/utils/math/hash_test.cc
index 7083170..cbe874a 100644
--- a/src/tint/utils/math/hash_test.cc
+++ b/src/tint/utils/math/hash_test.cc
@@ -21,7 +21,7 @@
#include "gtest/gtest.h"
#include "src/tint/utils/containers/vector.h"
-namespace tint::utils {
+namespace tint {
namespace {
TEST(HashTests, Basic) {
@@ -125,4 +125,4 @@
}
} // namespace
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/math/math.h b/src/tint/utils/math/math.h
index 59bd36c..8525383 100644
--- a/src/tint/utils/math/math.h
+++ b/src/tint/utils/math/math.h
@@ -20,7 +20,7 @@
#include <string>
#include <type_traits>
-namespace tint::utils {
+namespace tint {
/// @param alignment the next multiple to round `value` to
/// @param value the value to round to the next multiple of `alignment`
@@ -98,6 +98,6 @@
return pot;
}
-} // namespace tint::utils
+} // namespace tint
#endif // SRC_TINT_UTILS_MATH_MATH_H_
diff --git a/src/tint/utils/math/math_test.cc b/src/tint/utils/math/math_test.cc
index 8da26ba..706dded 100644
--- a/src/tint/utils/math/math_test.cc
+++ b/src/tint/utils/math/math_test.cc
@@ -16,7 +16,7 @@
#include "gtest/gtest.h"
-namespace tint::utils {
+namespace tint {
namespace {
TEST(MathTests, RoundUp) {
@@ -142,4 +142,4 @@
}
} // namespace
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/memory/bitcast.h b/src/tint/utils/memory/bitcast.h
index 30f772b..14e00ee 100644
--- a/src/tint/utils/memory/bitcast.h
+++ b/src/tint/utils/memory/bitcast.h
@@ -19,7 +19,7 @@
#include <cstring>
#include <type_traits>
-namespace tint::utils {
+namespace tint {
/// Bitcast performs a cast of `from` to the `TO` type using a memcpy.
/// This unsafe cast avoids triggering Clang's Control Flow Integrity checks.
@@ -48,6 +48,6 @@
return to;
}
-} // namespace tint::utils
+} // namespace tint
#endif // SRC_TINT_UTILS_MEMORY_BITCAST_H_
diff --git a/src/tint/utils/memory/bitcast_test.cc b/src/tint/utils/memory/bitcast_test.cc
index 558c52f..2ffb4be 100644
--- a/src/tint/utils/memory/bitcast_test.cc
+++ b/src/tint/utils/memory/bitcast_test.cc
@@ -18,7 +18,7 @@
#include "gtest/gtest.h"
-namespace tint::utils {
+namespace tint {
namespace {
TEST(Bitcast, Integer) {
@@ -34,4 +34,4 @@
}
} // namespace
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/memory/block_allocator.h b/src/tint/utils/memory/block_allocator.h
index 1cc382c..2ee1296 100644
--- a/src/tint/utils/memory/block_allocator.h
+++ b/src/tint/utils/memory/block_allocator.h
@@ -22,7 +22,7 @@
#include "src/tint/utils/math/math.h"
#include "src/tint/utils/memory/bitcast.h"
-namespace tint::utils {
+namespace tint {
/// A container and allocator of objects of (or deriving from) the template type `T`.
/// Objects are allocated by calling Create(), and are owned by the BlockAllocator.
@@ -259,7 +259,7 @@
auto& block = data.block;
- block.current_offset = utils::RoundUp(alignof(TYPE), block.current_offset);
+ block.current_offset = tint::RoundUp(alignof(TYPE), block.current_offset);
if (block.current_offset + sizeof(TYPE) > BLOCK_SIZE) {
// Allocate a new block from the heap
auto* prev_block = block.current;
@@ -277,7 +277,7 @@
}
auto* base = &block.current->data[0];
- auto* ptr = utils::Bitcast<TYPE*>(base + block.current_offset);
+ auto* ptr = tint::Bitcast<TYPE*>(base + block.current_offset);
block.current_offset += sizeof(TYPE);
return ptr;
}
@@ -336,6 +336,6 @@
} data;
};
-} // namespace tint::utils
+} // namespace tint
#endif // SRC_TINT_UTILS_MEMORY_BLOCK_ALLOCATOR_H_
diff --git a/src/tint/utils/memory/block_allocator_test.cc b/src/tint/utils/memory/block_allocator_test.cc
index 194769a..d6da564 100644
--- a/src/tint/utils/memory/block_allocator_test.cc
+++ b/src/tint/utils/memory/block_allocator_test.cc
@@ -16,7 +16,7 @@
#include "gtest/gtest.h"
-namespace tint::utils {
+namespace tint {
namespace {
struct LifetimeCounter {
@@ -161,4 +161,4 @@
}
} // namespace
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/memory/bump_allocator.h b/src/tint/utils/memory/bump_allocator.h
index c4c07e8..db78644 100644
--- a/src/tint/utils/memory/bump_allocator.h
+++ b/src/tint/utils/memory/bump_allocator.h
@@ -22,7 +22,7 @@
#include "src/tint/utils/math/math.h"
#include "src/tint/utils/memory/bitcast.h"
-namespace tint::utils {
+namespace tint {
constexpr size_t kBlockSize = 64 * 1024;
@@ -122,6 +122,6 @@
} data;
};
-} // namespace tint::utils
+} // namespace tint
#endif // SRC_TINT_UTILS_MEMORY_BUMP_ALLOCATOR_H_
diff --git a/src/tint/utils/memory/bump_allocator_test.cc b/src/tint/utils/memory/bump_allocator_test.cc
index 0212586..4241699 100644
--- a/src/tint/utils/memory/bump_allocator_test.cc
+++ b/src/tint/utils/memory/bump_allocator_test.cc
@@ -16,7 +16,7 @@
#include "gtest/gtest.h"
-namespace tint::utils {
+namespace tint {
namespace {
using BumpAllocatorTest = testing::Test;
@@ -46,4 +46,4 @@
}
} // namespace
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/result/result.h b/src/tint/utils/result/result.h
index ef52312..ee87ecd 100644
--- a/src/tint/utils/result/result.h
+++ b/src/tint/utils/result/result.h
@@ -21,7 +21,7 @@
#include "src/tint/utils/debug/debug.h"
#include "src/tint/utils/text/string_stream.h"
-namespace tint::utils {
+namespace tint {
/// Empty structure that can be used as the SUCCESS_TYPE for a Result.
struct SuccessType {};
@@ -163,10 +163,10 @@
/// @param res the result
/// @return the stream so calls can be chained
template <typename SUCCESS, typename FAILURE>
-inline utils::StringStream& operator<<(utils::StringStream& out, Result<SUCCESS, FAILURE> res) {
+inline StringStream& operator<<(StringStream& out, Result<SUCCESS, FAILURE> res) {
return res ? (out << "success: " << res.Get()) : (out << "failure: " << res.Failure());
}
-} // namespace tint::utils
+} // namespace tint
#endif // SRC_TINT_UTILS_RESULT_RESULT_H_
diff --git a/src/tint/utils/result/result_test.cc b/src/tint/utils/result/result_test.cc
index e7039cc..35ed8cf 100644
--- a/src/tint/utils/result/result_test.cc
+++ b/src/tint/utils/result/result_test.cc
@@ -18,7 +18,7 @@
#include "gmock/gmock.h"
-namespace tint::utils {
+namespace tint {
namespace {
TEST(ResultTest, SuccessInt) {
@@ -64,4 +64,4 @@
}
} // namespace
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/rtti/castable.cc b/src/tint/utils/rtti/castable.cc
index dd4114a..4827dfaa 100644
--- a/src/tint/utils/rtti/castable.cc
+++ b/src/tint/utils/rtti/castable.cc
@@ -14,20 +14,20 @@
#include "src/tint/utils/rtti/castable.h"
-namespace tint::utils {
+namespace tint {
/// The unique TypeInfo for the CastableBase type
/// @return doxygen-thinks-this-static-field-is-a-function :(
template <>
-const TypeInfo utils::detail::TypeInfoOf<CastableBase>::info{
+const TypeInfo tint::detail::TypeInfoOf<CastableBase>::info{
nullptr,
"CastableBase",
- tint::utils::TypeInfo::HashCodeOf<CastableBase>(),
- tint::utils::TypeInfo::FullHashCodeOf<CastableBase>(),
+ tint::TypeInfo::HashCodeOf<CastableBase>(),
+ tint::TypeInfo::FullHashCodeOf<CastableBase>(),
};
CastableBase::CastableBase(const CastableBase&) = default;
CastableBase::~CastableBase() = default;
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/rtti/castable.h b/src/tint/utils/rtti/castable.h
index 7b0c97e..f2d288c 100644
--- a/src/tint/utils/rtti/castable.h
+++ b/src/tint/utils/rtti/castable.h
@@ -43,39 +43,39 @@
TINT_CASTABLE_PUSH_DISABLE_WARNINGS();
// Forward declarations
-namespace tint::utils {
+namespace tint {
class CastableBase;
/// Ignore is used as a special type used for skipping over types for trait
/// helper functions.
class Ignore {};
-} // namespace tint::utils
+} // namespace tint
-namespace tint::utils::detail {
+namespace tint::detail {
template <typename T>
struct TypeInfoOf;
-} // namespace tint::utils::detail
+} // namespace tint::detail
-namespace tint::utils {
+namespace tint {
/// True if all template types that are not Ignore derive from CastableBase
template <typename... TYPES>
static constexpr bool IsCastable =
- ((utils::traits::IsTypeOrDerived<TYPES, CastableBase> || std::is_same_v<TYPES, Ignore>)&&...) &&
+ ((tint::traits::IsTypeOrDerived<TYPES, CastableBase> || std::is_same_v<TYPES, Ignore>)&&...) &&
!(std::is_same_v<TYPES, Ignore> && ...);
/// Helper macro to instantiate the TypeInfo<T> template for `CLASS`.
-#define TINT_INSTANTIATE_TYPEINFO(CLASS) \
- TINT_CASTABLE_PUSH_DISABLE_WARNINGS(); \
- template <> \
- const tint::utils::TypeInfo tint::utils::detail::TypeInfoOf<CLASS>::info{ \
- &tint::utils::detail::TypeInfoOf<CLASS::TrueBase>::info, \
- #CLASS, \
- tint::utils::TypeInfo::HashCodeOf<CLASS>(), \
- tint::utils::TypeInfo::FullHashCodeOf<CLASS>(), \
- }; \
- TINT_CASTABLE_POP_DISABLE_WARNINGS(); \
- static_assert(std::is_same_v<CLASS, CLASS::Base::Class>, \
+#define TINT_INSTANTIATE_TYPEINFO(CLASS) \
+ TINT_CASTABLE_PUSH_DISABLE_WARNINGS(); \
+ template <> \
+ const tint::TypeInfo tint::detail::TypeInfoOf<CLASS>::info{ \
+ &tint::detail::TypeInfoOf<CLASS::TrueBase>::info, \
+ #CLASS, \
+ tint::TypeInfo::HashCodeOf<CLASS>(), \
+ tint::TypeInfo::FullHashCodeOf<CLASS>(), \
+ }; \
+ TINT_CASTABLE_POP_DISABLE_WARNINGS(); \
+ static_assert(std::is_same_v<CLASS, CLASS::Base::Class>, \
#CLASS " does not derive from Castable<" #CLASS "[, BASE]>")
/// Bit flags that can be passed to the template parameter `FLAGS` of Is() and As().
@@ -130,7 +130,7 @@
/// @param object the object type to test from, which must be, or derive from type `FROM`.
/// @see CastFlags
template <typename TO, typename FROM, int FLAGS = 0>
- static inline bool Is(const tint::utils::TypeInfo* object) {
+ static inline bool Is(const tint::TypeInfo* object) {
constexpr const bool downcast = std::is_base_of<FROM, TO>::value;
constexpr const bool upcast = std::is_base_of<TO, FROM>::value;
constexpr const bool nocast = std::is_same<FROM, TO>::value;
@@ -158,7 +158,7 @@
/// @param type the test type info
/// @returns true if the class with this TypeInfo is of, or derives from the
/// class with the given TypeInfo.
- inline bool Is(const tint::utils::TypeInfo* type) const {
+ inline bool Is(const tint::TypeInfo* type) const {
if (!Maybe(type->hashcode, full_hashcode)) {
return false;
}
@@ -176,7 +176,7 @@
/// @returns the static TypeInfo for the type T
template <typename T>
static const TypeInfo& Of() {
- return utils::detail::TypeInfoOf<std::remove_cv_t<T>>::info;
+ return tint::detail::TypeInfoOf<std::remove_cv_t<T>>::info;
}
/// @returns a compile-time hashcode for the type `T`.
@@ -191,9 +191,9 @@
/// Use the compiler's "pretty" function name, which includes the template
/// type, to obtain a unique hash value.
#ifdef _MSC_VER
- constexpr uint32_t crc = utils::CRC32(__FUNCSIG__);
+ constexpr uint32_t crc = tint::CRC32(__FUNCSIG__);
#else
- constexpr uint32_t crc = utils::CRC32(__PRETTY_FUNCTION__);
+ constexpr uint32_t crc = tint::CRC32(__PRETTY_FUNCTION__);
#endif
constexpr uint32_t bit_a = (crc & 63);
constexpr uint32_t bit_b = ((crc >> 6) & 63);
@@ -223,8 +223,8 @@
return HashCodeOf<std::remove_cv_t<std::tuple_element_t<0, TUPLE>>>();
} else {
constexpr auto kMid = kCount / 2;
- return CombinedHashCodeOfTuple<utils::traits::SliceTuple<0, kMid, TUPLE>>() |
- CombinedHashCodeOfTuple<utils::traits::SliceTuple<kMid, kCount - kMid, TUPLE>>();
+ return CombinedHashCodeOfTuple<tint::traits::SliceTuple<0, kMid, TUPLE>>() |
+ CombinedHashCodeOfTuple<tint::traits::SliceTuple<kMid, kCount - kMid, TUPLE>>();
}
}
@@ -248,8 +248,8 @@
// Possibly one of the types in `TUPLE`.
// Split the search in two, and scan each block.
static constexpr auto kMid = kCount / 2;
- return IsAnyOfTuple<utils::traits::SliceTuple<0, kMid, TUPLE>>() ||
- IsAnyOfTuple<utils::traits::SliceTuple<kMid, kCount - kMid, TUPLE>>();
+ return IsAnyOfTuple<tint::traits::SliceTuple<0, kMid, TUPLE>>() ||
+ IsAnyOfTuple<tint::traits::SliceTuple<kMid, kCount - kMid, TUPLE>>();
}
return false;
}
@@ -281,7 +281,7 @@
/// @returns true if `obj` is a valid pointer, and is of, or derives from the class `TO`
/// @param obj the object to test from
/// @see CastFlags
-template <typename TO, int FLAGS = 0, typename FROM = utils::detail::Infer>
+template <typename TO, int FLAGS = 0, typename FROM = tint::detail::Infer>
inline bool Is(FROM* obj) {
if (obj == nullptr) {
return false;
@@ -297,8 +297,8 @@
/// @see CastFlags
template <typename TYPE,
int FLAGS = 0,
- typename OBJ = utils::detail::Infer,
- typename Pred = utils::detail::Infer>
+ typename OBJ = tint::detail::Infer,
+ typename Pred = tint::detail::Infer>
inline bool Is(OBJ* obj, Pred&& pred) {
return Is<TYPE, FLAGS, OBJ>(obj) && pred(static_cast<std::add_const_t<TYPE>*>(obj));
}
@@ -318,7 +318,7 @@
/// `TO`.
/// @param obj the object to cast from
/// @see CastFlags
-template <typename TO, int FLAGS = 0, typename FROM = utils::detail::Infer>
+template <typename TO, int FLAGS = 0, typename FROM = tint::detail::Infer>
inline TO* As(FROM* obj) {
auto* as_castable = static_cast<CastableBase*>(obj);
return Is<TO, FLAGS>(obj) ? static_cast<TO*>(as_castable) : nullptr;
@@ -328,7 +328,7 @@
/// `TO`.
/// @param obj the object to cast from
/// @see CastFlags
-template <typename TO, int FLAGS = 0, typename FROM = utils::detail::Infer>
+template <typename TO, int FLAGS = 0, typename FROM = tint::detail::Infer>
inline const TO* As(const FROM* obj) {
auto* as_castable = static_cast<const CastableBase*>(obj);
return Is<TO, FLAGS>(obj) ? static_cast<const TO*>(as_castable) : nullptr;
@@ -352,27 +352,27 @@
CastableBase& operator=(const CastableBase& other) = default;
/// @returns the TypeInfo of the object
- inline const tint::utils::TypeInfo& TypeInfo() const { return *type_info_; }
+ inline const tint::TypeInfo& TypeInfo() const { return *type_info_; }
/// @returns true if this object is of, or derives from the class `TO`
template <typename TO>
inline bool Is() const {
- return tint::utils::Is<TO>(this);
+ return tint::Is<TO>(this);
}
/// @returns true if this object is of, or derives from the class `TO` and pred(const TO*)
/// returns true
/// @param pred predicate function with signature `bool(const TO*)` called iff object is of, or
/// derives from the class `TO`.
- template <typename TO, int FLAGS = 0, typename Pred = utils::detail::Infer>
+ template <typename TO, int FLAGS = 0, typename Pred = tint::detail::Infer>
inline bool Is(Pred&& pred) const {
- return tint::utils::Is<TO, FLAGS>(this, std::forward<Pred>(pred));
+ return tint::Is<TO, FLAGS>(this, std::forward<Pred>(pred));
}
/// @returns true if this object is of, or derives from any of the `TO` classes.
template <typename... TO>
inline bool IsAnyOf() const {
- return tint::utils::IsAnyOf<TO...>(this);
+ return tint::IsAnyOf<TO...>(this);
}
/// @returns this object dynamically cast to the type `TO` or `nullptr` if this object does not
@@ -380,7 +380,7 @@
/// @see CastFlags
template <typename TO, int FLAGS = 0>
inline TO* As() {
- return tint::utils::As<TO, FLAGS>(this);
+ return tint::As<TO, FLAGS>(this);
}
/// @returns this object dynamically cast to the type `TO` or `nullptr` if this object does not
@@ -388,14 +388,14 @@
/// @see CastFlags
template <typename TO, int FLAGS = 0>
inline const TO* As() const {
- return tint::utils::As<const TO, FLAGS>(this);
+ return tint::As<const TO, FLAGS>(this);
}
protected:
CastableBase() = default;
/// The type information for the object
- const tint::utils::TypeInfo* type_info_ = nullptr;
+ const tint::TypeInfo* type_info_ = nullptr;
};
/// Castable is a helper to derive `CLASS` from `BASE`, automatically implementing the Is() and As()
@@ -441,25 +441,24 @@
/// @see CastFlags
template <typename TO, int FLAGS = 0>
inline bool Is() const {
- return tint::utils::Is<TO, FLAGS>(static_cast<const CLASS*>(this));
+ return tint::Is<TO, FLAGS>(static_cast<const CLASS*>(this));
}
/// @returns true if this object is of, or derives from the class `TO` and
/// pred(const TO*) returns true
/// @param pred predicate function with signature `bool(const TO*)` called iff
/// object is of, or derives from the class `TO`.
- template <int FLAGS = 0, typename Pred = utils::detail::Infer>
+ template <int FLAGS = 0, typename Pred = tint::detail::Infer>
inline bool Is(Pred&& pred) const {
- using TO = typename std::remove_pointer<utils::traits::ParameterType<Pred, 0>>::type;
- return tint::utils::Is<TO, FLAGS>(static_cast<const CLASS*>(this),
- std::forward<Pred>(pred));
+ using TO = typename std::remove_pointer<tint::traits::ParameterType<Pred, 0>>::type;
+ return tint::Is<TO, FLAGS>(static_cast<const CLASS*>(this), std::forward<Pred>(pred));
}
/// @returns true if this object is of, or derives from any of the `TO`
/// classes.
template <typename... TO>
inline bool IsAnyOf() const {
- return tint::utils::IsAnyOf<TO...>(static_cast<const CLASS*>(this));
+ return tint::IsAnyOf<TO...>(static_cast<const CLASS*>(this));
}
/// @returns this object dynamically cast to the type `TO` or `nullptr` if
@@ -467,7 +466,7 @@
/// @see CastFlags
template <typename TO, int FLAGS = 0>
inline TO* As() {
- return tint::utils::As<TO, FLAGS>(this);
+ return tint::As<TO, FLAGS>(this);
}
/// @returns this object dynamically cast to the type `TO` or `nullptr` if
@@ -475,7 +474,7 @@
/// @see CastFlags
template <typename TO, int FLAGS = 0>
inline const TO* As() const {
- return tint::utils::As<const TO, FLAGS>(this);
+ return tint::As<const TO, FLAGS>(this);
}
};
@@ -521,7 +520,7 @@
template <typename A, typename B>
struct CastableCommonBaseImpl<A, B> {
/// The common base class for A, B and OTHERS
- using type = std::conditional_t<utils::traits::IsTypeOrDerived<A, B>,
+ using type = std::conditional_t<tint::traits::IsTypeOrDerived<A, B>,
B, // A derives from B
CastableCommonBase<A, typename B::TrueBase>>;
};
@@ -537,14 +536,14 @@
/// Resolves to the common most derived type that each of the types in `TYPES` derives from.
template <typename... TYPES>
-using CastableCommonBase = utils::detail::CastableCommonBase<TYPES...>;
+using CastableCommonBase = tint::detail::CastableCommonBase<TYPES...>;
-} // namespace tint::utils
+} // namespace tint
namespace tint {
-using utils::As;
-using utils::Is;
+using tint::As;
+using tint::Is;
} // namespace tint
diff --git a/src/tint/utils/rtti/castable_test.cc b/src/tint/utils/rtti/castable_test.cc
index 847602d..2aa740f 100644
--- a/src/tint/utils/rtti/castable_test.cc
+++ b/src/tint/utils/rtti/castable_test.cc
@@ -19,18 +19,18 @@
#include "gtest/gtest.h"
-namespace tint::utils {
+namespace tint {
namespace {
-struct Animal : public tint::utils::Castable<Animal> {};
-struct Amphibian : public tint::utils::Castable<Amphibian, Animal> {};
-struct Mammal : public tint::utils::Castable<Mammal, Animal> {};
-struct Reptile : public tint::utils::Castable<Reptile, Animal> {};
-struct Frog : public tint::utils::Castable<Frog, Amphibian> {};
-struct Bear : public tint::utils::Castable<Bear, Mammal> {};
-struct Lizard : public tint::utils::Castable<Lizard, Reptile> {};
-struct Gecko : public tint::utils::Castable<Gecko, Lizard> {};
-struct Iguana : public tint::utils::Castable<Iguana, Lizard> {};
+struct Animal : public Castable<Animal> {};
+struct Amphibian : public Castable<Amphibian, Animal> {};
+struct Mammal : public Castable<Mammal, Animal> {};
+struct Reptile : public Castable<Reptile, Animal> {};
+struct Frog : public Castable<Frog, Amphibian> {};
+struct Bear : public Castable<Bear, Mammal> {};
+struct Lizard : public Castable<Lizard, Reptile> {};
+struct Gecko : public Castable<Gecko, Lizard> {};
+struct Iguana : public Castable<Iguana, Lizard> {};
TEST(CastableBase, Is) {
std::unique_ptr<CastableBase> frog = std::make_unique<Frog>();
@@ -291,4 +291,4 @@
TINT_INSTANTIATE_TYPEINFO(Lizard);
TINT_INSTANTIATE_TYPEINFO(Gecko);
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/rtti/switch.h b/src/tint/utils/rtti/switch.h
index 7c42eda..9d95064 100644
--- a/src/tint/utils/rtti/switch.h
+++ b/src/tint/utils/rtti/switch.h
@@ -44,13 +44,13 @@
/// @see Switch().
template <typename FN>
using SwitchCaseType =
- std::remove_pointer_t<utils::traits::ParameterType<std::remove_reference_t<FN>, 0>>;
+ std::remove_pointer_t<tint::traits::ParameterType<std::remove_reference_t<FN>, 0>>;
/// Evaluates to true if the function `FN` has the signature of a Default case in a Switch().
/// @see Switch().
template <typename FN>
inline constexpr bool IsDefaultCase =
- std::is_same_v<utils::traits::ParameterType<std::remove_reference_t<FN>, 0>, Default>;
+ std::is_same_v<tint::traits::ParameterType<std::remove_reference_t<FN>, 0>, Default>;
/// Searches the list of Switch cases for a Default case, returning the index of the Default case.
/// If the a Default case is not found in the tuple, then -1 is returned.
@@ -67,7 +67,7 @@
/// Resolves to T if T is not nullptr_t, otherwise resolves to Ignore.
template <typename T>
-using NullptrToIgnore = std::conditional_t<std::is_same_v<T, std::nullptr_t>, utils::Ignore, T>;
+using NullptrToIgnore = std::conditional_t<std::is_same_v<T, std::nullptr_t>, tint::Ignore, T>;
/// Resolves to `const TYPE` if any of `CASE_RETURN_TYPES` are const or pointer-to-const, otherwise
/// resolves to TYPE.
@@ -92,7 +92,7 @@
/// SwitchReturnTypeImpl specialization for non-castable case types and an inferred return type.
template <typename... CASE_RETURN_TYPES>
-struct SwitchReturnTypeImpl</*IS_CASTABLE*/ false, utils::detail::Infer, CASE_RETURN_TYPES...> {
+struct SwitchReturnTypeImpl</*IS_CASTABLE*/ false, tint::detail::Infer, CASE_RETURN_TYPES...> {
/// Resolves to the common type for all the cases return types.
using type = std::common_type_t<CASE_RETURN_TYPES...>;
};
@@ -108,10 +108,10 @@
/// SwitchReturnTypeImpl specialization for castable case types and an inferred return type.
template <typename... CASE_RETURN_TYPES>
-struct SwitchReturnTypeImpl</*IS_CASTABLE*/ true, utils::detail::Infer, CASE_RETURN_TYPES...> {
+struct SwitchReturnTypeImpl</*IS_CASTABLE*/ true, tint::detail::Infer, CASE_RETURN_TYPES...> {
private:
using InferredType =
- utils::CastableCommonBase<NullptrToIgnore<std::remove_pointer_t<CASE_RETURN_TYPES>>...>;
+ CastableCommonBase<NullptrToIgnore<std::remove_pointer_t<CASE_RETURN_TYPES>>...>;
public:
/// `const T*` or `T*`, where T is the common base type for all the castable case types.
@@ -123,7 +123,7 @@
/// from the case return types.
template <typename REQUESTED_TYPE, typename... CASE_RETURN_TYPES>
using SwitchReturnType = typename SwitchReturnTypeImpl<
- utils::IsCastable<NullptrToIgnore<std::remove_pointer_t<CASE_RETURN_TYPES>>...>,
+ tint::IsCastable<NullptrToIgnore<std::remove_pointer_t<CASE_RETURN_TYPES>>...>,
REQUESTED_TYPE,
CASE_RETURN_TYPES...>::type;
@@ -162,12 +162,10 @@
/// @param cases the switch cases
/// @return the value returned by the called case. If no cases matched, then the zero value for the
/// consistent case type.
-template <typename RETURN_TYPE = utils::detail::Infer,
- typename T = utils::CastableBase,
- typename... CASES>
+template <typename RETURN_TYPE = tint::detail::Infer, typename T = CastableBase, typename... CASES>
inline auto Switch(T* object, CASES&&... cases) {
using ReturnType =
- tint::detail::SwitchReturnType<RETURN_TYPE, utils::traits::ReturnType<CASES>...>;
+ tint::detail::SwitchReturnType<RETURN_TYPE, tint::traits::ReturnType<CASES>...>;
static constexpr int kDefaultIndex = tint::detail::IndexOfDefaultCase<std::tuple<CASES...>>();
static constexpr bool kHasDefaultCase = kDefaultIndex >= 0;
static constexpr bool kHasReturnType = !std::is_same_v<ReturnType, void>;
@@ -204,9 +202,9 @@
uint8_t data[sizeof(ReturnTypeOrU8)];
};
ReturnStorage return_storage;
- auto* result = utils::Bitcast<ReturnTypeOrU8*>(&return_storage);
+ auto* result = tint::Bitcast<ReturnTypeOrU8*>(&return_storage);
- const utils::TypeInfo& type_info = object->TypeInfo();
+ const tint::TypeInfo& type_info = object->TypeInfo();
// Examines the parameter type of the case function.
// If the parameter is a pointer type that `object` is of, or derives from, then that case
diff --git a/src/tint/utils/rtti/switch_bench.cc b/src/tint/utils/rtti/switch_bench.cc
index d2bf9f1..74ed13f 100644
--- a/src/tint/utils/rtti/switch_bench.cc
+++ b/src/tint/utils/rtti/switch_bench.cc
@@ -21,46 +21,46 @@
namespace tint {
namespace {
-struct Base : public tint::utils::Castable<Base> {};
-struct A : public tint::utils::Castable<A, Base> {};
-struct AA : public tint::utils::Castable<AA, A> {};
-struct AAA : public tint::utils::Castable<AAA, AA> {};
-struct AAB : public tint::utils::Castable<AAB, AA> {};
-struct AAC : public tint::utils::Castable<AAC, AA> {};
-struct AB : public tint::utils::Castable<AB, A> {};
-struct ABA : public tint::utils::Castable<ABA, AB> {};
-struct ABB : public tint::utils::Castable<ABB, AB> {};
-struct ABC : public tint::utils::Castable<ABC, AB> {};
-struct AC : public tint::utils::Castable<AC, A> {};
-struct ACA : public tint::utils::Castable<ACA, AC> {};
-struct ACB : public tint::utils::Castable<ACB, AC> {};
-struct ACC : public tint::utils::Castable<ACC, AC> {};
-struct B : public tint::utils::Castable<B, Base> {};
-struct BA : public tint::utils::Castable<BA, B> {};
-struct BAA : public tint::utils::Castable<BAA, BA> {};
-struct BAB : public tint::utils::Castable<BAB, BA> {};
-struct BAC : public tint::utils::Castable<BAC, BA> {};
-struct BB : public tint::utils::Castable<BB, B> {};
-struct BBA : public tint::utils::Castable<BBA, BB> {};
-struct BBB : public tint::utils::Castable<BBB, BB> {};
-struct BBC : public tint::utils::Castable<BBC, BB> {};
-struct BC : public tint::utils::Castable<BC, B> {};
-struct BCA : public tint::utils::Castable<BCA, BC> {};
-struct BCB : public tint::utils::Castable<BCB, BC> {};
-struct BCC : public tint::utils::Castable<BCC, BC> {};
-struct C : public tint::utils::Castable<C, Base> {};
-struct CA : public tint::utils::Castable<CA, C> {};
-struct CAA : public tint::utils::Castable<CAA, CA> {};
-struct CAB : public tint::utils::Castable<CAB, CA> {};
-struct CAC : public tint::utils::Castable<CAC, CA> {};
-struct CB : public tint::utils::Castable<CB, C> {};
-struct CBA : public tint::utils::Castable<CBA, CB> {};
-struct CBB : public tint::utils::Castable<CBB, CB> {};
-struct CBC : public tint::utils::Castable<CBC, CB> {};
-struct CC : public tint::utils::Castable<CC, C> {};
-struct CCA : public tint::utils::Castable<CCA, CC> {};
-struct CCB : public tint::utils::Castable<CCB, CC> {};
-struct CCC : public tint::utils::Castable<CCC, CC> {};
+struct Base : public Castable<Base> {};
+struct A : public Castable<A, Base> {};
+struct AA : public Castable<AA, A> {};
+struct AAA : public Castable<AAA, AA> {};
+struct AAB : public Castable<AAB, AA> {};
+struct AAC : public Castable<AAC, AA> {};
+struct AB : public Castable<AB, A> {};
+struct ABA : public Castable<ABA, AB> {};
+struct ABB : public Castable<ABB, AB> {};
+struct ABC : public Castable<ABC, AB> {};
+struct AC : public Castable<AC, A> {};
+struct ACA : public Castable<ACA, AC> {};
+struct ACB : public Castable<ACB, AC> {};
+struct ACC : public Castable<ACC, AC> {};
+struct B : public Castable<B, Base> {};
+struct BA : public Castable<BA, B> {};
+struct BAA : public Castable<BAA, BA> {};
+struct BAB : public Castable<BAB, BA> {};
+struct BAC : public Castable<BAC, BA> {};
+struct BB : public Castable<BB, B> {};
+struct BBA : public Castable<BBA, BB> {};
+struct BBB : public Castable<BBB, BB> {};
+struct BBC : public Castable<BBC, BB> {};
+struct BC : public Castable<BC, B> {};
+struct BCA : public Castable<BCA, BC> {};
+struct BCB : public Castable<BCB, BC> {};
+struct BCC : public Castable<BCC, BC> {};
+struct C : public Castable<C, Base> {};
+struct CA : public Castable<CA, C> {};
+struct CAA : public Castable<CAA, CA> {};
+struct CAB : public Castable<CAB, CA> {};
+struct CAC : public Castable<CAC, CA> {};
+struct CB : public Castable<CB, C> {};
+struct CBA : public Castable<CBA, CB> {};
+struct CBB : public Castable<CBB, CB> {};
+struct CBC : public Castable<CBC, CB> {};
+struct CC : public Castable<CC, C> {};
+struct CCA : public Castable<CCA, CC> {};
+struct CCB : public Castable<CCB, CC> {};
+struct CCC : public Castable<CCC, CC> {};
using AllTypes = std::tuple<Base,
A,
diff --git a/src/tint/utils/rtti/switch_test.cc b/src/tint/utils/rtti/switch_test.cc
index 252fb18..5e5abe6 100644
--- a/src/tint/utils/rtti/switch_test.cc
+++ b/src/tint/utils/rtti/switch_test.cc
@@ -22,15 +22,15 @@
namespace tint {
namespace {
-struct Animal : public tint::utils::Castable<Animal> {};
-struct Amphibian : public tint::utils::Castable<Amphibian, Animal> {};
-struct Mammal : public tint::utils::Castable<Mammal, Animal> {};
-struct Reptile : public tint::utils::Castable<Reptile, Animal> {};
-struct Frog : public tint::utils::Castable<Frog, Amphibian> {};
-struct Bear : public tint::utils::Castable<Bear, Mammal> {};
-struct Lizard : public tint::utils::Castable<Lizard, Reptile> {};
-struct Gecko : public tint::utils::Castable<Gecko, Lizard> {};
-struct Iguana : public tint::utils::Castable<Iguana, Lizard> {};
+struct Animal : public Castable<Animal> {};
+struct Amphibian : public Castable<Amphibian, Animal> {};
+struct Mammal : public Castable<Mammal, Animal> {};
+struct Reptile : public Castable<Reptile, Animal> {};
+struct Frog : public Castable<Frog, Amphibian> {};
+struct Bear : public Castable<Bear, Mammal> {};
+struct Lizard : public Castable<Lizard, Reptile> {};
+struct Gecko : public Castable<Gecko, Lizard> {};
+struct Iguana : public Castable<Iguana, Lizard> {};
TEST(Castable, SwitchNoDefault) {
std::unique_ptr<Animal> frog = std::make_unique<Frog>();
@@ -331,8 +331,8 @@
gecko.get(), //
[](Mammal* p) { return p; }, //
[](Amphibian* p) { return p; }, //
- [](Default) -> utils::CastableBase* { return nullptr; });
- static_assert(std::is_same_v<decltype(result), utils::CastableBase*>);
+ [](Default) -> CastableBase* { return nullptr; });
+ static_assert(std::is_same_v<decltype(result), CastableBase*>);
EXPECT_EQ(result, nullptr);
}
}
@@ -444,12 +444,12 @@
EXPECT_EQ(result, nullptr);
}
{
- auto* result = Switch<utils::CastableBase>(
+ auto* result = Switch<CastableBase>(
bear.get(), //
[](Mammal* p) { return p; }, //
[](Amphibian* p) { return const_cast<const Amphibian*>(p); },
[](Default) { return nullptr; });
- static_assert(std::is_same_v<decltype(result), const utils::CastableBase*>);
+ static_assert(std::is_same_v<decltype(result), const CastableBase*>);
EXPECT_EQ(result, bear.get());
}
{
@@ -476,11 +476,11 @@
EXPECT_EQ(result, nullptr);
}
{
- auto* result = Switch<utils::CastableBase>(
+ auto* result = Switch<CastableBase>(
bear.get(), //
[](Mammal* p) { return p; }, //
[](Amphibian* p) { return const_cast<const Amphibian*>(p); }); //
- static_assert(std::is_same_v<decltype(result), const utils::CastableBase*>);
+ static_assert(std::is_same_v<decltype(result), const CastableBase*>);
EXPECT_EQ(result, bear.get());
}
{
diff --git a/src/tint/utils/templates/enums.tmpl.inc b/src/tint/utils/templates/enums.tmpl.inc
index adc06e0..73db9f7 100644
--- a/src/tint/utils/templates/enums.tmpl.inc
+++ b/src/tint/utils/templates/enums.tmpl.inc
@@ -50,7 +50,7 @@
/// @param out the stream to write to
/// @param value the {{$enum}}
/// @returns `out` so calls can be chained
-utils::StringStream& operator<<(utils::StringStream& out, {{$enum}} value);
+StringStream& operator<<(StringStream& out, {{$enum}} value);
/// Parse{{$enum}} parses a {{$enum}} from a string.
/// @param str the string to parse
@@ -94,7 +94,7 @@
{{- /* provided sem.Enum. */ -}}
{{- /* ------------------------------------------------------------------ */ -}}
{{- $enum := Eval "EnumName" $ -}}
- utils::StringStream& operator<<(utils::StringStream& out, {{$enum}} value) {
+ StringStream& operator<<(StringStream& out, {{$enum}} value) {
switch (value) {
case {{$enum}}::kUndefined:
return out << "undefined";
@@ -156,7 +156,7 @@
TEST_P({{$enum}}PrintTest, Print) {
{{$enum}} value = GetParam().value;
const char* expect = GetParam().string;
- EXPECT_EQ(expect, utils::ToString(value));
+ EXPECT_EQ(expect, tint::ToString(value));
}
INSTANTIATE_TEST_SUITE_P(ValidCases, {{$enum}}PrintTest, testing::ValuesIn(kValidCases));
diff --git a/src/tint/utils/text/float_to_string.cc b/src/tint/utils/text/float_to_string.cc
index 9f9878c..cfbfc00 100644
--- a/src/tint/utils/text/float_to_string.cc
+++ b/src/tint/utils/text/float_to_string.cc
@@ -52,7 +52,7 @@
template <typename F>
std::string ToString(F f) {
- utils::StringStream s;
+ StringStream s;
s << f;
return s.str();
}
diff --git a/src/tint/utils/text/float_to_string_test.cc b/src/tint/utils/text/float_to_string_test.cc
index 20beb16..4b54b80 100644
--- a/src/tint/utils/text/float_to_string_test.cc
+++ b/src/tint/utils/text/float_to_string_test.cc
@@ -169,7 +169,7 @@
// NaN bit (0) to quiet NaN (1). As NaN floating point numbers can be silently modified by the
// architecture, and the signalling bit is architecture defined, this test may fail on other
// architectures.
- auto nan = utils::Bitcast<float>(0x7fc0beef);
+ auto nan = tint::Bitcast<float>(0x7fc0beef);
EXPECT_EQ(FloatToBitPreservingString(nan), "0x1.817ddep+128");
EXPECT_EQ(FloatToBitPreservingString(-nan), "-0x1.817ddep+128");
}
@@ -326,7 +326,7 @@
}
TEST(DoubleToBitPreservingStringTest, NaN) {
- auto nan = utils::Bitcast<double>(0x7ff8cafef00dbeefull);
+ auto nan = tint::Bitcast<double>(0x7ff8cafef00dbeefull);
EXPECT_EQ(DoubleToBitPreservingString(static_cast<double>(nan)), "0x1.8cafef00dbeefp+1024");
EXPECT_EQ(DoubleToBitPreservingString(static_cast<double>(-nan)), "-0x1.8cafef00dbeefp+1024");
}
diff --git a/src/tint/utils/text/parse_num.cc b/src/tint/utils/text/parse_num.cc
index c2a0eea..4b2fac1 100644
--- a/src/tint/utils/text/parse_num.cc
+++ b/src/tint/utils/text/parse_num.cc
@@ -18,7 +18,7 @@
#include "absl/strings/charconv.h"
-namespace tint::utils {
+namespace tint {
namespace {
@@ -95,4 +95,4 @@
return Parse<uint8_t>(str);
}
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/text/parse_num.h b/src/tint/utils/text/parse_num.h
index 936fd0f..dc8af52 100644
--- a/src/tint/utils/text/parse_num.h
+++ b/src/tint/utils/text/parse_num.h
@@ -21,7 +21,7 @@
#include "src/tint/utils/macros/compiler.h"
#include "src/tint/utils/result/result.h"
-namespace tint::utils {
+namespace tint {
/// Error returned by the number parsing functions
enum class ParseNumberError {
@@ -126,6 +126,6 @@
TINT_END_DISABLE_WARNING(UNREACHABLE_CODE);
-} // namespace tint::utils
+} // namespace tint
#endif // SRC_TINT_UTILS_TEXT_PARSE_NUM_H_
diff --git a/src/tint/utils/text/string.cc b/src/tint/utils/text/string.cc
index 91644f8..a7d3c77 100644
--- a/src/tint/utils/text/string.cc
+++ b/src/tint/utils/text/string.cc
@@ -18,7 +18,7 @@
#include "src/tint/utils/containers/vector.h"
#include "src/tint/utils/text/string.h"
-namespace tint::utils {
+namespace tint {
size_t Distance(std::string_view str_a, std::string_view str_b) {
const auto len_a = str_a.size();
@@ -51,7 +51,7 @@
void SuggestAlternatives(std::string_view got,
Slice<char const* const> strings,
- utils::StringStream& ss,
+ StringStream& ss,
const SuggestAlternativeOptions& options /* = {} */) {
auto views = Transform<8>(strings, [](char const* const str) { return std::string_view(str); });
SuggestAlternatives(got, views.Slice(), ss, options);
@@ -59,7 +59,7 @@
void SuggestAlternatives(std::string_view got,
Slice<std::string_view> strings,
- utils::StringStream& ss,
+ StringStream& ss,
const SuggestAlternativeOptions& options /* = {} */) {
// If the string typed was within kSuggestionDistance of one of the possible enum values,
// suggest that. Don't bother with suggestions if the string was extremely long.
@@ -69,7 +69,7 @@
size_t candidate_dist = kSuggestionDistance;
std::string_view candidate;
for (auto str : strings) {
- auto dist = utils::Distance(str, got);
+ auto dist = tint::Distance(str, got);
if (dist < candidate_dist) {
candidate = str;
candidate_dist = dist;
@@ -95,4 +95,4 @@
}
}
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/text/string.h b/src/tint/utils/text/string.h
index 96df884..8a6987b 100644
--- a/src/tint/utils/text/string.h
+++ b/src/tint/utils/text/string.h
@@ -22,7 +22,7 @@
#include "src/tint/utils/containers/vector.h"
#include "src/tint/utils/text/string_stream.h"
-namespace tint::utils {
+namespace tint {
/// @param str the string to apply replacements to
/// @param substr the string to search for
@@ -49,7 +49,7 @@
/// @returns value printed as a string via the stream `<<` operator
template <typename T>
std::string ToString(const T& value) {
- utils::StringStream s;
+ StringStream s;
s << value;
return s.str();
}
@@ -58,7 +58,7 @@
/// @returns value printed as a string via the stream `<<` operator
template <typename... TYs>
std::string ToString(const std::variant<TYs...>& value) {
- utils::StringStream s;
+ StringStream s;
s << std::visit([&](auto& v) { return ToString(v); }, value);
return s.str();
}
@@ -97,7 +97,7 @@
/// @param options options for the suggestion
void SuggestAlternatives(std::string_view got,
Slice<char const* const> strings,
- utils::StringStream& ss,
+ StringStream& ss,
const SuggestAlternativeOptions& options = {});
/// Suggest alternatives for an unrecognized string from a list of possible values.
@@ -107,7 +107,7 @@
/// @param options options for the suggestion
void SuggestAlternatives(std::string_view got,
Slice<std::string_view> strings,
- utils::StringStream& ss,
+ StringStream& ss,
const SuggestAlternativeOptions& options = {});
/// @param str the input string
@@ -178,8 +178,8 @@
/// @param str the input string
/// @param delimiter the delimiter
/// @return @p str split at each occurrence of @p delimiter
-inline utils::Vector<std::string_view, 8> Split(std::string_view str, std::string_view delimiter) {
- utils::Vector<std::string_view, 8> out;
+inline Vector<std::string_view, 8> Split(std::string_view str, std::string_view delimiter) {
+ Vector<std::string_view, 8> out;
while (str.length() > delimiter.length()) {
auto pos = str.find(delimiter);
if (pos == std::string_view::npos) {
@@ -201,8 +201,8 @@
/// @param delimiter the delimiter
/// @return @p parts joined as a string, delimited with @p delimiter
template <typename T>
-inline std::string Join(utils::VectorRef<T> parts, std::string_view delimiter) {
- utils::StringStream s;
+inline std::string Join(VectorRef<T> parts, std::string_view delimiter) {
+ StringStream s;
for (auto& part : parts) {
if (part != parts.Front()) {
s << delimiter;
@@ -216,10 +216,10 @@
/// @param delimiter the delimiter
/// @return @p parts joined as a string, delimited with @p delimiter
template <typename T, size_t N>
-inline std::string Join(const utils::Vector<T, N>& parts, std::string_view delimiter) {
- return Join(utils::VectorRef<T>(parts), delimiter);
+inline std::string Join(const Vector<T, N>& parts, std::string_view delimiter) {
+ return Join(VectorRef<T>(parts), delimiter);
}
-} // namespace tint::utils
+} // namespace tint
#endif // SRC_TINT_UTILS_TEXT_STRING_H_
diff --git a/src/tint/utils/text/string_stream.cc b/src/tint/utils/text/string_stream.cc
index ca84686..27d9f13a 100644
--- a/src/tint/utils/text/string_stream.cc
+++ b/src/tint/utils/text/string_stream.cc
@@ -14,7 +14,7 @@
#include "src/tint/utils/text/string_stream.h"
-namespace tint::utils {
+namespace tint {
StringStream::StringStream() {
sstream_.flags(sstream_.flags() | std::ios_base::showpoint | std::ios_base::fixed);
@@ -24,7 +24,7 @@
StringStream::~StringStream() = default;
-utils::StringStream& operator<<(utils::StringStream& out, CodePoint code_point) {
+StringStream& operator<<(StringStream& out, CodePoint code_point) {
if (code_point < 0x7f) {
// See https://en.cppreference.com/w/cpp/language/escape
switch (code_point) {
@@ -48,4 +48,4 @@
return out << "'U+" << std::hex << code_point.value << "'";
}
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/text/string_stream.h b/src/tint/utils/text/string_stream.h
index 3d65972..360f4b1 100644
--- a/src/tint/utils/text/string_stream.h
+++ b/src/tint/utils/text/string_stream.h
@@ -25,7 +25,7 @@
#include "src/tint/utils/text/unicode.h"
-namespace tint::utils {
+namespace tint {
/// Stringstream wrapper which automatically resets the locale and sets floating point emission
/// settings needed for Tint.
@@ -190,8 +190,8 @@
/// @param out the stream to write to
/// @param codepoint the CodePoint to write
/// @returns out so calls can be chained
-utils::StringStream& operator<<(utils::StringStream& out, CodePoint codepoint);
+StringStream& operator<<(StringStream& out, CodePoint codepoint);
-} // namespace tint::utils
+} // namespace tint
#endif // SRC_TINT_UTILS_TEXT_STRING_STREAM_H_
diff --git a/src/tint/utils/text/string_stream_test.cc b/src/tint/utils/text/string_stream_test.cc
index b18ebb2..c5a74fc 100644
--- a/src/tint/utils/text/string_stream_test.cc
+++ b/src/tint/utils/text/string_stream_test.cc
@@ -20,7 +20,7 @@
#include "gtest/gtest.h"
-namespace tint::utils {
+namespace tint {
namespace {
using StringStreamTest = testing::Test;
@@ -108,4 +108,4 @@
}
} // namespace
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/text/string_test.cc b/src/tint/utils/text/string_test.cc
index 1caa879..b570238 100644
--- a/src/tint/utils/text/string_test.cc
+++ b/src/tint/utils/text/string_test.cc
@@ -19,13 +19,13 @@
#include "src/tint/utils/containers/transform.h" // Used by ToStringList()
-namespace tint::utils {
+namespace tint {
namespace {
// Workaround for https://github.com/google/googletest/issues/3081
// Remove when using C++20
template <size_t N>
-utils::Vector<std::string, N> ToStringList(const utils::Vector<std::string_view, N>& views) {
+Vector<std::string, N> ToStringList(const Vector<std::string_view, N>& views) {
return Transform(views, [](std::string_view view) { return std::string(view); });
}
@@ -82,20 +82,20 @@
TEST(StringTest, SuggestAlternatives) {
{
const char* alternatives[] = {"hello world", "Hello World"};
- utils::StringStream ss;
+ StringStream ss;
SuggestAlternatives("hello wordl", alternatives, ss);
EXPECT_EQ(ss.str(), R"(Did you mean 'hello world'?
Possible values: 'hello world', 'Hello World')");
}
{
const char* alternatives[] = {"foobar", "something else"};
- utils::StringStream ss;
+ StringStream ss;
SuggestAlternatives("hello world", alternatives, ss);
EXPECT_EQ(ss.str(), R"(Possible values: 'foobar', 'something else')");
}
{
const char* alternatives[] = {"hello world", "Hello World"};
- utils::StringStream ss;
+ StringStream ss;
SuggestAlternativeOptions opts;
opts.prefix = "$";
SuggestAlternatives("hello wordl", alternatives, ss, opts);
@@ -104,7 +104,7 @@
}
{
const char* alternatives[] = {"hello world", "Hello World"};
- utils::StringStream ss;
+ StringStream ss;
SuggestAlternativeOptions opts;
opts.list_possible_values = false;
SuggestAlternatives("hello world", alternatives, ss, opts);
@@ -196,11 +196,11 @@
}
TEST(StringTest, Join) {
- EXPECT_EQ(Join(utils::Vector<int, 1>{}, ","), "");
- EXPECT_EQ(Join(utils::Vector{1, 2, 3}, ","), "1,2,3");
- EXPECT_EQ(Join(utils::Vector{"cat"}, ","), "cat");
- EXPECT_EQ(Join(utils::Vector{"cat", "dog"}, ","), "cat,dog");
+ EXPECT_EQ(Join(Vector<int, 1>{}, ","), "");
+ EXPECT_EQ(Join(Vector{1, 2, 3}, ","), "1,2,3");
+ EXPECT_EQ(Join(Vector{"cat"}, ","), "cat");
+ EXPECT_EQ(Join(Vector{"cat", "dog"}, ","), "cat,dog");
}
} // namespace
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/text/symbol_table.h b/src/tint/utils/text/symbol_table.h
index fd659eb..a95780c 100644
--- a/src/tint/utils/text/symbol_table.h
+++ b/src/tint/utils/text/symbol_table.h
@@ -93,11 +93,11 @@
// The value to be associated to the next registered symbol table entry.
uint32_t next_symbol_ = 1;
- utils::Hashmap<std::string_view, Symbol, 0> name_to_symbol_;
- utils::Hashmap<std::string, size_t, 0> last_prefix_to_index_;
+ Hashmap<std::string_view, Symbol, 0> name_to_symbol_;
+ Hashmap<std::string, size_t, 0> last_prefix_to_index_;
tint::GenerationID generation_id_;
- utils::BumpAllocator name_allocator_;
+ tint::BumpAllocator name_allocator_;
};
/// @param symbol_table the SymbolTable
diff --git a/src/tint/utils/text/text_generator.cc b/src/tint/utils/text/text_generator.cc
index 57fd106..dec64b0 100644
--- a/src/tint/utils/text/text_generator.cc
+++ b/src/tint/utils/text/text_generator.cc
@@ -20,7 +20,7 @@
#include "src/tint/utils/containers/map.h"
#include "src/tint/utils/debug/debug.h"
-namespace tint::utils {
+namespace tint {
TextGenerator::TextGenerator() = default;
@@ -34,8 +34,8 @@
std::string TextGenerator::StructName(const type::Struct* s) {
auto name = s->Name().Name();
if (name.size() > 1 && name[0] == '_' && name[1] == '_') {
- name = utils::GetOrCreate(builtin_struct_names_, s,
- [&] { return UniqueIdentifier(name.substr(2)); });
+ name = tint::GetOrCreate(builtin_struct_names_, s,
+ [&] { return UniqueIdentifier(name.substr(2)); });
}
return name;
}
@@ -106,7 +106,7 @@
}
std::string TextGenerator::TextBuffer::String(uint32_t indent /* = 0 */) const {
- utils::StringStream ss;
+ StringStream ss;
for (auto& line : lines) {
if (!line.content.empty()) {
for (uint32_t i = 0; i < indent + line.indent; i++) {
@@ -119,7 +119,7 @@
return ss.str();
}
-TextGenerator::ScopedParen::ScopedParen(utils::StringStream& stream) : s(stream) {
+TextGenerator::ScopedParen::ScopedParen(StringStream& stream) : s(stream) {
s << "(";
}
@@ -137,4 +137,4 @@
buffer_->DecrementIndent();
}
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/text/text_generator.h b/src/tint/utils/text/text_generator.h
index 7248560..1db6d37 100644
--- a/src/tint/utils/text/text_generator.h
+++ b/src/tint/utils/text/text_generator.h
@@ -24,7 +24,7 @@
#include "src/tint/utils/diagnostic/diagnostic.h"
#include "src/tint/utils/text/string_stream.h"
-namespace tint::utils {
+namespace tint {
/// Helper methods for generators which are creating text output
class TextGenerator {
@@ -100,13 +100,13 @@
/// Destructor
~LineWriter();
- /// @returns the utils::StringStream
- operator utils::StringStream&() { return os; }
+ /// @returns the StringStream
+ operator StringStream&() { return os; }
/// @param rhs the value to write to the line
- /// @returns the utils::StringStream so calls can be chained
+ /// @returns the StringStream so calls can be chained
template <typename T>
- utils::StringStream& operator<<(T&& rhs) {
+ StringStream& operator<<(T&& rhs) {
return os << std::forward<T>(rhs);
}
@@ -114,7 +114,7 @@
LineWriter(const LineWriter&) = delete;
LineWriter& operator=(const LineWriter&) = delete;
- utils::StringStream os;
+ StringStream os;
TextBuffer* buffer;
};
@@ -154,8 +154,8 @@
/// Helper for writing a '(' on construction and a ')' destruction.
struct ScopedParen {
/// Constructor
- /// @param stream the utils::StringStream that will be written to
- explicit ScopedParen(utils::StringStream& stream);
+ /// @param stream the StringStream that will be written to
+ explicit ScopedParen(StringStream& stream);
/// Destructor
~ScopedParen();
@@ -163,7 +163,7 @@
ScopedParen(ScopedParen&& rhs) = delete;
ScopedParen(const ScopedParen&) = delete;
ScopedParen& operator=(const ScopedParen&) = delete;
- utils::StringStream& s;
+ StringStream& s;
};
/// Helper for incrementing indentation on construction and decrementing
@@ -203,6 +203,6 @@
std::unordered_map<const type::Struct*, std::string> builtin_struct_names_;
};
-} // namespace tint::utils
+} // namespace tint
#endif // SRC_TINT_UTILS_TEXT_TEXT_GENERATOR_H_
diff --git a/src/tint/utils/text/unicode.cc b/src/tint/utils/text/unicode.cc
index 7bb64b5..b066790 100644
--- a/src/tint/utils/text/unicode.cc
+++ b/src/tint/utils/text/unicode.cc
@@ -16,7 +16,7 @@
#include <algorithm>
-namespace tint::utils {
+namespace tint {
namespace {
struct CodePointRange {
@@ -422,4 +422,4 @@
} // namespace utf8
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/text/unicode.h b/src/tint/utils/text/unicode.h
index e5e32c0..83f6da5 100644
--- a/src/tint/utils/text/unicode.h
+++ b/src/tint/utils/text/unicode.h
@@ -20,7 +20,7 @@
#include <string_view>
#include <utility>
-namespace tint::utils {
+namespace tint {
/// CodePoint is a unicode code point.
struct CodePoint {
@@ -75,6 +75,6 @@
} // namespace utf8
-} // namespace tint::utils
+} // namespace tint
#endif // SRC_TINT_UTILS_TEXT_UNICODE_H_
diff --git a/src/tint/utils/text/unicode_test.cc b/src/tint/utils/text/unicode_test.cc
index 9f87b04..e80c65e 100644
--- a/src/tint/utils/text/unicode_test.cc
+++ b/src/tint/utils/text/unicode_test.cc
@@ -22,7 +22,7 @@
/// Helper for constructing a CodePoint
#define C(x) CodePoint(x)
-namespace tint::utils {
+namespace tint {
////////////////////////////////////////////////////////////////////////////////
// CodePoint character set tests
@@ -487,4 +487,4 @@
} // namespace
-} // namespace tint::utils
+} // namespace tint
diff --git a/src/tint/utils/traits/traits.h b/src/tint/utils/traits/traits.h
index f9c9a91..6516c06 100644
--- a/src/tint/utils/traits/traits.h
+++ b/src/tint/utils/traits/traits.h
@@ -20,7 +20,7 @@
#include <type_traits>
#include <utility>
-namespace tint::utils::traits {
+namespace tint::traits {
/// Convience type definition for std::decay<T>::type
template <typename T>
@@ -209,6 +209,6 @@
template <typename T>
using CharArrayToCharPtr = typename traits::detail::CharArrayToCharPtrImpl<T>::type;
-} // namespace tint::utils::traits
+} // namespace tint::traits
#endif // SRC_TINT_UTILS_TRAITS_TRAITS_H_
diff --git a/src/tint/utils/traits/traits_test.cc b/src/tint/utils/traits/traits_test.cc
index da78f27..348415f 100644
--- a/src/tint/utils/traits/traits_test.cc
+++ b/src/tint/utils/traits/traits_test.cc
@@ -16,7 +16,7 @@
#include "gtest/gtest.h"
-namespace tint::utils::traits {
+namespace tint::traits {
namespace {
@@ -246,4 +246,4 @@
static_assert(std::is_same_v<int, CharArrayToCharPtr<int>>);
static_assert(std::is_same_v<int[2], CharArrayToCharPtr<int[2]>>);
-} // namespace tint::utils::traits
+} // namespace tint::traits