Move type/builtin to builtin.

This CL moves type::Builtin to builtin::Builtin.

Change-Id: I8b058dfcac38f782e07393b69e38534175f67524
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/120403
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
dan sinclair 2023-02-19 04:28:04 +00:00 committed by Dawn LUCI CQ
parent ba082fdb48
commit ef30aa400c
16 changed files with 145 additions and 144 deletions

View File

@ -697,6 +697,8 @@ libtint_source_set("libtint_builtins_src") {
"builtin/access.h",
"builtin/address_space.cc",
"builtin/address_space.h",
"builtin/builtin.cc",
"builtin/builtin.h",
"builtin/builtin_value.cc",
"builtin/builtin_value.h",
"builtin/extension.cc",
@ -723,8 +725,6 @@ libtint_source_set("libtint_type_src") {
"type/atomic.h",
"type/bool.cc",
"type/bool.h",
"type/builtin.cc",
"type/builtin.h",
"type/clone_context.h",
"type/depth_multisampled_texture.cc",
"type/depth_multisampled_texture.h",
@ -1296,6 +1296,7 @@ if (tint_build_unittests) {
sources = [
"builtin/access_test.cc",
"builtin/address_space_test.cc",
"builtin/builtin_test.cc",
"builtin/builtin_value_test.cc",
"builtin/extension_test.cc",
"builtin/texel_format_test.cc",
@ -1417,7 +1418,6 @@ if (tint_build_unittests) {
sources = [
"type/atomic_test.cc",
"type/bool_test.cc",
"type/builtin_test.cc",
"type/depth_multisampled_texture_test.cc",
"type/depth_texture_test.cc",
"type/external_texture_test.cc",

View File

@ -550,6 +550,7 @@ list(APPEND TINT_LIB_SRCS
tint_generated(builtin/access BENCH TEST)
tint_generated(builtin/address_space BENCH TEST)
tint_generated(builtin/builtin BENCH TEST)
tint_generated(builtin/builtin_value BENCH TEST)
tint_generated(builtin/extension BENCH TEST)
tint_generated(builtin/texel_format BENCH TEST)
@ -558,7 +559,6 @@ tint_generated(ast/interpolate_attribute BENCH TEST)
tint_generated(resolver/init_conv_intrinsic)
tint_generated(sem/builtin_type)
tint_generated(sem/parameter_usage)
tint_generated(type/builtin BENCH TEST)
if(UNIX)
list(APPEND TINT_LIB_SRCS diagnostic/printer_posix.cc)

View File

@ -15,14 +15,14 @@
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// src/tint/type/builtin.cc.tmpl
// src/tint/builtin/builtin.cc.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
#include "src/tint/type/builtin.h"
#include "src/tint/builtin/builtin.h"
namespace tint::type {
namespace tint::builtin {
/// ParseBuiltin parses a Builtin from a string.
/// @param str the string to parse
@ -384,4 +384,4 @@ std::ostream& operator<<(std::ostream& out, Builtin value) {
return out << "<unknown>";
}
} // namespace tint::type
} // namespace tint::builtin

View File

@ -15,12 +15,12 @@ See:
{{- $enum := (Sem.Enum "builtin_type") -}}
{{- Eval "OverrideEnumName" "Enum" $enum "Name" "Builtin" -}}
#include "src/tint/type/builtin.h"
#include "src/tint/builtin/builtin.h"
namespace tint::type {
namespace tint::builtin {
{{ Eval "ParseEnum" $enum}}
{{ Eval "EnumOStream" $enum}}
} // namespace tint::type
} // namespace tint::builtin

View File

@ -15,19 +15,19 @@
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// src/tint/type/builtin.h.tmpl
// src/tint/builtin/builtin.h.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
#ifndef SRC_TINT_TYPE_BUILTIN_H_
#define SRC_TINT_TYPE_BUILTIN_H_
#ifndef SRC_TINT_BUILTIN_BUILTIN_H_
#define SRC_TINT_BUILTIN_BUILTIN_H_
#include <ostream>
namespace tint::type {
namespace tint::builtin {
/// An enumerator of builtin types.
/// An enumerator of builtin builtin.
enum class Builtin {
kUndefined,
kArray,
@ -183,6 +183,6 @@ constexpr const char* kBuiltinStrings[] = {
"vec4u",
};
} // namespace tint::type
} // namespace tint::builtin
#endif // SRC_TINT_TYPE_BUILTIN_H_
#endif // SRC_TINT_BUILTIN_BUILTIN_H_

View File

@ -15,16 +15,16 @@ See:
{{- $enum := (Sem.Enum "builtin_type") -}}
{{- Eval "OverrideEnumName" "Enum" $enum "Name" "Builtin" -}}
#ifndef SRC_TINT_TYPE_BUILTIN_H_
#define SRC_TINT_TYPE_BUILTIN_H_
#ifndef SRC_TINT_BUILTIN_BUILTIN_H_
#define SRC_TINT_BUILTIN_BUILTIN_H_
#include <ostream>
namespace tint::type {
namespace tint::builtin {
/// An enumerator of builtin types.
/// An enumerator of builtin builtin.
{{ Eval "DeclareEnum" $enum}}
} // namespace tint::type
} // namespace tint::builtin
#endif // SRC_TINT_TYPE_BUILTIN_H_
#endif // SRC_TINT_BUILTIN_BUILTIN_H_

View File

@ -15,18 +15,18 @@
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// src/tint/type/builtin_bench.cc.tmpl
// src/tint/builtin/builtin_bench.cc.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
#include "src/tint/type/builtin.h"
#include "src/tint/builtin/builtin.h"
#include <array>
#include "benchmark/benchmark.h"
namespace tint::type {
namespace tint::builtin {
namespace {
void BuiltinParser(::benchmark::State& state) {
@ -526,4 +526,4 @@ void BuiltinParser(::benchmark::State& state) {
BENCHMARK(BuiltinParser);
} // namespace
} // namespace tint::type
} // namespace tint::builtin

View File

@ -15,16 +15,16 @@ See:
{{- $enum := (Sem.Enum "builtin_type") -}}
{{- Eval "OverrideEnumName" "Enum" $enum "Name" "Builtin" -}}
#include "src/tint/type/builtin.h"
#include "src/tint/builtin/builtin.h"
#include <array>
#include "benchmark/benchmark.h"
namespace tint::type {
namespace tint::builtin {
namespace {
{{ Eval "BenchmarkParseEnum" $enum }}
} // namespace
} // namespace tint::type
} // namespace tint::builtin

View File

@ -15,12 +15,12 @@
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// src/tint/type/builtin_test.cc.tmpl
// src/tint/builtin/builtin_test.cc.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
#include "src/tint/type/builtin.h"
#include "src/tint/builtin/builtin.h"
#include <string>
@ -28,7 +28,7 @@
#include "src/tint/utils/string.h"
namespace tint::type {
namespace tint::builtin {
namespace {
namespace parse_print_tests {
@ -348,4 +348,4 @@ INSTANTIATE_TEST_SUITE_P(ValidCases, BuiltinPrintTest, testing::ValuesIn(kValidC
} // namespace parse_print_tests
} // namespace
} // namespace tint::type
} // namespace tint::builtin

View File

@ -15,7 +15,7 @@ See:
{{- $enum := (Sem.Enum "builtin_type") -}}
{{- Eval "OverrideEnumName" "Enum" $enum "Name" "Builtin" -}}
#include "src/tint/type/builtin.h"
#include "src/tint/builtin/builtin.h"
#include <string>
@ -23,10 +23,10 @@ See:
#include "src/tint/utils/string.h"
namespace tint::type {
namespace tint::builtin {
namespace {
{{ Eval "TestParsePrintEnum" $enum}}
} // namespace
} // namespace tint::type
} // namespace tint::builtin

View File

@ -54,10 +54,10 @@
#include "src/tint/ast/variable_decl_statement.h"
#include "src/tint/ast/while_statement.h"
#include "src/tint/ast/workgroup_attribute.h"
#include "src/tint/builtin/builtin.h"
#include "src/tint/scope_stack.h"
#include "src/tint/sem/builtin.h"
#include "src/tint/symbol_table.h"
#include "src/tint/type/builtin.h"
#include "src/tint/utils/block_allocator.h"
#include "src/tint/utils/compiler_macros.h"
#include "src/tint/utils/defer.h"
@ -475,7 +475,8 @@ class DependencyScanner {
graph_.resolved_identifiers.Add(from, ResolvedIdentifier(builtin_fn));
return;
}
if (auto builtin_ty = type::ParseBuiltin(s); builtin_ty != type::Builtin::kUndefined) {
if (auto builtin_ty = builtin::ParseBuiltin(s);
builtin_ty != builtin::Builtin::kUndefined) {
graph_.resolved_identifiers.Add(from, ResolvedIdentifier(builtin_ty));
return;
}
@ -859,7 +860,7 @@ std::string ResolvedIdentifier::String(const SymbolTable& symbols, diag::List& d
if (auto builtin_fn = BuiltinFunction(); builtin_fn != sem::BuiltinType::kNone) {
return "builtin function '" + utils::ToString(builtin_fn) + "'";
}
if (auto builtin_ty = BuiltinType(); builtin_ty != type::Builtin::kUndefined) {
if (auto builtin_ty = BuiltinType(); builtin_ty != builtin::Builtin::kUndefined) {
return "builtin type '" + utils::ToString(builtin_ty) + "'";
}
if (auto access = Access(); access != builtin::Access::kUndefined) {

View File

@ -20,11 +20,11 @@
#include "src/tint/ast/module.h"
#include "src/tint/builtin/access.h"
#include "src/tint/builtin/builtin.h"
#include "src/tint/builtin/texel_format.h"
#include "src/tint/diagnostic/diagnostic.h"
#include "src/tint/sem/builtin_type.h"
#include "src/tint/symbol_table.h"
#include "src/tint/type/builtin.h"
#include "src/tint/utils/hashmap.h"
namespace tint::resolver {
@ -37,7 +37,7 @@ namespace tint::resolver {
/// - sem::BuiltinType
/// - builtin::Access
/// - builtin::AddressSpace
/// - type::Builtin
/// - builtin::Builtin
/// - builtin::TexelFormat
class ResolvedIdentifier {
public:
@ -86,13 +86,13 @@ class ResolvedIdentifier {
return builtin::AddressSpace::kUndefined;
}
/// @return the builtin type if the ResolvedIdentifier holds type::Builtin, otherwise
/// type::Builtin::kUndefined
type::Builtin BuiltinType() const {
if (auto n = std::get_if<type::Builtin>(&value_)) {
/// @return the builtin type if the ResolvedIdentifier holds builtin::Builtin, otherwise
/// builtin::Builtin::kUndefined
builtin::Builtin BuiltinType() const {
if (auto n = std::get_if<builtin::Builtin>(&value_)) {
return *n;
}
return type::Builtin::kUndefined;
return builtin::Builtin::kUndefined;
}
/// @return the texel format if the ResolvedIdentifier holds builtin::TexelFormat, otherwise
@ -132,7 +132,7 @@ class ResolvedIdentifier {
sem::BuiltinType,
builtin::Access,
builtin::AddressSpace,
type::Builtin,
builtin::Builtin,
builtin::TexelFormat>
value_;
};

View File

@ -1259,7 +1259,7 @@ TEST_P(ResolverDependencyGraphResolveToBuiltinType, Resolve) {
auto resolved = Build().resolved_identifiers.Get(ident);
ASSERT_TRUE(resolved);
EXPECT_EQ(resolved->BuiltinType(), type::ParseBuiltin(name))
EXPECT_EQ(resolved->BuiltinType(), builtin::ParseBuiltin(name))
<< resolved->String(Symbols(), Diagnostics());
}
@ -1316,17 +1316,17 @@ TEST_P(ResolverDependencyGraphResolveToBuiltinType, ShadowedByFunc) {
INSTANTIATE_TEST_SUITE_P(Types,
ResolverDependencyGraphResolveToBuiltinType,
testing::Combine(testing::ValuesIn(kTypeUseKinds),
testing::ValuesIn(type::kBuiltinStrings)));
testing::ValuesIn(builtin::kBuiltinStrings)));
INSTANTIATE_TEST_SUITE_P(Values,
ResolverDependencyGraphResolveToBuiltinType,
testing::Combine(testing::ValuesIn(kValueUseKinds),
testing::ValuesIn(type::kBuiltinStrings)));
testing::ValuesIn(builtin::kBuiltinStrings)));
INSTANTIATE_TEST_SUITE_P(Functions,
ResolverDependencyGraphResolveToBuiltinType,
testing::Combine(testing::ValuesIn(kFuncUseKinds),
testing::ValuesIn(type::kBuiltinStrings)));
testing::ValuesIn(builtin::kBuiltinStrings)));
} // namespace resolve_to_builtin_type

View File

@ -42,6 +42,7 @@
#include "src/tint/ast/variable_decl_statement.h"
#include "src/tint/ast/while_statement.h"
#include "src/tint/ast/workgroup_attribute.h"
#include "src/tint/builtin/builtin.h"
#include "src/tint/resolver/uniformity.h"
#include "src/tint/sem/break_if_statement.h"
#include "src/tint/sem/builtin_enum_expression.h"
@ -68,7 +69,6 @@
#include "src/tint/type/abstract_int.h"
#include "src/tint/type/array.h"
#include "src/tint/type/atomic.h"
#include "src/tint/type/builtin.h"
#include "src/tint/type/depth_multisampled_texture.h"
#include "src/tint/type/depth_texture.h"
#include "src/tint/type/external_texture.h"
@ -2133,36 +2133,36 @@ sem::Call* Resolver::Call(const ast::CallExpression* expr) {
return BuiltinCall(expr, f, args);
}
if (auto b = resolved->BuiltinType(); b != type::Builtin::kUndefined) {
if (auto b = resolved->BuiltinType(); b != builtin::Builtin::kUndefined) {
if (!ident->Is<ast::TemplatedIdentifier>()) {
// No template arguments provided.
// Check to see if this is an inferred-element-type call.
switch (b) {
case type::Builtin::kArray:
case builtin::Builtin::kArray:
return inferred_array();
case type::Builtin::kVec2:
case builtin::Builtin::kVec2:
return init_or_conv(InitConvIntrinsic::kVec2, nullptr);
case type::Builtin::kVec3:
case builtin::Builtin::kVec3:
return init_or_conv(InitConvIntrinsic::kVec3, nullptr);
case type::Builtin::kVec4:
case builtin::Builtin::kVec4:
return init_or_conv(InitConvIntrinsic::kVec4, nullptr);
case type::Builtin::kMat2X2:
case builtin::Builtin::kMat2X2:
return init_or_conv(InitConvIntrinsic::kMat2x2, nullptr);
case type::Builtin::kMat2X3:
case builtin::Builtin::kMat2X3:
return init_or_conv(InitConvIntrinsic::kMat2x3, nullptr);
case type::Builtin::kMat2X4:
case builtin::Builtin::kMat2X4:
return init_or_conv(InitConvIntrinsic::kMat2x4, nullptr);
case type::Builtin::kMat3X2:
case builtin::Builtin::kMat3X2:
return init_or_conv(InitConvIntrinsic::kMat3x2, nullptr);
case type::Builtin::kMat3X3:
case builtin::Builtin::kMat3X3:
return init_or_conv(InitConvIntrinsic::kMat3x3, nullptr);
case type::Builtin::kMat3X4:
case builtin::Builtin::kMat3X4:
return init_or_conv(InitConvIntrinsic::kMat3x4, nullptr);
case type::Builtin::kMat4X2:
case builtin::Builtin::kMat4X2:
return init_or_conv(InitConvIntrinsic::kMat4x2, nullptr);
case type::Builtin::kMat4X3:
case builtin::Builtin::kMat4X3:
return init_or_conv(InitConvIntrinsic::kMat4x3, nullptr);
case type::Builtin::kMat4X4:
case builtin::Builtin::kMat4X4:
return init_or_conv(InitConvIntrinsic::kMat4x4, nullptr);
default:
break;
@ -2284,7 +2284,7 @@ sem::Call* Resolver::BuiltinCall(const ast::CallExpression* expr,
return call;
}
type::Type* Resolver::BuiltinType(type::Builtin builtin_ty, const ast::Identifier* ident) {
type::Type* Resolver::BuiltinType(builtin::Builtin builtin_ty, const ast::Identifier* ident) {
auto& b = *builder_;
auto check_no_tmpl_args = [&](type::Type* ty) -> type::Type* {
@ -2537,151 +2537,151 @@ type::Type* Resolver::BuiltinType(type::Builtin builtin_ty, const ast::Identifie
};
switch (builtin_ty) {
case type::Builtin::kBool:
case builtin::Builtin::kBool:
return check_no_tmpl_args(b.create<type::Bool>());
case type::Builtin::kI32:
case builtin::Builtin::kI32:
return check_no_tmpl_args(i32());
case type::Builtin::kU32:
case builtin::Builtin::kU32:
return check_no_tmpl_args(u32());
case type::Builtin::kF16:
case builtin::Builtin::kF16:
return check_no_tmpl_args(f16());
case type::Builtin::kF32:
case builtin::Builtin::kF32:
return check_no_tmpl_args(b.create<type::F32>());
case type::Builtin::kVec2:
case builtin::Builtin::kVec2:
return vec_t(2);
case type::Builtin::kVec3:
case builtin::Builtin::kVec3:
return vec_t(3);
case type::Builtin::kVec4:
case builtin::Builtin::kVec4:
return vec_t(4);
case type::Builtin::kMat2X2:
case builtin::Builtin::kMat2X2:
return mat_t(2, 2);
case type::Builtin::kMat2X3:
case builtin::Builtin::kMat2X3:
return mat_t(2, 3);
case type::Builtin::kMat2X4:
case builtin::Builtin::kMat2X4:
return mat_t(2, 4);
case type::Builtin::kMat3X2:
case builtin::Builtin::kMat3X2:
return mat_t(3, 2);
case type::Builtin::kMat3X3:
case builtin::Builtin::kMat3X3:
return mat_t(3, 3);
case type::Builtin::kMat3X4:
case builtin::Builtin::kMat3X4:
return mat_t(3, 4);
case type::Builtin::kMat4X2:
case builtin::Builtin::kMat4X2:
return mat_t(4, 2);
case type::Builtin::kMat4X3:
case builtin::Builtin::kMat4X3:
return mat_t(4, 3);
case type::Builtin::kMat4X4:
case builtin::Builtin::kMat4X4:
return mat_t(4, 4);
case type::Builtin::kMat2X2F:
case builtin::Builtin::kMat2X2F:
return check_no_tmpl_args(mat(f32(), 2u, 2u));
case type::Builtin::kMat2X3F:
case builtin::Builtin::kMat2X3F:
return check_no_tmpl_args(mat(f32(), 2u, 3u));
case type::Builtin::kMat2X4F:
case builtin::Builtin::kMat2X4F:
return check_no_tmpl_args(mat(f32(), 2u, 4u));
case type::Builtin::kMat3X2F:
case builtin::Builtin::kMat3X2F:
return check_no_tmpl_args(mat(f32(), 3u, 2u));
case type::Builtin::kMat3X3F:
case builtin::Builtin::kMat3X3F:
return check_no_tmpl_args(mat(f32(), 3u, 3u));
case type::Builtin::kMat3X4F:
case builtin::Builtin::kMat3X4F:
return check_no_tmpl_args(mat(f32(), 3u, 4u));
case type::Builtin::kMat4X2F:
case builtin::Builtin::kMat4X2F:
return check_no_tmpl_args(mat(f32(), 4u, 2u));
case type::Builtin::kMat4X3F:
case builtin::Builtin::kMat4X3F:
return check_no_tmpl_args(mat(f32(), 4u, 3u));
case type::Builtin::kMat4X4F:
case builtin::Builtin::kMat4X4F:
return check_no_tmpl_args(mat(f32(), 4u, 4u));
case type::Builtin::kMat2X2H:
case builtin::Builtin::kMat2X2H:
return check_no_tmpl_args(mat(f16(), 2u, 2u));
case type::Builtin::kMat2X3H:
case builtin::Builtin::kMat2X3H:
return check_no_tmpl_args(mat(f16(), 2u, 3u));
case type::Builtin::kMat2X4H:
case builtin::Builtin::kMat2X4H:
return check_no_tmpl_args(mat(f16(), 2u, 4u));
case type::Builtin::kMat3X2H:
case builtin::Builtin::kMat3X2H:
return check_no_tmpl_args(mat(f16(), 3u, 2u));
case type::Builtin::kMat3X3H:
case builtin::Builtin::kMat3X3H:
return check_no_tmpl_args(mat(f16(), 3u, 3u));
case type::Builtin::kMat3X4H:
case builtin::Builtin::kMat3X4H:
return check_no_tmpl_args(mat(f16(), 3u, 4u));
case type::Builtin::kMat4X2H:
case builtin::Builtin::kMat4X2H:
return check_no_tmpl_args(mat(f16(), 4u, 2u));
case type::Builtin::kMat4X3H:
case builtin::Builtin::kMat4X3H:
return check_no_tmpl_args(mat(f16(), 4u, 3u));
case type::Builtin::kMat4X4H:
case builtin::Builtin::kMat4X4H:
return check_no_tmpl_args(mat(f16(), 4u, 4u));
case type::Builtin::kVec2F:
case builtin::Builtin::kVec2F:
return check_no_tmpl_args(vec(f32(), 2u));
case type::Builtin::kVec3F:
case builtin::Builtin::kVec3F:
return check_no_tmpl_args(vec(f32(), 3u));
case type::Builtin::kVec4F:
case builtin::Builtin::kVec4F:
return check_no_tmpl_args(vec(f32(), 4u));
case type::Builtin::kVec2H:
case builtin::Builtin::kVec2H:
return check_no_tmpl_args(vec(f16(), 2u));
case type::Builtin::kVec3H:
case builtin::Builtin::kVec3H:
return check_no_tmpl_args(vec(f16(), 3u));
case type::Builtin::kVec4H:
case builtin::Builtin::kVec4H:
return check_no_tmpl_args(vec(f16(), 4u));
case type::Builtin::kVec2I:
case builtin::Builtin::kVec2I:
return check_no_tmpl_args(vec(i32(), 2u));
case type::Builtin::kVec3I:
case builtin::Builtin::kVec3I:
return check_no_tmpl_args(vec(i32(), 3u));
case type::Builtin::kVec4I:
case builtin::Builtin::kVec4I:
return check_no_tmpl_args(vec(i32(), 4u));
case type::Builtin::kVec2U:
case builtin::Builtin::kVec2U:
return check_no_tmpl_args(vec(u32(), 2u));
case type::Builtin::kVec3U:
case builtin::Builtin::kVec3U:
return check_no_tmpl_args(vec(u32(), 3u));
case type::Builtin::kVec4U:
case builtin::Builtin::kVec4U:
return check_no_tmpl_args(vec(u32(), 4u));
case type::Builtin::kArray:
case builtin::Builtin::kArray:
return array();
case type::Builtin::kAtomic:
case builtin::Builtin::kAtomic:
return atomic();
case type::Builtin::kPtr:
case builtin::Builtin::kPtr:
return ptr();
case type::Builtin::kSampler:
case builtin::Builtin::kSampler:
return check_no_tmpl_args(builder_->create<type::Sampler>(type::SamplerKind::kSampler));
case type::Builtin::kSamplerComparison:
case builtin::Builtin::kSamplerComparison:
return check_no_tmpl_args(
builder_->create<type::Sampler>(type::SamplerKind::kComparisonSampler));
case type::Builtin::kTexture1D:
case builtin::Builtin::kTexture1D:
return sampled_texture(type::TextureDimension::k1d);
case type::Builtin::kTexture2D:
case builtin::Builtin::kTexture2D:
return sampled_texture(type::TextureDimension::k2d);
case type::Builtin::kTexture2DArray:
case builtin::Builtin::kTexture2DArray:
return sampled_texture(type::TextureDimension::k2dArray);
case type::Builtin::kTexture3D:
case builtin::Builtin::kTexture3D:
return sampled_texture(type::TextureDimension::k3d);
case type::Builtin::kTextureCube:
case builtin::Builtin::kTextureCube:
return sampled_texture(type::TextureDimension::kCube);
case type::Builtin::kTextureCubeArray:
case builtin::Builtin::kTextureCubeArray:
return sampled_texture(type::TextureDimension::kCubeArray);
case type::Builtin::kTextureDepth2D:
case builtin::Builtin::kTextureDepth2D:
return check_no_tmpl_args(
builder_->create<type::DepthTexture>(type::TextureDimension::k2d));
case type::Builtin::kTextureDepth2DArray:
case builtin::Builtin::kTextureDepth2DArray:
return check_no_tmpl_args(
builder_->create<type::DepthTexture>(type::TextureDimension::k2dArray));
case type::Builtin::kTextureDepthCube:
case builtin::Builtin::kTextureDepthCube:
return check_no_tmpl_args(
builder_->create<type::DepthTexture>(type::TextureDimension::kCube));
case type::Builtin::kTextureDepthCubeArray:
case builtin::Builtin::kTextureDepthCubeArray:
return check_no_tmpl_args(
builder_->create<type::DepthTexture>(type::TextureDimension::kCubeArray));
case type::Builtin::kTextureDepthMultisampled2D:
case builtin::Builtin::kTextureDepthMultisampled2D:
return check_no_tmpl_args(
builder_->create<type::DepthMultisampledTexture>(type::TextureDimension::k2d));
case type::Builtin::kTextureExternal:
case builtin::Builtin::kTextureExternal:
return check_no_tmpl_args(builder_->create<type::ExternalTexture>());
case type::Builtin::kTextureMultisampled2D:
case builtin::Builtin::kTextureMultisampled2D:
return multisampled_texture(type::TextureDimension::k2d);
case type::Builtin::kTextureStorage1D:
case builtin::Builtin::kTextureStorage1D:
return storage_texture(type::TextureDimension::k1d);
case type::Builtin::kTextureStorage2D:
case builtin::Builtin::kTextureStorage2D:
return storage_texture(type::TextureDimension::k2d);
case type::Builtin::kTextureStorage2DArray:
case builtin::Builtin::kTextureStorage2DArray:
return storage_texture(type::TextureDimension::k2dArray);
case type::Builtin::kTextureStorage3D:
case builtin::Builtin::kTextureStorage3D:
return storage_texture(type::TextureDimension::k3d);
case type::Builtin::kUndefined:
case builtin::Builtin::kUndefined:
break;
}
@ -2964,7 +2964,7 @@ sem::Expression* Resolver::Identifier(const ast::IdentifierExpression* expr) {
});
}
if (auto builtin_ty = resolved->BuiltinType(); builtin_ty != type::Builtin::kUndefined) {
if (auto builtin_ty = resolved->BuiltinType(); builtin_ty != builtin::Builtin::kUndefined) {
auto* ty = BuiltinType(builtin_ty, ident);
if (!ty) {
return nullptr;

View File

@ -463,7 +463,7 @@ class Resolver {
/// @returns the type::Type for the builtin type @p builtin_ty with the identifier @p ident
/// @note: Will raise an ICE if @p symbol is not a builtin type.
type::Type* BuiltinType(type::Builtin builtin_ty, const ast::Identifier* ident);
type::Type* BuiltinType(builtin::Builtin builtin_ty, const ast::Identifier* ident);
// ArrayInitializerSig represents a unique array initializer signature.
// It is a tuple of the array type, number of arguments provided and earliest evaluation stage.

View File

@ -19,9 +19,9 @@
#include <vector>
#include "gmock/gmock.h"
#include "src/tint/builtin/builtin.h"
#include "src/tint/builtin/texel_format.h"
#include "src/tint/transform/test_helper.h"
#include "src/tint/type/builtin.h"
namespace tint::transform {
namespace {
@ -1711,7 +1711,7 @@ std::string ExpandBuiltinType(std::string_view name) {
std::vector<const char*> ConstructableTypes() {
std::vector<const char*> out;
for (auto* ty : type::kBuiltinStrings) {
for (auto* ty : builtin::kBuiltinStrings) {
std::string_view type(ty);
if (type != "ptr" && type != "atomic" && !utils::HasPrefix(type, "sampler") &&
!utils::HasPrefix(type, "texture")) {
@ -1923,7 +1923,7 @@ INSTANTIATE_TEST_SUITE_P(RenamerBuiltinTypeTest,
/// @return WGSL builtin identifier keywords
std::vector<const char*> Identifiers() {
std::vector<const char*> out;
for (auto* ident : type::kBuiltinStrings) {
for (auto* ident : builtin::kBuiltinStrings) {
out.push_back(ident);
}
for (auto* ident : builtin::kAddressSpaceStrings) {